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

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 (42) hide show
  1. package/index.d.ts +274 -72
  2. package/index.js +11 -2
  3. package/package.json +9 -16
  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/event/vcsEvent.js +2 -2
  9. package/src/vcs/vcm/globalCollections.js +1 -5
  10. package/src/vcs/vcm/layer/featureStore.js +2 -2
  11. package/src/vcs/vcm/layer/featureStoreChanges.js +89 -73
  12. package/src/vcs/vcm/layer/featureVisibility.js +3 -2
  13. package/src/vcs/vcm/layer/geojson.js +3 -5
  14. package/src/vcs/vcm/layer/geojsonHelpers.js +3 -3
  15. package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +3 -2
  16. package/src/vcs/vcm/layer/tileProvider/mvtTileProvider.js +3 -3
  17. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +3 -3
  18. package/src/vcs/vcm/layer/tileProvider/urlTemplateTileProvider.js +3 -3
  19. package/src/vcs/vcm/layer/vectorHelpers.js +4 -4
  20. package/src/vcs/vcm/layer/wfs.js +5 -5
  21. package/src/vcs/vcm/maps/oblique.js +19 -23
  22. package/src/vcs/vcm/maps/openlayers.js +6 -3
  23. package/src/vcs/vcm/oblique/ObliqueCollection.js +33 -5
  24. package/src/vcs/vcm/oblique/ObliqueDataSet.js +7 -7
  25. package/src/vcs/vcm/oblique/ObliqueImageMeta.js +2 -2
  26. package/src/vcs/vcm/oblique/ObliqueProvider.js +6 -3
  27. package/src/vcs/vcm/oblique/ObliqueView.js +31 -1
  28. package/src/vcs/vcm/oblique/defaultObliqueCollection.js +62 -0
  29. package/src/vcs/vcm/util/clipping/clippingPlaneHelper.js +4 -4
  30. package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +3 -4
  31. package/src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js +13 -7
  32. package/src/vcs/vcm/util/featureconverter/extent3D.js +181 -0
  33. package/src/vcs/vcm/util/fetch.js +32 -0
  34. package/src/vcs/vcm/util/overrideCollection.js +224 -0
  35. package/src/vcs/vcm/util/projection.js +5 -2
  36. package/src/vcs/vcm/util/style/declarativeStyleItem.js +2 -0
  37. package/src/vcs/vcm/util/style/styleFactory.js +1 -1
  38. package/src/vcs/vcm/util/style/styleItem.js +2 -0
  39. package/src/vcs/vcm/util/style/vectorStyleItem.js +2 -0
  40. package/src/vcs/vcm/vcsApp.js +373 -0
  41. package/src/vcs/vcm/vcsAppContextHelpers.js +108 -0
  42. 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
@@ -65,8 +182,6 @@ export class VcsEvent<T extends any> {
65
182
 
66
183
  export const styleCollection: Collection<StyleItem>;
67
184
 
68
- export const obliqueCollectionCollection: Collection<ObliqueCollection>;
69
-
70
185
  /**
71
186
  */
72
187
  export interface ObliqueParameters {
@@ -1567,6 +1682,13 @@ export interface FeatureStoreChangesValues {
1567
1682
  changed: boolean;
1568
1683
  }
1569
1684
 
1685
+ export interface CommitAction {
1686
+ action: string;
1687
+ feature: import("ol/format/GeoJSON").GeoJSONFeature;
1688
+ original: import("ol").Feature<import("ol/geom/Geometry").default>;
1689
+ success: (...params: any[]) => any;
1690
+ }
1691
+
1570
1692
  /**
1571
1693
  * do not construct directly, use the layers .changeTracker instead
1572
1694
  */
@@ -5135,7 +5257,6 @@ export interface ObliqueOptions extends VcsMapOptions {
5135
5257
  changeOnMoveEnd?: boolean;
5136
5258
  switchThreshold?: number;
5137
5259
  switchOnEdge?: boolean;
5138
- defaultCollectionName?: string | undefined;
5139
5260
  }
5140
5261
 
5141
5262
  /**
@@ -5147,7 +5268,6 @@ export function getViewDirectionFromViewPoint(viewpoint: ViewPoint): ObliqueView
5147
5268
  * Oblique Map Class (2D map with oblique imagery)
5148
5269
  */
5149
5270
  export class Oblique extends BaseOLMap {
5150
- constructor(options: ObliqueOptions);
5151
5271
  static getDefaultOptions(): ObliqueOptions;
5152
5272
 
5153
5273
  /**
@@ -5377,6 +5497,7 @@ export interface ObliqueCollectionOptions extends VcsObjectOptions {
5377
5497
  minZoom?: number | undefined;
5378
5498
  scaleFactor?: number | undefined;
5379
5499
  hideLevels?: number | undefined;
5500
+ activeOnStartup?: boolean | undefined;
5380
5501
  }
5381
5502
 
5382
5503
  export class ObliqueCollection {
@@ -5388,11 +5509,16 @@ export class ObliqueCollection {
5388
5509
  * Event raised when images are loaded. Is passed an Array of ObliqueImages as its only argument.
5389
5510
  */
5390
5511
  imagesLoaded: VcsEvent<ObliqueImage[]>;
5512
+ /**
5513
+ * Whether to activate this collection after loading its defining context.
5514
+ */
5515
+ activeOnStartup: boolean;
5391
5516
  readonly dataSets: ObliqueDataSet[];
5392
5517
  /**
5393
5518
  * Indicates, that this collection has been loaded
5394
5519
  */
5395
5520
  loaded: boolean;
5521
+ destroyed: any;
5396
5522
  /**
5397
5523
  * A vector source of all tiles available to this collection in mercator. The feature have a "state" property,
5398
5524
  * the id is the string tile coordinate "z/x/y" of the tile
@@ -5642,7 +5768,7 @@ export interface ObliqueImageMetaOptions {
5642
5768
  tileResolution: number[];
5643
5769
  projection: Projection;
5644
5770
  url: string;
5645
- terrainProvider: import("@vcmap/cesium").CesiumTerrainProvider;
5771
+ terrainProvider?: import("@vcmap/cesium").CesiumTerrainProvider;
5646
5772
  name: string;
5647
5773
  format?: string | undefined;
5648
5774
  }
@@ -5678,7 +5804,7 @@ export class ObliqueImageMeta {
5678
5804
  /**
5679
5805
  * An optional terrain provider
5680
5806
  */
5681
- terrainProvider: import("@vcmap/cesium").CesiumTerrainProvider;
5807
+ terrainProvider: import("@vcmap/cesium").CesiumTerrainProvider | undefined;
5682
5808
  format: string;
5683
5809
  /**
5684
5810
  * Removes radial distortion in image coordinates. Radial coefficients must be provided
@@ -5787,7 +5913,7 @@ export class ObliqueView {
5787
5913
  /**
5788
5914
  * Sets the layers source to request data for this image
5789
5915
  */
5790
- setImageName(name: string): void;
5916
+ setImageName(name: string, isDefaultImage?: boolean): void;
5791
5917
  }
5792
5918
 
5793
5919
  /**
@@ -5807,6 +5933,43 @@ export const obliqueViewDirectionNames: {
5807
5933
 
5808
5934
  export function getDirectionName(direction: number): string | undefined;
5809
5935
 
5936
+ /**
5937
+ * This is a special oblique collection wich is shown, if no other oblique collection is set on an Oblique map.
5938
+ * It will render a single image which indicates that no images can be loaded.
5939
+ */
5940
+ export class DefaultObliqueCollection extends ObliqueCollection {
5941
+ viewOptions: ObliqueViewOptions;
5942
+
5943
+ /**
5944
+ * Event raised when images are loaded. Is passed an Array of ObliqueImages as its only argument.
5945
+ */
5946
+ imagesLoaded: VcsEvent<ObliqueImage[]>;
5947
+ /**
5948
+ * Whether to activate this collection after loading its defining context.
5949
+ */
5950
+ activeOnStartup: boolean;
5951
+ readonly dataSets: ObliqueDataSet[];
5952
+ /**
5953
+ * Indicates, that this collection has been loaded
5954
+ */
5955
+ loaded: boolean;
5956
+ destroyed: any;
5957
+ /**
5958
+ * A vector source of all tiles available to this collection in mercator. The feature have a "state" property,
5959
+ * the id is the string tile coordinate "z/x/y" of the tile
5960
+ */
5961
+ readonly tileFeatureSource: import("ol/source/Vector").default<import("ol/geom/Geometry").default>;
5962
+ /**
5963
+ * A vector source of all image currently loaded for this collection in mercator.
5964
+ * The id is the image name. The feature has a "viewDirection" property.
5965
+ */
5966
+ readonly imageFeatureSource: import("ol/source/Vector").default<import("ol/geom/Geometry").default>;
5967
+ /**
5968
+ * All currently loaded images
5969
+ */
5970
+ readonly images: ObliqueImage[];
5971
+ }
5972
+
5810
5973
  export interface PickTerrainReturn {
5811
5974
  estimate: boolean;
5812
5975
  coords: import("ol/coordinate").Coordinate;
@@ -6405,7 +6568,7 @@ export class WMSFeatureProvider extends AbstractFeatureProvider {
6405
6568
  * The feature response projection, if not present in the response format.
6406
6569
  */
6407
6570
  projection: Projection;
6408
- featureResponseCallback(response: import("axios").AxiosResponse<any>, coordinate: import("ol/coordinate").Coordinate): import("ol").Feature<import("ol/geom/Geometry").default>[];
6571
+ featureResponseCallback(data: import("ol/format/GeoJSON").GeoJSONObject, coordinate: import("ol/coordinate").Coordinate): import("ol").Feature<import("ol/geom/Geometry").default>[];
6409
6572
  /**
6410
6573
  * The layer name of the associated layer
6411
6574
  */
@@ -6441,69 +6604,6 @@ export function validateCircle(circle: import("ol/geom/Circle").default): boolea
6441
6604
 
6442
6605
  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
6606
 
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
6607
  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
6608
 
6509
6609
  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 +6666,12 @@ export function getCartesian3AndWGS84FromCoordinates(coordinates: import("ol/coo
6566
6666
  */
6567
6667
  export function validatePolygon(polygon: import("ol/geom/Polygon").default): boolean;
6568
6668
 
6669
+ export function requestUrl(url: string, init?: RequestInit): Promise<Response>;
6670
+
6671
+ export function requestJson(url: string, init?: RequestInit): Promise<any>;
6672
+
6673
+ export function requestArrayBuffer(url: string, init?: RequestInit): Promise<ArrayBuffer>;
6674
+
6569
6675
  export function getFlatCoordinatesFromSimpleGeometry(geometry: import("ol/geom/SimpleGeometry").default): import("ol/coordinate").Coordinate[];
6570
6676
 
6571
6677
  export function getFlatCoordinatesFromGeometry(geometry: import("ol/geom/Geometry").default, inputCoordinates?: any[]): import("ol/coordinate").Coordinate[];
@@ -6771,6 +6877,20 @@ export function cartesian2DDistance(point0: import("ol/coordinate").Coordinate,
6771
6877
 
6772
6878
  export function cartesian3DDistance(p1: import("ol/coordinate").Coordinate, p2: import("ol/coordinate").Coordinate): number;
6773
6879
 
6880
+ /**
6881
+ * A symbol added to override collections.
6882
+ */
6883
+ export const isOverrideCollection: symbol;
6884
+
6885
+ /**
6886
+ * @param getDynamicContextId - function to get the current dynamic context id
6887
+ * @param [serializeItem] - optional function to serialize an item, defaults to returning item.toJSON or item: i => (i.toJSON || i)
6888
+ * @param [deserializeItem] - optional desirialization function. defaults to returning the passed object: i => i
6889
+ * @param [ctor] - optional constructor to validate deserialized items against. if passed, deserializeItem must be an instance of ctor.
6890
+ * @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.
6891
+ */
6892
+ 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>;
6893
+
6774
6894
  /**
6775
6895
  */
6776
6896
  export interface ProjectionOptions {
@@ -6793,6 +6913,8 @@ export interface ProjectionOptions {
6793
6913
  prefix?: string | undefined;
6794
6914
  }
6795
6915
 
6916
+
6917
+
6796
6918
  /**
6797
6919
  * Set the default projections epsg and proj4. Does not update
6798
6920
  * projection created prior to this functions call.
@@ -6986,7 +7108,7 @@ export function getShapeFromOptions(options: VectorStyleItemImage): import("ol/s
6986
7108
 
6987
7109
  export const shapeCategory: any;
6988
7110
 
6989
- export function getStyleOrDefaultStyle(styleOptions?: Reference | DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem | string, defaultStyle?: VectorStyleItem | DeclarativeStyleItem): StyleItem;
7111
+ export function getStyleOrDefaultStyle(styleOptions?: Reference | DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem | string, defaultStyle?: StyleItem): StyleItem;
6990
7112
 
6991
7113
  export interface FontObject {
6992
7114
  fontStyle: string;
@@ -7467,4 +7589,84 @@ export class ViewPoint extends VcsObject {
7467
7589
  readonly className: string;
7468
7590
  }
7469
7591
 
7592
+ export class VcsApp {
7593
+ readonly id: string;
7594
+ readonly maps: OverrideMapCollection;
7595
+ readonly layers: OverrideLayerCollection;
7596
+ readonly obliqueCollections: OverrideCollection<ObliqueCollection>;
7597
+ readonly viewPoints: OverrideCollection<ViewPoint>;
7598
+ readonly styles: OverrideCollection<StyleItem>;
7599
+ readonly categories: CategoryCollection;
7600
+ readonly destroyed: VcsEvent<void>;
7601
+ readonly contextAdded: any;
7602
+ readonly contextRemoved: any;
7603
+ getContextById(id: string): Context;
7604
+ protected _parseContext(context: Context): Promise<void>;
7605
+ protected _setContextState(context: Context): Promise<void>;
7606
+ addContext(context: Context): Promise<void>;
7607
+ protected _removeContext(contextId: string): Promise<void>;
7608
+ removeContext(contextId: string): Promise<void>;
7609
+ /**
7610
+ * Destroys the app and all its collections, their content and ui managers.
7611
+ */
7612
+ destroy(): void;
7613
+ }
7614
+
7615
+ export function getVcsAppById(id: string): VcsApp;
7616
+
7617
+ export const contextIdSymbol: symbol;
7618
+
7619
+ /**
7620
+ * returns a constructor of a type.
7621
+ */
7622
+ export function getObjectFromOptions(options: any, ...args: any[]): Promise<object | null>;
7623
+
7624
+ export function deserializeMap(vcsApp: VcsApp, mapConfig: VcsMapOptions): Promise<VcsMap | null>;
7625
+
7626
+ export function deserializeViewPoint(viewPointObject: ViewPointOptions): Promise<null | ViewPoint>;
7627
+
7628
+ export function serializeLayer(vcsApp: VcsApp, layer: Layer): Promise<LayerOptions | null>;
7629
+
7630
+ export function getLayerIndex(current: Layer, previous: Layer, currentIndex: number): number | null;
7631
+
7632
+ export function destroyCollection(collection: Collection<any>): void;
7633
+
7634
+
7635
+
7636
+
7637
+ export interface OverrideCollectionInterface<T extends any> {
7638
+ replaced: VcsEvent<T>;
7639
+ shadowMap: Map<string, object[]>;
7640
+ override: (item: T) => T;
7641
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7642
+ removeContext: (contextId: string) => Promise<void>;
7643
+ serializeContext: (contextId: string) => object[];
7644
+ }
7645
+
7646
+ export class OverrideCollection<T extends any> extends Collection<T> implements OverrideCollectionInterface<T> {
7647
+ replaced: VcsEvent<T>;
7648
+ shadowMap: Map<string, object[]>;
7649
+ override: (item: T) => T;
7650
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7651
+ removeContext: (contextId: string) => Promise<void>;
7652
+ serializeContext: (contextId: string) => object[];
7653
+ }
7654
+
7655
+ export class OverrideLayerCollection extends LayerCollection implements OverrideCollectionInterface<Layer> {
7656
+ replaced: VcsEvent<Layer>;
7657
+ shadowMap: Map<string, object[]>;
7658
+ override: (item: Layer) => Layer;
7659
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7660
+ removeContext: (contextId: string) => Promise<void>;
7661
+ serializeContext: (contextId: string) => object[];
7662
+ }
7663
+
7664
+ export class OverrideMapCollection extends MapCollection implements OverrideCollectionInterface<VcsMap> {
7665
+ replaced: VcsEvent<VcsMap>;
7666
+ shadowMap: Map<string, object[]>;
7667
+ override: (item: VcsMap) => VcsMap;
7668
+ parseItems: (items: object[], contextId: string) => Promise<void>;
7669
+ removeContext: (contextId: string) => Promise<void>;
7670
+ serializeContext: (contextId: string) => object[];
7671
+ }
7470
7672
 
package/index.js CHANGED
@@ -6,9 +6,13 @@ 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
- export { styleCollection, obliqueCollectionCollection } from './src/vcs/vcm/globalCollections.js';
15
+ export { styleCollection } from './src/vcs/vcm/globalCollections.js';
12
16
  export { default as AbstractInteraction } from './src/vcs/vcm/interaction/abstractInteraction.js';
13
17
  export { default as CoordinateAtPixel } from './src/vcs/vcm/interaction/coordinateAtPixel.js';
14
18
  export { default as EventHandler } from './src/vcs/vcm/interaction/eventHandler.js';
@@ -98,6 +102,7 @@ export { default as ObliqueImageMeta } from './src/vcs/vcm/oblique/ObliqueImageM
98
102
  export { default as ObliqueProvider } from './src/vcs/vcm/oblique/ObliqueProvider.js';
99
103
  export { default as ObliqueView } from './src/vcs/vcm/oblique/ObliqueView.js';
100
104
  export { ObliqueViewDirection, obliqueViewDirectionNames, getDirectionName } from './src/vcs/vcm/oblique/ObliqueViewDirection.js';
105
+ export { default as DefaultObliqueCollection } from './src/vcs/vcm/oblique/defaultObliqueCollection.js';
101
106
  export { sortRealWordEdgeCoordinates, checkLineIntersection, transformCWIFC, transformToImage, transformFromImage, hasSameOrigin } from './src/vcs/vcm/oblique/helpers.js';
102
107
  export { getVersionFromImageJson, parseImageMeta, parseImageData, parseLegacyImageData } from './src/vcs/vcm/oblique/parseImageJson.js';
103
108
  export { default as ClippingObject } from './src/vcs/vcm/util/clipping/clippingObject.js';
@@ -114,11 +119,12 @@ export { default as TileProviderFeatureProvider } from './src/vcs/vcm/util/featu
114
119
  export { getFormat, default as WMSFeatureProvider } from './src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js';
115
120
  export { validateCircle, default as circleToCesium } from './src/vcs/vcm/util/featureconverter/circleToCesium.js';
116
121
  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';
122
+ export { default as Extent3D } from './src/vcs/vcm/util/featureconverter/extent3D.js';
118
123
  export { getMaterialAppearance, createClassificationPrimitive, createPrimitive, createOutlinePrimitive, createLinePrimitive, getMinHeightOrGroundLevel, getStoreyHeights, validateStoreys, getHeightAboveGround, getHeightInfo, getStoreyOptions, addPrimitivesToContext } from './src/vcs/vcm/util/featureconverter/featureconverterHelper.js';
119
124
  export { validateLineString, default as lineStringToCesium } from './src/vcs/vcm/util/featureconverter/lineStringToCesium.js';
120
125
  export { getBillboardOptions, getLabelOptions, getModelOptions, validatePoint, getCartesian3AndWGS84FromCoordinates, default as pointToCesium } from './src/vcs/vcm/util/featureconverter/pointToCesium.js';
121
126
  export { validatePolygon, default as polygonToCesium } from './src/vcs/vcm/util/featureconverter/polygonToCesium.js';
127
+ export { requestUrl, requestJson, requestArrayBuffer } from './src/vcs/vcm/util/fetch.js';
122
128
  export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, circleFromCenterRadius, convertGeometryToPolygon, enforceEndingVertex, removeEndingVertex, removeEndingVertexFromGeometry, enforceRightHand } from './src/vcs/vcm/util/geometryHelpers.js';
123
129
  export { default as IndexedCollection } from './src/vcs/vcm/util/indexedCollection.js';
124
130
  export { isMobile } from './src/vcs/vcm/util/isMobile.js';
@@ -126,6 +132,7 @@ export { default as LayerCollection } from './src/vcs/vcm/util/layerCollection.j
126
132
  export { getLocaleChangedEvent, detectBrowserLocale, getCurrentLocale, setCurrentLocale } from './src/vcs/vcm/util/locale.js';
127
133
  export { default as MapCollection } from './src/vcs/vcm/util/mapCollection.js';
128
134
  export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance } from './src/vcs/vcm/util/math.js';
135
+ export { isOverrideCollection, default as makeOverrideCollection } from './src/vcs/vcm/util/overrideCollection.js';
129
136
  export { wgs84ToMercatorTransformer, mercatorToWgs84Transformer, setDefaultProjectionOptions, getDefaultProjection, wgs84Projection, mercatorProjection, default as Projection } from './src/vcs/vcm/util/projection.js';
130
137
  export { default as SplitScreen } from './src/vcs/vcm/util/splitScreen.js';
131
138
  export { defaultDeclarativeStyle, default as DeclarativeStyleItem } from './src/vcs/vcm/util/style/declarativeStyleItem.js';
@@ -137,3 +144,5 @@ export { olcsGeometryType, vectorStyleSymbol, defaultVectorStyle, fromCesiumColo
137
144
  export { embedIconsInStyle, default as writeStyle } from './src/vcs/vcm/util/style/writeStyle.js';
138
145
  export { isSameOrigin } from './src/vcs/vcm/util/urlHelpers.js';
139
146
  export { propertyEqualsEpsilon, angleEqualsEpsilon, coordinateEqualsEpsilon, default as ViewPoint } from './src/vcs/vcm/util/viewpoint.js';
147
+ export { getVcsAppById, default as VcsApp } from './src/vcs/vcm/vcsApp.js';
148
+ 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.7",
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",
@@ -36,7 +36,6 @@
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-commonjs": "^18.0.0",
38
38
  "@rollup/plugin-node-resolve": "^11.2.1",
39
- "@vcmap/cesium": "^1.87.3",
40
39
  "@vcsuite/eslint-config": "^2.0.3",
41
40
  "@vcsuite/tsd-jsdoc": "^1.0.2",
42
41
  "@web/dev-server": "^0.1.11",
@@ -51,25 +50,20 @@
51
50
  "jsdom-global": "^3.0.2",
52
51
  "mocha": "^9.1.3",
53
52
  "mocha-junit-reporter": "^2.0.2",
54
- "ol": "^6.9.0",
53
+ "nock": "^13.2.4",
54
+ "node-fetch": "^3.2.0",
55
55
  "sinon": "^9.2.4",
56
56
  "sinon-chai": "^3.6.0",
57
- "typescript": "^4.4.4"
57
+ "typescript": "^4.6.2"
58
58
  },
59
59
  "peerDependencies": {
60
- "@vcmap/cesium": "~1.87.2",
61
- "ol": "^6.5.0"
60
+ "@vcmap/cesium": "~1.87.3",
61
+ "ol": "~6.13.0"
62
62
  },
63
63
  "eslintConfig": {
64
64
  "extends": [
65
65
  "@vcsuite/eslint-config/vue"
66
- ],
67
- "rules": {
68
- "import/extensions": [
69
- "error",
70
- "always"
71
- ]
72
- }
66
+ ]
73
67
  },
74
68
  "eslintIgnore": [
75
69
  "node_modules",
@@ -82,9 +76,8 @@
82
76
  "@vcsuite/check": "^1.0.3",
83
77
  "@vcsuite/logger": "^1.0.1",
84
78
  "@vcsuite/parsers": "^1.0.1",
85
- "axios": "^0.21.4",
86
79
  "fast-deep-equal": "^3.1.3",
87
- "proj4": "^2.7.2",
80
+ "proj4": "^2.7.5",
88
81
  "rbush": ">=3.0.1",
89
82
  "rbush-knn": "^3.0.1",
90
83
  "underscore.template": "^0.1.7",
@@ -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);