@anov/gis-skills-cli 0.0.0-stage → 0.3.3

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +637 -0
  2. package/INSTALL.md +481 -0
  3. package/LICENSE +15 -0
  4. package/README.md +148 -2
  5. package/RELEASING.md +162 -0
  6. package/bin/anov-gis-skills.mjs +470 -0
  7. package/lib/mcp-config.mjs +273 -0
  8. package/package.json +43 -4
  9. package/skills/anovgis-analysis/SKILL.md +585 -0
  10. package/skills/anovgis-effects/SKILL.md +260 -0
  11. package/skills/anovgis-imagery-terrain/SKILL.md +505 -0
  12. package/skills/anovgis-layers/SKILL.md +627 -0
  13. package/skills/anovgis-materials/SKILL.md +635 -0
  14. package/skills/anovgis-models-3dtiles/SKILL.md +448 -0
  15. package/skills/anovgis-pitfalls/SKILL.md +561 -0
  16. package/skills/anovgis-popup-widget/SKILL.md +474 -0
  17. package/skills/anovgis-primitives/SKILL.md +482 -0
  18. package/skills/anovgis-vector-graphics/SKILL.md +602 -0
  19. package/skills/anovgis-viewer/SKILL.md +618 -0
  20. package/skills/using-anovgis/DEMO-MAP.md +64 -0
  21. package/skills/using-anovgis/DEMO-SKILL-MAP.md +248 -0
  22. package/skills/using-anovgis/DOMAINS.md +183 -0
  23. package/skills/using-anovgis/REFERENCE.md +114 -0
  24. package/skills/using-anovgis/SKILL.md +392 -0
  25. package/skills/using-anovgis/templates/README.md +154 -0
  26. package/skills/using-anovgis/templates/combo1-vue3-vite.md +295 -0
  27. package/skills/using-anovgis/templates/combo2-vue2-cli.md +119 -0
  28. package/skills/using-anovgis/templates/combo3-html-cdn.md +107 -0
  29. package/skills/using-anovgis/templates/combo4-vanilla-webpack.md +91 -0
  30. package/skills/using-anovgis/templates/wizard-profiles.md +105 -0
  31. package/vendor/cesiumjs-skills/LICENSE +201 -0
  32. package/vendor/cesiumjs-skills/NOTICE +18 -0
  33. package/vendor/cesiumjs-skills/skills/cesiumjs-3d-tiles/SKILL.md +465 -0
  34. package/vendor/cesiumjs-skills/skills/cesiumjs-camera/SKILL.md +500 -0
  35. package/vendor/cesiumjs-skills/skills/cesiumjs-core-utilities/SKILL.md +403 -0
  36. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/REFERENCE.md +397 -0
  37. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/SKILL.md +351 -0
  38. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/01-diffuse-tint.js +38 -0
  39. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/02-texture-swap.js +42 -0
  40. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/03-feature-id-tileset.js +29 -0
  41. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/04-translucent-override.js +37 -0
  42. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/05-vertex-displacement.js +49 -0
  43. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/06-metadata-ramp.js +34 -0
  44. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/07-voxel-shader.js +27 -0
  45. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/README.md +19 -0
  46. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/_sandcastle-template.html +9 -0
  47. package/vendor/cesiumjs-skills/skills/cesiumjs-entities/SKILL.md +389 -0
  48. package/vendor/cesiumjs-skills/skills/cesiumjs-imagery/SKILL.md +471 -0
  49. package/vendor/cesiumjs-skills/skills/cesiumjs-interaction/SKILL.md +423 -0
  50. package/vendor/cesiumjs-skills/skills/cesiumjs-materials-shaders/SKILL.md +292 -0
  51. package/vendor/cesiumjs-skills/skills/cesiumjs-models-particles/SKILL.md +423 -0
  52. package/vendor/cesiumjs-skills/skills/cesiumjs-primitives/SKILL.md +537 -0
  53. package/vendor/cesiumjs-skills/skills/cesiumjs-spatial-math/SKILL.md +358 -0
  54. package/vendor/cesiumjs-skills/skills/cesiumjs-terrain-environment/SKILL.md +401 -0
  55. package/vendor/cesiumjs-skills/skills/cesiumjs-time-properties/SKILL.md +353 -0
  56. package/vendor/cesiumjs-skills/skills/cesiumjs-viewer-setup/SKILL.md +434 -0
  57. package/vendor/cesiumjs-skills/skills/using-cesiumjs-skills/SKILL.md +35 -0
@@ -0,0 +1,403 @@
1
+ ---
2
+ name: cesiumjs-core-utilities
3
+ description: "CesiumJS core utilities and networking - Resource, Color, Event, Request, RequestScheduler, error handling, helper functions, feature detection. Use when fetching remote data, managing HTTP requests, working with colors, handling events, debugging errors, or using utility functions like defined, clone, or buildModuleUrl."
4
+ ---
5
+ # CesiumJS Core Utilities & Networking
6
+
7
+ Version baseline: CesiumJS v1.142+ (ES module imports, `defaultValue` removed in v1.134)
8
+
9
+ ## Breaking Change: defaultValue Removed (v1.134)
10
+
11
+ ```js
12
+ // WRONG (removed in v1.134)
13
+ const name = defaultValue(options.name, "default");
14
+ const opts = defaultValue(options, defaultValue.EMPTY_OBJECT);
15
+
16
+ // CORRECT (v1.134+)
17
+ import { Frozen } from "cesium";
18
+ const name = options.name ?? "default";
19
+ const opts = options ?? Frozen.EMPTY_OBJECT;
20
+ ```
21
+
22
+ `Frozen.EMPTY_OBJECT` is `Object.freeze({})` and `Frozen.EMPTY_ARRAY` is `Object.freeze([])`. Use them as safe defaults for options objects and array parameters.
23
+
24
+ ## Resource: HTTP Requests and Data Fetching
25
+
26
+ `Resource` is the unified class for all HTTP operations. It wraps URL construction, query parameters, headers, proxying, and retry logic.
27
+
28
+ ### Fetching Data
29
+
30
+ ```js
31
+ import { Resource } from "cesium";
32
+
33
+ // Static shorthand: accepts a URL string or options object
34
+ const jsonData = await Resource.fetchJson({ url: "https://api.example.com/data.json" });
35
+
36
+ // Instance-based: construct once, reuse for multiple fetches
37
+ const resource = new Resource({
38
+ url: "https://api.example.com/features",
39
+ queryParameters: { format: "json", limit: "100" },
40
+ headers: { "Authorization": "Bearer my-token" },
41
+ });
42
+ const features = await resource.fetchJson();
43
+ const text = await resource.fetchText(); // string
44
+ const buffer = await resource.fetchArrayBuffer(); // ArrayBuffer
45
+ const blob = await resource.fetchBlob(); // Blob
46
+ const image = await resource.fetchImage(); // HTMLImageElement or ImageBitmap
47
+ ```
48
+
49
+ ### Derived Resources and Template Values
50
+
51
+ ```js
52
+ import { Resource } from "cesium";
53
+
54
+ const api = new Resource({
55
+ url: "https://tiles.example.com/{version}/tiles/{z}/{x}/{y}.png",
56
+ templateValues: { version: "v2" },
57
+ headers: { "X-Api-Key": "abc123" },
58
+ });
59
+
60
+ // getDerivedResource inherits headers, proxy, and retry settings
61
+ const tile = api.getDerivedResource({
62
+ templateValues: { z: "10", x: "512", y: "384" },
63
+ });
64
+ const tileImage = await tile.fetchImage();
65
+
66
+ // Modify query parameters on an existing resource
67
+ resource.setQueryParameters({ access_token: "new-token" });
68
+ resource.appendQueryParameters({ extra: "param" });
69
+ ```
70
+
71
+ ### Retry and Proxy
72
+
73
+ ```js
74
+ import { Resource, DefaultProxy } from "cesium";
75
+
76
+ // Retry on specific HTTP status codes
77
+ const resource = new Resource({
78
+ url: "https://api.example.com/unstable",
79
+ retryAttempts: 3,
80
+ retryCallback: (resource, error) => {
81
+ if (error.statusCode === 429) {
82
+ return new Promise((resolve) => setTimeout(() => resolve(true), 2000));
83
+ }
84
+ return false;
85
+ },
86
+ });
87
+
88
+ // DefaultProxy appends the target URL as a query parameter
89
+ const proxied = new Resource({
90
+ url: "https://external-server.com/data.json",
91
+ proxy: new DefaultProxy("/proxy/"),
92
+ });
93
+ // Request goes to: /proxy/?https%3A%2F%2Fexternal-server.com%2Fdata.json
94
+ ```
95
+
96
+ ### POST and PUT
97
+
98
+ ```js
99
+ import { Resource } from "cesium";
100
+
101
+ const resource = new Resource({ url: "https://api.example.com/upload" });
102
+ const result = await resource.post(JSON.stringify({ name: "test" }), {
103
+ headers: { "Content-Type": "application/json" },
104
+ });
105
+ // resource.put() works the same way
106
+ ```
107
+
108
+ ## Color
109
+
110
+ RGBA components as floats [0.0, 1.0]. Over 140 named constants as frozen static properties (e.g., `Color.RED`, `Color.CORNFLOWERBLUE`, `Color.TRANSPARENT`).
111
+
112
+ ### Creating Colors
113
+
114
+ ```js
115
+ import { Color } from "cesium";
116
+
117
+ const red = Color.RED; // frozen constant
118
+ const custom = new Color(0.2, 0.6, 0.8, 1.0); // float constructor
119
+ const blue = Color.fromCssColorString("#3498db"); // hex string
120
+ const semiRed = Color.fromCssColorString("rgba(255,0,0,0.5)"); // CSS rgba()
121
+ const coral = Color.fromBytes(255, 127, 80, 255); // 0-255 bytes
122
+ const hsl = Color.fromHsl(0.58, 0.8, 0.5, 1.0); // hue/sat/light
123
+ const bright = Color.fromRandom({ // constrained random
124
+ minimumRed: 0.75, minimumGreen: 0.75, minimumBlue: 0.75, alpha: 1.0,
125
+ });
126
+ ```
127
+
128
+ ### Manipulation and Conversion
129
+
130
+ ```js
131
+ import { Color } from "cesium";
132
+
133
+ const base = Color.fromCssColorString("#3498db");
134
+ const translucent = base.withAlpha(0.5); // new Color with alpha
135
+ const lighter = base.brighten(0.3, new Color()); // requires result param
136
+ const darker = base.darken(0.3, new Color());
137
+ const css = base.toCssColorString(); // "rgb(52,152,219)"
138
+ const hex = base.toCssHexString(); // "#3498db"
139
+ const bytes = base.toBytes(); // [52, 152, 219, 255]
140
+ const equal = Color.RED.equals(new Color(1.0, 0.0, 0.0, 1.0)); // true
141
+ ```
142
+
143
+ ## Event System
144
+
145
+ `Event` is the publish-subscribe mechanism used throughout CesiumJS. Classes expose Event properties like `Viewer.selectedEntityChanged` and `Cesium3DTileset.tileLoad`.
146
+
147
+ ### Basic Usage
148
+
149
+ ```js
150
+ import { Event } from "cesium";
151
+
152
+ const onDataReceived = new Event();
153
+
154
+ // addEventListener returns a removal function
155
+ const removeListener = onDataReceived.addEventListener((data) => {
156
+ console.log("Received:", data);
157
+ });
158
+
159
+ onDataReceived.raiseEvent({ id: 1, value: "test" }); // invoke all listeners
160
+ removeListener(); // unsubscribe
161
+ ```
162
+
163
+ ### EventHelper for Batch Cleanup
164
+
165
+ ```js
166
+ import { EventHelper } from "cesium";
167
+
168
+ const helper = new EventHelper();
169
+ helper.add(viewer.selectedEntityChanged, (entity) => {
170
+ console.log("Selected:", entity?.name);
171
+ });
172
+ helper.add(viewer.clock.onTick, (clock) => { /* per-frame logic */ });
173
+ helper.add(viewer.scene.globe.tileLoadProgressEvent, (queueLength) => {
174
+ console.log("Tiles loading:", queueLength);
175
+ });
176
+
177
+ // Remove all listeners at once (e.g., in a destroy method)
178
+ helper.removeAll();
179
+ ```
180
+
181
+ ## RequestScheduler Configuration
182
+
183
+ `RequestScheduler` is a singleton that manages concurrent request limits. `Request` objects represent individual HTTP requests with priority and throttling (primarily internal).
184
+
185
+ ```js
186
+ import { RequestScheduler } from "cesium";
187
+
188
+ RequestScheduler.maximumRequests = 64; // global max (default: 50)
189
+ RequestScheduler.maximumRequestsPerServer = 12; // per-server max (default: 18)
190
+
191
+ // Override for known HTTP/2 servers
192
+ RequestScheduler.requestsByServer = {
193
+ "api.cesium.com:443": 32,
194
+ "assets.cesium.com:443": 32,
195
+ };
196
+ ```
197
+
198
+ ## Error Handling
199
+
200
+ - **DeveloperError** -- bug in calling code (invalid args). Thrown only in debug builds; fix the code, do not catch.
201
+ - **RuntimeError** -- runtime failure (network, shader compile). Catch in production.
202
+
203
+ ```js
204
+ import { RuntimeError, formatError, Cesium3DTileset } from "cesium";
205
+
206
+ try {
207
+ const tileset = await Cesium3DTileset.fromUrl("https://example.com/tileset.json");
208
+ viewer.scene.primitives.add(tileset);
209
+ } catch (error) {
210
+ if (error instanceof RuntimeError) {
211
+ console.error("Failed to load tileset:", error.message);
212
+ } else {
213
+ console.error(formatError(error)); // extracts name, message, stack
214
+ }
215
+ }
216
+ ```
217
+
218
+ ## Helper Functions
219
+
220
+ ### defined, clone, combine
221
+
222
+ ```js
223
+ import { defined, clone, combine } from "cesium";
224
+
225
+ // defined: returns true if value is neither null nor undefined
226
+ if (defined(entity.billboard)) {
227
+ entity.billboard.scale = 2.0;
228
+ }
229
+
230
+ // clone: shallow by default, pass true for deep
231
+ const obj = clone({ a: 1, nested: { b: 2 } }, true);
232
+
233
+ // combine: merge objects, first arg's keys take precedence
234
+ const merged = combine({ size: 20 }, { size: 10, color: "red" });
235
+ // { size: 20, color: "red" }
236
+ ```
237
+
238
+ ### createGuid, buildModuleUrl
239
+
240
+ ```js
241
+ import { createGuid, buildModuleUrl } from "cesium";
242
+
243
+ const id = createGuid(); // "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
244
+
245
+ // Resolve paths relative to Cesium installation
246
+ const iconUrl = buildModuleUrl("Assets/Textures/maki/marker.png");
247
+ ```
248
+
249
+ ### URL Utilities
250
+
251
+ ```js
252
+ import { objectToQuery, queryToObject, getExtensionFromUri, getBaseUri } from "cesium";
253
+
254
+ const qs = objectToQuery({ key1: "value 1", key2: ["x", "y"] });
255
+ // "key1=value%201&key2=x&key2=y"
256
+
257
+ const parsed = queryToObject("key1=value%201&key2=x&key2=y");
258
+ // { key1: "value 1", key2: ["x", "y"] }
259
+
260
+ getExtensionFromUri("https://example.com/model.glb?v=2"); // "glb"
261
+ getBaseUri("https://example.com/data/model.glb"); // "https://example.com/data/"
262
+ ```
263
+
264
+ ### destroyObject
265
+
266
+ Replaces all methods on an object with functions that throw `DeveloperError`, and sets `isDestroyed()` to return `true`. Standard cleanup pattern for objects holding native resources.
267
+
268
+ ```js
269
+ import { destroyObject } from "cesium";
270
+
271
+ class MyWidget {
272
+ constructor(viewer) {
273
+ this._handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
274
+ }
275
+ isDestroyed() { return false; }
276
+ destroy() {
277
+ this._handler.destroy();
278
+ return destroyObject(this);
279
+ }
280
+ }
281
+ ```
282
+
283
+ ## AssociativeArray
284
+
285
+ O(1) key lookup with a live `values` array for allocation-free iteration in render loops.
286
+
287
+ ```js
288
+ import { AssociativeArray } from "cesium";
289
+
290
+ const items = new AssociativeArray();
291
+ items.set("building-1", { height: 50 });
292
+ items.set("building-2", { height: 80 });
293
+
294
+ items.get("building-1"); // { height: 50 }
295
+ items.contains("building-1"); // true
296
+
297
+ // Iterate without per-frame allocations
298
+ const values = items.values;
299
+ for (let i = 0; i < values.length; i++) { /* process values[i] */ }
300
+
301
+ items.remove("building-1");
302
+ items.removeAll();
303
+ ```
304
+
305
+ ## PinBuilder
306
+
307
+ Generates map pin canvas elements with colors, text, maki icons, or custom images.
308
+
309
+ ```js
310
+ import { PinBuilder, Color, Cartesian3, VerticalOrigin } from "cesium";
311
+
312
+ const pin = new PinBuilder();
313
+ const redPin = pin.fromColor(Color.RED, 48); // solid color
314
+ const textPin = pin.fromText("A", Color.BLUE, 48); // text label
315
+ const iconPin = await pin.fromMakiIconId("hospital", Color.GREEN, 48); // maki icon
316
+ const urlPin = await pin.fromUrl("/icons/custom.png", Color.YELLOW, 48);
317
+
318
+ viewer.entities.add({
319
+ position: Cartesian3.fromDegrees(-75.17, 39.95),
320
+ billboard: {
321
+ image: pin.fromText("1", Color.ROYALBLUE, 48),
322
+ verticalOrigin: VerticalOrigin.BOTTOM,
323
+ },
324
+ });
325
+ ```
326
+
327
+ ## DistanceDisplayCondition
328
+
329
+ Controls entity/billboard/label visibility based on camera distance.
330
+
331
+ ```js
332
+ import { DistanceDisplayCondition, Cartesian3, Color } from "cesium";
333
+
334
+ viewer.entities.add({
335
+ position: Cartesian3.fromDegrees(-75.17, 39.95),
336
+ billboard: {
337
+ image: "/icons/marker.png",
338
+ distanceDisplayCondition: new DistanceDisplayCondition(100.0, 50000.0),
339
+ },
340
+ });
341
+ ```
342
+
343
+ ## Feature Detection and Fullscreen
344
+
345
+ ```js
346
+ import { FeatureDetection, Fullscreen } from "cesium";
347
+
348
+ if (FeatureDetection.supportsWebAssembly()) { /* WASM workers OK */ }
349
+ if (FeatureDetection.supportsTypedArrays()) { /* TypedArrays OK */ }
350
+
351
+ if (Fullscreen.supportsFullscreen()) {
352
+ Fullscreen.requestFullscreen(viewer.container);
353
+ }
354
+ ```
355
+
356
+ ## TaskProcessor
357
+
358
+ Wraps Web Workers for background computation. Worker is created lazily on first `scheduleTask`.
359
+
360
+ ```js
361
+ import { TaskProcessor, defined } from "cesium";
362
+
363
+ const processor = new TaskProcessor("myWorkerModule");
364
+ const promise = processor.scheduleTask({ data: largeArray, op: "simplify" });
365
+
366
+ if (!defined(promise)) {
367
+ // Too many active tasks; retry next frame
368
+ } else {
369
+ const result = await promise;
370
+ }
371
+ processor.destroy(); // release worker when done
372
+ ```
373
+
374
+ ## TrustedServers
375
+
376
+ Credentials (cookies, auth headers) are sent only to registered servers.
377
+
378
+ ```js
379
+ import { TrustedServers } from "cesium";
380
+
381
+ TrustedServers.add("secure-tiles.example.com", 443);
382
+ TrustedServers.contains("https://secure-tiles.example.com/tileset.json"); // true
383
+ TrustedServers.remove("secure-tiles.example.com", 443);
384
+ ```
385
+
386
+ ## Performance Tips
387
+
388
+ 1. **Reuse Resource instances** -- `getDerivedResource` inherits proxy, headers, and retry config without re-parsing the URL.
389
+ 2. **Tune RequestScheduler for HTTP/2** -- increase `maximumRequests` and per-server limits via `requestsByServer` for faster tile loading.
390
+ 3. **Use `Frozen.EMPTY_OBJECT` for defaults** -- avoids allocating a new `{}` on every call in hot paths.
391
+ 4. **Prefer `defined()` over truthiness** -- correctly distinguishes `0`, `""`, and `false` from `null`/`undefined`.
392
+ 5. **Use AssociativeArray in render loops** -- its `values` array avoids per-frame `Object.keys()` allocations.
393
+ 6. **Set retryAttempts conservatively** -- gate retries on specific status codes (401, 429, 503) via `retryCallback`.
394
+ 7. **Destroy TaskProcessors when done** -- idle workers still consume memory.
395
+ 8. **Never mutate frozen Color constants** -- call `.clone()` or `.withAlpha()` first.
396
+ 9. **Use `formatError` in catch blocks** -- extracts name, message, and stack from any error type.
397
+ 10. **Cache PinBuilder output** -- store canvas references when generating many identical pins across frames.
398
+
399
+ ## See Also
400
+
401
+ - **cesiumjs-viewer-setup** -- Viewer initialization, Ion token, scene configuration
402
+ - **cesiumjs-imagery** -- Imagery providers that consume `Resource` for tile fetching
403
+ - **cesiumjs-entities** -- Entity API using `Color`, `DistanceDisplayCondition`, and `PinBuilder`