@cyclomedia/streetsmart-api 23.14.4 → 23.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -47
- package/index.d.ts +529 -36
- package/package.json +10 -13
- package/src/types/MeshViewer.d.ts +81 -0
- package/src/types/ObliqueViewer.d.ts +180 -0
- package/src/types/PanoramaViewer.d.ts +340 -0
- package/src/types/PointCloudViewer.d.ts +159 -0
- package/src/types/shared.d.ts +355 -0
- package/dist/esm/index.js +0 -80
package/index.d.ts
CHANGED
|
@@ -1,80 +1,573 @@
|
|
|
1
|
+
/// <reference path="./src/types/shared.d.ts" />
|
|
1
2
|
declare module '@cyclomedia/streetsmart-api' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
type Locale = 'de' | 'en-GB' | 'en-US' | 'fi' | 'fr' | 'nl' | 'tr';
|
|
4
|
+
|
|
5
|
+
type EventType =
|
|
6
|
+
| MeasurementEvents
|
|
7
|
+
| PanoramaViewerEvents
|
|
8
|
+
| ObliqueViewerEvents
|
|
9
|
+
| MeshViewerEvents
|
|
10
|
+
| PointCloudViewerEvents;
|
|
11
|
+
|
|
12
|
+
type Viewer = MeshViewerContainer | PanoramaViewer | ObliqueViewer | PointCloudViewer;
|
|
13
|
+
|
|
14
|
+
type GlobalEventCallback<T extends GlobalViewerEvents | MeasurementEvents> = (
|
|
15
|
+
event: GlobalEvent[T],
|
|
16
|
+
) => StreetSmartApi;
|
|
17
|
+
|
|
18
|
+
interface GlobalEvent {
|
|
19
|
+
[GlobalViewerEvents.VIEWER_ADDED]: ViewerEvent<{ viewer: Viewer }>;
|
|
20
|
+
[GlobalViewerEvents.VIEWER_UPDATED]: ViewerEvent<{ viewer: Viewer }>;
|
|
21
|
+
[GlobalViewerEvents.VIEWER_REMOVED]: ViewerEvent<{ viewer: Viewer }>;
|
|
22
|
+
[MeasurementEvents.MEASUREMENT_STARTED]: ViewerEvent<
|
|
23
|
+
MeasurementEventDetails[MeasurementEvents.MEASUREMENT_STARTED]
|
|
24
|
+
>;
|
|
25
|
+
[MeasurementEvents.MEASUREMENT_STOPPED]: ViewerEvent<
|
|
26
|
+
MeasurementEventDetails[MeasurementEvents.MEASUREMENT_STOPPED]
|
|
27
|
+
>;
|
|
28
|
+
[MeasurementEvents.MEASUREMENT_CHANGED]: ViewerEvent<
|
|
29
|
+
MeasurementEventDetails[MeasurementEvents.MEASUREMENT_CHANGED]
|
|
30
|
+
>;
|
|
31
|
+
[MeasurementEvents.MEASUREMENT_SAVED]: ViewerEvent<
|
|
32
|
+
MeasurementEventDetails[MeasurementEvents.MEASUREMENT_SAVED]
|
|
33
|
+
>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
enum RecordingService {
|
|
37
|
+
DCR = 'DCR',
|
|
38
|
+
THIRD_PARTY = 'TP',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ApiOptionsBase {
|
|
42
|
+
// DOM element to render the viewers into.
|
|
43
|
+
targetElement: HTMLElement;
|
|
11
44
|
apiKey: string;
|
|
45
|
+
// Indicates whether to login using OAuth
|
|
46
|
+
// EPSG code of the coordinate system used in the API. E.g. "EPSG:28992".
|
|
12
47
|
srs: string;
|
|
13
|
-
|
|
48
|
+
// Language used as default in the API. <br /> Default is 'en-US'
|
|
49
|
+
locale?: Locale;
|
|
50
|
+
// Max distance that is used for draw the overlays in the panorama viewer. <br />Default is 30m
|
|
14
51
|
overlayDrawDistance?: number;
|
|
52
|
+
/*
|
|
53
|
+
Alternate configuration url to use for all configuration services.
|
|
54
|
+
Can be used for a {@link http://localinstallation.cyclomedia.com|local installation}.
|
|
55
|
+
*/
|
|
15
56
|
configurationUrl?: string;
|
|
16
|
-
|
|
57
|
+
// The address settings to use for address searches.
|
|
17
58
|
addressSettings?: {
|
|
59
|
+
// The locale to use. e.g. 'nl', use only 2 letter {@link https://www.iso.org/iso-3166-country-codes.html ISO-3166} {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 country codes}.
|
|
18
60
|
locale: string;
|
|
61
|
+
// The name of the database. e.g. 'CMDatabase'.
|
|
19
62
|
database: string;
|
|
20
63
|
};
|
|
21
64
|
}
|
|
22
65
|
|
|
66
|
+
interface BasicAuthOptions {
|
|
67
|
+
username: string;
|
|
68
|
+
password: string;
|
|
69
|
+
tid?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface OAuthOptions {
|
|
73
|
+
// The clientId can be obtained from the helpdesk.
|
|
74
|
+
clientId: string;
|
|
75
|
+
// The absolute / relative path to the endpoint that handles **login** redirects from OAuth
|
|
76
|
+
loginRedirectUri: string;
|
|
77
|
+
// The absolute / relative path to the endpoint that handles **logout** redirects from OAuth
|
|
78
|
+
logoutRedirectUri: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type AuthOptions = ({ loginOauth: false } & BasicAuthOptions) | ({ loginOauth: true } & OAuthOptions);
|
|
82
|
+
|
|
83
|
+
export type ApiOptions = ApiOptionsBase & AuthOptions;
|
|
84
|
+
|
|
23
85
|
type OpenViewerQuery =
|
|
24
86
|
| string
|
|
25
87
|
| number[]
|
|
26
88
|
| {
|
|
27
|
-
|
|
89
|
+
coordinate: number[];
|
|
90
|
+
// Date range only works for ViewerType.PANORAMA
|
|
28
91
|
dateRange?: {
|
|
29
92
|
from: string;
|
|
30
93
|
to: string;
|
|
31
94
|
};
|
|
32
95
|
};
|
|
33
96
|
|
|
97
|
+
type PanoramaViewerOptions = Partial<{
|
|
98
|
+
/**
|
|
99
|
+
* Show window close button. Default is true.
|
|
100
|
+
*/
|
|
101
|
+
closable: boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Show window maximize button. Default is true.
|
|
105
|
+
*/
|
|
106
|
+
maximizable: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Replace already opened panorama viewer.
|
|
110
|
+
*/
|
|
111
|
+
replace: boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Show recording dots.
|
|
115
|
+
*/
|
|
116
|
+
recordingsVisible: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Enable viewing earlier recordings.
|
|
120
|
+
*/
|
|
121
|
+
timeTravelVisible: boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Show viewer navigation bar.
|
|
125
|
+
*/
|
|
126
|
+
navbarVisible: boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Show viewer sidebar.
|
|
130
|
+
*/
|
|
131
|
+
sidebarVisible: boolean;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Show measurement type button in measurement navigation bar. Default is true.
|
|
135
|
+
*/
|
|
136
|
+
measureTypeButtonVisible: boolean;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Allow toggle of measurement type in measurement navigation bar. Default is true.
|
|
140
|
+
*/
|
|
141
|
+
measureTypeButtonToggle: boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Start new measurement when clicking on measurement type button in measurement navigation bar. Default is true.
|
|
145
|
+
*/
|
|
146
|
+
measureTypeButtonStart: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
|
|
149
|
+
type ObliqueViewerOptions = Partial<{
|
|
150
|
+
/**
|
|
151
|
+
* Show window close button. Default is true.
|
|
152
|
+
*/
|
|
153
|
+
closable: boolean;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Show window maximize button. Default is true.
|
|
157
|
+
*/
|
|
158
|
+
maximizable: boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Enable viewing earlier oblique images.
|
|
162
|
+
*/
|
|
163
|
+
timeTravelVisible: boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Show viewer navigation bar.
|
|
167
|
+
*/
|
|
168
|
+
navbarVisible: boolean;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Show viewer sidebar.
|
|
172
|
+
*/
|
|
173
|
+
sidebarVisible: boolean;
|
|
174
|
+
}>;
|
|
175
|
+
|
|
176
|
+
interface PointcloudViewerOptions {
|
|
177
|
+
/**
|
|
178
|
+
* Type of point cloud to open.
|
|
179
|
+
*/
|
|
180
|
+
pointCloudType: PointCloudType;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface MeshViewerOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Determines how the camera is set when opening the viewer (e.g., OBLIQUE -> bird's view, PANORAMA -> streetview, etc.).
|
|
186
|
+
*/
|
|
187
|
+
fromViewer: ViewerType;
|
|
188
|
+
}
|
|
189
|
+
|
|
34
190
|
interface OpenViewerOptions {
|
|
35
|
-
|
|
191
|
+
// Provide viewer type or multiple viewer types in array to open multiple viewers.
|
|
192
|
+
viewerType: ViewerType[] | ViewerType;
|
|
193
|
+
// EPSG code of the spatial reference system to use
|
|
36
194
|
srs: string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
195
|
+
// Value indicating what kind of service to open
|
|
196
|
+
recordingServiceType?: RecordingService;
|
|
197
|
+
panoramaViewer?: PanoramaViewerOptions;
|
|
198
|
+
obliqueViewer?: ObliqueViewerOptions;
|
|
199
|
+
pointcloudViewer?: PointcloudViewerOptions;
|
|
200
|
+
meshviewer?: MeshViewerOptions;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
type Credentials = {
|
|
204
|
+
username: string;
|
|
205
|
+
password: string;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
enum MeasureMethods {
|
|
209
|
+
MEASURE_SMART = 'DepthMap',
|
|
210
|
+
SMART_CLICK = 'SmartClick',
|
|
211
|
+
FORWARD_INTERSECTION = 'ForwardIntersection',
|
|
41
212
|
}
|
|
42
213
|
|
|
43
|
-
|
|
214
|
+
enum MeasurementGeometryTypes {
|
|
215
|
+
POINT = 'Point',
|
|
216
|
+
LINESTRING = 'LineString',
|
|
217
|
+
POLYGON = 'Polygon',
|
|
218
|
+
ORTHOGONAL = 'Orthogonal',
|
|
219
|
+
HEIGHT = 'Height',
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
class StreetSmartApi {
|
|
223
|
+
static init(options: ApiOptions): Promise<void>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Open a panorama, oblique, point cloud viewer and/or meshviewer using a query. The query can be a coordinate, an extent, an address or a panorama/oblique ID.
|
|
227
|
+
* @param {string} query - The query<p/>
|
|
228
|
+
* <ul>
|
|
229
|
+
* <li>Coordinate: x,y E.g. <code>'86580,437038'</code></li>
|
|
230
|
+
* <li>Extent: minx,miny,maxx,maxy E.g. <code>'86580,437038,86880,437338'</code></li>
|
|
231
|
+
* <li>Address: E.g. <code>'Domplein, Utrecht'</code></li>
|
|
232
|
+
* <li>Panorama ID: E.g. <code>'5D4KX5SM'</code></li>
|
|
233
|
+
* <li>Oblique ID: E.g. <code>'014_0849_00135489_NOB16'</code></li>
|
|
234
|
+
* </ul>
|
|
235
|
+
* @param {object} options
|
|
236
|
+
* @param options.viewerType - an array indicating what kind of viewer(s) to open
|
|
237
|
+
* @param options.recordingServiceType - value indicating what kind of service to open
|
|
238
|
+
* @param options.srs - EPSG code of the spatial reference system to use
|
|
239
|
+
* @param options.panoramaViewer - options object for PanoramaViewer options
|
|
240
|
+
* @param options.obliqueViewer - options object for ObliqueViewer options
|
|
241
|
+
* @param options.pointcloudViewer - options object for PointcloudViewer options
|
|
242
|
+
* @param options.meshviewer - options object for MeshViewer options
|
|
243
|
+
* @returns When the promise resolves, it returns an array with references to the created {@link PanoramaViewer}, {@link ObliqueViewer}, {@link PointCloudViewer} and/or {@link MeshViewerContainer}.
|
|
244
|
+
* @example <caption>Open a panorama viewer by ID:</caption>
|
|
245
|
+
* StreetSmartApi.open('5D4KX5SM', {
|
|
246
|
+
* viewerType: [StreetSmartApi.ViewerType.PANORAMA],
|
|
247
|
+
* srs: 'EPSG:28992',
|
|
248
|
+
* panoramaViewer: { replace: false, },
|
|
249
|
+
* }).then(
|
|
250
|
+
* function(result) {
|
|
251
|
+
* if (result && result[0]) {
|
|
252
|
+
* console.log('Opened a panorama viewer through API!', result[0]);
|
|
253
|
+
* }
|
|
254
|
+
* }
|
|
255
|
+
* ).catch(
|
|
256
|
+
* function(reason) {
|
|
257
|
+
* console.log('Error opening panorama viewer: ' + reason);
|
|
258
|
+
* }
|
|
259
|
+
* )
|
|
260
|
+
* @example <caption>Open a panorama viewer by coordinate and date range (this is only applicable for the panorama viewer):</caption>
|
|
261
|
+
* StreetSmartApi.open(
|
|
262
|
+
* {
|
|
263
|
+
* coordinate: [121692.34, 487812.37, 5.60],
|
|
264
|
+
* dateRange: {from: '2017-03-01', to: '2017-04-01'},
|
|
265
|
+
* },
|
|
266
|
+
* {
|
|
267
|
+
* viewerType: [StreetSmartApi.ViewerType.PANORAMA],
|
|
268
|
+
* srs: 'EPSG:28992',
|
|
269
|
+
* panoramaViewer: { replace: false, },
|
|
270
|
+
* }).then(
|
|
271
|
+
* function(result) {
|
|
272
|
+
* if (result && result[0]) {
|
|
273
|
+
* console.log('Opened a panorama viewer through API!', result[0]);
|
|
274
|
+
* }
|
|
275
|
+
* }
|
|
276
|
+
* ).catch(
|
|
277
|
+
* function(reason) {
|
|
278
|
+
* console.log('Error opening panorama viewer: ' + reason);
|
|
279
|
+
* }
|
|
280
|
+
* )
|
|
281
|
+
* @example <caption>Open a panorama viewer and oblique viewer by address:</caption>
|
|
282
|
+
* StreetSmartApi.open('Van Voordenpark 1, Zaltbommel', {
|
|
283
|
+
* viewerType: [StreetSmartApi.ViewerType.PANORAMA, StreetSmartApi.ViewerType.OBLIQUE],
|
|
284
|
+
* srs: 'EPSG:28992',
|
|
285
|
+
* }).then(
|
|
286
|
+
* function(result) {
|
|
287
|
+
* if (result && result[0] && result[1]) {
|
|
288
|
+
* console.log('Opened a panorama viewer and oblique viewer through API!', result[0], result[1]);
|
|
289
|
+
* }
|
|
290
|
+
* }
|
|
291
|
+
* ).catch(
|
|
292
|
+
* function(reason) {
|
|
293
|
+
* console.log('Error opening viewers: ' + reason);
|
|
294
|
+
* }
|
|
295
|
+
* )
|
|
296
|
+
* @example <caption>Open a aerial pointcloud viewer by coordinate:</caption>
|
|
297
|
+
* StreetSmartApi.open(
|
|
298
|
+
* {
|
|
299
|
+
* coordinate: [121692.34, 487812.37, 5.60],
|
|
300
|
+
* },
|
|
301
|
+
* {
|
|
302
|
+
* viewerType: [StreetSmartApi.ViewerType.POINTCLOUD],
|
|
303
|
+
* srs: 'EPSG:28992',
|
|
304
|
+
* pointcloudViewer: { pointCloudType: StreetSmartApi.PointCloudType.AERIAL }}).then(
|
|
305
|
+
* function(result) {
|
|
306
|
+
* if (result && result[0]) {
|
|
307
|
+
* console.log('Opened a pointcloud viewer through API!', result[0]);
|
|
308
|
+
* }
|
|
309
|
+
* }
|
|
310
|
+
* ).catch(
|
|
311
|
+
* function(reason) {
|
|
312
|
+
* console.log('Error opening pointcloud viewer: ' + reason);
|
|
313
|
+
* }
|
|
314
|
+
* )
|
|
315
|
+
* @example <caption>Open a panorama viewer and an aerial pointcloud viewer by coordinate:</caption>
|
|
316
|
+
* StreetSmartApi.open(
|
|
317
|
+
* {
|
|
318
|
+
* coordinate: [121692.34, 487812.37, 5.60],
|
|
319
|
+
* },
|
|
320
|
+
* {
|
|
321
|
+
* viewerType: [StreetSmartApi.ViewerType.PANORAMA, StreetSmartApi.ViewerType.POINTCLOUD],
|
|
322
|
+
* srs: 'EPSG:28992',
|
|
323
|
+
* panoramaViewer: { replace: false, },
|
|
324
|
+
* pointcloudViewer: { pointCloudType: StreetSmartApi.PointCloudType.AERIAL }}).then(
|
|
325
|
+
* function(result) {
|
|
326
|
+
* if (result) {
|
|
327
|
+
* console.log('Opened a pointcloud viewer and a panorama viewer through API!', result);
|
|
328
|
+
* }
|
|
329
|
+
* }
|
|
330
|
+
* ).catch(
|
|
331
|
+
* function(reason) {
|
|
332
|
+
* console.log('Error opening pointcloud viewer and panorama viewer: ' + reason);
|
|
333
|
+
* }
|
|
334
|
+
* )
|
|
335
|
+
* @example <caption>Open a meshviewer by coordinates:</caption>
|
|
336
|
+
* StreetSmartApi.open(
|
|
337
|
+
* {
|
|
338
|
+
* coordinate: [121293.08, 487400, 69],
|
|
339
|
+
* },
|
|
340
|
+
* {
|
|
341
|
+
* viewerType: StreetSmartApi.ViewerType.MESHVIEWER,
|
|
342
|
+
* srs: 'EPSG:28992',
|
|
343
|
+
* meshviewer: {
|
|
344
|
+
* fromViewer: StreetSmartApi.ViewerType.PANORAMA,
|
|
345
|
+
* }
|
|
346
|
+
* }).then(
|
|
347
|
+
* function(result) {
|
|
348
|
+
* if (result) {
|
|
349
|
+
* console.log('Opened a meshviewer through the API', result);
|
|
350
|
+
* }
|
|
351
|
+
* }
|
|
352
|
+
* ).catch(
|
|
353
|
+
* function(reason) {
|
|
354
|
+
* console.log('Error opening meshviewer: ' + reason);
|
|
355
|
+
* }
|
|
356
|
+
* )
|
|
357
|
+
* @example <caption>Open a meshviewer by imageID or address: (choose one)</caption>
|
|
358
|
+
* StreetSmartApi.open("WE4UGIO7" || "Dam 3, Amsterdam",
|
|
359
|
+
* {
|
|
360
|
+
* viewerType: StreetSmartApi.ViewerType.MESHVIEWER,
|
|
361
|
+
* srs: 'EPSG:28992',
|
|
362
|
+
* meshviewer: {
|
|
363
|
+
* fromViewer: StreetSmartApi.ViewerType.PANORAMA,
|
|
364
|
+
* }
|
|
365
|
+
* }).then(
|
|
366
|
+
* function(result) {
|
|
367
|
+
* if (result) {
|
|
368
|
+
* console.log('Opened a meshviewer through the API', result);
|
|
369
|
+
* }
|
|
370
|
+
* }
|
|
371
|
+
* ).catch(
|
|
372
|
+
* function(reason) {
|
|
373
|
+
* console.log('Error opening meshviewer: ' + reason);
|
|
374
|
+
* }
|
|
375
|
+
* )
|
|
376
|
+
*/
|
|
377
|
+
static open(query: OpenViewerQuery, options: OpenViewerOptions): Promise<Viewer[]>;
|
|
44
378
|
|
|
45
|
-
|
|
379
|
+
static destroy(options: { targetElement: HTMLElement; loginOauth: boolean }): Promise<void>;
|
|
46
380
|
|
|
47
|
-
|
|
381
|
+
static getAddressSettings(): { locale: string; database: string };
|
|
48
382
|
|
|
49
|
-
|
|
383
|
+
static getApiReadyState(): boolean;
|
|
50
384
|
|
|
51
|
-
|
|
385
|
+
static getApplicationName(): string;
|
|
52
386
|
|
|
53
|
-
|
|
387
|
+
static getApplicationVersion(): string;
|
|
54
388
|
|
|
55
|
-
|
|
389
|
+
static getDebugLogs(): string[];
|
|
56
390
|
|
|
57
|
-
|
|
391
|
+
static getPermissions(): string[];
|
|
58
392
|
|
|
59
|
-
|
|
393
|
+
static getViewers(): Viewer[];
|
|
60
394
|
|
|
61
|
-
|
|
395
|
+
/**
|
|
396
|
+
* @returns {Array|null} Returns an array that includes type, GeoJSON data, and CRS object. Returns `null` if there is no active measurement.
|
|
397
|
+
* @example
|
|
398
|
+
* // Get the active measurement data
|
|
399
|
+
* const result = StreetSmartApi.getActiveMeasurement();
|
|
400
|
+
*/
|
|
401
|
+
static getActiveMeasurement(): MeasurementCollection | null;
|
|
62
402
|
|
|
63
|
-
|
|
403
|
+
/**
|
|
404
|
+
* ** EXPERIMENTAL **
|
|
405
|
+
* Set the active measurement.
|
|
406
|
+
*
|
|
407
|
+
* @param {object} geojson - A GeoJSON FeatureCollection including a CRS object. See http://geojson.org/geojson-spec#coordinate-reference-system-objects.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* // Set the active measurement data
|
|
411
|
+
* const measurement = StreetSmartApi.getActiveMeasurement();
|
|
412
|
+
*
|
|
413
|
+
* // Modify the measurement
|
|
414
|
+
* measurement.features[0].properties.id = 'changed_measurement';
|
|
415
|
+
*
|
|
416
|
+
* // Set the modified measurement
|
|
417
|
+
* StreetSmartApi.setActiveMeasurement(measurement)
|
|
418
|
+
*/
|
|
419
|
+
static setActiveMeasurement(geojson: MeasurementCollection): void;
|
|
64
420
|
|
|
65
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Start measurement mode for the given panorama viewer.
|
|
423
|
+
*
|
|
424
|
+
* @param viewer - An instance of {@link PanoramaViewer} or {@link ObliqueViewer}.
|
|
425
|
+
* @param {Object} [options] - Object containing measurement options.
|
|
426
|
+
* @param [options.geometry] - Bypasses the measurement mode dialog and starts measurement in the given mode.
|
|
427
|
+
* @param [options.measureMethod] - Starts the measurement with a specified measurement method. MeasureSmart, SmartClick, or Forward Intersection. Only applicable to panorama measurements.
|
|
428
|
+
* @param [options.showSaveMeasurementButton] - Show the 'Save measurement' button during the measurement. Note: With the button toggle: 'SAVE_MEASUREMENT' you can also enable the measurement button. You need this toggle if you want to start the measurement from the panorama viewer.
|
|
429
|
+
* @param [options.recordingServiceType] - Type of recordings which will be used to perform measurements on. Defaults to RecordingSerivceType.DCR.
|
|
430
|
+
* @example <caption>Start measurement mode without passing a geometry type.
|
|
431
|
+
* The user can then choose the measurement mode.</caption>
|
|
432
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer);
|
|
433
|
+
* @example <caption>Start measurement mode as point measurement</caption>
|
|
434
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry: StreetSmartApi.MeasurementGeometryType.POINT});
|
|
435
|
+
* @example <caption>Start measurement mode as distance measurement</caption>
|
|
436
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry: StreetSmartApi.MeasurementGeometryType.LINESTRING});
|
|
437
|
+
* @example <caption>Start measurement mode as surface measurement</caption>
|
|
438
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry: StreetSmartApi.MeasurementGeometryType.POLYGON});
|
|
439
|
+
* @example <caption>Start measurement mode as surface measurement, with a measure method Smart Click</caption>
|
|
440
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry: StreetSmartApi.MeasurementGeometryType.POLYGON, measureMethod: StreetSmartApi.MeasureMethods.SMART_CLICK });
|
|
441
|
+
* @example <caption>Start measurement mode as surface measurement, with the show measurement button visible</caption>
|
|
442
|
+
* StreetSmartApi.startMeasurementMode(panoramaViewer, {geometry: StreetSmartApi.MeasurementGeometryType.POLYGON, showSaveMeasurementButton: true });
|
|
443
|
+
* @example <caption>Show the 'Save measurement' button during a measurement. The measurement can be started from the panorama viewer.</caption>
|
|
444
|
+
* StreetSmartApi.open('5D4KX5SM', {
|
|
445
|
+
* viewerType: [StreetSmartApi.ViewerType.PANORAMA],
|
|
446
|
+
* srs: 'EPSG:28992',
|
|
447
|
+
* replace: false,
|
|
448
|
+
* }).then(
|
|
449
|
+
* function(result) {
|
|
450
|
+
* if (result && result[0]) {
|
|
451
|
+
* const viewer = result[0];
|
|
452
|
+
* viewer.toggleButtonEnabled(StreetSmartApi.PanoramaViewerUi.SAVE_MEASUREMENT);
|
|
453
|
+
* }
|
|
454
|
+
* }).catch(
|
|
455
|
+
* function(reason) {
|
|
456
|
+
* console.log('Error opening panorama viewer: ' + reason);
|
|
457
|
+
* }
|
|
458
|
+
* )
|
|
459
|
+
*/
|
|
460
|
+
static startMeasurementMode(
|
|
461
|
+
viewer: PanoramaViewer | ObliqueViewer,
|
|
462
|
+
options?: {
|
|
463
|
+
geometry?: MeasurementGeometryTypes;
|
|
464
|
+
measureMethod?: MeasureMethods;
|
|
465
|
+
showSaveMeasurementButton?: boolean;
|
|
466
|
+
recordingServiceType?: RecordingService;
|
|
467
|
+
},
|
|
468
|
+
): void;
|
|
66
469
|
|
|
67
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Stop measurement mode. */
|
|
472
|
+
static stopMeasurementMode(): void;
|
|
68
473
|
|
|
69
|
-
|
|
474
|
+
static on<T extends GlobalViewerEvents | MeasurementEvents>(
|
|
475
|
+
type: T,
|
|
476
|
+
callback: GlobalEventCallback<T>,
|
|
477
|
+
): StreetSmartApi;
|
|
70
478
|
|
|
71
|
-
|
|
479
|
+
static off<T extends GlobalViewerEvents | MeasurementEvents>(
|
|
480
|
+
type: T,
|
|
481
|
+
callback: GlobalEventCallback<T>,
|
|
482
|
+
): StreetSmartApi;
|
|
72
483
|
|
|
73
|
-
|
|
484
|
+
/**
|
|
485
|
+
* Sets whether cursor movements will snap to nearby features while in measurement mode.
|
|
486
|
+
*
|
|
487
|
+
* @param {boolean} enabled - Whether to enable or disable snapping.
|
|
488
|
+
* @default false
|
|
489
|
+
*/
|
|
490
|
+
static setSnapping(enabled: boolean): void;
|
|
74
491
|
|
|
75
|
-
|
|
492
|
+
/**
|
|
493
|
+
* Sets the overlay draw distance.
|
|
494
|
+
*
|
|
495
|
+
* @param overlayDrawDistance - The distance value for overlay drawing.
|
|
496
|
+
* @example
|
|
497
|
+
* var layer = StreetSmartApi.addOverlay("My GeoJSON", {}, "EPSG:28992");
|
|
498
|
+
* StreetSmartApi.setOverlayDrawDistance(50);
|
|
499
|
+
*/
|
|
500
|
+
static setOverlayDrawDistance(overlayDrawDistance: number): void;
|
|
76
501
|
|
|
77
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Add a GeoJSON overlay to the panorama viewer. Can be removed with {@link StreetSmartApi.removeOverlay}
|
|
504
|
+
* @example
|
|
505
|
+
* // Add Overlay
|
|
506
|
+
* const options = { name: 'My GeoJSON', geojson: {}, sourceSrs: 'EPSG:28992', sldXMLtext: 'XMLstring' };
|
|
507
|
+
* const layer = StreetSmartApi.addOverlay(options);
|
|
508
|
+
* const {id: layerId} = layer;
|
|
509
|
+
*/
|
|
510
|
+
static addOverlay(options: {
|
|
511
|
+
geojson: object;
|
|
512
|
+
name?: string;
|
|
513
|
+
sourceSrs?: string;
|
|
514
|
+
sldXMLtext?: string;
|
|
515
|
+
color?: string;
|
|
516
|
+
visible?: boolean;
|
|
517
|
+
}): { id: string };
|
|
78
518
|
|
|
79
|
-
|
|
519
|
+
/**
|
|
520
|
+
* Remove a GeoJSON overlay from the panorama viewer
|
|
521
|
+
* @param layerId - Id of the layer. Use the id that was returned by {@link StreetSmartApi.addOverlay}
|
|
522
|
+
* @example
|
|
523
|
+
* // Add Overlay
|
|
524
|
+
* const layer = StreetSmartApi.addOverlay({ name: 'My GeoJSON', geojson: {}, sourceSrs: 'EPSG:28992' });
|
|
525
|
+
* // Remove Overlay
|
|
526
|
+
* StreetSmartApi.removeOverlay(layer.id);
|
|
527
|
+
*/
|
|
528
|
+
static removeOverlay(layerId: string): void;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Add a WFS Layer as an overlay to the panorama viewer. Can be removed with {@link removeOverlay}
|
|
532
|
+
*
|
|
533
|
+
* @param {Object} options - Set of parameters for overlay
|
|
534
|
+
* @param {string} options.name - Name of the layer
|
|
535
|
+
* @param {string} options.url - The URL where the WFS is hosted. Not needed if a remoteOWS is provided in the SLD.
|
|
536
|
+
* @param {string} options.typeName - The type name of the layer. Not needed if a remoteOWS is provided in the SLD.
|
|
537
|
+
* @param {string} options.version - The WFS version to be used
|
|
538
|
+
* @param {string} [options.sldXMLtext] - Optional XML string for Styled Layer Descriptor, this can contain a remoteOWS with WFS service.
|
|
539
|
+
* @param {string} [options.color] - Optional color string, needs to be a hexadecimal string value
|
|
540
|
+
* @param {boolean} [options.authRequired] - Whether this layer requires authentication to access
|
|
541
|
+
* @param {credentials} [options.credentials] - Credentials used to access the layer.
|
|
542
|
+
* @param {boolean} [options.visible] - Optional for setting the visibility of the layer, default is true
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* // Add WFS layer
|
|
546
|
+
* var options = {
|
|
547
|
+
* name: 'My Super cool layer',
|
|
548
|
+
* url: 'http://testserver.com/geoserver/streets/wfs',
|
|
549
|
+
* typeName: 'streets:street-center-lines',
|
|
550
|
+
* version: '1.1.0',
|
|
551
|
+
* color: '#00ff00',
|
|
552
|
+
* authRequired: true,
|
|
553
|
+
* credentials: { username: 'Mike', password: 'Tyson'}
|
|
554
|
+
* };
|
|
555
|
+
* var layer = StreetSmartApi.addWFSLayer(options);
|
|
556
|
+
* var layerId = layer.id;
|
|
557
|
+
*
|
|
558
|
+
* @returns {{id: string}}
|
|
559
|
+
*/
|
|
560
|
+
static addWFSLayer(options: {
|
|
561
|
+
name: string;
|
|
562
|
+
url: string;
|
|
563
|
+
typeName: string;
|
|
564
|
+
version: string;
|
|
565
|
+
sldXMLtext?: string;
|
|
566
|
+
color?: string;
|
|
567
|
+
authRequired?: boolean;
|
|
568
|
+
credentials?: Credentials;
|
|
569
|
+
visible?: boolean;
|
|
570
|
+
customLayerType?: string;
|
|
571
|
+
}): { id: string };
|
|
572
|
+
}
|
|
80
573
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclomedia/streetsmart-api",
|
|
3
|
-
"version": "23.14.
|
|
3
|
+
"version": "23.14.5",
|
|
4
4
|
"description": "The Streetsmart API wrapped as a npm package",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "scripts/build.sh",
|
|
7
7
|
"rollup": "rollup -c",
|
|
8
8
|
"docs": "npx typedoc --out docs src --theme minimal",
|
|
9
|
-
"test": "jest"
|
|
10
|
-
"prepublishOnly": "npm run build && npm run test && npm version patch",
|
|
11
|
-
"postpublish": "git add . && git commit -m 'Patch update' && git push"
|
|
9
|
+
"test": "jest"
|
|
12
10
|
},
|
|
13
11
|
"repository": {
|
|
14
12
|
"type": "git",
|
|
@@ -29,23 +27,22 @@
|
|
|
29
27
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
30
28
|
"@rollup/plugin-replace": "^5.0.5",
|
|
31
29
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
32
|
-
"@rollup/
|
|
30
|
+
"@rollup/wasm-node": "^4.9.2",
|
|
33
31
|
"@types/jest": "^29.5.7",
|
|
34
32
|
"jest": "^29.7.0",
|
|
35
|
-
"rollup": "^4.
|
|
33
|
+
"rollup": "^4.9.2",
|
|
36
34
|
"ts-jest": "^29.1.1",
|
|
35
|
+
"type-fest": "^4.8.3",
|
|
37
36
|
"typedoc": "^0.25.2",
|
|
38
37
|
"typescript": "^5.2.2"
|
|
39
38
|
},
|
|
40
39
|
"module": "dist/esm/index.js",
|
|
41
|
-
"
|
|
42
|
-
".": {
|
|
43
|
-
"default": "./dist/esm/index.js"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
40
|
+
"main": "./dist/esm/index.js",
|
|
46
41
|
"files": [
|
|
47
42
|
"dist",
|
|
48
|
-
"index.d.ts"
|
|
43
|
+
"index.d.ts",
|
|
44
|
+
"README.md",
|
|
45
|
+
"src/types/*"
|
|
49
46
|
],
|
|
50
|
-
"
|
|
47
|
+
"types": "index.d.ts"
|
|
51
48
|
}
|