@vcmap/core 5.0.0-rc.8 → 5.0.0-rc.9
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.
- package/index.d.ts +110 -102
- package/index.js +4 -5
- package/package.json +2 -2
- package/src/category/appBackedCategory.js +38 -3
- package/src/category/category.js +37 -10
- package/src/category/categoryCollection.js +3 -3
- package/src/classRegistry.js +107 -28
- package/src/featureProvider/abstractFeatureProvider.js +1 -1
- package/src/featureProvider/tileProviderFeatureProvider.js +2 -0
- package/src/featureProvider/wmsFeatureProvider.js +2 -0
- package/src/layer/cesiumTilesetLayer.js +3 -6
- package/src/layer/czmlLayer.js +2 -2
- package/src/layer/dataSourceLayer.js +2 -2
- package/src/layer/featureLayer.js +10 -23
- package/src/layer/featureStoreLayer.js +3 -3
- package/src/layer/geojsonHelpers.js +1 -18
- package/src/layer/geojsonLayer.js +2 -2
- package/src/layer/layer.js +3 -3
- package/src/layer/openStreetMapLayer.js +2 -2
- package/src/layer/pointCloudLayer.js +4 -4
- package/src/layer/rasterLayer.js +2 -2
- package/src/layer/singleImageLayer.js +2 -2
- package/src/layer/terrainLayer.js +2 -2
- package/src/layer/tileProvider/mvtTileProvider.js +18 -0
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +19 -4
- package/src/layer/tileProvider/tileProvider.js +10 -1
- package/src/layer/tileProvider/urlTemplateTileProvider.js +15 -0
- package/src/layer/tmsLayer.js +2 -2
- package/src/layer/vectorLayer.js +9 -18
- package/src/layer/vectorTileLayer.js +12 -21
- package/src/layer/wfsLayer.js +2 -2
- package/src/layer/wmsLayer.js +2 -2
- package/src/layer/wmtsLayer.js +2 -2
- package/src/map/baseOLMap.js +2 -2
- package/src/map/cesiumMap.js +2 -2
- package/src/map/obliqueMap.js +2 -2
- package/src/map/openlayersMap.js +2 -2
- package/src/map/vcsMap.js +2 -2
- package/src/overrideClassRegistry.js +204 -0
- package/src/style/declarativeStyleItem.js +17 -18
- package/src/style/styleFactory.js +14 -33
- package/src/style/styleItem.js +15 -96
- package/src/style/vectorStyleItem.js +68 -78
- package/src/style/writeStyle.js +4 -7
- package/src/util/projection.js +0 -3
- package/src/util/viewpoint.js +0 -3
- package/src/vcsApp.js +103 -5
- package/src/vcsAppContextHelpers.js +51 -38
- package/src/globalCollections.js +0 -7
- package/src/layer/tileProvider/tileProviderFactory.js +0 -28
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface AppBackedCategoryOptions extends CategoryOptions {
|
|
|
7
7
|
|
|
8
8
|
export class AppBackedCategory extends Category<VcsObject> {
|
|
9
9
|
constructor(options: AppBackedCategoryOptions);
|
|
10
|
+
protected _deserializeItem(config: VcsObjectOptions): Promise<VcsObject>;
|
|
10
11
|
serializeForContext(contextId: string): null;
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -16,7 +17,10 @@ export interface CategoryOptions extends VcsObjectOptions {
|
|
|
16
17
|
title?: string | {
|
|
17
18
|
[key: string]: string;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* the class registry name on the current app to provide classes for this category. if provided, parseItems will deserialize using this class registry. See: {@link getObjectFromClassRegistry}.
|
|
22
|
+
*/
|
|
23
|
+
classRegistryName?: string;
|
|
20
24
|
featureProperty?: string | undefined;
|
|
21
25
|
layerOptions?: VectorOptions;
|
|
22
26
|
/**
|
|
@@ -40,6 +44,7 @@ export class Category<T extends Object|VcsObject> extends VcsObject {
|
|
|
40
44
|
};
|
|
41
45
|
protected _app: VcsApp;
|
|
42
46
|
protected _layer: VectorLayer;
|
|
47
|
+
readonly classRegistryName: string;
|
|
43
48
|
/**
|
|
44
49
|
* The collection of this category.
|
|
45
50
|
*/
|
|
@@ -67,6 +72,10 @@ export class Category<T extends Object|VcsObject> extends VcsObject {
|
|
|
67
72
|
*/
|
|
68
73
|
setCollection(collection: Collection<T>): void;
|
|
69
74
|
setApp(app: VcsApp): void;
|
|
75
|
+
/**
|
|
76
|
+
* @returns // XXX should this still be async?
|
|
77
|
+
*/
|
|
78
|
+
protected _deserializeItem(config: any): Promise<T>;
|
|
70
79
|
protected _serializeItem(item: T): object[];
|
|
71
80
|
serializeForContext(contextId: string): CategoryOptions | null;
|
|
72
81
|
/**
|
|
@@ -111,26 +120,37 @@ export class VcsCameraPrimitive {
|
|
|
111
120
|
show: boolean;
|
|
112
121
|
}
|
|
113
122
|
|
|
114
|
-
export class ClassRegistry {
|
|
115
|
-
|
|
123
|
+
export class ClassRegistry<T extends Object|VcsObject> {
|
|
124
|
+
getClassNames(): string[];
|
|
116
125
|
/**
|
|
117
126
|
* Register a class by its class name.
|
|
118
127
|
*/
|
|
119
128
|
registerClass(className: string, ctor: (...params: any[]) => any): void;
|
|
120
|
-
/**
|
|
121
|
-
* @param cb - a callback providing a promise which returns the constructor on resolve.
|
|
122
|
-
* used for lazy loading modules, e.g
|
|
123
|
-
* <code>ClassRegistry.registerDeferredClass(() => import('my-module').then(({ default: MyCtor }) => MyCtor));</code>
|
|
124
|
-
*/
|
|
125
|
-
registerDeferredClass(className: string, cb: (...params: any[]) => any): void;
|
|
126
129
|
/**
|
|
127
130
|
* Gets the constructor for a registered class or undefined, if no such class was registerd
|
|
128
131
|
*/
|
|
129
|
-
getClass(className: string): ((...params: any[]) => any) |
|
|
130
|
-
|
|
132
|
+
getClass(className: string): ((...params: any[]) => any) | undefined;
|
|
133
|
+
hasClass(className: string): boolean;
|
|
134
|
+
create(className: string, ...args: any[]): T;
|
|
135
|
+
createFromTypeOptions(options: any, ...args: any[]): T;
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
export const
|
|
138
|
+
export const layerClassRegistry: ClassRegistry<Layer>;
|
|
139
|
+
|
|
140
|
+
export const tileProviderClassRegistry: ClassRegistry<TileProvider>;
|
|
141
|
+
|
|
142
|
+
export const featureProviderClassRegistry: ClassRegistry<AbstractFeatureProvider>;
|
|
143
|
+
|
|
144
|
+
export const mapClassRegistry: ClassRegistry<VcsMap>;
|
|
145
|
+
|
|
146
|
+
export const styleClassRegistry: ClassRegistry<StyleItem>;
|
|
147
|
+
|
|
148
|
+
export const categoryClassRegistry: ClassRegistry<Category<any>>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Returns an object based on a class registry or override class registry and a typed options object. as opposed to ClassRegistry.createFromTypedOptions, this function never throws.
|
|
152
|
+
*/
|
|
153
|
+
export function getObjectFromClassRegistry<T extends Object|VcsObject>(classRegistry: OverrideClassRegistry<T> | ClassRegistry<T>, options: any, ...args: any[]): T | null;
|
|
134
154
|
|
|
135
155
|
export interface VcsAppConfig {
|
|
136
156
|
id?: string | undefined;
|
|
@@ -369,8 +389,6 @@ export class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
369
389
|
mapTypes: string[];
|
|
370
390
|
}
|
|
371
391
|
|
|
372
|
-
export const styleCollection: Collection<StyleItem>;
|
|
373
|
-
|
|
374
392
|
/**
|
|
375
393
|
*/
|
|
376
394
|
export interface ObliqueParameters {
|
|
@@ -1412,11 +1430,7 @@ export class DataSourceLayer extends Layer {
|
|
|
1412
1430
|
/**
|
|
1413
1431
|
*/
|
|
1414
1432
|
export interface FeatureLayerOptions extends LayerOptions {
|
|
1415
|
-
style?: DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem |
|
|
1416
|
-
/**
|
|
1417
|
-
* vcs:undocumented
|
|
1418
|
-
*/
|
|
1419
|
-
activeStyleName?: string | undefined;
|
|
1433
|
+
style?: DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem | undefined;
|
|
1420
1434
|
/**
|
|
1421
1435
|
* properties to add to generic features, eg for display in the balloon
|
|
1422
1436
|
*/
|
|
@@ -1478,11 +1492,11 @@ export class FeatureLayer extends Layer {
|
|
|
1478
1492
|
* Set properties, which are always added to the generic object, eg. for use in balloons
|
|
1479
1493
|
*/
|
|
1480
1494
|
assignGenericFeatureProperties(properties: any): void;
|
|
1481
|
-
getStyleOrDefaultStyle(styleOptions?:
|
|
1495
|
+
getStyleOrDefaultStyle(styleOptions?: DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem, defaultStyle?: VectorStyleItem | DeclarativeStyleItem): StyleItem;
|
|
1482
1496
|
/**
|
|
1483
1497
|
* Sets the style based on a styleName on a layer
|
|
1484
1498
|
*/
|
|
1485
|
-
setStyle(style:
|
|
1499
|
+
setStyle(style: import("ol/style/Style").default | import("ol/style/Style").StyleFunction | StyleItem, silent?: boolean): void;
|
|
1486
1500
|
/**
|
|
1487
1501
|
* Clears the style of this layer
|
|
1488
1502
|
*/
|
|
@@ -2227,7 +2241,7 @@ export interface VcsMeta extends VectorPropertiesOptions {
|
|
|
2227
2241
|
* the version of the vcsMeta schema
|
|
2228
2242
|
*/
|
|
2229
2243
|
version?: string | undefined;
|
|
2230
|
-
style?: VectorStyleItemOptions | DeclarativeStyleItemOptions |
|
|
2244
|
+
style?: VectorStyleItemOptions | DeclarativeStyleItemOptions | undefined;
|
|
2231
2245
|
embeddedIcons?: string[] | undefined;
|
|
2232
2246
|
screenSpaceError?: number | undefined;
|
|
2233
2247
|
flightOptions?: any | undefined;
|
|
@@ -3422,9 +3436,9 @@ export class MVTTileProvider extends TileProvider {
|
|
|
3422
3436
|
|
|
3423
3437
|
/**
|
|
3424
3438
|
*/
|
|
3425
|
-
export interface
|
|
3439
|
+
export interface StaticGeoJSONTileProviderOptions extends TileProviderOptions {
|
|
3426
3440
|
/**
|
|
3427
|
-
* geojson
|
|
3441
|
+
* url to the geojson
|
|
3428
3442
|
*/
|
|
3429
3443
|
url: string;
|
|
3430
3444
|
}
|
|
@@ -3433,9 +3447,9 @@ export interface StaticGeojsonTileProviderOptions extends TileProviderOptions {
|
|
|
3433
3447
|
* Loads the provided geojson url and tiles the content in memory, data is only requested once
|
|
3434
3448
|
*/
|
|
3435
3449
|
export class StaticGeoJSONTileProvider extends TileProvider {
|
|
3436
|
-
constructor(options:
|
|
3450
|
+
constructor(options: StaticGeoJSONTileProviderOptions);
|
|
3437
3451
|
static readonly className: any;
|
|
3438
|
-
static getDefaultOptions():
|
|
3452
|
+
static getDefaultOptions(): StaticGeoJSONTileProviderOptions;
|
|
3439
3453
|
url: string;
|
|
3440
3454
|
/**
|
|
3441
3455
|
* Cesium Webmercator TilingScheme
|
|
@@ -3634,8 +3648,6 @@ export class TileProvider extends VcsObject {
|
|
|
3634
3648
|
readonly className: string;
|
|
3635
3649
|
}
|
|
3636
3650
|
|
|
3637
|
-
export function factory(options: any): Promise<TileProvider>;
|
|
3638
|
-
|
|
3639
3651
|
/**
|
|
3640
3652
|
*/
|
|
3641
3653
|
export interface URLTemplateTileProviderOptions extends TileProviderOptions {
|
|
@@ -4294,7 +4306,7 @@ export function synchronizeFeatureVisibility(source: FeatureVisibility, destinat
|
|
|
4294
4306
|
/**
|
|
4295
4307
|
*/
|
|
4296
4308
|
export interface VectorTileOptions extends FeatureLayerOptions {
|
|
4297
|
-
tileProvider: TileProviderOptions;
|
|
4309
|
+
tileProvider: TileProviderOptions | TileProvider;
|
|
4298
4310
|
highlightStyle?: VectorStyleItemOptions | VectorStyleItem | undefined;
|
|
4299
4311
|
vectorProperties?: VectorPropertiesOptions | undefined;
|
|
4300
4312
|
/**
|
|
@@ -6118,6 +6130,53 @@ export function parseImageData(json: ObliqueImageJson, imageMetas: ObliqueImageM
|
|
|
6118
6130
|
|
|
6119
6131
|
export function parseLegacyImageData(json: ObliqueImageJson, imageMetas: ObliqueImageMeta[]): ObliqueImage[];
|
|
6120
6132
|
|
|
6133
|
+
export class OverrideClassRegistry<T extends Object|VcsObject> {
|
|
6134
|
+
constructor(coreClassRegistry: ClassRegistry<T>);
|
|
6135
|
+
/**
|
|
6136
|
+
* Called if a class was replaced. Is passed the className
|
|
6137
|
+
*/
|
|
6138
|
+
replaced: VcsEvent<string>;
|
|
6139
|
+
/**
|
|
6140
|
+
* Called if a class was removed. Is passed the className
|
|
6141
|
+
*/
|
|
6142
|
+
removed: VcsEvent<string>;
|
|
6143
|
+
getClassNames(): string[];
|
|
6144
|
+
/**
|
|
6145
|
+
* Register a class for a given context by name. If the class already exists, it will be replaced and replaced called with the classeName.
|
|
6146
|
+
*/
|
|
6147
|
+
registerClass(contextId: string, className: string, ctor: (...params: any[]) => any): void;
|
|
6148
|
+
/**
|
|
6149
|
+
* Unregister a previously registered class. You can only unregister classes added to this registry, not the underlying core registry.
|
|
6150
|
+
* If when registering this class you have replaced class, it will be re-instated and replaced called.
|
|
6151
|
+
* If there is no previously registered class, it will be removed and removed will be called.
|
|
6152
|
+
*/
|
|
6153
|
+
unregisterClass(contextId: string, className: string): void;
|
|
6154
|
+
/**
|
|
6155
|
+
* Gets the constructor for a registered class or undefined, if no such class was registerd
|
|
6156
|
+
*/
|
|
6157
|
+
getClass(className: string): ((...params: any[]) => any) | undefined;
|
|
6158
|
+
hasClass(className: string): boolean;
|
|
6159
|
+
/**
|
|
6160
|
+
* Create an object of the given className. The constructor is passed args.
|
|
6161
|
+
*/
|
|
6162
|
+
create(className: string, ...args: any[]): T;
|
|
6163
|
+
/**
|
|
6164
|
+
* A convenience API to pass in a serialized VcsObject directly. It calls create using options.type as the className.
|
|
6165
|
+
* Will throw an error if options.type is not a string or options is not an Object.
|
|
6166
|
+
* Passes options and args to the constructor in that order.
|
|
6167
|
+
*/
|
|
6168
|
+
createFromTypeOptions(options: any, ...args: any[]): T;
|
|
6169
|
+
/**
|
|
6170
|
+
* Removes all classes registered from within a certain context. Will re-instate classes overwritten by the context
|
|
6171
|
+
* and call the appropriate events, outlined in unregisterClass.
|
|
6172
|
+
*/
|
|
6173
|
+
removeContext(contextId: string): void;
|
|
6174
|
+
/**
|
|
6175
|
+
* Destroys the override class registry
|
|
6176
|
+
*/
|
|
6177
|
+
destroy(): void;
|
|
6178
|
+
}
|
|
6179
|
+
|
|
6121
6180
|
export interface DeclarativeStyleItemConditions {
|
|
6122
6181
|
conditions: (string[] | string)[];
|
|
6123
6182
|
}
|
|
@@ -6188,13 +6247,6 @@ export class DeclarativeStyleItem extends StyleItem {
|
|
|
6188
6247
|
labelColor: any;
|
|
6189
6248
|
font: any;
|
|
6190
6249
|
pointSize: any;
|
|
6191
|
-
title: string | {
|
|
6192
|
-
[key: string]: string;
|
|
6193
|
-
};
|
|
6194
|
-
/**
|
|
6195
|
-
* Legend entries
|
|
6196
|
-
*/
|
|
6197
|
-
legend: StyleItemLegendEntry[];
|
|
6198
6250
|
supportedLayers: string[];
|
|
6199
6251
|
/**
|
|
6200
6252
|
* Fired on style updates
|
|
@@ -6220,7 +6272,7 @@ export function getShapeFromOptions(options: VectorStyleItemImage): import("ol/s
|
|
|
6220
6272
|
|
|
6221
6273
|
export const shapeCategory: any;
|
|
6222
6274
|
|
|
6223
|
-
export function getStyleOrDefaultStyle(styleOptions?:
|
|
6275
|
+
export function getStyleOrDefaultStyle(styleOptions?: DeclarativeStyleItemOptions | VectorStyleItemOptions | StyleItem, defaultStyle?: StyleItem): StyleItem;
|
|
6224
6276
|
|
|
6225
6277
|
export interface FontObject {
|
|
6226
6278
|
fontStyle: string;
|
|
@@ -6325,64 +6377,21 @@ export interface StyleItemLegendEntry {
|
|
|
6325
6377
|
/**
|
|
6326
6378
|
*/
|
|
6327
6379
|
export interface StyleItemOptions extends VcsObjectOptions {
|
|
6328
|
-
/**
|
|
6329
|
-
* used in configuration to differentiate vector from declarative styles
|
|
6330
|
-
*/
|
|
6331
|
-
type?: string | undefined;
|
|
6332
|
-
/**
|
|
6333
|
-
* name is used when none is specifies
|
|
6334
|
-
*/
|
|
6335
|
-
title?: string | {
|
|
6336
|
-
[key: string]: string;
|
|
6337
|
-
} | undefined;
|
|
6338
|
-
legend?: StyleItemLegendEntry[] | undefined;
|
|
6339
6380
|
/**
|
|
6340
6381
|
* colorBlendMode for 3D Tiledataset @see https://cesiumjs.org/import("@vcmap/cesium").Build/Documentation/Cesium3DTileColorBlendMode.html
|
|
6341
6382
|
*/
|
|
6342
6383
|
colorBlendMode?: number;
|
|
6343
6384
|
}
|
|
6344
6385
|
|
|
6345
|
-
/**
|
|
6346
|
-
*/
|
|
6347
|
-
export interface Reference {
|
|
6348
|
-
type?: string;
|
|
6349
|
-
name: string;
|
|
6350
|
-
/**
|
|
6351
|
-
* vcs:undocumented this is not yet implemented
|
|
6352
|
-
*/
|
|
6353
|
-
url?: string | undefined;
|
|
6354
|
-
}
|
|
6355
|
-
|
|
6356
6386
|
export interface StyleItemSections {
|
|
6357
6387
|
meta?: boolean | undefined;
|
|
6358
6388
|
}
|
|
6359
6389
|
|
|
6360
|
-
/**
|
|
6361
|
-
* Enumeration of possible style types.
|
|
6362
|
-
*/
|
|
6363
|
-
export const enum StyleType {
|
|
6364
|
-
VECTOR,
|
|
6365
|
-
DECLARATIVE,
|
|
6366
|
-
REFERENCE
|
|
6367
|
-
}
|
|
6368
|
-
|
|
6369
|
-
/**
|
|
6370
|
-
* indicates, that this style is part of the config and can be referenced by name
|
|
6371
|
-
*/
|
|
6372
|
-
export const referenceableStyleSymbol: symbol;
|
|
6373
|
-
|
|
6374
6390
|
/**
|
|
6375
6391
|
* An abstract style definition which can be applied to a layer
|
|
6376
6392
|
*/
|
|
6377
6393
|
export class StyleItem extends VcsObject {
|
|
6378
6394
|
constructor(options: StyleItemOptions);
|
|
6379
|
-
title: string | {
|
|
6380
|
-
[key: string]: string;
|
|
6381
|
-
};
|
|
6382
|
-
/**
|
|
6383
|
-
* Legend entries
|
|
6384
|
-
*/
|
|
6385
|
-
legend: StyleItemLegendEntry[];
|
|
6386
6395
|
supportedLayers: string[];
|
|
6387
6396
|
/**
|
|
6388
6397
|
* The 3D representation of this style
|
|
@@ -6397,19 +6406,14 @@ export class StyleItem extends VcsObject {
|
|
|
6397
6406
|
style: any;
|
|
6398
6407
|
isSupported(className: string): boolean;
|
|
6399
6408
|
/**
|
|
6400
|
-
*
|
|
6401
|
-
*/
|
|
6402
|
-
getOptions(sections?: VectorStyleItemSections | DeclarativeStyleItemSections): VectorStyleItemOptions | DeclarativeStyleItemOptions;
|
|
6403
|
-
/**
|
|
6404
|
-
* Clones this style
|
|
6409
|
+
* Clones this style. Does not pass the name property.
|
|
6405
6410
|
*/
|
|
6406
6411
|
clone(result?: StyleItem): StyleItem;
|
|
6407
6412
|
assign(styleItem: StyleItem): StyleItem;
|
|
6408
|
-
equals(styleItem: StyleItem): boolean;
|
|
6409
6413
|
/**
|
|
6410
|
-
*
|
|
6414
|
+
* Tests if two styleItems are equivalent. Does not match the name property (e.g. identifier)
|
|
6411
6415
|
*/
|
|
6412
|
-
|
|
6416
|
+
equals(styleItem: StyleItem): boolean;
|
|
6413
6417
|
protected _styleChanged(): void;
|
|
6414
6418
|
/**
|
|
6415
6419
|
* unique Name
|
|
@@ -6528,13 +6532,6 @@ export class VectorStyleItem extends StyleItem {
|
|
|
6528
6532
|
* @param section - one of fill, stroke, image
|
|
6529
6533
|
*/
|
|
6530
6534
|
unset(section: string): void;
|
|
6531
|
-
title: string | {
|
|
6532
|
-
[key: string]: string;
|
|
6533
|
-
};
|
|
6534
|
-
/**
|
|
6535
|
-
* Legend entries
|
|
6536
|
-
*/
|
|
6537
|
-
legend: StyleItemLegendEntry[];
|
|
6538
6535
|
supportedLayers: string[];
|
|
6539
6536
|
/**
|
|
6540
6537
|
* The 3D representation of this style
|
|
@@ -7459,6 +7456,14 @@ export class VcsApp {
|
|
|
7459
7456
|
readonly destroyed: VcsEvent<void>;
|
|
7460
7457
|
readonly contextAdded: any;
|
|
7461
7458
|
readonly contextRemoved: any;
|
|
7459
|
+
readonly dynamicContextId: string;
|
|
7460
|
+
readonly mapClassRegistry: OverrideClassRegistry<VcsMap>;
|
|
7461
|
+
readonly layerClassRegistry: OverrideClassRegistry<Layer>;
|
|
7462
|
+
readonly styleClassRegistry: OverrideClassRegistry<StyleItem>;
|
|
7463
|
+
readonly categoryClassRegistry: OverrideClassRegistry<Category<object | VcsObject>>;
|
|
7464
|
+
readonly categoryItemClassRegistry: OverrideClassRegistry<any>;
|
|
7465
|
+
readonly tileProviderClassRegistry: OverrideClassRegistry<TileProvider>;
|
|
7466
|
+
readonly featureProviderClassRegistry: OverrideClassRegistry<AbstractFeatureProvider>;
|
|
7462
7467
|
getContextById(id: string): Context;
|
|
7463
7468
|
protected _parseContext(context: Context): Promise<void>;
|
|
7464
7469
|
protected _setContextState(context: Context): Promise<void>;
|
|
@@ -7475,16 +7480,19 @@ export function getVcsAppById(id: string): VcsApp;
|
|
|
7475
7480
|
|
|
7476
7481
|
export const contextIdSymbol: symbol;
|
|
7477
7482
|
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7483
|
+
export interface ContextLayerOptions extends LayerOptions {
|
|
7484
|
+
style?: string | StyleItemOptions;
|
|
7485
|
+
tileProvider?: TileProviderOptions;
|
|
7486
|
+
featureProvider?: AbstractFeatureProviderOptions;
|
|
7487
|
+
}
|
|
7488
|
+
|
|
7489
|
+
export function deserializeMap(vcsApp: VcsApp, mapConfig: VcsMapOptions): VcsMap | null;
|
|
7482
7490
|
|
|
7483
|
-
export function
|
|
7491
|
+
export function deserializeViewPoint(viewPointObject: ViewPointOptions): null | ViewPoint;
|
|
7484
7492
|
|
|
7485
|
-
export function
|
|
7493
|
+
export function deserializeLayer(vcsApp: VcsApp, layerConfig: ContextLayerOptions): Layer | null;
|
|
7486
7494
|
|
|
7487
|
-
export function serializeLayer(vcsApp: VcsApp, layer: Layer):
|
|
7495
|
+
export function serializeLayer(vcsApp: VcsApp, layer: Layer): ContextLayerOptions;
|
|
7488
7496
|
|
|
7489
7497
|
export function getLayerIndex(current: Layer, previous: Layer, currentIndex: number): number | null;
|
|
7490
7498
|
|
package/index.js
CHANGED
|
@@ -9,14 +9,13 @@ import './src/cesium/cesiumVcsCameraPrimitive.js';
|
|
|
9
9
|
export { default as AppBackedCategory } from './src/category/appBackedCategory.js';
|
|
10
10
|
export { default as Category } from './src/category/category.js';
|
|
11
11
|
export { default as CategoryCollection } from './src/category/categoryCollection.js';
|
|
12
|
-
export {
|
|
12
|
+
export { layerClassRegistry, tileProviderClassRegistry, featureProviderClassRegistry, mapClassRegistry, styleClassRegistry, categoryClassRegistry, getObjectFromClassRegistry, default as ClassRegistry } from './src/classRegistry.js';
|
|
13
13
|
export { default as Context } from './src/context.js';
|
|
14
14
|
export { default as AbstractFeatureProvider } from './src/featureProvider/abstractFeatureProvider.js';
|
|
15
15
|
export { getGenericFeatureFromProvidedFeature } from './src/featureProvider/featureProviderHelpers.js';
|
|
16
16
|
export { isProvidedFeature, showProvidedFeature } from './src/featureProvider/featureProviderSymbols.js';
|
|
17
17
|
export { default as TileProviderFeatureProvider } from './src/featureProvider/tileProviderFeatureProvider.js';
|
|
18
18
|
export { getFormat, default as WMSFeatureProvider } from './src/featureProvider/wmsFeatureProvider.js';
|
|
19
|
-
export { styleCollection } from './src/globalCollections.js';
|
|
20
19
|
export { default as AbstractInteraction } from './src/interaction/abstractInteraction.js';
|
|
21
20
|
export { default as CoordinateAtPixel } from './src/interaction/coordinateAtPixel.js';
|
|
22
21
|
export { default as EventHandler } from './src/interaction/eventHandler.js';
|
|
@@ -78,7 +77,6 @@ export { tiledLayerLoaded, globeLoaded } from './src/layer/tileLoadedHelper.js';
|
|
|
78
77
|
export { default as MVTTileProvider } from './src/layer/tileProvider/mvtTileProvider.js';
|
|
79
78
|
export { default as StaticGeoJSONTileProvider } from './src/layer/tileProvider/staticGeojsonTileProvider.js';
|
|
80
79
|
export { mercatorResolutionsToLevel, rectangleToExtent, default as TileProvider } from './src/layer/tileProvider/tileProvider.js';
|
|
81
|
-
export { default as factory } from './src/layer/tileProvider/tileProviderFactory.js';
|
|
82
80
|
export { getURL, default as URLTemplateTileProvider } from './src/layer/tileProvider/urlTemplateTileProvider.js';
|
|
83
81
|
export { default as TMSLayer } from './src/layer/tmsLayer.js';
|
|
84
82
|
export { fvLastUpdated, globalHiderLastUpdated, updateFeatureVisibility, updateGlobalHider, synchronizeFeatureVisibilityWithSource, getGenericFeatureFromClickedObject } from './src/layer/vectorHelpers.js';
|
|
@@ -107,11 +105,12 @@ export { default as ObliqueProvider } from './src/oblique/obliqueProvider.js';
|
|
|
107
105
|
export { default as ObliqueView } from './src/oblique/obliqueView.js';
|
|
108
106
|
export { ObliqueViewDirection, obliqueViewDirectionNames, getDirectionName } from './src/oblique/obliqueViewDirection.js';
|
|
109
107
|
export { getVersionFromImageJson, parseImageMeta, parseImageData, parseLegacyImageData } from './src/oblique/parseImageJson.js';
|
|
108
|
+
export { default as OverrideClassRegistry } from './src/overrideClassRegistry.js';
|
|
110
109
|
export { defaultDeclarativeStyle, default as DeclarativeStyleItem } from './src/style/declarativeStyleItem.js';
|
|
111
110
|
export { getShapeFromOptions, shapeCategory } from './src/style/shapesCategory.js';
|
|
112
111
|
export { getStyleOrDefaultStyle } from './src/style/styleFactory.js';
|
|
113
112
|
export { PatternType, hexToOlColor, cesiumColorToColor, olColorToCesiumColor, parseColor, getCesiumColor, getStringColor, createPattern, olColorToHex, validateHexColor, parseFont, combineFont, colorInCanvas, getFillOptions, getStrokeOptions, getTextOptions, getTextFromOptions, getCssStyleFromTextStyle, emptyStyle, emptyColor, whiteColor, blackColor, getDefaultVectorStyleItemOptions, getDefaultCondition, defaultExtrudedHeightCondition } from './src/style/styleHelpers.js';
|
|
114
|
-
export {
|
|
113
|
+
export { default as StyleItem } from './src/style/styleItem.js';
|
|
115
114
|
export { OlcsGeometryType, vectorStyleSymbol, defaultVectorStyle, fromCesiumColor, default as VectorStyleItem } from './src/style/vectorStyleItem.js';
|
|
116
115
|
export { embedIconsInStyle, default as writeStyle } from './src/style/writeStyle.js';
|
|
117
116
|
export { default as ClippingObject } from './src/util/clipping/clippingObject.js';
|
|
@@ -142,6 +141,6 @@ export { default as SplitScreen } from './src/util/splitScreen.js';
|
|
|
142
141
|
export { isSameOrigin } from './src/util/urlHelpers.js';
|
|
143
142
|
export { propertyEqualsEpsilon, angleEqualsEpsilon, coordinateEqualsEpsilon, default as ViewPoint } from './src/util/viewpoint.js';
|
|
144
143
|
export { getVcsAppById, default as VcsApp } from './src/vcsApp.js';
|
|
145
|
-
export { contextIdSymbol,
|
|
144
|
+
export { contextIdSymbol, deserializeMap, deserializeViewPoint, deserializeLayer, serializeLayer, getLayerIndex, destroyCollection } from './src/vcsAppContextHelpers.js';
|
|
146
145
|
export { default as VcsEvent } from './src/vcsEvent.js';
|
|
147
146
|
export { default as VcsObject } from './src/vcsObject.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@types/rbush": "^3.0.0",
|
|
76
|
-
"@vcsuite/check": "^1.
|
|
76
|
+
"@vcsuite/check": "^1.1.2",
|
|
77
77
|
"@vcsuite/logger": "^1.0.1",
|
|
78
78
|
"@vcsuite/parsers": "^1.0.1",
|
|
79
79
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import Category from './category.js';
|
|
2
|
-
import {
|
|
2
|
+
import { categoryClassRegistry } from '../classRegistry.js';
|
|
3
|
+
import ViewPoint from '../util/viewpoint.js';
|
|
4
|
+
import ObliqueCollection from '../oblique/obliqueCollection.js';
|
|
5
|
+
import { deserializeLayer, deserializeMap } from '../vcsAppContextHelpers.js';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* @typedef {CategoryOptions} AppBackedCategoryOptions
|
|
6
9
|
* @property {string} collectionName
|
|
7
10
|
*/
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @type {Object<string, string>}
|
|
14
|
+
*/
|
|
15
|
+
const collectionNameMap = {
|
|
16
|
+
layers: 'layerClassRegistry',
|
|
17
|
+
styles: 'styleClassRegistry',
|
|
18
|
+
maps: 'mapClassRegistry',
|
|
19
|
+
categories: 'categoryClassRegistry',
|
|
20
|
+
};
|
|
21
|
+
|
|
9
22
|
/**
|
|
10
23
|
* @class
|
|
11
24
|
* @extends {Category<import("@vcmap/core").VcsObject>}
|
|
@@ -17,11 +30,33 @@ class AppBackedCategory extends Category {
|
|
|
17
30
|
* @param {AppBackedCategoryOptions} options
|
|
18
31
|
*/
|
|
19
32
|
constructor(options) {
|
|
20
|
-
options.
|
|
33
|
+
options.classRegistryName = collectionNameMap[options.collectionName];
|
|
21
34
|
super(options);
|
|
22
35
|
this._collectionName = options.collectionName;
|
|
23
36
|
}
|
|
24
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @param {VcsObjectOptions} config
|
|
40
|
+
* @returns {Promise<import("@vcmap/core").VcsObject>}
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
async _deserializeItem(config) {
|
|
44
|
+
if (!this._app) {
|
|
45
|
+
throw new Error('Cannot deserialize item before setting the vcApp');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (this._collectionName === 'viewPoints') {
|
|
49
|
+
return new ViewPoint(config);
|
|
50
|
+
} else if (this._collectionName === 'obliqueCollections') {
|
|
51
|
+
return new ObliqueCollection(config);
|
|
52
|
+
} else if (this._collectionName === 'layers') {
|
|
53
|
+
return deserializeLayer(this._app, config);
|
|
54
|
+
} else if (this._collectionName === 'maps') {
|
|
55
|
+
return deserializeMap(this._app, config);
|
|
56
|
+
}
|
|
57
|
+
return super._deserializeItem(config);
|
|
58
|
+
}
|
|
59
|
+
|
|
25
60
|
setApp(app) {
|
|
26
61
|
super.setApp(app);
|
|
27
62
|
this.setCollection(this._app[this._collectionName]);
|
|
@@ -38,4 +73,4 @@ class AppBackedCategory extends Category {
|
|
|
38
73
|
}
|
|
39
74
|
|
|
40
75
|
export default AppBackedCategory;
|
|
41
|
-
|
|
76
|
+
categoryClassRegistry.registerClass(AppBackedCategory.className, AppBackedCategory);
|
package/src/category/category.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { check } from '@vcsuite/check';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
-
import { parseBoolean } from '@vcsuite/parsers';
|
|
4
3
|
import { Feature } from 'ol';
|
|
5
|
-
import { contextIdSymbol, destroyCollection
|
|
4
|
+
import { contextIdSymbol, destroyCollection } from '../vcsAppContextHelpers.js';
|
|
6
5
|
import makeOverrideCollection, { isOverrideCollection } from '../util/overrideCollection.js';
|
|
7
6
|
import VcsObject from '../vcsObject.js';
|
|
8
7
|
import VectorLayer from '../layer/vectorLayer.js';
|
|
9
8
|
import IndexedCollection from '../util/indexedCollection.js';
|
|
10
9
|
import { parseGeoJSON, writeGeoJSONFeature } from '../layer/geojsonHelpers.js';
|
|
11
10
|
import Collection from '../util/collection.js';
|
|
12
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
13
11
|
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
12
|
+
import { categoryClassRegistry, getObjectFromClassRegistry } from '../classRegistry.js';
|
|
13
|
+
import OverrideClassRegistry from '../overrideClassRegistry.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @typedef {VcsObjectOptions} CategoryOptions
|
|
17
17
|
* @property {string|Object<string, string>} [title]
|
|
18
|
-
* @property {
|
|
18
|
+
* @property {string} [classRegistryName=''] - the class registry name on the current app to provide classes for this category. if provided, parseItems will deserialize using this class registry. See: {@link getObjectFromClassRegistry}.
|
|
19
19
|
* @property {string|undefined} [featureProperty]
|
|
20
20
|
* @property {VectorOptions} [layerOptions={}]
|
|
21
21
|
* @property {Array<Object>} [items] - items are not evaluated by the constructor but passed to parseItem during deserialization.
|
|
@@ -85,7 +85,7 @@ class Category extends VcsObject {
|
|
|
85
85
|
return {
|
|
86
86
|
title: '',
|
|
87
87
|
featureProperty: undefined,
|
|
88
|
-
|
|
88
|
+
classRegistryName: undefined,
|
|
89
89
|
layerOptions: {},
|
|
90
90
|
keyProperty: 'name',
|
|
91
91
|
items: [],
|
|
@@ -113,10 +113,10 @@ class Category extends VcsObject {
|
|
|
113
113
|
*/
|
|
114
114
|
this._featureProperty = options.featureProperty || defaultOptions.featureProperty;
|
|
115
115
|
/**
|
|
116
|
-
* @type {
|
|
116
|
+
* @type {string}
|
|
117
117
|
* @private
|
|
118
118
|
*/
|
|
119
|
-
this.
|
|
119
|
+
this._classRegistryName = options.classRegistryName;
|
|
120
120
|
/**
|
|
121
121
|
* @type {VectorOptions}
|
|
122
122
|
* @private
|
|
@@ -154,6 +154,12 @@ class Category extends VcsObject {
|
|
|
154
154
|
this._contextRemovedListener = () => {};
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @type {string}
|
|
159
|
+
* @readonly
|
|
160
|
+
*/
|
|
161
|
+
get classRegistryName() { return this._classRegistryName; }
|
|
162
|
+
|
|
157
163
|
/**
|
|
158
164
|
* The collection of this category.
|
|
159
165
|
* @type {OverrideCollection<T>}
|
|
@@ -242,7 +248,12 @@ class Category extends VcsObject {
|
|
|
242
248
|
*/
|
|
243
249
|
mergeOptions(options) {
|
|
244
250
|
const defaultOptions = Category.getDefaultConfig();
|
|
245
|
-
checkMergeOptionOverride(
|
|
251
|
+
checkMergeOptionOverride(
|
|
252
|
+
'classRegistryName',
|
|
253
|
+
this._classRegistryName,
|
|
254
|
+
defaultOptions.classRegistryName,
|
|
255
|
+
options.classRegistryName,
|
|
256
|
+
);
|
|
246
257
|
checkMergeOptionOverride(
|
|
247
258
|
'featureProperty',
|
|
248
259
|
this._featureProperty,
|
|
@@ -284,7 +295,7 @@ class Category extends VcsObject {
|
|
|
284
295
|
collection,
|
|
285
296
|
this._getDynamicContextId.bind(this),
|
|
286
297
|
this._serializeItem.bind(this),
|
|
287
|
-
this.
|
|
298
|
+
this._deserializeItem.bind(this),
|
|
288
299
|
);
|
|
289
300
|
|
|
290
301
|
[...this.collection].forEach((item) => { this._itemAdded(item); });
|
|
@@ -321,6 +332,22 @@ class Category extends VcsObject {
|
|
|
321
332
|
}
|
|
322
333
|
}
|
|
323
334
|
|
|
335
|
+
/**
|
|
336
|
+
* @protected
|
|
337
|
+
* @param {*} config
|
|
338
|
+
* @returns {Promise<T>} // XXX should this still be async?
|
|
339
|
+
*/
|
|
340
|
+
async _deserializeItem(config) {
|
|
341
|
+
if (!this._app) {
|
|
342
|
+
throw new Error('Cannot deserialize item before setting the vcApp');
|
|
343
|
+
}
|
|
344
|
+
const classRegistry = this._classRegistryName ? this._app[this._classRegistryName] : null;
|
|
345
|
+
if (classRegistry && classRegistry instanceof OverrideClassRegistry) {
|
|
346
|
+
return getObjectFromClassRegistry(classRegistry, config);
|
|
347
|
+
}
|
|
348
|
+
return config;
|
|
349
|
+
}
|
|
350
|
+
|
|
324
351
|
/**
|
|
325
352
|
* @protected
|
|
326
353
|
* @param {T} item
|
|
@@ -371,4 +398,4 @@ class Category extends VcsObject {
|
|
|
371
398
|
}
|
|
372
399
|
|
|
373
400
|
export default Category;
|
|
374
|
-
|
|
401
|
+
categoryClassRegistry.registerClass(Category.className, Category);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getLogger as getLoggerByName } from '@vcsuite/logger';
|
|
2
2
|
import Category from './category.js';
|
|
3
|
-
import { getObjectFromOptions } from '../vcsAppContextHelpers.js';
|
|
4
3
|
import './appBackedCategory.js';
|
|
5
4
|
import IndexedCollection from '../util/indexedCollection.js';
|
|
5
|
+
import { getObjectFromClassRegistry } from '../classRegistry.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @returns {import("@vcsuite/logger").Logger}
|
|
@@ -120,7 +120,7 @@ class CategoryCollection extends IndexedCollection {
|
|
|
120
120
|
category = this.getByKey(options.name);
|
|
121
121
|
category.mergeOptions(options);
|
|
122
122
|
} else {
|
|
123
|
-
category = await
|
|
123
|
+
category = await getObjectFromClassRegistry(this._app.categoryClassRegistry, options);
|
|
124
124
|
if (category) {
|
|
125
125
|
if (this.add(category) == null) {
|
|
126
126
|
return null;
|
|
@@ -129,7 +129,7 @@ class CategoryCollection extends IndexedCollection {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
if (!category) {
|
|
132
|
-
throw new Error(`Category ${options.name} with type ${
|
|
132
|
+
throw new Error(`Category ${options.name} with type ${options.type} could not be created`);
|
|
133
133
|
}
|
|
134
134
|
return category;
|
|
135
135
|
}
|