Starting to implement GPX visualization.
This commit is contained in:
1 parent
cd9ee67fed
commit
d86d63ca61
8 files changed
+123
-10
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import react, { useEffect, useState } from 'react';
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
import { TileKeyObject, Rectangle } from './types';
|
||||
|
||||
export interface GpxesProperties {
|
||||
keyObject?: TileKeyObject;
|
||||
zoom?: number;
|
||||
viewPort?: Rectangle;
|
||||
}
|
||||
|
||||
export const Gpxes: react.FC<GpxesProperties> = (props: GpxesProperties) => {
|
||||
const [visibleGpxes, setVisibleGpxes] = useState<any>([]);
|
||||
useEffect(() => {
|
||||
const getVisibleGpxes = async () => {
|
||||
const gpxes = await dispatch({
|
||||
action: 'getGpxesForViewport',
|
||||
params: {
|
||||
viewport: props.viewPort,
|
||||
zoomLevel: props.keyObject?.zoomLevel,
|
||||
},
|
||||
});
|
||||
console.log(`Gpxes, visibles: ${JSON.stringify(gpxes)}`);
|
||||
setVisibleGpxes(gpxes);
|
||||
};
|
||||
getVisibleGpxes();
|
||||
}, [
|
||||
props.viewPort?.bottomRight.x,
|
||||
props.viewPort?.bottomRight.y,
|
||||
props.viewPort?.topLeft.x,
|
||||
props.viewPort?.topLeft.y,
|
||||
props.keyObject?.zoomLevel,
|
||||
]);
|
||||
return <></>;
|
||||
};
|
||||
|
||||
export default Gpxes;
|
||||
Reference in new issue
Block a user