@vcmap/core 6.0.7 → 6.1.0-rc.2
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/dist/cesium.d.ts +3 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +8 -1
- package/dist/src/featureProvider/featureProviderSymbols.d.ts +5 -0
- package/dist/src/featureProvider/featureProviderSymbols.js +5 -1
- package/dist/src/featureProvider/featureProviderSymbols.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.js +58 -62
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.js +25 -13
- package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
- package/dist/src/layer/cesium/sourceVectorContextSync.d.ts +27 -0
- package/dist/src/layer/cesium/sourceVectorContextSync.js +94 -0
- package/dist/src/layer/cesium/sourceVectorContextSync.js.map +1 -0
- package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +4 -27
- package/dist/src/layer/cesium/vectorCesiumImpl.js +15 -107
- package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.d.ts +12 -1
- package/dist/src/layer/cesium/vectorContext.js +6 -0
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/layerSymbols.js +1 -1
- package/dist/src/layer/layerSymbols.js.map +1 -1
- package/dist/src/layer/oblique/sourceObliqueSync.d.ts +18 -0
- package/dist/src/layer/oblique/sourceObliqueSync.js +319 -0
- package/dist/src/layer/oblique/sourceObliqueSync.js.map +1 -0
- package/dist/src/layer/oblique/vectorObliqueImpl.d.ts +2 -40
- package/dist/src/layer/oblique/vectorObliqueImpl.js +8 -283
- package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +10 -1
- package/dist/src/layer/vectorLayer.js +23 -1
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/map/baseOLMap.js +8 -1
- package/dist/src/map/baseOLMap.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +2 -0
- package/dist/src/map/cesiumMap.js +26 -1
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +24 -12
- package/dist/src/map/vcsMap.js +92 -38
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/ol/source/ClusterEnhancedVectorSource.d.ts +6 -4
- package/dist/src/ol/source/ClusterEnhancedVectorSource.js +4 -9
- package/dist/src/ol/source/ClusterEnhancedVectorSource.js.map +1 -1
- package/dist/src/ol/source/VcsCluster.d.ts +10 -10
- package/dist/src/ol/source/VcsCluster.js +23 -7
- package/dist/src/ol/source/VcsCluster.js.map +1 -1
- package/dist/src/util/clipping/clippingPolygonHelper.d.ts +7 -0
- package/dist/src/util/clipping/clippingPolygonHelper.js +53 -0
- package/dist/src/util/clipping/clippingPolygonHelper.js.map +1 -0
- package/dist/src/util/clipping/clippingPolygonObject.d.ts +59 -0
- package/dist/src/util/clipping/clippingPolygonObject.js +158 -0
- package/dist/src/util/clipping/clippingPolygonObject.js.map +1 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.d.ts +18 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.js +167 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.js.map +1 -0
- package/dist/src/util/layerCollection.d.ts +11 -1
- package/dist/src/util/layerCollection.js +67 -12
- package/dist/src/util/layerCollection.js.map +1 -1
- package/dist/src/util/mapCollection.d.ts +16 -1
- package/dist/src/util/mapCollection.js +37 -3
- package/dist/src/util/mapCollection.js.map +1 -1
- package/dist/src/util/renderScreenshot.d.ts +9 -0
- package/dist/src/util/renderScreenshot.js +162 -0
- package/dist/src/util/renderScreenshot.js.map +1 -0
- package/dist/src/util/rotation.d.ts +30 -0
- package/dist/src/util/rotation.js +145 -0
- package/dist/src/util/rotation.js.map +1 -0
- package/dist/src/util/vcsTemplate.d.ts +7 -0
- package/dist/src/util/vcsTemplate.js +248 -0
- package/dist/src/util/vcsTemplate.js.map +1 -0
- package/dist/src/vcsApp.d.ts +7 -0
- package/dist/src/vcsApp.js +29 -0
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/src/vcsModule.d.ts +6 -2
- package/dist/src/vcsModule.js.map +1 -1
- package/dist/src/vectorCluster/vectorClusterCesiumContext.d.ts +18 -0
- package/dist/src/{layer/cesium/clusterContext.js → vectorCluster/vectorClusterCesiumContext.js} +28 -42
- package/dist/src/vectorCluster/vectorClusterCesiumContext.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroup.d.ts +96 -0
- package/dist/src/vectorCluster/vectorClusterGroup.js +320 -0
- package/dist/src/vectorCluster/vectorClusterGroup.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.d.ts +20 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js +115 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.d.ts +19 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.js +37 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.d.ts +31 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.js +76 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.d.ts +17 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js +62 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.d.ts +17 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js +62 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.d.ts +110 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.js +374 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.d.ts +1 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.js +3 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.js.map +1 -0
- package/index.ts +42 -1
- package/package.json +3 -1
- package/src/cesium/cesium.d.ts +3 -0
- package/src/featureProvider/featureProviderSymbols.ts +6 -1
- package/src/interaction/featureAtPixelInteraction.ts +109 -84
- package/src/interaction/featureProviderInteraction.ts +42 -28
- package/src/layer/cesium/sourceVectorContextSync.ts +134 -0
- package/src/layer/cesium/vcsTile/vcsDebugTile.ts +1 -1
- package/src/layer/cesium/vcsTile/vcsVectorTile.ts +1 -1
- package/src/layer/cesium/vectorCesiumImpl.ts +30 -144
- package/src/layer/cesium/vectorContext.ts +17 -1
- package/src/layer/layerSymbols.ts +1 -1
- package/src/layer/oblique/sourceObliqueSync.ts +436 -0
- package/src/layer/oblique/vectorObliqueImpl.ts +11 -397
- package/src/layer/vectorLayer.ts +35 -2
- package/src/map/baseOLMap.ts +8 -1
- package/src/map/cesiumMap.ts +36 -3
- package/src/map/vcsMap.ts +121 -47
- package/src/ol/ol.d.ts +8 -1
- package/src/ol/source/{ClusterEnhancedVectorSource.js → ClusterEnhancedVectorSource.ts} +7 -10
- package/src/ol/source/VcsCluster.ts +58 -0
- package/src/util/clipping/clippingPolygonHelper.ts +86 -0
- package/src/util/clipping/clippingPolygonObject.ts +223 -0
- package/src/util/clipping/clippingPolygonObjectCollection.ts +249 -0
- package/src/util/layerCollection.ts +90 -12
- package/src/util/mapCollection.ts +53 -2
- package/src/util/renderScreenshot.ts +193 -0
- package/src/util/rotation.ts +215 -0
- package/src/util/vcsTemplate.ts +373 -0
- package/src/vcsApp.ts +65 -0
- package/src/vcsModule.ts +6 -2
- package/src/vectorCluster/vectorClusterCesiumContext.ts +123 -0
- package/src/vectorCluster/vectorClusterGroup.ts +463 -0
- package/src/vectorCluster/vectorClusterGroupCesiumImpl.ts +176 -0
- package/src/vectorCluster/vectorClusterGroupCollection.ts +43 -0
- package/src/vectorCluster/vectorClusterGroupImpl.ts +107 -0
- package/src/vectorCluster/vectorClusterGroupObliqueImpl.ts +84 -0
- package/src/vectorCluster/vectorClusterGroupOpenlayersImpl.ts +81 -0
- package/src/vectorCluster/vectorClusterStyleItem.ts +490 -0
- package/src/vectorCluster/vectorClusterSymbols.ts +2 -0
- package/dist/src/layer/cesium/clusterContext.d.ts +0 -20
- package/dist/src/layer/cesium/clusterContext.js.map +0 -1
- package/src/layer/cesium/clusterContext.ts +0 -140
- package/src/ol/source/VcsCluster.js +0 -37
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Camera, Cartesian2, Cartesian3, Cartographic, Math as CesiumMath, } from '@vcmap-cesium/engine';
|
|
2
|
+
import Viewpoint from './viewpoint.js';
|
|
3
|
+
import { CesiumMap } from '../../index.js';
|
|
4
|
+
import Projection from './projection.js';
|
|
5
|
+
/**
|
|
6
|
+
* Unique symbol for rotation.
|
|
7
|
+
* @type {symbol}
|
|
8
|
+
*/
|
|
9
|
+
export const rotationMapControlSymbol = Symbol('rotationMapControlSymbol');
|
|
10
|
+
/**
|
|
11
|
+
* Rotates the camera to a specified viewpoint.
|
|
12
|
+
* @param {SetViewOptions} options - The options for setting the view.
|
|
13
|
+
* @param {number} [distance] - The distance to move backward.
|
|
14
|
+
* @param {CesiumMap} activeMap - The active map instance.
|
|
15
|
+
*/
|
|
16
|
+
function setUpdatedPosition(options, distance, activeMap) {
|
|
17
|
+
let cameraPosition;
|
|
18
|
+
const clonedCamera = new Camera(activeMap.getCesiumWidget().scene);
|
|
19
|
+
clonedCamera.setView(options);
|
|
20
|
+
clonedCamera.moveBackward(distance);
|
|
21
|
+
cameraPosition = clonedCamera.position;
|
|
22
|
+
const cam = activeMap.getCesiumWidget().scene.camera;
|
|
23
|
+
const cameraOptions = {
|
|
24
|
+
heading: options.orientation.heading,
|
|
25
|
+
pitch: options.orientation.pitch,
|
|
26
|
+
roll: options.orientation.roll,
|
|
27
|
+
};
|
|
28
|
+
cameraPosition = cameraPosition || null;
|
|
29
|
+
cam.cancelFlight();
|
|
30
|
+
cam.setView({
|
|
31
|
+
destination: cameraPosition,
|
|
32
|
+
orientation: cameraOptions,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Rotates the center of the map.
|
|
37
|
+
* @param {number} heading - The current heading of the view.
|
|
38
|
+
* @param {CesiumMap} activeMap - The current Cesium Map.
|
|
39
|
+
* @param {number} timePerRotation - The current rotation speed.
|
|
40
|
+
* @param {JulianDate} [timeLastTick] - The time of the last tick.
|
|
41
|
+
* @returns {number | undefined} The new heading.
|
|
42
|
+
*/
|
|
43
|
+
export function calculateRotation(heading, activeMap, timePerRotation, timeLastTick) {
|
|
44
|
+
let localHeading = heading;
|
|
45
|
+
const { clock } = activeMap.getCesiumWidget();
|
|
46
|
+
let timeDifference = timeLastTick
|
|
47
|
+
? clock.currentTime.secondsOfDay - timeLastTick.secondsOfDay
|
|
48
|
+
: 1 / 60;
|
|
49
|
+
if (timeDifference <= 0 || timeDifference > 1) {
|
|
50
|
+
timeDifference = 1 / 60;
|
|
51
|
+
}
|
|
52
|
+
const timeFactor = timeDifference / (1 / 60);
|
|
53
|
+
const headingDiff = CesiumMath.TWO_PI / ((timePerRotation * 60) / timeFactor);
|
|
54
|
+
localHeading += headingDiff;
|
|
55
|
+
localHeading = CesiumMath.zeroToTwoPi(localHeading);
|
|
56
|
+
return localHeading;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Starts the rotation of the map.
|
|
60
|
+
* @param app - The VCS application instance.
|
|
61
|
+
* @param [viewpoint] - The optional viewpoint to start the rotation from, if no viewpoint is provided the current Viewpoint is used.
|
|
62
|
+
* @param [timePerRotation=60] - The duration of a single full rotation in seconds.
|
|
63
|
+
* @returns A function to stop the rotation.
|
|
64
|
+
*/
|
|
65
|
+
export async function startRotation(app, viewpoint, timePerRotation = 60) {
|
|
66
|
+
const { activeMap } = app.maps;
|
|
67
|
+
let localViewpoint;
|
|
68
|
+
let rotationListener;
|
|
69
|
+
let resetMapControls;
|
|
70
|
+
const stopRotation = () => {
|
|
71
|
+
if (rotationListener) {
|
|
72
|
+
rotationListener();
|
|
73
|
+
rotationListener = undefined;
|
|
74
|
+
}
|
|
75
|
+
if (resetMapControls) {
|
|
76
|
+
resetMapControls();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
if (activeMap instanceof CesiumMap) {
|
|
80
|
+
const scene = activeMap.getScene();
|
|
81
|
+
if (scene) {
|
|
82
|
+
if (!(viewpoint instanceof Viewpoint)) {
|
|
83
|
+
localViewpoint = activeMap.getViewpointSync() || undefined;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
localViewpoint = viewpoint.clone();
|
|
87
|
+
}
|
|
88
|
+
if (localViewpoint) {
|
|
89
|
+
if (!localViewpoint.animate) {
|
|
90
|
+
localViewpoint.animate = true;
|
|
91
|
+
localViewpoint.duration = 0.00000001;
|
|
92
|
+
}
|
|
93
|
+
await activeMap.gotoViewpoint(localViewpoint);
|
|
94
|
+
const newCenter = scene.pickPosition(new Cartesian2(scene.canvas.width / 2, scene.canvas.height / 2));
|
|
95
|
+
if (newCenter) {
|
|
96
|
+
const cartographic = Cartographic.fromCartesian(newCenter);
|
|
97
|
+
localViewpoint.groundPosition = [
|
|
98
|
+
CesiumMath.toDegrees(cartographic.longitude),
|
|
99
|
+
CesiumMath.toDegrees(cartographic.latitude),
|
|
100
|
+
cartographic.height,
|
|
101
|
+
];
|
|
102
|
+
localViewpoint.distance = Cartesian3.distance(newCenter, scene.camera.position);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw new Error('new ground position could not be determined');
|
|
106
|
+
}
|
|
107
|
+
const { distance } = localViewpoint;
|
|
108
|
+
const heading = CesiumMath.toRadians(localViewpoint.heading);
|
|
109
|
+
const pitch = CesiumMath.toRadians(localViewpoint.pitch);
|
|
110
|
+
const roll = CesiumMath.toRadians(localViewpoint.roll);
|
|
111
|
+
const groundPositionCoords = localViewpoint.groundPosition;
|
|
112
|
+
if (!groundPositionCoords[2]) {
|
|
113
|
+
const positions = await activeMap.getHeightFromTerrain([
|
|
114
|
+
Projection.wgs84ToMercator(groundPositionCoords),
|
|
115
|
+
]);
|
|
116
|
+
groundPositionCoords[2] = positions[0][2];
|
|
117
|
+
}
|
|
118
|
+
const groundPosition = Cartesian3.fromDegrees(groundPositionCoords[0], groundPositionCoords[1], groundPositionCoords[2]);
|
|
119
|
+
const options = {
|
|
120
|
+
destination: groundPosition,
|
|
121
|
+
orientation: {
|
|
122
|
+
heading,
|
|
123
|
+
pitch,
|
|
124
|
+
roll,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
let timeLastTick;
|
|
128
|
+
resetMapControls = app.maps.requestExclusiveMapControls({ apiCalls: true, keyEvents: true, pointerEvents: true }, stopRotation, rotationMapControlSymbol);
|
|
129
|
+
rotationListener = activeMap
|
|
130
|
+
.getCesiumWidget()
|
|
131
|
+
.scene.postRender.addEventListener(() => {
|
|
132
|
+
options.orientation.heading = calculateRotation(options.orientation.heading, activeMap, timePerRotation, timeLastTick);
|
|
133
|
+
if (options) {
|
|
134
|
+
setUpdatedPosition(options, distance, activeMap);
|
|
135
|
+
}
|
|
136
|
+
timeLastTick = activeMap.getCesiumWidget().clock.currentTime;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return () => {
|
|
142
|
+
stopRotation();
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=rotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotation.js","sourceRoot":"","sources":["../../../src/util/rotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,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F,IAAI,OAAO,EAAE,CAAC;wBACZ,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;oBACnD,CAAC;oBAED,YAAY,GAAG,SAAS,CAAC,eAAe,EAAG,CAAC,KAAK,CAAC,WAAW,CAAC;gBAChE,CAAC,CAAC,CAAC;YACP,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAS,EAAE;QAChB,YAAY,EAAE,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a template in these steps. See {@link documentation/vcsTemplate.md} for more information.
|
|
3
|
+
* 1. expand conditional blocks. this will remove any blocks that do not match their expressions and choose from if / elseif / else block which of them to render
|
|
4
|
+
* 2. expand iterations. this will create new templates for each iteration and re-run the rendering for those blocks
|
|
5
|
+
* 3. render attributes. this will add the attributes to all the blocks not within each blocks
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderTemplate(template: string | string[], data: Record<string, unknown>): string;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { BooleanType, newParsingContext, StringType, NoneType, } from 'ol/expr/expression.js';
|
|
2
|
+
import { buildExpression, newEvaluationContext } from 'ol/expr/cpu.js';
|
|
3
|
+
import { is } from '@vcsuite/check';
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} expressionString
|
|
6
|
+
* @param {Record<string, unknown>} data
|
|
7
|
+
* @param {number} evaluationType
|
|
8
|
+
* @returns {*}
|
|
9
|
+
*/
|
|
10
|
+
function evaluateExpression(expressionString, data, evaluationType) {
|
|
11
|
+
const parsed = expressionString.startsWith('[')
|
|
12
|
+
? JSON.parse(expressionString)
|
|
13
|
+
: [
|
|
14
|
+
'get',
|
|
15
|
+
...expressionString
|
|
16
|
+
.replace(/\[([^\]]+)]/g, '.$1')
|
|
17
|
+
.split('.')
|
|
18
|
+
.filter((f) => f),
|
|
19
|
+
];
|
|
20
|
+
const compiledExpression = buildExpression(parsed, evaluationType, newParsingContext());
|
|
21
|
+
const evaluationContext = newEvaluationContext();
|
|
22
|
+
evaluationContext.properties = data;
|
|
23
|
+
return compiledExpression(evaluationContext);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Replaces template strings by provided attributes, e.g. {{myAttribute}}
|
|
27
|
+
*/
|
|
28
|
+
function replaceAttributes(template, data) {
|
|
29
|
+
const pattern = /\{\{([^}]+)}}/g;
|
|
30
|
+
return template.replace(pattern, (_p, value) => {
|
|
31
|
+
return (evaluateExpression(value.trim(), data, StringType) ?? '');
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function regexHits(regexp, string) {
|
|
35
|
+
const hits = [];
|
|
36
|
+
let hit;
|
|
37
|
+
// eslint-disable-next-line no-cond-assign
|
|
38
|
+
while ((hit = regexp.exec(string))) {
|
|
39
|
+
hits.push(hit);
|
|
40
|
+
}
|
|
41
|
+
return hits;
|
|
42
|
+
}
|
|
43
|
+
function findTopLevelBlock(openings, closings, accepted, rejected) {
|
|
44
|
+
const localOpenings = openings.slice();
|
|
45
|
+
const localClosings = closings.slice();
|
|
46
|
+
while (localOpenings.length > 0) {
|
|
47
|
+
let matchingClosing;
|
|
48
|
+
let matchingOpening;
|
|
49
|
+
while (!matchingClosing && localClosings.length > 0) {
|
|
50
|
+
const currentClosing = localClosings.shift();
|
|
51
|
+
const openingDistances = localOpenings.map((o) => currentClosing.index - o.index);
|
|
52
|
+
const minDistance = openingDistances.reduce((min, currentDistance) => {
|
|
53
|
+
if (currentDistance > 0 && currentDistance < min) {
|
|
54
|
+
return currentDistance;
|
|
55
|
+
}
|
|
56
|
+
return min;
|
|
57
|
+
}, Infinity);
|
|
58
|
+
const matchingOpeningIndex = openingDistances.indexOf(minDistance);
|
|
59
|
+
matchingOpening = localOpenings[matchingOpeningIndex];
|
|
60
|
+
if (matchingOpeningIndex === 0) {
|
|
61
|
+
matchingClosing = currentClosing;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
rejected({ opening: matchingOpening, closing: currentClosing });
|
|
65
|
+
}
|
|
66
|
+
localOpenings.splice(matchingOpeningIndex, 1);
|
|
67
|
+
}
|
|
68
|
+
if (matchingOpening && matchingClosing) {
|
|
69
|
+
accepted({ opening: matchingOpening, closing: matchingClosing });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function tagWithinBlock(tag, block) {
|
|
74
|
+
return tag.index > block.opening.index && tag.index < block.closing.index;
|
|
75
|
+
}
|
|
76
|
+
function getForEachBlocks(template) {
|
|
77
|
+
const forEachBlocks = [];
|
|
78
|
+
const forEachOpenings = regexHits(/\s*{{#each\s\(([^.)]+)\)\sin\s([^}]+)}}\s*/g, template);
|
|
79
|
+
const forEachClosings = regexHits(/\s*{{\/each}}\s*/g, template);
|
|
80
|
+
if (forEachClosings.length > forEachOpenings.length) {
|
|
81
|
+
throw new Error('Template failed to render, missing opening tag for each statements');
|
|
82
|
+
}
|
|
83
|
+
else if (forEachClosings.length < forEachOpenings.length) {
|
|
84
|
+
throw new Error('Template failed to render, missing closing tag for each statements');
|
|
85
|
+
}
|
|
86
|
+
findTopLevelBlock(forEachOpenings, forEachClosings, (block) => {
|
|
87
|
+
forEachBlocks.push(block);
|
|
88
|
+
}, () => { });
|
|
89
|
+
return forEachBlocks;
|
|
90
|
+
}
|
|
91
|
+
function getConditionalBlocks(template, forEachBlocks) {
|
|
92
|
+
const conditionalBlocks = [];
|
|
93
|
+
let conditionalOpenings = regexHits(/\s*{{#if\s([^}]*)}}\s*/g, template);
|
|
94
|
+
let conditionalClosings = regexHits(/\s*{{\/if}}\s*/g, template);
|
|
95
|
+
let elseIfs = regexHits(/\s*{{elseif\s([^}]*)}}\s*/g, template);
|
|
96
|
+
let elses = regexHits(/\s*{{else}}\s*/g, template);
|
|
97
|
+
const withinForEachBlock = (tag) => forEachBlocks.find((block) => tagWithinBlock(tag, block));
|
|
98
|
+
// conditionals within a for each blocks are rendered with the for each block, ignore
|
|
99
|
+
conditionalOpenings = conditionalOpenings.filter((t) => !withinForEachBlock(t));
|
|
100
|
+
conditionalClosings = conditionalClosings.filter((t) => !withinForEachBlock(t));
|
|
101
|
+
if (conditionalClosings.length > conditionalOpenings.length) {
|
|
102
|
+
throw new Error('Template failed to render, missing closing tag for if statements');
|
|
103
|
+
}
|
|
104
|
+
else if (conditionalClosings.length < conditionalOpenings.length) {
|
|
105
|
+
throw new Error('Template failed to render, missing opening tag for if statements');
|
|
106
|
+
}
|
|
107
|
+
const filterElseIfElse = (block) => {
|
|
108
|
+
elseIfs = elseIfs.filter((tag) => !tagWithinBlock(tag, block));
|
|
109
|
+
elses = elses.filter((tag) => !tagWithinBlock(tag, block));
|
|
110
|
+
};
|
|
111
|
+
findTopLevelBlock(conditionalOpenings, conditionalClosings, (block) => {
|
|
112
|
+
const blockElseIfs = elseIfs.filter((tag) => tagWithinBlock(tag, block));
|
|
113
|
+
const elseStatement = elses.find((tag) => tagWithinBlock(tag, block));
|
|
114
|
+
if (elseStatement &&
|
|
115
|
+
blockElseIfs.length > 0 &&
|
|
116
|
+
elseStatement.index < blockElseIfs.at(-1).index) {
|
|
117
|
+
throw new Error('{{else}} must be the last entry in a block');
|
|
118
|
+
}
|
|
119
|
+
conditionalBlocks.push({
|
|
120
|
+
...block,
|
|
121
|
+
elseStatement,
|
|
122
|
+
elseIfs: blockElseIfs,
|
|
123
|
+
});
|
|
124
|
+
}, (block) => {
|
|
125
|
+
filterElseIfElse(block);
|
|
126
|
+
});
|
|
127
|
+
return conditionalBlocks;
|
|
128
|
+
}
|
|
129
|
+
function shouldRemoveWhiteSpace(openingTag) {
|
|
130
|
+
return /\n\s*\{/.test(openingTag) && /}\s*\n/.test(openingTag);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* This will extract the block to render separately. This will depend on the white space handling. If the
|
|
134
|
+
* opening is placed on its own line, whitespace after the opening and before the closing blocks will be removed
|
|
135
|
+
* from the sub template, up to the first new line feed.
|
|
136
|
+
*/
|
|
137
|
+
function getSubTemplateForBlock(template, block) {
|
|
138
|
+
const removeWhiteSpace = shouldRemoveWhiteSpace(block.opening[0]);
|
|
139
|
+
let startIndex = block.opening.index + block.opening[0].indexOf('}') + 2;
|
|
140
|
+
let endIndex = block.closing.index + block.closing[0].indexOf('{');
|
|
141
|
+
if (removeWhiteSpace) {
|
|
142
|
+
startIndex += (/}\s*\n/.exec(block.opening[0])?.[0].length ?? 1) - 1;
|
|
143
|
+
endIndex -= (/\n\s*\{/.exec(block.closing[0])?.[0].length ?? 2) - 2;
|
|
144
|
+
}
|
|
145
|
+
return template.substring(startIndex, endIndex);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* This will replace a block with a previously extracted blocks rendered template.
|
|
149
|
+
* This will depend on the white space handling. If the opening is placed on its own line,
|
|
150
|
+
* whitespace before the opening and after the closing blocks will be removed up to the first new line feed,
|
|
151
|
+
* from the new template string all together.
|
|
152
|
+
*/
|
|
153
|
+
function replaceBlock(template, block, replacement) {
|
|
154
|
+
const removeWhiteSpace = shouldRemoveWhiteSpace(block.opening[0]);
|
|
155
|
+
let startIndex = block.opening.index + block.opening[0].indexOf('{');
|
|
156
|
+
let endIndex = block.closing.index + block.closing[0].indexOf('}') + 2;
|
|
157
|
+
if (removeWhiteSpace) {
|
|
158
|
+
startIndex -= (/\n\s*\{/.exec(block.opening[0])?.[0].length ?? 2) - 2;
|
|
159
|
+
endIndex += (/}\s*\n/.exec(block.closing[0])?.[0].length ?? 1) - 1;
|
|
160
|
+
}
|
|
161
|
+
return `${template.substring(0, startIndex)}${replacement}${template.substring(endIndex)}`;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Replaces {{#if }} blocks
|
|
165
|
+
*/
|
|
166
|
+
function expandConditionalsAndLoops(template, data) {
|
|
167
|
+
let renderedTemplate = template;
|
|
168
|
+
const forEachBlocks = getForEachBlocks(template);
|
|
169
|
+
getConditionalBlocks(template, forEachBlocks)
|
|
170
|
+
.reverse()
|
|
171
|
+
.forEach(
|
|
172
|
+
/** @param {ConditionalBlock} block */ (block) => {
|
|
173
|
+
const partialBlocks = [block.opening];
|
|
174
|
+
if (block.elseIfs) {
|
|
175
|
+
partialBlocks.push(...block.elseIfs);
|
|
176
|
+
}
|
|
177
|
+
let trueStatementIndex = partialBlocks.findIndex((s) => evaluateExpression(s[1].trim(), data, BooleanType));
|
|
178
|
+
if (trueStatementIndex === -1 && block.elseStatement) {
|
|
179
|
+
trueStatementIndex = partialBlocks.length;
|
|
180
|
+
}
|
|
181
|
+
let renderedBlock = '';
|
|
182
|
+
if (trueStatementIndex > -1) {
|
|
183
|
+
if (block.elseStatement) {
|
|
184
|
+
partialBlocks.push(block.elseStatement);
|
|
185
|
+
}
|
|
186
|
+
partialBlocks.push(block.closing);
|
|
187
|
+
const blockTemplate = getSubTemplateForBlock(template, {
|
|
188
|
+
opening: partialBlocks[trueStatementIndex],
|
|
189
|
+
closing: partialBlocks[trueStatementIndex + 1],
|
|
190
|
+
});
|
|
191
|
+
renderedBlock = expandConditionalsAndLoops(blockTemplate, data);
|
|
192
|
+
}
|
|
193
|
+
renderedTemplate = replaceBlock(renderedTemplate, block, renderedBlock);
|
|
194
|
+
});
|
|
195
|
+
// only iterate over blocks not removed by conditionals
|
|
196
|
+
getForEachBlocks(renderedTemplate)
|
|
197
|
+
.reverse()
|
|
198
|
+
.forEach((block) => {
|
|
199
|
+
const obj = evaluateExpression(block.opening[2].trim(), data, NoneType);
|
|
200
|
+
let keyValuePairs;
|
|
201
|
+
if (is(obj, Object)) {
|
|
202
|
+
keyValuePairs = Object.entries(obj);
|
|
203
|
+
}
|
|
204
|
+
else if (Array.isArray(obj)) {
|
|
205
|
+
keyValuePairs = obj.entries();
|
|
206
|
+
}
|
|
207
|
+
const renderedBlocks = [];
|
|
208
|
+
if (keyValuePairs) {
|
|
209
|
+
let index = 0;
|
|
210
|
+
const [valueName, keyName, indexName] = block.opening[1]
|
|
211
|
+
.split(',')
|
|
212
|
+
.map((e) => e.trim())
|
|
213
|
+
.slice(0, 3);
|
|
214
|
+
const blockTemplate = getSubTemplateForBlock(renderedTemplate, block);
|
|
215
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
216
|
+
for (const args of keyValuePairs) {
|
|
217
|
+
const forEachData = structuredClone(data);
|
|
218
|
+
forEachData[valueName] = args[1];
|
|
219
|
+
if (keyName) {
|
|
220
|
+
forEachData[keyName] = args[0];
|
|
221
|
+
}
|
|
222
|
+
if (indexName) {
|
|
223
|
+
forEachData[indexName] = index;
|
|
224
|
+
}
|
|
225
|
+
const currentBlock = expandConditionalsAndLoops(blockTemplate, forEachData);
|
|
226
|
+
renderedBlocks.push(replaceAttributes(currentBlock, forEachData));
|
|
227
|
+
index += 1;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
renderedTemplate = replaceBlock(renderedTemplate, block, renderedBlocks.join(''));
|
|
231
|
+
});
|
|
232
|
+
return renderedTemplate;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Renders a template in these steps. See {@link documentation/vcsTemplate.md} for more information.
|
|
236
|
+
* 1. expand conditional blocks. this will remove any blocks that do not match their expressions and choose from if / elseif / else block which of them to render
|
|
237
|
+
* 2. expand iterations. this will create new templates for each iteration and re-run the rendering for those blocks
|
|
238
|
+
* 3. render attributes. this will add the attributes to all the blocks not within each blocks
|
|
239
|
+
*/
|
|
240
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
241
|
+
export function renderTemplate(template, data) {
|
|
242
|
+
const templateString = Array.isArray(template)
|
|
243
|
+
? template.join('\n')
|
|
244
|
+
: template;
|
|
245
|
+
const conditionalTemplate = expandConditionalsAndLoops(templateString, data);
|
|
246
|
+
return replaceAttributes(conditionalTemplate, data);
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=vcsTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vcsTemplate.js","sourceRoot":"","sources":["../../../src/util/vcsTempl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,CAAC,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC,CAAC,QAAQ,CAAC;IACb,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAC7E,OAAO,iBAAiB,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/src/vcsApp.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ import { HiddenObject } from './util/hiddenObjects.js';
|
|
|
18
18
|
import FlightInstance from './util/flight/flightInstance.js';
|
|
19
19
|
import FlightCollection from './util/flight/flightCollection.js';
|
|
20
20
|
import DisplayQuality from './util/displayQuality/displayQuality.js';
|
|
21
|
+
import VectorClusterGroup from './vectorCluster/vectorClusterGroup.js';
|
|
22
|
+
import VectorClusterGroupCollection from './vectorCluster/vectorClusterGroupCollection.js';
|
|
23
|
+
import ClippingPolygonObject from './util/clipping/clippingPolygonObject.js';
|
|
21
24
|
export type VcsAppOptions = {
|
|
22
25
|
_id?: string | undefined;
|
|
23
26
|
name?: string | undefined;
|
|
@@ -48,12 +51,14 @@ declare class VcsApp {
|
|
|
48
51
|
private _maps;
|
|
49
52
|
private _layerClassRegistry;
|
|
50
53
|
private _layers;
|
|
54
|
+
private _vectorClusterGroups;
|
|
51
55
|
private _obliqueCollections;
|
|
52
56
|
private _viewpoints;
|
|
53
57
|
private _styleClassRegistry;
|
|
54
58
|
private _styles;
|
|
55
59
|
private _modules;
|
|
56
60
|
private _hiddenObjects;
|
|
61
|
+
private _clippingPolygons;
|
|
57
62
|
private _flights;
|
|
58
63
|
private _categoryClassRegistry;
|
|
59
64
|
private _categories;
|
|
@@ -78,11 +83,13 @@ declare class VcsApp {
|
|
|
78
83
|
get localeChanged(): VcsEvent<string>;
|
|
79
84
|
get maps(): OverrideCollection<VcsMap, MapCollection>;
|
|
80
85
|
get layers(): OverrideCollection<Layer, LayerCollection>;
|
|
86
|
+
get vectorClusterGroups(): OverrideCollection<VectorClusterGroup, VectorClusterGroupCollection>;
|
|
81
87
|
get obliqueCollections(): OverrideCollection<ObliqueCollection>;
|
|
82
88
|
get viewpoints(): OverrideCollection<Viewpoint>;
|
|
83
89
|
get styles(): OverrideCollection<StyleItem>;
|
|
84
90
|
get categories(): CategoryCollection;
|
|
85
91
|
get hiddenObject(): OverrideCollection<HiddenObject>;
|
|
92
|
+
get clippingPolygons(): OverrideCollection<ClippingPolygonObject>;
|
|
86
93
|
get flights(): OverrideCollection<FlightInstance, FlightCollection>;
|
|
87
94
|
get displayQuality(): DisplayQuality;
|
|
88
95
|
get destroyed(): VcsEvent<void>;
|
package/dist/src/vcsApp.js
CHANGED
|
@@ -24,6 +24,9 @@ import { createHiddenObjectsCollection, } from './util/hiddenObjects.js';
|
|
|
24
24
|
import FlightInstance from './util/flight/flightInstance.js';
|
|
25
25
|
import FlightCollection from './util/flight/flightCollection.js';
|
|
26
26
|
import DisplayQuality from './util/displayQuality/displayQuality.js';
|
|
27
|
+
import VectorClusterGroup from './vectorCluster/vectorClusterGroup.js';
|
|
28
|
+
import ClippingPolygonObject from './util/clipping/clippingPolygonObject.js';
|
|
29
|
+
import ClippingPolygonObjectCollection from './util/clipping/clippingPolygonObjectCollection.js';
|
|
27
30
|
function getLogger() {
|
|
28
31
|
return getLoggerByName('init');
|
|
29
32
|
}
|
|
@@ -52,12 +55,14 @@ class VcsApp {
|
|
|
52
55
|
_maps;
|
|
53
56
|
_layerClassRegistry;
|
|
54
57
|
_layers;
|
|
58
|
+
_vectorClusterGroups;
|
|
55
59
|
_obliqueCollections;
|
|
56
60
|
_viewpoints;
|
|
57
61
|
_styleClassRegistry;
|
|
58
62
|
_styles;
|
|
59
63
|
_modules;
|
|
60
64
|
_hiddenObjects;
|
|
65
|
+
_clippingPolygons;
|
|
61
66
|
_flights;
|
|
62
67
|
_categoryClassRegistry;
|
|
63
68
|
_categories;
|
|
@@ -86,6 +91,7 @@ class VcsApp {
|
|
|
86
91
|
this._layerClassRegistry = new OverrideClassRegistry(layerClassRegistry);
|
|
87
92
|
this._layers = makeOverrideCollection(this._maps.layerCollection, getDynamicModuleId, serializeLayer.bind(null, this), deserializeLayer.bind(null, this), Layer, getLayerIndex);
|
|
88
93
|
this._layers.locale = this.locale;
|
|
94
|
+
this._vectorClusterGroups = makeOverrideCollection(this._layers.vectorClusterGroups, getDynamicModuleId, undefined, (config) => new VectorClusterGroup(config), VectorClusterGroup);
|
|
89
95
|
this._obliqueCollections = makeOverrideCollection(new Collection(), getDynamicModuleId, undefined, (config) => new ObliqueCollection(config), ObliqueCollection);
|
|
90
96
|
this._viewpoints = makeOverrideCollection(new Collection(), getDynamicModuleId, undefined, deserializeViewpoint, Viewpoint);
|
|
91
97
|
this._styleClassRegistry = new OverrideClassRegistry(styleClassRegistry);
|
|
@@ -93,6 +99,7 @@ class VcsApp {
|
|
|
93
99
|
this._modules = new IndexedCollection('_id');
|
|
94
100
|
this._modules.add(this._dynamicModule);
|
|
95
101
|
this._hiddenObjects = createHiddenObjectsCollection(getDynamicModuleId, this._layers.globalHider);
|
|
102
|
+
this._clippingPolygons = makeOverrideCollection(new ClippingPolygonObjectCollection(this), getDynamicModuleId, undefined, (clippingPolygonOptions) => new ClippingPolygonObject(clippingPolygonOptions));
|
|
96
103
|
this._flights = makeOverrideCollection(new FlightCollection(this), getDynamicModuleId, undefined, (flightOptions) => new FlightInstance(flightOptions));
|
|
97
104
|
this._categoryClassRegistry = new OverrideClassRegistry(categoryClassRegistry);
|
|
98
105
|
this._categories = new CategoryCollection(this);
|
|
@@ -136,6 +143,9 @@ class VcsApp {
|
|
|
136
143
|
get layers() {
|
|
137
144
|
return this._layers;
|
|
138
145
|
}
|
|
146
|
+
get vectorClusterGroups() {
|
|
147
|
+
return this._vectorClusterGroups;
|
|
148
|
+
}
|
|
139
149
|
get obliqueCollections() {
|
|
140
150
|
return this._obliqueCollections;
|
|
141
151
|
}
|
|
@@ -151,6 +161,9 @@ class VcsApp {
|
|
|
151
161
|
get hiddenObject() {
|
|
152
162
|
return this._hiddenObjects;
|
|
153
163
|
}
|
|
164
|
+
get clippingPolygons() {
|
|
165
|
+
return this._clippingPolygons;
|
|
166
|
+
}
|
|
154
167
|
get flights() {
|
|
155
168
|
return this._flights;
|
|
156
169
|
}
|
|
@@ -207,11 +220,13 @@ class VcsApp {
|
|
|
207
220
|
}
|
|
208
221
|
await this._styles.parseItems(config.styles, module._id);
|
|
209
222
|
await this._layers.parseItems(config.layers, module._id);
|
|
223
|
+
await this._vectorClusterGroups.parseItems(config.vectorClusterGroups, module._id);
|
|
210
224
|
// TODO add ade here
|
|
211
225
|
await this._obliqueCollections.parseItems(config.obliqueCollections, module._id);
|
|
212
226
|
await this._viewpoints.parseItems(config.viewpoints, module._id);
|
|
213
227
|
await this._maps.parseItems(config.maps, module._id);
|
|
214
228
|
await this._hiddenObjects.parseItems(config.hiddenObjects, module._id);
|
|
229
|
+
await this._clippingPolygons.parseItems(config.clippingPolygons, module._id);
|
|
215
230
|
await this._flights.parseItems(config.flights, module._id);
|
|
216
231
|
if (Array.isArray(config.categories)) {
|
|
217
232
|
await Promise.all(config.categories.map(async ({ name, items }) => {
|
|
@@ -231,6 +246,13 @@ class VcsApp {
|
|
|
231
246
|
});
|
|
232
247
|
}
|
|
233
248
|
});
|
|
249
|
+
[...this._clippingPolygons]
|
|
250
|
+
.filter((c) => c[moduleIdSymbol] === module._id)
|
|
251
|
+
.forEach((c) => {
|
|
252
|
+
if (c.activeOnStartup) {
|
|
253
|
+
c.activate();
|
|
254
|
+
}
|
|
255
|
+
});
|
|
234
256
|
if (config.startingObliqueCollectionName) {
|
|
235
257
|
const startingObliqueCollection = this._obliqueCollections.getByKey(config.startingObliqueCollectionName);
|
|
236
258
|
if (startingObliqueCollection) {
|
|
@@ -317,11 +339,14 @@ class VcsApp {
|
|
|
317
339
|
const config = this._modules.getByKey(moduleId).toJSON();
|
|
318
340
|
config.maps = this._maps.serializeModule(moduleId);
|
|
319
341
|
config.layers = this._layers.serializeModule(moduleId);
|
|
342
|
+
config.vectorClusterGroups =
|
|
343
|
+
this._vectorClusterGroups.serializeModule(moduleId);
|
|
320
344
|
config.obliqueCollections =
|
|
321
345
|
this._obliqueCollections.serializeModule(moduleId);
|
|
322
346
|
config.viewpoints = this._viewpoints.serializeModule(moduleId);
|
|
323
347
|
config.styles = this._styles.serializeModule(moduleId);
|
|
324
348
|
config.hiddenObjects = this._hiddenObjects.serializeModule(moduleId);
|
|
349
|
+
config.clippingPolygons = this._clippingPolygons.serializeModule(moduleId);
|
|
325
350
|
config.flights = this._flights.serializeModule(moduleId);
|
|
326
351
|
config.categories = [...this._categories]
|
|
327
352
|
.map((c) => c.serializeModule(moduleId))
|
|
@@ -355,7 +380,9 @@ class VcsApp {
|
|
|
355
380
|
this._styles.removeModule(moduleId),
|
|
356
381
|
this._obliqueCollections.removeModule(moduleId),
|
|
357
382
|
this._hiddenObjects.removeModule(moduleId),
|
|
383
|
+
this._clippingPolygons.removeModule(moduleId),
|
|
358
384
|
this._flights.removeModule(moduleId),
|
|
385
|
+
this._vectorClusterGroups.removeModule(moduleId),
|
|
359
386
|
]);
|
|
360
387
|
}
|
|
361
388
|
async removeModule(moduleId) {
|
|
@@ -394,8 +421,10 @@ class VcsApp {
|
|
|
394
421
|
destroyCollection(this._layers);
|
|
395
422
|
destroyCollection(this._obliqueCollections);
|
|
396
423
|
destroyCollection(this._viewpoints);
|
|
424
|
+
destroyCollection(this._flights);
|
|
397
425
|
destroyCollection(this._styles);
|
|
398
426
|
destroyCollection(this._categories);
|
|
427
|
+
destroyCollection(this._clippingPolygons);
|
|
399
428
|
this._modules.destroy();
|
|
400
429
|
this._hiddenObjects.destroy();
|
|
401
430
|
this._mapClassRegistry.destroy();
|