@ino-cesium/common 0.0.4 → 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 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 };
@@ -0,0 +1,86 @@
1
+ /**---------tooltip start---------**/
2
+ .twipsy {
3
+ display: none;
4
+ position: absolute;
5
+ visibility: visible;
6
+ max-width: 300px;
7
+ min-width: 100px;
8
+ padding: 5px;
9
+ font-size: 12px;
10
+ z-index: 1000;
11
+ }
12
+
13
+ .twipsy-inner {
14
+ padding: 3px 8px;
15
+ background-color: rgba(117, 117, 117, 0.8);
16
+ color: white;
17
+ text-align: left;
18
+ max-width: 300px;
19
+ text-decoration: none;
20
+ -webkit-border-radius: 4px;
21
+ -moz-border-radius: 4px;
22
+ border-radius: 4px;
23
+ border: 1px solid #aaa;
24
+ }
25
+
26
+ /**---------tooltip end---------**/
27
+
28
+ /**---------draw edit ui start---------**/
29
+ .draw-edit-ui {
30
+ position: fixed;
31
+ left: 0;
32
+ top: 0;
33
+ width: 132px;
34
+ height: 28px;
35
+ }
36
+
37
+ .draw-edit-icon {
38
+ width: 28px;
39
+ cursor: pointer;
40
+ background: rgba(255, 255, 255, 1);
41
+ border: 1px solid #1296db;
42
+ padding: 2px;
43
+ margin-right: 5px;
44
+ border-radius: 50%;
45
+ }
46
+
47
+ /**---------draw edit ui end---------**/
48
+
49
+ /**---------bottom status bar start---------**/
50
+ .bottom-status-bar {
51
+ position: fixed;
52
+ bottom: 0px;
53
+ display: flex;
54
+ width: 100%;
55
+ justify-content: space-between;
56
+ align-items: center;
57
+ z-index: 99999;
58
+ background: rgba(0, 0, 0, 0.4);
59
+ padding: 2px 8px;
60
+ pointer-events: none;
61
+ font-weight: bold;
62
+ height: 30px;
63
+
64
+ div {
65
+ color: #fff;
66
+ border-radius: 5px;
67
+ margin-right: 5px;
68
+ }
69
+ .scale-bar {
70
+ border: 2px solid #ffffff;
71
+ border-radius: 0px !important;
72
+ padding: 0 10px;
73
+ border-top: none !important;
74
+ height: 10px;
75
+ position: relative;
76
+ bottom: -6px;
77
+ display: flex;
78
+ justify-content: center;
79
+ }
80
+ .scale-label {
81
+ margin-top: -15px;
82
+ margin-right: 0px;
83
+ }
84
+ }
85
+
86
+ /**---------bottom status bar end---------**/
package/package.json CHANGED
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "name": "@ino-cesium/common",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "author": "koino",
6
- "types": "./dist/index.d.ts",
7
6
  "keywords": [
8
7
  "cesium",
9
8
  "ino-cesium",
10
9
  "ino-cesium-common"
11
10
  ],
12
11
  "exports": {
13
- ".": "./dist/index.js",
14
- "./ino-css": "./dist/ino-cesium.css"
12
+ ".": "./dist/index.js"
15
13
  },
16
14
  "typesVersions": {
17
15
  "*": {
18
16
  "*": [
19
- "./src/*"
17
+ "./src/*",
18
+ "./dist/*"
20
19
  ]
21
20
  }
22
21
  },
@@ -30,7 +29,8 @@
30
29
  "access": "public"
31
30
  },
32
31
  "dependencies": {
33
- "@turf/turf": "^7.0.0"
32
+ "@turf/turf": "^7.0.0",
33
+ "@ino-cesium/common": "0.0.4"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "cesium": "*"
@@ -38,6 +38,7 @@
38
38
  "devDependencies": {
39
39
  "@types/geojson": "^7946.0.14"
40
40
  },
41
+ "types": "./dist/index.d.ts",
41
42
  "scripts": {
42
43
  "build": "rimraf dist && rollup -c",
43
44
  "clean": "rimraf dist",