@map-colonies/react-components 4.8.1 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ .debugPanel {
2
+ transform: translateZ(0);
3
+ height: calc(100vh - 220px);
4
+ max-height: 460px;
5
+ width: 280px;
6
+ position: absolute;
7
+ top: 44px;
8
+ right: 12px;
9
+ /* color: #AFBFDA;
10
+ background: #2D3748;
11
+ padding: 20px 24px; */
12
+ }
13
+
14
+ .debugPanel .mdc-dialog__container {
15
+ align-items: unset;
16
+ }
17
+
18
+ .debugPanel .mdc-dialog .mdc-dialog__surface {
19
+ max-height: unset;
20
+ }
21
+
22
+ body[dir='rtl'] .debugPanel {
23
+ left: 12px;
24
+ right: unset;
25
+ }
26
+
27
+ .debugPanel .title {
28
+ text-align: center;
29
+ font-size: 16px;
30
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface IDebugPanelProps {
3
+ children: React.ReactNode;
4
+ locale?: {
5
+ [key: string]: string;
6
+ };
7
+ }
8
+ export declare const DebugPanel: React.FC<IDebugPanelProps>;
@@ -0,0 +1,46 @@
1
+ .wfsContainer .title {
2
+ text-align: center;
3
+ font-weight: bold;
4
+ margin-bottom: 12px;
5
+ width: 260px;
6
+ }
7
+
8
+ .wfsContainer .featureType {
9
+ font-size: 12px;
10
+ margin-bottom: 12px;
11
+ direction: ltr;
12
+ }
13
+
14
+ body[dir='rtl'] .wfsContainer .featureType {
15
+ direction: rtl;
16
+ }
17
+
18
+ .wfsContainer .name {
19
+ color: #AEF;
20
+ font-weight: bold;
21
+ white-space: nowrap;
22
+ overflow: hidden;
23
+ text-overflow: ellipsis;
24
+ width: 260px;
25
+ }
26
+
27
+ .wfsContainer .info {
28
+ display: flex;
29
+ }
30
+
31
+ .wfsContainer .spacer {
32
+ margin: 0 20px;
33
+ }
34
+
35
+ .wfsContainer .blinking {
36
+ animation: blink 1s infinite;
37
+ }
38
+
39
+ @keyframes blink {
40
+ 0%, 100% {
41
+ opacity: 1;
42
+ }
43
+ 50% {
44
+ opacity: 0.5;
45
+ }
46
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface IWFSProps {
3
+ locale?: {
4
+ [key: string]: string;
5
+ };
6
+ }
7
+ export declare const WFS: React.FC<IWFSProps>;
8
+ export {};
@@ -1,4 +1,6 @@
1
1
  import { Rectangle } from 'cesium';
2
+ import { BBox, Feature, Point } from 'geojson';
3
+ import { CesiumViewer } from '../map';
2
4
  import { CustomImageryProvider } from './customImageryProviders';
3
5
  /**
4
6
  * An async function to detect images with transparency.
@@ -15,3 +17,29 @@ export declare const imageHasTransparency: (image: string | HTMLImageElement | I
15
17
  * @param anotherRect
16
18
  */
17
19
  export declare const cesiumRectangleContained: (rect: Rectangle, anotherRect: Rectangle) => boolean;
20
+ /**
21
+ * Calculates distance from a point to the edges of a given bbox.
22
+ * @param position Point to calculate distance from
23
+ * @param bbox Bounding box to calculate distance to
24
+ * @returns Distance in km
25
+ */
26
+ export declare const distance: (position: Feature<Point>, bbox: BBox) => number;
27
+ /**
28
+ * Calculates the center of a given bbox.
29
+ * @param bbox Cesium Rectangle
30
+ * @returns Center point of the bbox
31
+ */
32
+ export declare const center: (bbox: Rectangle) => Feature<Point>;
33
+ /**
34
+ * Converts a Cesium Rectangle to a GeoJSON bbox array.
35
+ * @param bbox Cesium Rectangle
36
+ * @returns BBox array
37
+ */
38
+ export declare const rectangle2bbox: (bbox: Rectangle) => BBox;
39
+ /**
40
+ * Computes a limited view rectangle in case of 3D mode based on the camera position and max distance.
41
+ * @param mapViewer Cesium Viewer instance
42
+ * @param maxDistanceMeters Max distance in meters to limit the view rectangle
43
+ * @returns View rectangle
44
+ */
45
+ export declare const computeLimitedViewRectangle: (mapViewer: CesiumViewer, maxDistanceMeters?: number) => Rectangle | undefined;
@@ -5,3 +5,4 @@ export * from './wms.layer';
5
5
  export * from './wmts.layer';
6
6
  export * from './xyz.layer';
7
7
  export * from './osm.layer';
8
+ export * from './wfs.layer';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { GeoJsonDataSource } from 'cesium';
3
+ import { CesiumViewer } from '../map';
4
+ export interface ICesiumWFSLayerOptions {
5
+ url: string;
6
+ featureType: string;
7
+ style: Record<string, unknown>;
8
+ pageSize: number;
9
+ zoomLevel: number;
10
+ maxCacheSize: number;
11
+ keyField?: string;
12
+ }
13
+ export interface ICesiumWFSLayer extends React.Attributes {
14
+ options: ICesiumWFSLayerOptions;
15
+ meta: Record<string, unknown>;
16
+ visualizationHandler: (mapViewer: CesiumViewer, wfsDataSource: GeoJsonDataSource, processEntityIds: string[]) => void;
17
+ }
18
+ export declare const CesiumWFSLayer: React.FC<ICesiumWFSLayer>;
@@ -3,6 +3,7 @@ import { RCesiumOSMLayerOptions, RCesiumWMSLayerOptions, RCesiumWMTSLayerOptions
3
3
  import { CesiumViewer } from './map';
4
4
  import { IBaseMap } from './settings/settings';
5
5
  import { IMapLegend } from './map-legend';
6
+ import { ICesiumWFSLayer } from './layers/wfs.layer';
6
7
  import { CesiumCartesian2 } from './proxied.types';
7
8
  export interface ICesiumImageryLayer extends InstanceType<typeof ImageryLayer> {
8
9
  meta?: Record<string, unknown>;
@@ -30,15 +31,21 @@ declare class LayerManager {
30
31
  mapViewer: CesiumViewer;
31
32
  legendsList: IMapLegend[];
32
33
  layerUpdated: Event;
34
+ dataLayerUpdated: Event;
33
35
  private readonly layers;
36
+ private readonly dataLayers;
34
37
  private readonly legendsExtractor?;
35
38
  private readonly layerManagerFootprintMetaFieldPath;
36
39
  constructor(mapViewer: CesiumViewer, legendsExtractor?: LegendExtractor, onLayersUpdate?: () => void, layerManagerFootprintMetaFieldPath?: string);
37
40
  get layerList(): ICesiumImageryLayer[];
41
+ get dataLayerList(): ICesiumWFSLayer[];
42
+ addDataLayer(dataLayer: ICesiumWFSLayer): void;
38
43
  addMetaToLayer(meta: any, layerPredicate: (layer: ImageryLayer, idx: number) => boolean): void;
44
+ addMetaToDataLayer(meta: any): void;
39
45
  setBaseMapLayers(baseMap: IBaseMap): void;
40
46
  addRasterLayer(layer: IRasterLayer, index: number, parentId: string): void;
41
47
  removeLayer(layerId: string): void;
48
+ removeDataLayer(dataLayerId: string): void;
42
49
  removeBaseMapLayers(): void;
43
50
  removeNotBaseMapLayers(): void;
44
51
  raise(layerId: string, positions?: number): void;
@@ -52,6 +59,9 @@ declare class LayerManager {
52
59
  pickImageryLayers(position: CesiumCartesian2): ICesiumImageryLayer[] | undefined;
53
60
  findLayerByPOI(x: number, y: number, onlyShown?: boolean): ICesiumImageryLayer[] | undefined;
54
61
  addTransparentImageryProvider(): void;
62
+ addDataLayerUpdatedListener(callback: (meta: any) => void): void;
63
+ removeDataLayerUpdatedListener(callback: (meta: any) => void): void;
64
+ findDataLayerById(dataLayerId: string): ICesiumWFSLayer | undefined;
55
65
  private setLegends;
56
66
  private getBaseLayersCount;
57
67
  private findLayerById;
@@ -44,6 +44,9 @@ interface ILegends {
44
44
  };
45
45
  mapLegendsExtractor?: LegendExtractor;
46
46
  }
47
+ export interface IDebugPanel {
48
+ wfs?: Record<string, unknown>;
49
+ }
47
50
  export interface CesiumMapProps extends ViewerProps {
48
51
  showMousePosition?: boolean;
49
52
  showZoomLevel?: boolean;
@@ -69,6 +72,7 @@ export interface CesiumMapProps extends ViewerProps {
69
72
  legends?: ILegends;
70
73
  layerManagerFootprintMetaFieldPath?: string;
71
74
  displayZoomButtons?: boolean;
75
+ debugPanel?: IDebugPanel;
72
76
  }
73
77
  export declare const useCesiumMap: () => CesiumViewer;
74
78
  export declare const CesiumMap: React.FC<CesiumMapProps>;
@@ -1,4 +1,4 @@
1
- import { BoundingSphere, Cartesian2, Cartesian3, Cartographic, CesiumTerrainProvider, ConstantPositionProperty, ConstantProperty, Ellipsoid, EllipsoidTerrainProvider, GeographicTilingScheme, HorizontalOrigin, LabelStyle, PolylineDashMaterialProperty, Rectangle, Resource, VerticalOrigin } from 'cesium';
1
+ import { BillboardGraphics, BoundingSphere, Cartesian2, Cartesian3, Cartographic, CesiumTerrainProvider, ConstantPositionProperty, ConstantProperty, Ellipsoid, EllipsoidTerrainProvider, GeographicTilingScheme, HeightReference, HorizontalOrigin, JulianDate, LabelStyle, PolylineDashMaterialProperty, PolylineGraphics, PositionProperty, Rectangle, Resource, VerticalOrigin } from 'cesium';
2
2
  export declare class CesiumPolylineDashMaterialProperty extends PolylineDashMaterialProperty {
3
3
  }
4
4
  export declare class CesiumConstantProperty extends ConstantProperty {
@@ -25,7 +25,16 @@ export declare class CesiumEllipsoidTerrainProvider extends EllipsoidTerrainProv
25
25
  }
26
26
  export declare class CesiumCesiumTerrainProvider extends CesiumTerrainProvider {
27
27
  }
28
+ export declare class CesiumCesiumPolylineGraphics extends PolylineGraphics {
29
+ }
30
+ export declare class CesiumJulianDate extends JulianDate {
31
+ }
32
+ export declare class CesiumPositionProperty extends PositionProperty {
33
+ }
34
+ export declare class CesiumCesiumBillboardGraphics extends BillboardGraphics {
35
+ }
28
36
  export declare const CesiumVerticalOrigin: typeof VerticalOrigin;
29
37
  export declare const CesiumHorizontalOrigin: typeof HorizontalOrigin;
30
38
  export declare const CesiumLabelStyle: typeof LabelStyle;
31
- export { sampleTerrainMostDetailed as cesiumSampleTerrainMostDetailed, Math as CesiumMath } from 'cesium';
39
+ export declare const CesiumHeightReference: typeof HeightReference;
40
+ export { Entity as CesiumCesiumEntity, GeoJsonDataSource as CesiumGeoJsonDataSource, Math as CesiumMath, PolygonGraphics as CesiumCesiumPolygonGraphics, sampleTerrainMostDetailed as cesiumSampleTerrainMostDetailed, } from 'cesium';
@@ -4,7 +4,8 @@
4
4
  }
5
5
 
6
6
  .settingsIconContainer,
7
- .mapLegendToggleContainer {
7
+ .mapLegendToggleContainer,
8
+ .debugPanelIconContainer {
8
9
  fill: #fff;
9
10
  width: 40px;
10
11
  height: 40px;
@@ -14,7 +15,8 @@
14
15
  }
15
16
 
16
17
  .settingsIconContainer:hover,
17
- .mapLegendToggleContainer:hover {
18
+ .mapLegendToggleContainer:hover,
19
+ .debugPanelIconContainer:hover {
18
20
  background: #48b;
19
21
  border-color: #aef;
20
22
  }
@@ -30,8 +32,11 @@
30
32
  max-height: 460px;
31
33
  width: 280px;
32
34
  position: absolute;
33
- top: 40px;
34
- right: 80px;
35
+ top: 44px;
36
+ right: 12px;
37
+ /* color: #AFBFDA;
38
+ background: #2D3748;
39
+ padding: 20px 24px; */
35
40
  }
36
41
 
37
42
  .settingsDialogPortal .mdc-dialog__container {
@@ -43,7 +48,7 @@
43
48
  }
44
49
 
45
50
  body[dir='rtl'] .settingsDialogPortal {
46
- left: 80px;
51
+ left: 12px;
47
52
  right: unset;
48
53
  }
49
54
 
@@ -1,9 +1,9 @@
1
1
  .compass.rtl {
2
2
  right: unset;
3
- left: 20px;
3
+ left: 24px;
4
4
  }
5
5
 
6
6
  .compass.ltr {
7
7
  left: unset;
8
- right: 20px;
8
+ right: 24px;
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-colonies/react-components",
3
- "version": "4.8.1",
3
+ "version": "4.9.1",
4
4
  "main": "./dist/@map-colonies/react-components.umd.js",
5
5
  "module": "./dist/@map-colonies/react-components.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,6 +32,7 @@
32
32
  "@turf/bbox-polygon": "^6.0.1",
33
33
  "@turf/boolean-point-in-polygon": "^6.5.0",
34
34
  "@turf/helpers": "^6.1.4",
35
+ "@turf/point-to-polygon-distance": "^7.2.0",
35
36
  "@turf/rewind": "^5.1.5",
36
37
  "cesium": "1.103.0",
37
38
  "chonky": "^2.3.2",
@@ -45,11 +46,13 @@
45
46
  "lodash": "^4.17.20",
46
47
  "ol": "^6.4.3",
47
48
  "ol-ext": "^4.0.18",
49
+ "p-map": "6.0.0",
48
50
  "react-datepicker": "^4.16.0",
49
51
  "react-select": "5.7.3",
50
52
  "resium": "1.16.1",
51
53
  "rimraf": "3.0.2",
52
- "textarea-caret": "^3.1.0"
54
+ "textarea-caret": "^3.1.0",
55
+ "uuid": "^11.1.0"
53
56
  },
54
57
  "devDependencies": {
55
58
  "@storybook/addon-essentials": "6.5.16",
@@ -73,5 +76,5 @@
73
76
  "files": [
74
77
  "dist"
75
78
  ],
76
- "gitHead": "a7c6229ccc82f0d6744f9653d5a31792c56d667a"
79
+ "gitHead": "2ae5b6ed367f680b7392b5f9825d425d6cfdc03e"
77
80
  }