@vcmap/core 5.0.0-rc.4 → 5.0.0-rc.5

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.
Files changed (30) hide show
  1. package/index.d.ts +222 -65
  2. package/index.js +9 -1
  3. package/package.json +5 -10
  4. package/src/vcs/vcm/category/appBackedCategory.js +41 -0
  5. package/src/vcs/vcm/category/category.js +374 -0
  6. package/src/vcs/vcm/category/categoryCollection.js +145 -0
  7. package/src/vcs/vcm/context.js +73 -0
  8. package/src/vcs/vcm/layer/featureStore.js +2 -2
  9. package/src/vcs/vcm/layer/featureStoreChanges.js +89 -73
  10. package/src/vcs/vcm/layer/geojson.js +3 -5
  11. package/src/vcs/vcm/layer/geojsonHelpers.js +3 -3
  12. package/src/vcs/vcm/layer/tileProvider/mvtTileProvider.js +3 -3
  13. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +3 -3
  14. package/src/vcs/vcm/layer/tileProvider/urlTemplateTileProvider.js +3 -3
  15. package/src/vcs/vcm/layer/vectorHelpers.js +4 -4
  16. package/src/vcs/vcm/layer/wfs.js +5 -5
  17. package/src/vcs/vcm/oblique/ObliqueDataSet.js +7 -7
  18. package/src/vcs/vcm/util/clipping/clippingPlaneHelper.js +4 -4
  19. package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +3 -4
  20. package/src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js +11 -6
  21. package/src/vcs/vcm/util/featureconverter/extent3D.js +181 -0
  22. package/src/vcs/vcm/util/fetch.js +32 -0
  23. package/src/vcs/vcm/util/overrideCollection.js +224 -0
  24. package/src/vcs/vcm/util/style/declarativeStyleItem.js +2 -0
  25. package/src/vcs/vcm/util/style/styleFactory.js +1 -1
  26. package/src/vcs/vcm/util/style/styleItem.js +2 -0
  27. package/src/vcs/vcm/util/style/vectorStyleItem.js +2 -0
  28. package/src/vcs/vcm/vcsApp.js +360 -0
  29. package/src/vcs/vcm/vcsAppContextHelpers.js +108 -0
  30. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
package/index.d.ts CHANGED
@@ -14,6 +14,103 @@ export class VcsCameraPrimitive {
14
14
  show: boolean;
15
15
  }
16
16
 
17
+ export interface AppBackedCategoryOptions extends CategoryOptions {
18
+ collectionName: string;
19
+ }
20
+
21
+ export class AppBackedCategory extends Category<VcsObject> {
22
+ constructor(options: AppBackedCategoryOptions);
23
+ serializeForContext(contextId: string): null;
24
+ }
25
+
26
+ /**
27
+ */
28
+ export interface CategoryOptions extends VcsObjectOptions {
29
+ title?: string | {
30
+ [key: string]: string;
31
+ };
32
+ typed?: boolean;
33
+ featureProperty?: string | undefined;
34
+ layerOptions?: VectorOptions;
35
+ /**
36
+ * items are not evaluated by the constructor but passed to parseItem during deserialization.
37
+ */
38
+ items?: object[];
39
+ keyProperty?: string;
40
+ }
41
+
42
+ /**
43
+ * A category contains user based items and is a special container. The container should not be created directly, but via
44
+ * the requestCategory API on the categories collection. Do not use toJSON to retrieve the state of a category, since
45
+ * categories outlive contexts and may be changed with mergeOptions to no longer reflect your initial state. Requestors
46
+ * should keep track of the requested options themselves.
47
+ */
48
+ export class Category<T extends Object|VcsObject> extends VcsObject {
49
+ constructor(options: CategoryOptions);
50
+ static getDefaultConfig(): CategoryOptions;
51
+ title: string | {
52
+ [key: string]: string;
53
+ };
54
+ protected _app: VcsApp;
55
+ protected _layer: Vector;
56
+ /**
57
+ * The collection of this category.
58
+ */
59
+ readonly collection: OverrideCollection<T>;
60
+ /**
61
+ * Returns the layer of this collection. Caution, do not use the layer API to add or remove items.
62
+ * When adding items to the collection, the features are added to the layer async (timeout of 0), since there is weird behavior
63
+ * when removing and adding a feature with the same id in the same sync call.
64
+ */
65
+ layer: Vector | null;
66
+ protected _itemAdded(item: T): void;
67
+ protected _itemRemoved(item: T): void;
68
+ protected _itemReplaced(item: T): void;
69
+ protected _itemMoved(item: T): void;
70
+ /**
71
+ * Throws if typed, featureProperty and keyProperty do not match. Merges other options.
72
+ * Only merges: style, highlightStyle, zIndex & vectorProperties from layerOptions.
73
+ */
74
+ mergeOptions(options: CategoryOptions): void;
75
+ /**
76
+ * When setting the category, it MUST use the same unqiueKey as the previous collection (default is "name").
77
+ * All items in the current collection _will be destroyed_ and the current collection will be destroyed. The category will take
78
+ * complete ownership of the collection and destroy it once the category is destroyed. The collection will
79
+ * be turned into an {@see OverrideCollection}.
80
+ */
81
+ setCollection(collection: Collection<T>): void;
82
+ setApp(app: VcsApp): void;
83
+ protected _serializeItem(item: T): object[];
84
+ serializeForContext(contextId: string): CategoryOptions | null;
85
+ /**
86
+ * unique Name
87
+ */
88
+ readonly name: string;
89
+ properties: any;
90
+ readonly className: string;
91
+ }
92
+
93
+ export class CategoryCollection extends IndexedCollection<Category<Object|VcsObject>> {
94
+ constructor(app: VcsApp);
95
+ /**
96
+ * Do not call add directly. Use request category for adding categories.
97
+ */
98
+ add(category: Category<object | VcsObject>): number | null;
99
+ /**
100
+ * Categories should be static. Removing them can lead to undefined behavior.
101
+ */
102
+ remove(category: Category<object | VcsObject>): void;
103
+ /**
104
+ * Parses the category items. Items will only be parsed, if a category with said name exists. Otherwise,
105
+ * they will be cached, until such a category is requested.
106
+ */
107
+ parseCategoryItems(name: string, items: object[], contextId: string): Promise<void>;
108
+ /**
109
+ * Add categories with this API.
110
+ */
111
+ requestCategory(options: CategoryOptions): Promise<Category<object | VcsObject>>;
112
+ }
113
+
17
114
  export class ClassRegistry {
18
115
  logger: import("@vcsuite/logger").Logger;
19
116
  /**
@@ -36,6 +133,26 @@ export class ClassRegistry {
36
133
 
37
134
  export const VcsClassRegistry: ClassRegistry;
38
135
 
136
+ export interface VcsAppConfig {
137
+ id?: string | undefined;
138
+ layers?: LayerOptions[];
139
+ maps?: VcsMapOptions[];
140
+ styles?: StyleItemOptions[];
141
+ viewpoints?: ViewPointOptions[];
142
+ startingViewPointName?: string;
143
+ startingMapName?: string;
144
+ projection?: ProjectionOptions;
145
+ categories?: { name: string; items: object[]; }[];
146
+ obliqueCollections?: ObliqueCollectionOptions[];
147
+ }
148
+
149
+ export class Context {
150
+ constructor(config: VcsAppConfig);
151
+ readonly id: string;
152
+ readonly checkSum: string;
153
+ readonly config: VcsAppConfig;
154
+ }
155
+
39
156
  export class VcsEvent<T extends any> {
40
157
  /**
41
158
  * The number of listeners
@@ -1567,6 +1684,13 @@ export interface FeatureStoreChangesValues {
1567
1684
  changed: boolean;
1568
1685
  }
1569
1686
 
1687
+ export interface CommitAction {
1688
+ action: string;
1689
+ feature: import("ol/format/GeoJSON").GeoJSONFeature;
1690
+ original: import("ol").Feature<import("ol/geom/Geometry").default>;
1691
+ success: (...params: any[]) => any;
1692
+ }
1693
+
1570
1694
  /**
1571
1695
  * do not construct directly, use the layers .changeTracker instead
1572
1696
  */
@@ -6405,7 +6529,7 @@ export class WMSFeatureProvider extends AbstractFeatureProvider {
6405
6529
  * The feature response projection, if not present in the response format.
6406
6530
  */
6407
6531
  projection: Projection;
6408
- featureResponseCallback(response: import("axios").AxiosResponse<any>, coordinate: import("ol/coordinate").Coordinate): import("ol").Feature<import("ol/geom/Geometry").default>[];
6532
+ featureResponseCallback(data: import("ol/format/GeoJSON").GeoJSONObject, coordinate: import("ol/coordinate").Coordinate): import("ol").Feature<import("ol/geom/Geometry").default>[];
6409
6533
  /**
6410
6534
  * The layer name of the associated layer
6411
6535
  */
@@ -6441,69 +6565,6 @@ export function validateCircle(circle: import("ol/geom/Circle").default): boolea
6441
6565
 
6442
6566
  export function getStylesArray(style: void | import("ol/style/Style").StyleLike, feature: import("ol").Feature<import("ol/geom/Geometry").default>, resolution?: number): import("ol/style/Style").default[];
6443
6567
 
6444
- /**
6445
- * Create an empty extent.
6446
- * @returns Empty extent.
6447
- */
6448
- export function createEmpty3D(): number[];
6449
-
6450
- /**
6451
- * Create a new extent or update the provided extent.
6452
- * @param minX - Minimum X.
6453
- * @param minY - Minimum Y.
6454
- * @param minZ - Minimum Z.
6455
- * @param maxX - Maximum X.
6456
- * @param maxY - Maximum Y.
6457
- * @param maxZ - Maximum Z.
6458
- * @param [optExtent] - Destination extent.
6459
- * @returns Extent.
6460
- */
6461
- export function createOrUpdate3D(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number, optExtent?: number[]): number[];
6462
-
6463
- /**
6464
- * @param extent - Extent.
6465
- * @param x - X.
6466
- * @param y - Y.
6467
- * @param z - Z.
6468
- */
6469
- export function extendXYZ(extent: number[], x: number, y: number, z: number): void;
6470
-
6471
- /**
6472
- * @param extent - Extent.
6473
- * @param x - X.
6474
- * @param y - Y.
6475
- */
6476
- export function extendXY(extent: number[], x: number, y: number): void;
6477
-
6478
- /**
6479
- * @param extent - Extent.
6480
- * @param z - Z.
6481
- */
6482
- export function extendZ(extent: number[], z: number): void;
6483
-
6484
- /**
6485
- * @param extent - Extent.
6486
- * @param flatCoordinates - Flat coordinates.
6487
- * @param stride - Stride.
6488
- * @returns Extent.
6489
- */
6490
- export function extendFlatCoordinates(extent: number[], flatCoordinates: number[], stride: number): number[];
6491
-
6492
- /**
6493
- * @param geometry - Geometry.
6494
- * @param [optExtent] - Extent.
6495
- * @returns Extent.
6496
- */
6497
- export function createOrUpdateFromGeometry(geometry: import("ol/geom/Geometry").default, optExtent?: number[]): number[];
6498
-
6499
- export function createOrUpdateFromHeightInfo(heightInfo: VectorHeightInfo, optExtent: number[]): void;
6500
-
6501
- /**
6502
- * @param extent - Extent.
6503
- * @returns Extent.
6504
- */
6505
- export function make2D(extent: number[]): import("ol/extent").Extent;
6506
-
6507
6568
  export function getMaterialAppearance(scene: import("@vcmap/cesium").Scene, fill: import("ol/style/Fill").default, feature: import("ol").Feature<import("ol/geom/Geometry").default>): import("@vcmap/cesium").MaterialAppearance;
6508
6569
 
6509
6570
  export function createClassificationPrimitive(options: any, geometries: import("@vcmap/cesium").Geometry[], color: import("@vcmap/cesium").Color, classificationType: import("@vcmap/cesium").ClassificationType): import("@vcmap/cesium").ClassificationPrimitive;
@@ -6566,6 +6627,12 @@ export function getCartesian3AndWGS84FromCoordinates(coordinates: import("ol/coo
6566
6627
  */
6567
6628
  export function validatePolygon(polygon: import("ol/geom/Polygon").default): boolean;
6568
6629
 
6630
+ export function requestUrl(url: string, init?: RequestInit): Promise<Response>;
6631
+
6632
+ export function requestJson(url: string, init?: RequestInit): Promise<any>;
6633
+
6634
+ export function requestArrayBuffer(url: string, init?: RequestInit): Promise<ArrayBuffer>;
6635
+
6569
6636
  export function getFlatCoordinatesFromSimpleGeometry(geometry: import("ol/geom/SimpleGeometry").default): import("ol/coordinate").Coordinate[];
6570
6637
 
6571
6638
  export function getFlatCoordinatesFromGeometry(geometry: import("ol/geom/Geometry").default, inputCoordinates?: any[]): import("ol/coordinate").Coordinate[];
@@ -6771,6 +6838,20 @@ export function cartesian2DDistance(point0: import("ol/coordinate").Coordinate,
6771
6838
 
6772
6839
  export function cartesian3DDistance(p1: import("ol/coordinate").Coordinate, p2: import("ol/coordinate").Coordinate): number;
6773
6840
 
6841
+ /**
6842
+ * A symbol added to override collections.
6843
+ */
6844
+ export const isOverrideCollection: symbol;
6845
+
6846
+ /**
6847
+ * @param getDynamicContextId - function to get the current dynamic context id
6848
+ * @param [serializeItem] - optional function to serialize an item, defaults to returning item.toJSON or item: i => (i.toJSON || i)
6849
+ * @param [deserializeItem] - optional desirialization function. defaults to returning the passed object: i => i
6850
+ * @param [ctor] - optional constructor to validate deserialized items against. if passed, deserializeItem must be an instance of ctor.
6851
+ * @param [determineShadowIndex] - return the index where a shadow should be inserted. only has relevance, if the collection is indexed. previous and current index may be null.
6852
+ */
6853
+ export function makeOverrideCollection<T extends any>(collection: Collection<T>, getDynamicContextId: (...params: any[]) => any, serializeItem?: (...params: any[]) => any, deserializeItem?: (...params: any[]) => any, ctor?: any, determineShadowIndex?: ((...params: any[]) => any) | null): OverrideCollection<T>;
6854
+
6774
6855
  /**
6775
6856
  */
6776
6857
  export interface ProjectionOptions {
@@ -6986,7 +7067,7 @@ export function getShapeFromOptions(options: VectorStyleItemImage): import("ol/s
6986
7067
 
6987
7068
  export const shapeCategory: any;
6988
7069
 
6989
- export function getStyleOrDefaultStyle(styleOptions?: Reference | DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem | string, defaultStyle?: VectorStyleItem | DeclarativeStyleItem): StyleItem;
7070
+ export function getStyleOrDefaultStyle(styleOptions?: Reference | DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem | string, defaultStyle?: StyleItem): StyleItem;
6990
7071
 
6991
7072
  export interface FontObject {
6992
7073
  fontStyle: string;
@@ -7467,4 +7548,80 @@ export class ViewPoint extends VcsObject {
7467
7548
  readonly className: string;
7468
7549
  }
7469
7550
 
7551
+ export class VcsApp {
7552
+ readonly id: string;
7553
+ readonly maps: OverrideMapCollection;
7554
+ readonly layers: OverrideLayerCollection;
7555
+ readonly obliqueCollections: OverrideCollection<ObliqueCollection>;
7556
+ readonly viewPoints: OverrideCollection<ViewPoint>;
7557
+ readonly styles: OverrideCollection<StyleItem>;
7558
+ readonly categories: CategoryCollection;
7559
+ readonly destroyed: VcsEvent<void>;
7560
+ readonly contextAdded: any;
7561
+ readonly contextRemoved: any;
7562
+ getContextById(id: string): Context;
7563
+ protected _parseContext(context: Context): Promise<void>;
7564
+ protected _setContextState(context: Context): Promise<void>;
7565
+ addContext(context: Context): Promise<void>;
7566
+ protected _removeContext(contextId: string): Promise<void>;
7567
+ removeContext(contextId: string): Promise<void>;
7568
+ }
7569
+
7570
+ export function getVcsAppById(id: string): VcsApp;
7571
+
7572
+ export const contextIdSymbol: symbol;
7573
+
7574
+ /**
7575
+ * returns a constructor of a type.
7576
+ */
7577
+ export function getObjectFromOptions(options: any, ...args: any[]): Promise<object | null>;
7578
+
7579
+ export function deserializeMap(vcsApp: VcsApp, mapConfig: VcsMapOptions): Promise<VcsMap | null>;
7580
+
7581
+ export function deserializeViewPoint(viewPointObject: ViewPointOptions): Promise<null | ViewPoint>;
7582
+
7583
+ export function serializeLayer(vcsApp: VcsApp, layer: Layer): Promise<LayerOptions | null>;
7584
+
7585
+ export function getLayerIndex(current: Layer, previous: Layer, currentIndex: number): number | null;
7586
+
7587
+ export function destroyCollection(collection: Collection<any>): void;
7588
+
7589
+
7590
+
7591
+
7592
+ export interface OverrideCollectionInterface<T extends any> {
7593
+ replaced: VcsEvent<T>;
7594
+ shadowMap: Map<string, object[]>;
7595
+ override: (item: T) => T;
7596
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7597
+ removeContext: (contextId: string) => Promise<void>;
7598
+ serializeContext: (contextId: string) => object[];
7599
+ }
7600
+
7601
+ export class OverrideCollection<T extends any> extends Collection<T> implements OverrideCollectionInterface<T> {
7602
+ replaced: VcsEvent<T>;
7603
+ shadowMap: Map<string, object[]>;
7604
+ override: (item: T) => T;
7605
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7606
+ removeContext: (contextId: string) => Promise<void>;
7607
+ serializeContext: (contextId: string) => object[];
7608
+ }
7609
+
7610
+ export class OverrideLayerCollection extends LayerCollection implements OverrideCollectionInterface<Layer> {
7611
+ replaced: VcsEvent<Layer>;
7612
+ shadowMap: Map<string, object[]>;
7613
+ override: (item: Layer) => Layer;
7614
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7615
+ removeContext: (contextId: string) => Promise<void>;
7616
+ serializeContext: (contextId: string) => object[];
7617
+ }
7618
+
7619
+ export class OverrideMapCollection extends MapCollection implements OverrideCollectionInterface<VcsMap> {
7620
+ replaced: VcsEvent<VcsMap>;
7621
+ shadowMap: Map<string, object[]>;
7622
+ override: (item: VcsMap) => VcsMap;
7623
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7624
+ removeContext: (contextId: string) => Promise<void>;
7625
+ serializeContext: (contextId: string) => object[];
7626
+ }
7470
7627
 
package/index.js CHANGED
@@ -6,7 +6,11 @@ import './src/cesium/cesium3DTilePointFeature.js';
6
6
  import './src/cesium/cesium3DTileFeature.js';
7
7
  import './src/cesium/cesiumVcsCameraPrimitive.js';
8
8
 
9
+ export { default as AppBackedCategory } from './src/vcs/vcm/category/appBackedCategory.js';
10
+ export { default as Category } from './src/vcs/vcm/category/category.js';
11
+ export { default as CategoryCollection } from './src/vcs/vcm/category/categoryCollection.js';
9
12
  export { VcsClassRegistry, default as ClassRegistry } from './src/vcs/vcm/classRegistry.js';
13
+ export { default as Context } from './src/vcs/vcm/context.js';
10
14
  export { default as VcsEvent } from './src/vcs/vcm/event/vcsEvent.js';
11
15
  export { styleCollection, obliqueCollectionCollection } from './src/vcs/vcm/globalCollections.js';
12
16
  export { default as AbstractInteraction } from './src/vcs/vcm/interaction/abstractInteraction.js';
@@ -114,11 +118,12 @@ export { default as TileProviderFeatureProvider } from './src/vcs/vcm/util/featu
114
118
  export { getFormat, default as WMSFeatureProvider } from './src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js';
115
119
  export { validateCircle, default as circleToCesium } from './src/vcs/vcm/util/featureconverter/circleToCesium.js';
116
120
  export { getStylesArray, default as convert } from './src/vcs/vcm/util/featureconverter/convert.js';
117
- export { createEmpty3D, createOrUpdate3D, extendXYZ, extendXY, extendZ, extendFlatCoordinates, createOrUpdateFromGeometry, createOrUpdateFromHeightInfo, make2D } from './src/vcs/vcm/util/featureconverter/extent3d.js';
121
+ export { default as Extent3D } from './src/vcs/vcm/util/featureconverter/extent3D.js';
118
122
  export { getMaterialAppearance, createClassificationPrimitive, createPrimitive, createOutlinePrimitive, createLinePrimitive, getMinHeightOrGroundLevel, getStoreyHeights, validateStoreys, getHeightAboveGround, getHeightInfo, getStoreyOptions, addPrimitivesToContext } from './src/vcs/vcm/util/featureconverter/featureconverterHelper.js';
119
123
  export { validateLineString, default as lineStringToCesium } from './src/vcs/vcm/util/featureconverter/lineStringToCesium.js';
120
124
  export { getBillboardOptions, getLabelOptions, getModelOptions, validatePoint, getCartesian3AndWGS84FromCoordinates, default as pointToCesium } from './src/vcs/vcm/util/featureconverter/pointToCesium.js';
121
125
  export { validatePolygon, default as polygonToCesium } from './src/vcs/vcm/util/featureconverter/polygonToCesium.js';
126
+ export { requestUrl, requestJson, requestArrayBuffer } from './src/vcs/vcm/util/fetch.js';
122
127
  export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, circleFromCenterRadius, convertGeometryToPolygon, enforceEndingVertex, removeEndingVertex, removeEndingVertexFromGeometry, enforceRightHand } from './src/vcs/vcm/util/geometryHelpers.js';
123
128
  export { default as IndexedCollection } from './src/vcs/vcm/util/indexedCollection.js';
124
129
  export { isMobile } from './src/vcs/vcm/util/isMobile.js';
@@ -126,6 +131,7 @@ export { default as LayerCollection } from './src/vcs/vcm/util/layerCollection.j
126
131
  export { getLocaleChangedEvent, detectBrowserLocale, getCurrentLocale, setCurrentLocale } from './src/vcs/vcm/util/locale.js';
127
132
  export { default as MapCollection } from './src/vcs/vcm/util/mapCollection.js';
128
133
  export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance } from './src/vcs/vcm/util/math.js';
134
+ export { isOverrideCollection, default as makeOverrideCollection } from './src/vcs/vcm/util/overrideCollection.js';
129
135
  export { wgs84ToMercatorTransformer, mercatorToWgs84Transformer, setDefaultProjectionOptions, getDefaultProjection, wgs84Projection, mercatorProjection, default as Projection } from './src/vcs/vcm/util/projection.js';
130
136
  export { default as SplitScreen } from './src/vcs/vcm/util/splitScreen.js';
131
137
  export { defaultDeclarativeStyle, default as DeclarativeStyleItem } from './src/vcs/vcm/util/style/declarativeStyleItem.js';
@@ -137,3 +143,5 @@ export { olcsGeometryType, vectorStyleSymbol, defaultVectorStyle, fromCesiumColo
137
143
  export { embedIconsInStyle, default as writeStyle } from './src/vcs/vcm/util/style/writeStyle.js';
138
144
  export { isSameOrigin } from './src/vcs/vcm/util/urlHelpers.js';
139
145
  export { propertyEqualsEpsilon, angleEqualsEpsilon, coordinateEqualsEpsilon, default as ViewPoint } from './src/vcs/vcm/util/viewpoint.js';
146
+ export { getVcsAppById, default as VcsApp } from './src/vcs/vcm/vcsApp.js';
147
+ export { contextIdSymbol, getObjectFromOptions, deserializeMap, deserializeViewPoint, serializeLayer, getLayerIndex, destroyCollection } from './src/vcs/vcm/vcsAppContextHelpers.js';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@vcmap/core",
3
- "version": "5.0.0-rc.4",
3
+ "version": "5.0.0-rc.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "types": "index.d.ts",
8
8
  "scripts": {
9
- "test": "node --experimental-json-modules node_modules/mocha/bin/_mocha --exit --require tests/setupJsdom.js --require tests/setup.js --file tests/vcs.js --recursive \"tests/**/*spec.js\"",
9
+ "test": "node node_modules/mocha/bin/_mocha --exit --require tests/setupJsdom.js --require tests/setup.js --file tests/vcs.js --recursive \"tests/**/*spec.js\"",
10
10
  "lint": "eslint .",
11
11
  "pretype-check": "npm run build-typedefs",
12
12
  "type-check": "node build/typeCheck.js",
@@ -51,6 +51,8 @@
51
51
  "jsdom-global": "^3.0.2",
52
52
  "mocha": "^9.1.3",
53
53
  "mocha-junit-reporter": "^2.0.2",
54
+ "nock": "^13.2.4",
55
+ "node-fetch": "^3.2.0",
54
56
  "ol": "^6.9.0",
55
57
  "sinon": "^9.2.4",
56
58
  "sinon-chai": "^3.6.0",
@@ -63,13 +65,7 @@
63
65
  "eslintConfig": {
64
66
  "extends": [
65
67
  "@vcsuite/eslint-config/vue"
66
- ],
67
- "rules": {
68
- "import/extensions": [
69
- "error",
70
- "always"
71
- ]
72
- }
68
+ ]
73
69
  },
74
70
  "eslintIgnore": [
75
71
  "node_modules",
@@ -82,7 +78,6 @@
82
78
  "@vcsuite/check": "^1.0.3",
83
79
  "@vcsuite/logger": "^1.0.1",
84
80
  "@vcsuite/parsers": "^1.0.1",
85
- "axios": "^0.21.4",
86
81
  "fast-deep-equal": "^3.1.3",
87
82
  "proj4": "^2.7.2",
88
83
  "rbush": ">=3.0.1",
@@ -0,0 +1,41 @@
1
+ import Category from './category.js';
2
+ import { VcsClassRegistry } from '../classRegistry.js';
3
+
4
+ /**
5
+ * @typedef {CategoryOptions} AppBackedCategoryOptions
6
+ * @property {string} collectionName
7
+ */
8
+
9
+ /**
10
+ * @class
11
+ * @extends {Category<import("@vcmap/core").VcsObject>}
12
+ */
13
+ class AppBackedCategory extends Category {
14
+ static get className() { return 'category.AppBackedCategory'; }
15
+
16
+ /**
17
+ * @param {AppBackedCategoryOptions} options
18
+ */
19
+ constructor(options) {
20
+ options.typed = true;
21
+ super(options);
22
+ this._collectionName = options.collectionName;
23
+ }
24
+
25
+ setApp(app) {
26
+ super.setApp(app);
27
+ this.setCollection(this._app[this._collectionName]);
28
+ }
29
+
30
+ /**
31
+ * @param {string} contextId
32
+ * @returns {null}
33
+ */
34
+ // eslint-disable-next-line class-methods-use-this,no-unused-vars
35
+ serializeForContext(contextId) {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ export default AppBackedCategory;
41
+ VcsClassRegistry.registerClass(AppBackedCategory.className, AppBackedCategory);