@ino-cesium/common 0.0.3 → 0.0.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/dist/index.d.ts +2 -197
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
2
|
import { Cartesian3, Viewer, Cesium3DTileFeature, ImageryLayer, Cesium3DTileset, Cartesian2, Cartographic, SkyBox, Entity, SampledPositionProperty, JulianDate } from 'cesium';
|
|
3
|
+
import { FeatureCollection, Point, GeoJsonProperties, LineString, Polygon } from 'geojson';
|
|
3
4
|
|
|
4
5
|
interface ISetViewByLngLatOptions {
|
|
5
6
|
lng: number;
|
|
@@ -202,202 +203,6 @@ declare class Popup {
|
|
|
202
203
|
destroy(): void;
|
|
203
204
|
}
|
|
204
205
|
|
|
205
|
-
// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems
|
|
206
|
-
// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* The value values for the "type" property of GeoJSON Objects.
|
|
212
|
-
* https://tools.ietf.org/html/rfc7946#section-1.4
|
|
213
|
-
*/
|
|
214
|
-
type GeoJsonTypes = GeoJSON$1["type"];
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Bounding box
|
|
218
|
-
* https://tools.ietf.org/html/rfc7946#section-5
|
|
219
|
-
*/
|
|
220
|
-
type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* A Position is an array of coordinates.
|
|
224
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.1
|
|
225
|
-
* Array should contain between two and three elements.
|
|
226
|
-
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
|
|
227
|
-
* but the current specification only allows X, Y, and (optionally) Z to be defined.
|
|
228
|
-
*
|
|
229
|
-
* Note: the type will not be narrowed down to `[number, number] | [number, number, number]` due to
|
|
230
|
-
* marginal benefits and the large impact of breaking change.
|
|
231
|
-
*
|
|
232
|
-
* See previous discussions on the type narrowing:
|
|
233
|
-
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21590|Nov 2017}
|
|
234
|
-
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/67773|Dec 2023}
|
|
235
|
-
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/71441| Dec 2024}
|
|
236
|
-
*
|
|
237
|
-
* One can use a
|
|
238
|
-
* {@link https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates|user-defined type guard that returns a type predicate}
|
|
239
|
-
* to determine if a position is a 2D or 3D position.
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* import type { Position } from 'geojson';
|
|
243
|
-
*
|
|
244
|
-
* type StrictPosition = [x: number, y: number] | [x: number, y: number, z: number]
|
|
245
|
-
*
|
|
246
|
-
* function isStrictPosition(position: Position): position is StrictPosition {
|
|
247
|
-
* return position.length === 2 || position.length === 3
|
|
248
|
-
* };
|
|
249
|
-
*
|
|
250
|
-
* let position: Position = [-116.91, 45.54];
|
|
251
|
-
*
|
|
252
|
-
* let x: number;
|
|
253
|
-
* let y: number;
|
|
254
|
-
* let z: number | undefined;
|
|
255
|
-
*
|
|
256
|
-
* if (isStrictPosition(position)) {
|
|
257
|
-
* // `tsc` would throw an error if we tried to destructure a fourth parameter
|
|
258
|
-
* [x, y, z] = position;
|
|
259
|
-
* } else {
|
|
260
|
-
* throw new TypeError("Position is not a 2D or 3D point");
|
|
261
|
-
* }
|
|
262
|
-
*/
|
|
263
|
-
type Position = number[];
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* The base GeoJSON object.
|
|
267
|
-
* https://tools.ietf.org/html/rfc7946#section-3
|
|
268
|
-
* The GeoJSON specification also allows foreign members
|
|
269
|
-
* (https://tools.ietf.org/html/rfc7946#section-6.1)
|
|
270
|
-
* Developers should use "&" type in TypeScript or extend the interface
|
|
271
|
-
* to add these foreign members.
|
|
272
|
-
*/
|
|
273
|
-
interface GeoJsonObject {
|
|
274
|
-
// Don't include foreign members directly into this type def.
|
|
275
|
-
// in order to preserve type safety.
|
|
276
|
-
// [key: string]: any;
|
|
277
|
-
/**
|
|
278
|
-
* Specifies the type of GeoJSON object.
|
|
279
|
-
*/
|
|
280
|
-
type: GeoJsonTypes;
|
|
281
|
-
/**
|
|
282
|
-
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
|
|
283
|
-
* The value of the bbox member is an array of length 2*n where n is the number of dimensions
|
|
284
|
-
* represented in the contained geometries, with all axes of the most southwesterly point
|
|
285
|
-
* followed by all axes of the more northeasterly point.
|
|
286
|
-
* The axes order of a bbox follows the axes order of geometries.
|
|
287
|
-
* https://tools.ietf.org/html/rfc7946#section-5
|
|
288
|
-
*/
|
|
289
|
-
bbox?: BBox | undefined;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Union of GeoJSON objects.
|
|
294
|
-
*/
|
|
295
|
-
type GeoJSON$1<G extends Geometry | null = Geometry, P = GeoJsonProperties> =
|
|
296
|
-
| G
|
|
297
|
-
| Feature<G, P>
|
|
298
|
-
| FeatureCollection<G, P>;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Geometry object.
|
|
302
|
-
* https://tools.ietf.org/html/rfc7946#section-3
|
|
303
|
-
*/
|
|
304
|
-
type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Point geometry object.
|
|
308
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
309
|
-
*/
|
|
310
|
-
interface Point extends GeoJsonObject {
|
|
311
|
-
type: "Point";
|
|
312
|
-
coordinates: Position;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* MultiPoint geometry object.
|
|
317
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
318
|
-
*/
|
|
319
|
-
interface MultiPoint extends GeoJsonObject {
|
|
320
|
-
type: "MultiPoint";
|
|
321
|
-
coordinates: Position[];
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* LineString geometry object.
|
|
326
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
327
|
-
*/
|
|
328
|
-
interface LineString extends GeoJsonObject {
|
|
329
|
-
type: "LineString";
|
|
330
|
-
coordinates: Position[];
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* MultiLineString geometry object.
|
|
335
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
336
|
-
*/
|
|
337
|
-
interface MultiLineString extends GeoJsonObject {
|
|
338
|
-
type: "MultiLineString";
|
|
339
|
-
coordinates: Position[][];
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Polygon geometry object.
|
|
344
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
345
|
-
*/
|
|
346
|
-
interface Polygon extends GeoJsonObject {
|
|
347
|
-
type: "Polygon";
|
|
348
|
-
coordinates: Position[][];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* MultiPolygon geometry object.
|
|
353
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
354
|
-
*/
|
|
355
|
-
interface MultiPolygon extends GeoJsonObject {
|
|
356
|
-
type: "MultiPolygon";
|
|
357
|
-
coordinates: Position[][][];
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Geometry Collection
|
|
362
|
-
* https://tools.ietf.org/html/rfc7946#section-3.1.8
|
|
363
|
-
*/
|
|
364
|
-
interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
|
|
365
|
-
type: "GeometryCollection";
|
|
366
|
-
geometries: G[];
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
type GeoJsonProperties = { [name: string]: any } | null;
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* A feature object which contains a geometry and associated properties.
|
|
373
|
-
* https://tools.ietf.org/html/rfc7946#section-3.2
|
|
374
|
-
*/
|
|
375
|
-
interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
376
|
-
type: "Feature";
|
|
377
|
-
/**
|
|
378
|
-
* The feature's geometry
|
|
379
|
-
*/
|
|
380
|
-
geometry: G;
|
|
381
|
-
/**
|
|
382
|
-
* A value that uniquely identifies this feature in a
|
|
383
|
-
* https://tools.ietf.org/html/rfc7946#section-3.2.
|
|
384
|
-
*/
|
|
385
|
-
id?: string | number | undefined;
|
|
386
|
-
/**
|
|
387
|
-
* Properties associated with this feature.
|
|
388
|
-
*/
|
|
389
|
-
properties: P;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* A collection of feature objects.
|
|
394
|
-
* https://tools.ietf.org/html/rfc7946#section-3.3
|
|
395
|
-
*/
|
|
396
|
-
interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
397
|
-
type: "FeatureCollection";
|
|
398
|
-
features: Array<Feature<G, P>>;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
206
|
/**
|
|
402
207
|
* 生成随机点输入geojosn 格式
|
|
403
208
|
* @param count 点数量
|
|
@@ -766,4 +571,4 @@ interface IOpenAnimOptions {
|
|
|
766
571
|
}
|
|
767
572
|
|
|
768
573
|
export { BaseMaterialProperty, BasePrimitive, types as Common, FlyAttitude, Popup, RoamStatus, Tooltip, calcArea, calcCameraHeightFromZoom, calcGeodesicDistance, calcGeodesicDistances, calcLerpPosition, calcPoistionCenter, calcSpaceDistance, calcSpaceDistances, calcTerrainHeightFromPositions, calcTriangleArea, calcZoomFromCameraHeight, changeGlobeOpatity, changeUndergroundModel, clacPositionsForParabola, createBottomStatusBar, createEagleEye, createOpenAnim, createRoamHandler, createSkyBox, createSkyBoxOnGround, flyToCameraView, flyToCesium3DTile, flyToDataSource, flyToFromSphere, flyToImagery, flyToLnglat, flyToPosition, getCameraView, initCesium, initCesiumEvent, makeLnglatToPosition, makeLnglatsToLineGeojson, makeLnglatsToPointGeojson, makeLnglatsToPolygonGeojson, makeLnglatsToPositions, makePositionsClose, makePositionsForAntiClockwise, makePositionsForClockwise, makePositionsToLnglats, makePositiontoLnglat, makeYawPitchRollToHeadingPitchRoll, numberId, randomColor, randomPointToGeoJson, randomPolygonToGeoJson, randomPolylineToGeoJson, setViewToLnglat, twinkleModel };
|
|
769
|
-
export type { IRoamEvent, IRoamHandler, IRoamItem, IRoamItemHPR, IRoaming };
|
|
574
|
+
export type { IOpenAnimOptions, IRoamEvent, IRoamHandler, IRoamItem, IRoamItemHPR, IRoaming };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ino-cesium/common",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"author": "koino",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cesium",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"ino-cesium-common"
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
|
-
".": "./dist/index.js"
|
|
13
|
-
"./ino-css": "./dist/ino-cesium.css"
|
|
12
|
+
".": "./dist/index.js"
|
|
14
13
|
},
|
|
15
14
|
"typesVersions": {
|
|
16
15
|
"*": {
|
|
17
16
|
"*": [
|
|
18
|
-
"./src/*"
|
|
17
|
+
"./src/*",
|
|
18
|
+
"./dist/*"
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
},
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@turf/turf": "^7.0.0"
|
|
32
|
+
"@turf/turf": "^7.0.0",
|
|
33
|
+
"@ino-cesium/common": "0.0.4"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"cesium": "*"
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/geojson": "^7946.0.14"
|
|
39
40
|
},
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
40
42
|
"scripts": {
|
|
41
43
|
"build": "rimraf dist && rollup -c",
|
|
42
44
|
"clean": "rimraf dist",
|