@vcmap/ui 6.0.11 → 6.0.13

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/assets/ui.js CHANGED
@@ -1 +1 @@
1
- export * from "./ui-f56287eb.js";
1
+ export * from "./ui-1785b87a.js";
@@ -1 +1 @@
1
- export * from "./vue-41556557.js";
1
+ export * from "./vue-13dade86.js";
@@ -10,7 +10,7 @@ function loadCss(href) {
10
10
  elem.onerror = reject;
11
11
  document.head.appendChild(elem);
12
12
  });
13
- } await loadCss('./assets/vuetify-03bc5f58.css');import { watch as X, onScopeDispose as tt, effectScope as Ul, shallowRef as K, Fragment as ie, reactive as it, computed as b, watchEffect as Ne, toRefs as Wt, capitalize as On, isVNode as Oc, Comment as Rc, unref as ot, warn as Ha, getCurrentInstance as Nc, ref as W, provide as Ae, inject as ye, defineComponent as Hc, camelize as Ir, h as jt, toRaw as Ee, createVNode as r, mergeProps as N, onBeforeUnmount as nt, readonly as Kl, onDeactivated as _r, onActivated as zc, onMounted as Ke, nextTick as Se, TransitionGroup as ql, Transition as Ht, isRef as _n, toRef as F, onBeforeMount as Xl, withDirectives as $e, resolveDirective as dt, vShow as xt, onUpdated as Wc, Text as jc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Uc, cloneVNode as Kc, createTextVNode as Pt, onUnmounted as qc, onBeforeUpdate as Xc, withModifiers as Pl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Tr } from "./vue-41556557.js";
13
+ } await loadCss('./assets/vuetify-73c966ed.css');import { watch as X, onScopeDispose as tt, effectScope as Ul, shallowRef as K, Fragment as ie, reactive as it, computed as b, watchEffect as Ne, toRefs as Wt, capitalize as On, isVNode as Oc, Comment as Rc, unref as ot, warn as Ha, getCurrentInstance as Nc, ref as W, provide as Ae, inject as ye, defineComponent as Hc, camelize as Ir, h as jt, toRaw as Ee, createVNode as r, mergeProps as N, onBeforeUnmount as nt, readonly as Kl, onDeactivated as _r, onActivated as zc, onMounted as Ke, nextTick as Se, TransitionGroup as ql, Transition as Ht, isRef as _n, toRef as F, onBeforeMount as Xl, withDirectives as $e, resolveDirective as dt, vShow as xt, onUpdated as Wc, Text as jc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Uc, cloneVNode as Kc, createTextVNode as Pt, onUnmounted as qc, onBeforeUpdate as Xc, withModifiers as Pl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Tr } from "./vue-13dade86.js";
14
14
  function rt(e, n) {
15
15
  let t;
16
16
  function a() {
@@ -1 +1 @@
1
- export * from "./vuetify-03bc5f58.js";
1
+ export * from "./vuetify-73c966ed.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/ui",
3
- "version": "6.0.11",
3
+ "version": "6.0.13",
4
4
  "author": "Virtual City Systems",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@vcmap-cesium/engine": "^11.0.2",
60
- "@vcmap/core": "^6.0.6",
60
+ "@vcmap/core": "^6.0.7",
61
61
  "ol": "^10.2.1",
62
62
  "vue": "~3.4.38",
63
63
  "vuetify": "^3.7.3"
package/src/state.d.ts CHANGED
@@ -4,14 +4,16 @@
4
4
  export function createEmptyState(): AppState;
5
5
  /**
6
6
  * @param {UrlViewpointState} state
7
+ * @param {string} moduleId
7
8
  * @returns {import("@vcmap/core").ViewpointOptions|null}
8
9
  */
9
- export function parseUrlProjectedViewpointState(state: UrlViewpointState): import("@vcmap/core").ViewpointOptions | null;
10
+ export function parseUrlProjectedViewpointState(state: UrlViewpointState, moduleId: string): import("@vcmap/core").ViewpointOptions | null;
10
11
  /**
11
12
  * @param {UrlExtentState} state
13
+ * @param {string} moduleId
12
14
  * @returns {import("@vcmap/core").ViewpointOptions|null}
13
15
  */
14
- export function parseUrlExtentState(state: UrlExtentState): import("@vcmap/core").ViewpointOptions | null;
16
+ export function parseUrlExtentState(state: UrlExtentState, moduleId: string): import("@vcmap/core").ViewpointOptions | null;
15
17
  /**
16
18
  * @param {(URL)=} url
17
19
  * @returns {AppState}
package/src/state.js CHANGED
@@ -61,7 +61,7 @@ import {
61
61
 
62
62
  /**
63
63
  * @typedef {AppState} CachedAppState
64
- * @property {() => import("@vcmap/core").Viewpoint?} [getViewpoint]
64
+ * @property {(string) => import("@vcmap/core").Viewpoint?} [getViewpoint]
65
65
  */
66
66
 
67
67
  /**
@@ -104,66 +104,87 @@ function parseUrlViewpointState(state) {
104
104
  roll: state[5],
105
105
  });
106
106
 
107
- return vp.isValid() ? vp.toJSON() : null;
107
+ if (vp.isValid()) {
108
+ return vp.toJSON();
109
+ } else {
110
+ getLogger('StateManagement').warning(
111
+ 'The provided viewpoint options are not valid. Viewpoint will be ignored.',
112
+ );
113
+ return null;
114
+ }
108
115
  }
109
116
 
110
117
  /**
111
118
  * @param {UrlViewpointState} state
119
+ * @param {string} moduleId
112
120
  * @returns {import("@vcmap/core").ViewpointOptions|null}
113
121
  */
114
- export function parseUrlProjectedViewpointState(state) {
122
+ export function parseUrlProjectedViewpointState(state, moduleId) {
115
123
  const projection = getDefaultProjection();
116
124
  const projectionCode = parseInt(projection.epsg.split(':')[1], 10);
117
125
 
118
- let cameraPosition = state[0];
119
- let groundPosition = state[1];
120
- if (state[6] && state[6] === projectionCode) {
121
- if (cameraPosition) {
126
+ if (state[6] === projectionCode) {
127
+ let cameraPosition;
128
+ let groundPosition;
129
+ if (state[0]) {
122
130
  // (cameraPosition instanceof Coordinate)
123
131
  cameraPosition = Projection.transform(
124
132
  wgs84Projection,
125
133
  projection,
126
- cameraPosition,
134
+ state[0],
127
135
  );
128
136
  }
129
- if (groundPosition) {
137
+ if (state[1]) {
130
138
  groundPosition = Projection.transform(
131
139
  wgs84Projection,
132
140
  projection,
133
- groundPosition,
141
+ state[1],
134
142
  );
135
143
  }
144
+ return parseUrlViewpointState([
145
+ cameraPosition,
146
+ groundPosition,
147
+ ...state.slice(2),
148
+ ]);
149
+ } else {
150
+ getLogger('StateManagement').warning(
151
+ `The provided viewpoint epsg code (${state[6]}) does not equal epsg code (${projectionCode}) of module '${moduleId}' and therefore can not be handled. Camera and ground position will be ignored.`,
152
+ );
153
+ return null;
136
154
  }
137
-
138
- const vp = new Viewpoint({
139
- cameraPosition: cameraPosition ?? undefined,
140
- groundPosition: groundPosition ?? undefined,
141
- distance: state[2] > 0 ? state[2] : undefined,
142
- heading: state[3],
143
- pitch: state[4],
144
- roll: state[5],
145
- });
146
- vp.animate = false;
147
- return vp.isValid() ? vp.toJSON() : null;
148
155
  }
149
156
 
150
157
  /**
151
158
  * @param {UrlExtentState} state
159
+ * @param {string} moduleId
152
160
  * @returns {import("@vcmap/core").ViewpointOptions|null}
153
161
  */
154
- export function parseUrlExtentState(state) {
162
+ export function parseUrlExtentState(state, moduleId) {
155
163
  const projection = getDefaultProjection();
156
164
  const projectionCode = parseInt(projection.epsg.split(':')[1], 10);
157
165
  const extentOptions = { coordinates: state[0] };
158
- if (projectionCode === state[1]) {
166
+ if (!state[1]) {
167
+ extentOptions.projection = wgs84Projection;
168
+ } else if (state[1] && state[1] === projectionCode) {
159
169
  extentOptions.projection = projection;
160
170
  } else {
161
- extentOptions.projection = wgs84Projection;
171
+ getLogger('StateManagement').warning(
172
+ `The provided extent epsg code (${state[6]}) does not equal epsg code (${projectionCode}) of module '${moduleId}' and therefore can not be handled. The provided extent will be ignored.`,
173
+ );
174
+ return null;
162
175
  }
163
176
  const extent = new Extent(extentOptions);
164
- const vp = Viewpoint.createViewpointFromExtent(extent);
165
- vp.animate = false;
166
- return vp.isValid() ? vp.toJSON() : null;
177
+
178
+ if (extent.isValid()) {
179
+ const vp = Viewpoint.createViewpointFromExtent(extent);
180
+ vp.animate = false;
181
+ return vp.toJSON();
182
+ } else {
183
+ getLogger('StateManagement').warning(
184
+ 'The provided extent options are not valid. Extent will be ignored.',
185
+ );
186
+ return null;
187
+ }
167
188
  }
168
189
 
169
190
  /**
@@ -215,10 +236,12 @@ function writeUrlPluginState(state) {
215
236
  function parseUrlAppState(urlState) {
216
237
  const state = createEmptyState();
217
238
  if (Array.isArray(urlState[0])) {
218
- if (urlState[0][0].length === 4) {
219
- state.getViewpoint = () => parseUrlExtentState(urlState[0]);
220
- } else if (urlState[0].length === 7) {
221
- state.getViewpoint = () => parseUrlProjectedViewpointState(urlState[0]);
239
+ if (Array.isArray(urlState[0][0]) && urlState[0][0].length === 4) {
240
+ state.getViewpoint = (moduleId) =>
241
+ parseUrlExtentState(urlState[0], moduleId);
242
+ } else if (urlState[0][6]) {
243
+ state.getViewpoint = (moduleId) =>
244
+ parseUrlProjectedViewpointState(urlState[0], moduleId);
222
245
  } else {
223
246
  state.activeViewpoint = parseUrlViewpointState(urlState[0]);
224
247
  }
package/src/vcsUiApp.js CHANGED
@@ -687,18 +687,14 @@ class VcsUiApp extends VcsApp {
687
687
  this.obliqueCollections.getByKey(
688
688
  this._cachedAppState.activeObliqueCollection,
689
689
  ),
690
- new Viewpoint(this._cachedAppState.activeViewpoint),
691
690
  );
692
- } else if (this._cachedAppState.activeViewpoint && this.maps.activeMap) {
693
- await this.maps.activeMap.gotoViewpoint(
694
- new Viewpoint(this._cachedAppState.activeViewpoint),
695
- );
696
- } else if (
697
- typeof this._cachedAppState.getViewpoint === 'function' &&
698
- this.maps.activeMap
699
- ) {
700
- await this.maps.activeMap.gotoViewpoint(
701
- new Viewpoint(this._cachedAppState.getViewpoint()),
691
+ }
692
+ const viewpointOptions =
693
+ this._cachedAppState.activeViewpoint ??
694
+ this._cachedAppState.getViewpoint?.(module._id);
695
+ if (viewpointOptions) {
696
+ await this.maps.activeMap?.gotoViewpoint(
697
+ new Viewpoint(viewpointOptions),
702
698
  );
703
699
  }
704
700
  this._cachedAppState.moduleIds.splice(
File without changes