@accelint/map-toolkit 1.2.0 → 1.3.0
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/CHANGELOG.md +11 -0
- package/catalog-info.yaml +3 -3
- package/dist/camera/events.d.ts +45 -0
- package/dist/camera/events.js +45 -0
- package/dist/camera/events.js.map +1 -1
- package/dist/camera/store.d.ts +47 -0
- package/dist/camera/store.js +81 -0
- package/dist/camera/store.js.map +1 -1
- package/dist/camera/types.d.ts +81 -0
- package/dist/cursor-coordinates/constants.d.ts +8 -0
- package/dist/cursor-coordinates/constants.js +22 -0
- package/dist/cursor-coordinates/constants.js.map +1 -0
- package/dist/cursor-coordinates/store.d.ts +1 -0
- package/dist/cursor-coordinates/store.js +1 -0
- package/dist/cursor-coordinates/store.js.map +1 -1
- package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +5 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.js +23 -8
- package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
- package/dist/deckgl/base-map/constants.d.ts +12 -0
- package/dist/deckgl/base-map/constants.js +12 -0
- package/dist/deckgl/base-map/constants.js.map +1 -1
- package/dist/deckgl/base-map/controls.d.ts +11 -1
- package/dist/deckgl/base-map/controls.js +5 -0
- package/dist/deckgl/base-map/controls.js.map +1 -1
- package/dist/deckgl/base-map/events.d.ts +30 -0
- package/dist/deckgl/base-map/events.js +30 -0
- package/dist/deckgl/base-map/events.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +2 -2
- package/dist/deckgl/base-map/index.js +33 -3
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/provider.d.ts +2 -2
- package/dist/deckgl/index.js +1 -1
- package/dist/deckgl/saved-viewports/index.d.ts +75 -0
- package/dist/deckgl/saved-viewports/index.js +58 -0
- package/dist/deckgl/saved-viewports/index.js.map +1 -1
- package/dist/deckgl/saved-viewports/storage.d.ts +51 -0
- package/dist/deckgl/saved-viewports/storage.js +64 -0
- package/dist/deckgl/saved-viewports/storage.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/constants.js +18 -6
- package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/fiber.d.ts +7 -0
- package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +61 -4
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +22 -8
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +75 -4
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/constants.js +30 -0
- package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/fiber.js +36 -0
- package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +2 -2
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +32 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +37 -8
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +43 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +44 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +46 -3
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +37 -1
- package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/store.js +50 -2
- package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +138 -17
- package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/events.js +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +2 -2
- package/dist/deckgl/shapes/edit-shape-layer/index.js +14 -0
- package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +56 -8
- package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +26 -4
- package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +28 -3
- package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +24 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +33 -4
- package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +21 -2
- package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +35 -11
- package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/store.js +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -1
- package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +12 -0
- package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -1
- package/dist/deckgl/shapes/shared/types.d.ts +3 -3
- package/dist/deckgl/shapes/shared/types.js +2 -2
- package/dist/deckgl/shapes/shared/types.js.map +1 -1
- package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +3 -3
- package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -1
- package/dist/deckgl/shapes/shared/utils/pick-filtering.js +1 -1
- package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -1
- package/dist/deckgl/symbol-layer/fiber.d.ts +18 -0
- package/dist/deckgl/symbol-layer/fiber.js.map +1 -1
- package/dist/deckgl/symbol-layer/index.d.ts +79 -1
- package/dist/deckgl/symbol-layer/index.js +72 -1
- package/dist/deckgl/symbol-layer/index.js.map +1 -1
- package/dist/deckgl/text-layer/character-sets.d.ts +30 -0
- package/dist/deckgl/text-layer/character-sets.js +26 -0
- package/dist/deckgl/text-layer/character-sets.js.map +1 -1
- package/dist/deckgl/text-layer/default-settings.d.ts +29 -0
- package/dist/deckgl/text-layer/default-settings.js +28 -0
- package/dist/deckgl/text-layer/default-settings.js.map +1 -1
- package/dist/deckgl/text-layer/index.d.ts +65 -0
- package/dist/deckgl/text-layer/index.js +56 -0
- package/dist/deckgl/text-layer/index.js.map +1 -1
- package/dist/map-cursor/events.d.ts +19 -0
- package/dist/map-cursor/events.js +19 -0
- package/dist/map-cursor/events.js.map +1 -1
- package/dist/map-cursor/store.d.ts +34 -2
- package/dist/map-cursor/store.js +44 -3
- package/dist/map-cursor/store.js.map +1 -1
- package/dist/map-mode/store.d.ts +43 -4
- package/dist/map-mode/store.js +56 -6
- package/dist/map-mode/store.js.map +1 -1
- package/dist/shared/create-map-store.d.ts +14 -0
- package/dist/shared/create-map-store.js +26 -2
- package/dist/shared/create-map-store.js.map +1 -1
- package/dist/shared/units.d.ts +24 -0
- package/dist/shared/units.js +24 -0
- package/dist/shared/units.js.map +1 -1
- package/dist/viewport/store.d.ts +1 -0
- package/dist/viewport/store.js +4 -0
- package/dist/viewport/store.js.map +1 -1
- package/package.json +3 -3
|
@@ -237,7 +237,7 @@ interface PointShape extends BaseShape {
|
|
|
237
237
|
*
|
|
238
238
|
* Use this for type narrowing based on shape:
|
|
239
239
|
* @example
|
|
240
|
-
* ```
|
|
240
|
+
* ```typescript
|
|
241
241
|
* function handleShape(shape: Shape) {
|
|
242
242
|
* if (shape.shape === 'Circle') {
|
|
243
243
|
* // TypeScript knows shape.feature.properties.circleProperties exists
|
|
@@ -276,7 +276,7 @@ type Subscription = (onStoreChange: () => void) => () => void;
|
|
|
276
276
|
* Type guard for Circle shapes.
|
|
277
277
|
*
|
|
278
278
|
* @example
|
|
279
|
-
* ```
|
|
279
|
+
* ```typescript
|
|
280
280
|
* if (isCircleShape(shape)) {
|
|
281
281
|
* // shape.feature.properties.circleProperties is available
|
|
282
282
|
* const { center, radius } = shape.feature.properties.circleProperties;
|
|
@@ -288,7 +288,7 @@ declare function isCircleShape(shape: Shape): shape is CircleShape;
|
|
|
288
288
|
* Type guard for Ellipse shapes.
|
|
289
289
|
*
|
|
290
290
|
* @example
|
|
291
|
-
* ```
|
|
291
|
+
* ```typescript
|
|
292
292
|
* if (isEllipseShape(shape)) {
|
|
293
293
|
* // shape.feature.properties.ellipseProperties is available
|
|
294
294
|
* const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;
|
|
@@ -29,7 +29,7 @@ const ShapeFeatureType = {
|
|
|
29
29
|
* Type guard for Circle shapes.
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
|
-
* ```
|
|
32
|
+
* ```typescript
|
|
33
33
|
* if (isCircleShape(shape)) {
|
|
34
34
|
* // shape.feature.properties.circleProperties is available
|
|
35
35
|
* const { center, radius } = shape.feature.properties.circleProperties;
|
|
@@ -43,7 +43,7 @@ function isCircleShape(shape) {
|
|
|
43
43
|
* Type guard for Ellipse shapes.
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
|
-
* ```
|
|
46
|
+
* ```typescript
|
|
47
47
|
* if (isEllipseShape(shape)) {
|
|
48
48
|
* // shape.feature.properties.ellipseProperties is available
|
|
49
49
|
* const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/types.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport type { UniqueId } from '@accelint/core';\nimport type { Color } from '@deck.gl/core';\nimport type { Feature, LineString, Point, Polygon } from 'geojson';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Supported shape types\n */\nexport const ShapeFeatureType = {\n Circle: 'Circle',\n Ellipse: 'Ellipse',\n Polygon: 'Polygon',\n Rectangle: 'Rectangle',\n LineString: 'LineString',\n Point: 'Point',\n} as const;\n\nexport type ShapeFeatureType =\n (typeof ShapeFeatureType)[keyof typeof ShapeFeatureType];\n\n/**\n * Shape ID type - uses UniqueId from core\n */\nexport type ShapeId = UniqueId;\n\n/**\n * Border/outline width options (in pixels).\n * Controls the width of shape outlines.\n */\nexport type LineWidth = 1 | 2 | 4 | 8;\n\n/**\n * Border/outline pattern options.\n * Controls how shape outlines are rendered.\n */\nexport type LinePattern = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Style properties for rendering shapes\n */\nexport interface StyleProperties {\n /** Fill color as RGBA array [r, g, b, a] where each value is 0-255 */\n fillColor: Color;\n /** Border/outline color as RGBA array [r, g, b, a] where each value is 0-255 */\n lineColor: Color;\n /** Border/outline width in pixels */\n lineWidth: LineWidth;\n /** Border/outline pattern (solid, dashed, or dotted) */\n linePattern: LinePattern;\n /** Optional icon properties for Point geometries */\n icon?: {\n /** Icon atlas URL or data */\n atlas?: string;\n /** Icon mapping (name to position in atlas) */\n mapping?: Record<\n string,\n { x: number; y: number; width: number; height: number; mask?: boolean }\n >;\n /** Icon name to use from mapping */\n name?: string;\n /** Icon size in pixels */\n size?: number;\n };\n /** Optional custom label pixel offset [x, y] */\n labelOffset?: [number, number];\n /** Optional custom label vertical anchor */\n labelVerticalAnchor?: 'top' | 'middle' | 'bottom';\n /** Optional custom label horizontal anchor */\n labelHorizontalAnchor?: 'left' | 'center' | 'right';\n /** Optional custom label coordinate anchor (position along geometry) */\n labelCoordinateAnchor?:\n | 'center'\n | 'start'\n | 'middle'\n | 'end'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left';\n}\n\n/**\n * Circle-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface CircleProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** Radius with value and units */\n radius: {\n /** Radius value */\n value: number;\n /** Units for the radius measurement */\n units: DistanceUnit;\n };\n}\n\n/**\n * Ellipse-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface EllipseProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** X semi-axis (horizontal radius) with value and units */\n xSemiAxis: {\n /** X semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Y semi-axis (vertical radius) with value and units */\n ySemiAxis: {\n /** Y semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Rotation angle in degrees */\n angle: number;\n}\n\n/**\n * Custom geometry types supported\n */\nexport type CustomGeometry = Point | LineString | Polygon;\n\n/**\n * Properties for styled features.\n *\n * Note: circleProperties and ellipseProperties are optional at the type level\n * but are guaranteed to be present for their respective shape types.\n * Use the type guards (isCircleShape, isEllipseShape) for type narrowing.\n */\nexport interface StyledFeatureProperties {\n /** Style properties for rendering */\n styleProperties: StyleProperties;\n /** Shape ID for correlation */\n shapeId?: ShapeId;\n /** Circle properties (present for Circle shapes) */\n circleProperties?: CircleProperties;\n /** Ellipse properties (present for Ellipse shapes) */\n ellipseProperties?: EllipseProperties;\n}\n\n/**\n * Feature properties for Circle shapes (circleProperties required).\n * Used by CircleShape for better type narrowing.\n */\nexport interface CircleFeatureProperties extends StyledFeatureProperties {\n /** Circle properties (required for Circle shapes) */\n circleProperties: CircleProperties;\n}\n\n/**\n * Feature properties for Ellipse shapes (ellipseProperties required).\n * Used by EllipseShape for better type narrowing.\n */\nexport interface EllipseFeatureProperties extends StyledFeatureProperties {\n /** Ellipse properties (required for Ellipse shapes) */\n ellipseProperties: EllipseProperties;\n}\n\n/**\n * GeoJSON Feature with style properties\n */\nexport interface StyledFeature extends Feature {\n properties: StyledFeatureProperties;\n}\n\n/**\n * Base shape properties shared by all shapes\n */\ninterface BaseShape {\n /** Unique identifier */\n id: ShapeId;\n /** Full shape name used internally and in UI */\n name: string;\n /**\n * Optional short display label shown on the map\n * If not provided, the `name` property will be used instead\n * Useful for showing abbreviated text on the map (e.g., \"NYC\" vs \"New York City Office\")\n */\n label?: string;\n /** GeoJSON feature with geometry and style properties */\n feature: ShapeFeature;\n /** UTC timestamp (only set when saved) */\n lastUpdated?: number;\n /**\n * Whether the shape is locked for editing\n * Locked shapes cannot be modified due to data restrictions or user preference\n */\n locked?: boolean;\n}\n\n/**\n * Circle shape with required circleProperties\n */\nexport interface CircleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Circle;\n feature: StyledFeature & { properties: CircleFeatureProperties };\n}\n\n/**\n * Ellipse shape with required ellipseProperties\n */\nexport interface EllipseShape extends BaseShape {\n shape: typeof ShapeFeatureType.Ellipse;\n feature: StyledFeature & { properties: EllipseFeatureProperties };\n}\n\n/**\n * Polygon shape\n */\nexport interface PolygonShape extends BaseShape {\n shape: typeof ShapeFeatureType.Polygon;\n feature: StyledFeature;\n}\n\n/**\n * Rectangle shape\n */\nexport interface RectangleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Rectangle;\n feature: StyledFeature;\n}\n\n/**\n * LineString shape\n */\nexport interface LineStringShape extends BaseShape {\n shape: typeof ShapeFeatureType.LineString;\n feature: StyledFeature;\n}\n\n/**\n * Point shape\n */\nexport interface PointShape extends BaseShape {\n shape: typeof ShapeFeatureType.Point;\n feature: StyledFeature;\n}\n\n/**\n * Discriminated union of all shape types.\n *\n * Use this for type narrowing based on shape:\n * @example\n * ```ts\n * function handleShape(shape: Shape) {\n * if (shape.shape === 'Circle') {\n * // TypeScript knows shape.feature.properties.circleProperties exists\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * }\n * ```\n */\nexport type Shape =\n | CircleShape\n | EllipseShape\n | PolygonShape\n | RectangleShape\n | LineStringShape\n | PointShape;\n\n/**\n * Alias for ShapeFeatureType values\n */\nexport type ShapeFeatureTypeValues = ShapeFeatureType;\n\n/**\n * Alias for StyledFeature (shape feature)\n */\nexport type ShapeFeature = StyledFeature;\n\n/**\n * Alias for StyledFeature properties\n */\nexport type ShapeFeatureProperties = StyledFeature['properties'];\n\n/**\n * Circle radius type\n */\nexport type CircleRadius = CircleProperties['radius'];\n\n/**\n * Coordinate as [longitude, latitude]\n */\nexport type Coordinate = [number, number];\n\n/**\n * Function type for subscription (useSyncExternalStore pattern).\n * Used by draw-shape-layer and edit-shape-layer stores.\n */\nexport type Subscription = (onStoreChange: () => void) => () => void;\n\n// =============================================================================\n// Type Guards\n// =============================================================================\n\n/**\n * Type guard for Circle shapes.\n *\n * @example\n * ```ts\n * if (isCircleShape(shape)) {\n * // shape.feature.properties.circleProperties is available\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * ```\n */\nexport function isCircleShape(shape: Shape): shape is CircleShape {\n return shape.shape === ShapeFeatureType.Circle;\n}\n\n/**\n * Type guard for Ellipse shapes.\n *\n * @example\n * ```ts\n * if (isEllipseShape(shape)) {\n * // shape.feature.properties.ellipseProperties is available\n * const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;\n * }\n * ```\n */\nexport function isEllipseShape(shape: Shape): shape is EllipseShape {\n return shape.shape === ShapeFeatureType.Ellipse;\n}\n\n/**\n * Type guard for Polygon shapes.\n */\nexport function isPolygonShape(shape: Shape): shape is PolygonShape {\n return shape.shape === ShapeFeatureType.Polygon;\n}\n\n/**\n * Type guard for Rectangle shapes.\n */\nexport function isRectangleShape(shape: Shape): shape is RectangleShape {\n return shape.shape === ShapeFeatureType.Rectangle;\n}\n\n/**\n * Type guard for LineString shapes.\n */\nexport function isLineStringShape(shape: Shape): shape is LineStringShape {\n return shape.shape === ShapeFeatureType.LineString;\n}\n\n/**\n * Type guard for Point shapes.\n */\nexport function isPointShape(shape: Shape): shape is PointShape {\n return shape.shape === ShapeFeatureType.Point;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,OAAO;CACR;;;;;;;;;;;;AAwSD,SAAgB,cAAc,OAAoC;AAChE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;AAc1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,iBAAiB,OAAuC;AACtE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,kBAAkB,OAAwC;AACxE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,aAAa,OAAmC;AAC9D,QAAO,MAAM,UAAU,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/types.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport type { UniqueId } from '@accelint/core';\nimport type { Color } from '@deck.gl/core';\nimport type { Feature, LineString, Point, Polygon } from 'geojson';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Supported shape types\n */\nexport const ShapeFeatureType = {\n Circle: 'Circle',\n Ellipse: 'Ellipse',\n Polygon: 'Polygon',\n Rectangle: 'Rectangle',\n LineString: 'LineString',\n Point: 'Point',\n} as const;\n\nexport type ShapeFeatureType =\n (typeof ShapeFeatureType)[keyof typeof ShapeFeatureType];\n\n/**\n * Shape ID type - uses UniqueId from core\n */\nexport type ShapeId = UniqueId;\n\n/**\n * Border/outline width options (in pixels).\n * Controls the width of shape outlines.\n */\nexport type LineWidth = 1 | 2 | 4 | 8;\n\n/**\n * Border/outline pattern options.\n * Controls how shape outlines are rendered.\n */\nexport type LinePattern = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Style properties for rendering shapes\n */\nexport interface StyleProperties {\n /** Fill color as RGBA array [r, g, b, a] where each value is 0-255 */\n fillColor: Color;\n /** Border/outline color as RGBA array [r, g, b, a] where each value is 0-255 */\n lineColor: Color;\n /** Border/outline width in pixels */\n lineWidth: LineWidth;\n /** Border/outline pattern (solid, dashed, or dotted) */\n linePattern: LinePattern;\n /** Optional icon properties for Point geometries */\n icon?: {\n /** Icon atlas URL or data */\n atlas?: string;\n /** Icon mapping (name to position in atlas) */\n mapping?: Record<\n string,\n { x: number; y: number; width: number; height: number; mask?: boolean }\n >;\n /** Icon name to use from mapping */\n name?: string;\n /** Icon size in pixels */\n size?: number;\n };\n /** Optional custom label pixel offset [x, y] */\n labelOffset?: [number, number];\n /** Optional custom label vertical anchor */\n labelVerticalAnchor?: 'top' | 'middle' | 'bottom';\n /** Optional custom label horizontal anchor */\n labelHorizontalAnchor?: 'left' | 'center' | 'right';\n /** Optional custom label coordinate anchor (position along geometry) */\n labelCoordinateAnchor?:\n | 'center'\n | 'start'\n | 'middle'\n | 'end'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left';\n}\n\n/**\n * Circle-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface CircleProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** Radius with value and units */\n radius: {\n /** Radius value */\n value: number;\n /** Units for the radius measurement */\n units: DistanceUnit;\n };\n}\n\n/**\n * Ellipse-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface EllipseProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** X semi-axis (horizontal radius) with value and units */\n xSemiAxis: {\n /** X semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Y semi-axis (vertical radius) with value and units */\n ySemiAxis: {\n /** Y semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Rotation angle in degrees */\n angle: number;\n}\n\n/**\n * Custom geometry types supported\n */\nexport type CustomGeometry = Point | LineString | Polygon;\n\n/**\n * Properties for styled features.\n *\n * Note: circleProperties and ellipseProperties are optional at the type level\n * but are guaranteed to be present for their respective shape types.\n * Use the type guards (isCircleShape, isEllipseShape) for type narrowing.\n */\nexport interface StyledFeatureProperties {\n /** Style properties for rendering */\n styleProperties: StyleProperties;\n /** Shape ID for correlation */\n shapeId?: ShapeId;\n /** Circle properties (present for Circle shapes) */\n circleProperties?: CircleProperties;\n /** Ellipse properties (present for Ellipse shapes) */\n ellipseProperties?: EllipseProperties;\n}\n\n/**\n * Feature properties for Circle shapes (circleProperties required).\n * Used by CircleShape for better type narrowing.\n */\nexport interface CircleFeatureProperties extends StyledFeatureProperties {\n /** Circle properties (required for Circle shapes) */\n circleProperties: CircleProperties;\n}\n\n/**\n * Feature properties for Ellipse shapes (ellipseProperties required).\n * Used by EllipseShape for better type narrowing.\n */\nexport interface EllipseFeatureProperties extends StyledFeatureProperties {\n /** Ellipse properties (required for Ellipse shapes) */\n ellipseProperties: EllipseProperties;\n}\n\n/**\n * GeoJSON Feature with style properties\n */\nexport interface StyledFeature extends Feature {\n properties: StyledFeatureProperties;\n}\n\n/**\n * Base shape properties shared by all shapes\n */\ninterface BaseShape {\n /** Unique identifier */\n id: ShapeId;\n /** Full shape name used internally and in UI */\n name: string;\n /**\n * Optional short display label shown on the map\n * If not provided, the `name` property will be used instead\n * Useful for showing abbreviated text on the map (e.g., \"NYC\" vs \"New York City Office\")\n */\n label?: string;\n /** GeoJSON feature with geometry and style properties */\n feature: ShapeFeature;\n /** UTC timestamp (only set when saved) */\n lastUpdated?: number;\n /**\n * Whether the shape is locked for editing\n * Locked shapes cannot be modified due to data restrictions or user preference\n */\n locked?: boolean;\n}\n\n/**\n * Circle shape with required circleProperties\n */\nexport interface CircleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Circle;\n feature: StyledFeature & { properties: CircleFeatureProperties };\n}\n\n/**\n * Ellipse shape with required ellipseProperties\n */\nexport interface EllipseShape extends BaseShape {\n shape: typeof ShapeFeatureType.Ellipse;\n feature: StyledFeature & { properties: EllipseFeatureProperties };\n}\n\n/**\n * Polygon shape\n */\nexport interface PolygonShape extends BaseShape {\n shape: typeof ShapeFeatureType.Polygon;\n feature: StyledFeature;\n}\n\n/**\n * Rectangle shape\n */\nexport interface RectangleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Rectangle;\n feature: StyledFeature;\n}\n\n/**\n * LineString shape\n */\nexport interface LineStringShape extends BaseShape {\n shape: typeof ShapeFeatureType.LineString;\n feature: StyledFeature;\n}\n\n/**\n * Point shape\n */\nexport interface PointShape extends BaseShape {\n shape: typeof ShapeFeatureType.Point;\n feature: StyledFeature;\n}\n\n/**\n * Discriminated union of all shape types.\n *\n * Use this for type narrowing based on shape:\n * @example\n * ```typescript\n * function handleShape(shape: Shape) {\n * if (shape.shape === 'Circle') {\n * // TypeScript knows shape.feature.properties.circleProperties exists\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * }\n * ```\n */\nexport type Shape =\n | CircleShape\n | EllipseShape\n | PolygonShape\n | RectangleShape\n | LineStringShape\n | PointShape;\n\n/**\n * Alias for ShapeFeatureType values\n */\nexport type ShapeFeatureTypeValues = ShapeFeatureType;\n\n/**\n * Alias for StyledFeature (shape feature)\n */\nexport type ShapeFeature = StyledFeature;\n\n/**\n * Alias for StyledFeature properties\n */\nexport type ShapeFeatureProperties = StyledFeature['properties'];\n\n/**\n * Circle radius type\n */\nexport type CircleRadius = CircleProperties['radius'];\n\n/**\n * Coordinate as [longitude, latitude]\n */\nexport type Coordinate = [number, number];\n\n/**\n * Function type for subscription (useSyncExternalStore pattern).\n * Used by draw-shape-layer and edit-shape-layer stores.\n */\nexport type Subscription = (onStoreChange: () => void) => () => void;\n\n// =============================================================================\n// Type Guards\n// =============================================================================\n\n/**\n * Type guard for Circle shapes.\n *\n * @example\n * ```typescript\n * if (isCircleShape(shape)) {\n * // shape.feature.properties.circleProperties is available\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * ```\n */\nexport function isCircleShape(shape: Shape): shape is CircleShape {\n return shape.shape === ShapeFeatureType.Circle;\n}\n\n/**\n * Type guard for Ellipse shapes.\n *\n * @example\n * ```typescript\n * if (isEllipseShape(shape)) {\n * // shape.feature.properties.ellipseProperties is available\n * const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;\n * }\n * ```\n */\nexport function isEllipseShape(shape: Shape): shape is EllipseShape {\n return shape.shape === ShapeFeatureType.Ellipse;\n}\n\n/**\n * Type guard for Polygon shapes.\n */\nexport function isPolygonShape(shape: Shape): shape is PolygonShape {\n return shape.shape === ShapeFeatureType.Polygon;\n}\n\n/**\n * Type guard for Rectangle shapes.\n */\nexport function isRectangleShape(shape: Shape): shape is RectangleShape {\n return shape.shape === ShapeFeatureType.Rectangle;\n}\n\n/**\n * Type guard for LineString shapes.\n */\nexport function isLineStringShape(shape: Shape): shape is LineStringShape {\n return shape.shape === ShapeFeatureType.LineString;\n}\n\n/**\n * Type guard for Point shapes.\n */\nexport function isPointShape(shape: Shape): shape is PointShape {\n return shape.shape === ShapeFeatureType.Point;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,OAAO;CACR;;;;;;;;;;;;AAwSD,SAAgB,cAAc,OAAoC;AAChE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;AAc1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,iBAAiB,OAAuC;AACtE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,kBAAkB,OAAwC;AACxE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,aAAa,OAAmC;AAC9D,QAAO,MAAM,UAAU,iBAAiB"}
|
|
@@ -25,7 +25,7 @@ import { distance, point } from "@turf/turf";
|
|
|
25
25
|
* @returns Circle measurements including radius, diameter, and area
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
|
-
* ```
|
|
28
|
+
* ```typescript
|
|
29
29
|
* const { radius, diameter, area } = computeCircleMeasurements(
|
|
30
30
|
* [-122.4, 37.8],
|
|
31
31
|
* [-122.3, 37.8],
|
|
@@ -56,7 +56,7 @@ function computeCircleMeasurements(center, edgePoint, units) {
|
|
|
56
56
|
* @returns Rectangle measurements including width, height, and area
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
|
-
* ```
|
|
59
|
+
* ```typescript
|
|
60
60
|
* const coords = polygon.geometry.coordinates[0];
|
|
61
61
|
* const { width, height, area } = computeRectangleMeasurementsFromCorners(
|
|
62
62
|
* coords[0] as [number, number],
|
|
@@ -86,7 +86,7 @@ function computeRectangleMeasurementsFromCorners(corner0, corner1, corner2, unit
|
|
|
86
86
|
* @returns Ellipse measurements including axes and area
|
|
87
87
|
*
|
|
88
88
|
* @example
|
|
89
|
-
* ```
|
|
89
|
+
* ```typescript
|
|
90
90
|
* const coords = polygon.geometry.coordinates[0];
|
|
91
91
|
* const { majorAxis, minorAxis, area } = computeEllipseMeasurementsFromPolygon(
|
|
92
92
|
* coords as [number, number][],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-measurements.js","names":[],"sources":["../../../../../src/deckgl/shapes/shared/utils/geometry-measurements.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport { distance, point } from '@turf/turf';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Circle measurement result containing radius, diameter, and area.\n */\nexport interface CircleMeasurements {\n /** Radius in the specified units */\n radius: number;\n /** Diameter (radius * 2) in the specified units */\n diameter: number;\n /** Area (π * radius²) in the specified units squared */\n area: number;\n}\n\n/**\n * Ellipse measurement result containing semi-axes and area.\n */\nexport interface EllipseMeasurements {\n /** X semi-axis (horizontal radius) in the specified units */\n xSemiAxis: number;\n /** Y semi-axis (vertical radius) in the specified units */\n ySemiAxis: number;\n /** Major axis (full length of longer axis) in the specified units */\n majorAxis: number;\n /** Minor axis (full length of shorter axis) in the specified units */\n minorAxis: number;\n /** Area (π * xSemiAxis * ySemiAxis) in the specified units squared */\n area: number;\n}\n\n/**\n * Rectangle measurement result containing width, height, and area.\n */\nexport interface RectangleMeasurements {\n /** Width in the specified units */\n width: number;\n /** Height in the specified units */\n height: number;\n /** Area (width * height) in the specified units squared */\n area: number;\n}\n\n/**\n * Compute circle measurements from center and edge point.\n *\n * @param center - Center point as [longitude, latitude]\n * @param edgePoint - Point on the circle's edge as [longitude, latitude]\n * @param units - Distance units for the measurements\n * @returns Circle measurements including radius, diameter, and area\n *\n * @example\n * ```
|
|
1
|
+
{"version":3,"file":"geometry-measurements.js","names":[],"sources":["../../../../../src/deckgl/shapes/shared/utils/geometry-measurements.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport { distance, point } from '@turf/turf';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Circle measurement result containing radius, diameter, and area.\n */\nexport interface CircleMeasurements {\n /** Radius in the specified units */\n radius: number;\n /** Diameter (radius * 2) in the specified units */\n diameter: number;\n /** Area (π * radius²) in the specified units squared */\n area: number;\n}\n\n/**\n * Ellipse measurement result containing semi-axes and area.\n */\nexport interface EllipseMeasurements {\n /** X semi-axis (horizontal radius) in the specified units */\n xSemiAxis: number;\n /** Y semi-axis (vertical radius) in the specified units */\n ySemiAxis: number;\n /** Major axis (full length of longer axis) in the specified units */\n majorAxis: number;\n /** Minor axis (full length of shorter axis) in the specified units */\n minorAxis: number;\n /** Area (π * xSemiAxis * ySemiAxis) in the specified units squared */\n area: number;\n}\n\n/**\n * Rectangle measurement result containing width, height, and area.\n */\nexport interface RectangleMeasurements {\n /** Width in the specified units */\n width: number;\n /** Height in the specified units */\n height: number;\n /** Area (width * height) in the specified units squared */\n area: number;\n}\n\n/**\n * Compute circle measurements from center and edge point.\n *\n * @param center - Center point as [longitude, latitude]\n * @param edgePoint - Point on the circle's edge as [longitude, latitude]\n * @param units - Distance units for the measurements\n * @returns Circle measurements including radius, diameter, and area\n *\n * @example\n * ```typescript\n * const { radius, diameter, area } = computeCircleMeasurements(\n * [-122.4, 37.8],\n * [-122.3, 37.8],\n * 'kilometers'\n * );\n * ```\n */\nexport function computeCircleMeasurements(\n center: [number, number],\n edgePoint: [number, number],\n units: DistanceUnit,\n): CircleMeasurements {\n const radius = distance(center, edgePoint, { units });\n const diameter = radius * 2;\n const area = Math.PI * radius ** 2;\n\n return { radius, diameter, area };\n}\n\n/**\n * Compute ellipse measurements from center and semi-axis lengths.\n *\n * @param xSemiAxis - X semi-axis (horizontal radius) in the specified units\n * @param ySemiAxis - Y semi-axis (vertical radius) in the specified units\n * @returns Ellipse measurements including axes and area\n *\n * @example\n * ```typescript\n * const { majorAxis, minorAxis, area } = computeEllipseMeasurementsFromAxes(100, 50);\n * ```\n */\nexport function computeEllipseMeasurementsFromAxes(\n xSemiAxis: number,\n ySemiAxis: number,\n): EllipseMeasurements {\n const majorAxis = Math.max(xSemiAxis, ySemiAxis) * 2;\n const minorAxis = Math.min(xSemiAxis, ySemiAxis) * 2;\n const area = Math.PI * xSemiAxis * ySemiAxis;\n\n return { xSemiAxis, ySemiAxis, majorAxis, minorAxis, area };\n}\n\n/**\n * Compute rectangle measurements from adjacent corner points.\n *\n * Uses geodesic distance calculations for accurate measurements on Earth's surface.\n * Corners should be provided in order: corner0 -> corner1 -> corner2 where:\n * - corner0 to corner1 defines one edge (width)\n * - corner1 to corner2 defines the adjacent edge (height)\n *\n * @param corner0 - First corner as [longitude, latitude]\n * @param corner1 - Adjacent corner as [longitude, latitude]\n * @param corner2 - Corner adjacent to corner1 as [longitude, latitude]\n * @param units - Distance units for the measurements\n * @returns Rectangle measurements including width, height, and area\n *\n * @example\n * ```typescript\n * const coords = polygon.geometry.coordinates[0];\n * const { width, height, area } = computeRectangleMeasurementsFromCorners(\n * coords[0] as [number, number],\n * coords[1] as [number, number],\n * coords[2] as [number, number],\n * 'kilometers'\n * );\n * ```\n */\nexport function computeRectangleMeasurementsFromCorners(\n corner0: [number, number],\n corner1: [number, number],\n corner2: [number, number],\n units: DistanceUnit,\n): RectangleMeasurements {\n const width = distance(point(corner0), point(corner1), { units });\n const height = distance(point(corner1), point(corner2), { units });\n const area = width * height;\n\n return { width, height, area };\n}\n\n/**\n * Compute ellipse measurements from polygon coordinates.\n *\n * For an ellipse approximated as a polygon, calculates the major and minor axes\n * by measuring distances between opposite points on the perimeter.\n *\n * @param coordinates - Polygon ring coordinates as [[lon, lat], ...]\n * @param units - Distance units for the measurements\n * @returns Ellipse measurements including axes and area\n *\n * @example\n * ```typescript\n * const coords = polygon.geometry.coordinates[0];\n * const { majorAxis, minorAxis, area } = computeEllipseMeasurementsFromPolygon(\n * coords as [number, number][],\n * 'kilometers'\n * );\n * ```\n */\nexport function computeEllipseMeasurementsFromPolygon(\n coordinates: [number, number][],\n units: DistanceUnit,\n): { majorAxis: number; minorAxis: number; area: number } {\n // Remove the closing point if it duplicates the first\n const points =\n coordinates[0]?.[0] === coordinates[coordinates.length - 1]?.[0] &&\n coordinates[0]?.[1] === coordinates[coordinates.length - 1]?.[1]\n ? coordinates.slice(0, -1)\n : coordinates;\n\n if (points.length < 4) {\n return { majorAxis: 0, minorAxis: 0, area: 0 };\n }\n\n // For an ellipse polygon, opposite points are at index i and i + n/2\n const halfLen = Math.floor(points.length / 2);\n let maxDist = 0;\n let minDist = Number.POSITIVE_INFINITY;\n\n // Sample several diameter measurements\n for (let i = 0; i < halfLen; i++) {\n const p1 = points[i];\n const p2 = points[i + halfLen];\n if (!(p1 && p2)) {\n continue;\n }\n\n const dist = distance(\n [p1[0] as number, p1[1] as number],\n [p2[0] as number, p2[1] as number],\n { units },\n );\n\n if (dist > maxDist) {\n maxDist = dist;\n }\n if (dist < minDist) {\n minDist = dist;\n }\n }\n\n const majorAxis = maxDist;\n const minorAxis = minDist === Number.POSITIVE_INFINITY ? maxDist : minDist;\n\n // Ellipse area = π × a × b (where a and b are semi-axes)\n const semiMajor = majorAxis / 2;\n const semiMinor = minorAxis / 2;\n const ellipseArea = Math.PI * semiMajor * semiMinor;\n\n return { majorAxis, minorAxis, area: ellipseArea };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,SAAgB,0BACd,QACA,WACA,OACoB;CACpB,MAAM,SAAS,SAAS,QAAQ,WAAW,EAAE,OAAO,CAAC;AAIrD,QAAO;EAAE;EAAQ,UAHA,SAAS;EAGC,MAFd,KAAK,KAAK,UAAU;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDnC,SAAgB,wCACd,SACA,SACA,SACA,OACuB;CACvB,MAAM,QAAQ,SAAS,MAAM,QAAQ,EAAE,MAAM,QAAQ,EAAE,EAAE,OAAO,CAAC;CACjE,MAAM,SAAS,SAAS,MAAM,QAAQ,EAAE,MAAM,QAAQ,EAAE,EAAE,OAAO,CAAC;AAGlE,QAAO;EAAE;EAAO;EAAQ,MAFX,QAAQ;EAES;;;;;;;;;;;;;;;;;;;;;AAsBhC,SAAgB,sCACd,aACA,OACwD;CAExD,MAAM,SACJ,YAAY,KAAK,OAAO,YAAY,YAAY,SAAS,KAAK,MAC9D,YAAY,KAAK,OAAO,YAAY,YAAY,SAAS,KAAK,KAC1D,YAAY,MAAM,GAAG,GAAG,GACxB;AAEN,KAAI,OAAO,SAAS,EAClB,QAAO;EAAE,WAAW;EAAG,WAAW;EAAG,MAAM;EAAG;CAIhD,MAAM,UAAU,KAAK,MAAM,OAAO,SAAS,EAAE;CAC7C,IAAI,UAAU;CACd,IAAI,UAAU,OAAO;AAGrB,MAAK,IAAI,IAAI,GAAG,IAAI,SAAS,KAAK;EAChC,MAAM,KAAK,OAAO;EAClB,MAAM,KAAK,OAAO,IAAI;AACtB,MAAI,EAAE,MAAM,IACV;EAGF,MAAM,OAAO,SACX,CAAC,GAAG,IAAc,GAAG,GAAa,EAClC,CAAC,GAAG,IAAc,GAAG,GAAa,EAClC,EAAE,OAAO,CACV;AAED,MAAI,OAAO,QACT,WAAU;AAEZ,MAAI,OAAO,QACT,WAAU;;CAId,MAAM,YAAY;CAClB,MAAM,YAAY,YAAY,OAAO,oBAAoB,UAAU;CAGnE,MAAM,YAAY,YAAY;CAC9B,MAAM,YAAY,YAAY;AAG9B,QAAO;EAAE;EAAW;EAAW,MAFX,KAAK,KAAK,YAAY;EAEQ"}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* @returns Object containing filtered picks and whether filtering occurred
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
|
-
* ```
|
|
31
|
+
* ```typescript
|
|
32
32
|
* const picks = props.lastPointerMoveEvent?.picks;
|
|
33
33
|
* if (picks && picks.length > 0) {
|
|
34
34
|
* const { filteredPicks, didFilter } = filterGeometryAwarePicks(picks);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-filtering.js","names":["filteredPicks: T[]"],"sources":["../../../../../src/deckgl/shapes/shared/utils/pick-filtering.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\n/**\n * Result of filtering picks for geometry-aware processing.\n * Generic to support both deck.gl/core PickingInfo and editable-layers Pick types.\n */\nexport interface FilteredPicksResult<T> {\n /** The filtered picks array (only valid geometry picks) */\n filteredPicks: T[];\n /** Whether any picks were removed during filtering */\n didFilter: boolean;\n}\n\n/**\n * Filters picks to only include valid geometry elements.\n *\n * This prevents TypeError from sublayer elements that don't have geometry\n * when modes try to access pick.object.geometry.type. Only picks that are\n * either guide features (pick.isGuide) or have valid geometry are included.\n *\n * Uses a single-pass algorithm for efficiency - filters and tracks changes\n * in one loop iteration.\n *\n * @param picks - The picks array from a pointer event\n * @returns Object containing filtered picks and whether filtering occurred\n *\n * @example\n * ```
|
|
1
|
+
{"version":3,"file":"pick-filtering.js","names":["filteredPicks: T[]"],"sources":["../../../../../src/deckgl/shapes/shared/utils/pick-filtering.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\n/**\n * Result of filtering picks for geometry-aware processing.\n * Generic to support both deck.gl/core PickingInfo and editable-layers Pick types.\n */\nexport interface FilteredPicksResult<T> {\n /** The filtered picks array (only valid geometry picks) */\n filteredPicks: T[];\n /** Whether any picks were removed during filtering */\n didFilter: boolean;\n}\n\n/**\n * Filters picks to only include valid geometry elements.\n *\n * This prevents TypeError from sublayer elements that don't have geometry\n * when modes try to access pick.object.geometry.type. Only picks that are\n * either guide features (pick.isGuide) or have valid geometry are included.\n *\n * Uses a single-pass algorithm for efficiency - filters and tracks changes\n * in one loop iteration.\n *\n * @param picks - The picks array from a pointer event\n * @returns Object containing filtered picks and whether filtering occurred\n *\n * @example\n * ```typescript\n * const picks = props.lastPointerMoveEvent?.picks;\n * if (picks && picks.length > 0) {\n * const { filteredPicks, didFilter } = filterGeometryAwarePicks(picks);\n * if (didFilter) {\n * // Use filteredPicks in modified props\n * }\n * }\n * ```\n */\nexport function filterGeometryAwarePicks<T>(\n picks: T[],\n): FilteredPicksResult<T> {\n const filteredPicks: T[] = [];\n let didFilter = false;\n\n for (const pick of picks) {\n // Keep picks that are guides or have valid geometry\n // biome-ignore lint/suspicious/noExplicitAny: deck.gl picks have dynamic object structure\n const pickObj = pick as any;\n if (pickObj.isGuide || pickObj.object?.geometry?.type !== undefined) {\n filteredPicks.push(pick);\n } else {\n didFilter = true;\n }\n }\n\n return { filteredPicks, didFilter };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgB,yBACd,OACwB;CACxB,MAAMA,gBAAqB,EAAE;CAC7B,IAAI,YAAY;AAEhB,MAAK,MAAM,QAAQ,OAAO;EAGxB,MAAM,UAAU;AAChB,MAAI,QAAQ,WAAW,QAAQ,QAAQ,UAAU,SAAS,OACxD,eAAc,KAAK,KAAK;MAExB,aAAY;;AAIhB,QAAO;EAAE;EAAe;EAAW"}
|
|
@@ -17,6 +17,24 @@ declare global {
|
|
|
17
17
|
namespace React {
|
|
18
18
|
namespace JSX {
|
|
19
19
|
interface IntrinsicElements {
|
|
20
|
+
/**
|
|
21
|
+
* A Deck.gl Fiber layer for rendering MIL-STD-2525 and APP-6 military symbols.
|
|
22
|
+
*
|
|
23
|
+
* Automatically generates symbol icons from SIDC codes with support for
|
|
24
|
+
* multiple symbology standards and customizable rendering options.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <symbolLayer
|
|
29
|
+
* id="military-units"
|
|
30
|
+
* data={units}
|
|
31
|
+
* getSidc={d => d.sidc}
|
|
32
|
+
* getPosition={d => d.position}
|
|
33
|
+
* getSize={32}
|
|
34
|
+
* defaultSymbolOptions={{ colorMode: 'Dark' }}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
20
38
|
symbolLayer: SymbolLayerProps;
|
|
21
39
|
}
|
|
22
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fiber.js","names":[],"sources":["../../../src/deckgl/symbol-layer/fiber.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { extend } from '@deckgl-fiber-renderer/dom';\nimport { SymbolLayer, type SymbolLayerProps } from './index';\n\nextend({ SymbolLayer });\n\ndeclare global {\n namespace React {\n // biome-ignore lint/style/useNamingConvention: Built-in React namespace.\n namespace JSX {\n interface IntrinsicElements {\n symbolLayer: SymbolLayerProps;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,OAAO,EAAE,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"fiber.js","names":[],"sources":["../../../src/deckgl/symbol-layer/fiber.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { extend } from '@deckgl-fiber-renderer/dom';\nimport { SymbolLayer, type SymbolLayerProps } from './index';\n\nextend({ SymbolLayer });\n\ndeclare global {\n namespace React {\n // biome-ignore lint/style/useNamingConvention: Built-in React namespace.\n namespace JSX {\n interface IntrinsicElements {\n /**\n * A Deck.gl Fiber layer for rendering MIL-STD-2525 and APP-6 military symbols.\n *\n * Automatically generates symbol icons from SIDC codes with support for\n * multiple symbology standards and customizable rendering options.\n *\n * @example\n * ```tsx\n * <symbolLayer\n * id=\"military-units\"\n * data={units}\n * getSidc={d => d.sidc}\n * getPosition={d => d.position}\n * getSize={32}\n * defaultSymbolOptions={{ colorMode: 'Dark' }}\n * />\n * ```\n */\n symbolLayer: SymbolLayerProps;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,OAAO,EAAE,aAAa,CAAC"}
|
|
@@ -15,6 +15,9 @@ import { IconLayer, IconLayerProps } from "@deck.gl/layers";
|
|
|
15
15
|
import { SymbolOptions } from "milsymbol";
|
|
16
16
|
|
|
17
17
|
//#region src/deckgl/symbol-layer/index.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Internal props specific to SymbolLayer.
|
|
20
|
+
*/
|
|
18
21
|
type _SymbolLayerProps<TData = unknown> = {
|
|
19
22
|
/**
|
|
20
23
|
* An accessor function that returns the SIDC for a given data point.
|
|
@@ -29,9 +32,84 @@ type _SymbolLayerProps<TData = unknown> = {
|
|
|
29
32
|
*/
|
|
30
33
|
defaultSymbolOptions?: SymbolOptions;
|
|
31
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Props for SymbolLayer component.
|
|
37
|
+
* Extends IconLayer props with MIL-STD-2525 symbol rendering support.
|
|
38
|
+
*/
|
|
32
39
|
type SymbolLayerProps<TData = unknown> = _SymbolLayerProps<TData> & Omit<IconLayerProps<TData>, 'getIcon' | 'getColor' | 'iconAtlas' | 'iconMapping'>;
|
|
33
40
|
/**
|
|
34
|
-
*
|
|
41
|
+
* A Deck.gl layer for rendering MIL-STD-2525 and APP-6 military symbols.
|
|
42
|
+
*
|
|
43
|
+
* This layer extends IconLayer and automatically generates symbol icons from SIDC codes.
|
|
44
|
+
* It supports multiple symbology standards including MIL-STD-2525 B/C/D/E, STANAG APP6 B/D/E,
|
|
45
|
+
* and FM 1-02.2.
|
|
46
|
+
*
|
|
47
|
+
* Features:
|
|
48
|
+
* - Automatic symbol generation from SIDC codes
|
|
49
|
+
* - Caching for performance optimization
|
|
50
|
+
* - Customizable symbol options per data point
|
|
51
|
+
* - Dark/Light color modes
|
|
52
|
+
*
|
|
53
|
+
* Can be used directly with Deck.gl or as a JSX element with React Fiber:
|
|
54
|
+
* - React Fiber: `<symbolLayer id="symbols" data={[...]} ... />`
|
|
55
|
+
* - Direct: `new SymbolLayer({ id: 'symbols', data: [...], ... })`
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* Direct Deck.gl usage:
|
|
59
|
+
* ```typescript
|
|
60
|
+
* import { Deck } from '@deck.gl/core';
|
|
61
|
+
* import { SymbolLayer } from '@accelint/map-toolkit/deckgl/symbol-layer';
|
|
62
|
+
*
|
|
63
|
+
* const layer = new SymbolLayer({
|
|
64
|
+
* id: 'military-symbols',
|
|
65
|
+
* data: [
|
|
66
|
+
* { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },
|
|
67
|
+
* { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },
|
|
68
|
+
* ],
|
|
69
|
+
* getSidc: d => d.sidc,
|
|
70
|
+
* getPosition: d => d.position,
|
|
71
|
+
* getSize: 32,
|
|
72
|
+
* defaultSymbolOptions: {
|
|
73
|
+
* colorMode: 'Dark',
|
|
74
|
+
* size: 100,
|
|
75
|
+
* },
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* new Deck({
|
|
79
|
+
* initialViewState: { longitude: -120, latitude: 36, zoom: 6 },
|
|
80
|
+
* controller: true,
|
|
81
|
+
* layers: [layer],
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* React Fiber usage:
|
|
87
|
+
* ```tsx
|
|
88
|
+
* import '@accelint/map-toolkit/deckgl/symbol-layer/fiber';
|
|
89
|
+
* import { BaseMap } from '@accelint/map-toolkit/deckgl';
|
|
90
|
+
* import { View } from '@deckgl-fiber-renderer/dom';
|
|
91
|
+
*
|
|
92
|
+
* function MilitaryMap() {
|
|
93
|
+
* const units = [
|
|
94
|
+
* { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },
|
|
95
|
+
* { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },
|
|
96
|
+
* ];
|
|
97
|
+
*
|
|
98
|
+
* return (
|
|
99
|
+
* <BaseMap id="map" className="w-full h-full">
|
|
100
|
+
* <View id="main" controller />
|
|
101
|
+
* <symbolLayer
|
|
102
|
+
* id="military-units"
|
|
103
|
+
* data={units}
|
|
104
|
+
* getSidc={d => d.sidc}
|
|
105
|
+
* getPosition={d => d.position}
|
|
106
|
+
* getSize={32}
|
|
107
|
+
* defaultSymbolOptions={{ colorMode: 'Dark' }}
|
|
108
|
+
* />
|
|
109
|
+
* </BaseMap>
|
|
110
|
+
* );
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
35
113
|
*/
|
|
36
114
|
declare class SymbolLayer<TData = unknown, TExtraProps extends {} = {}> extends IconLayer<TData, TExtraProps & Required<_SymbolLayerProps<TData>>> {
|
|
37
115
|
static defaultProps: DefaultProps<SymbolLayerProps<unknown>>;
|
|
@@ -35,7 +35,78 @@ const defaultProps = {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* A Deck.gl layer for rendering MIL-STD-2525 and APP-6 military symbols.
|
|
39
|
+
*
|
|
40
|
+
* This layer extends IconLayer and automatically generates symbol icons from SIDC codes.
|
|
41
|
+
* It supports multiple symbology standards including MIL-STD-2525 B/C/D/E, STANAG APP6 B/D/E,
|
|
42
|
+
* and FM 1-02.2.
|
|
43
|
+
*
|
|
44
|
+
* Features:
|
|
45
|
+
* - Automatic symbol generation from SIDC codes
|
|
46
|
+
* - Caching for performance optimization
|
|
47
|
+
* - Customizable symbol options per data point
|
|
48
|
+
* - Dark/Light color modes
|
|
49
|
+
*
|
|
50
|
+
* Can be used directly with Deck.gl or as a JSX element with React Fiber:
|
|
51
|
+
* - React Fiber: `<symbolLayer id="symbols" data={[...]} ... />`
|
|
52
|
+
* - Direct: `new SymbolLayer({ id: 'symbols', data: [...], ... })`
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* Direct Deck.gl usage:
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { Deck } from '@deck.gl/core';
|
|
58
|
+
* import { SymbolLayer } from '@accelint/map-toolkit/deckgl/symbol-layer';
|
|
59
|
+
*
|
|
60
|
+
* const layer = new SymbolLayer({
|
|
61
|
+
* id: 'military-symbols',
|
|
62
|
+
* data: [
|
|
63
|
+
* { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },
|
|
64
|
+
* { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },
|
|
65
|
+
* ],
|
|
66
|
+
* getSidc: d => d.sidc,
|
|
67
|
+
* getPosition: d => d.position,
|
|
68
|
+
* getSize: 32,
|
|
69
|
+
* defaultSymbolOptions: {
|
|
70
|
+
* colorMode: 'Dark',
|
|
71
|
+
* size: 100,
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* new Deck({
|
|
76
|
+
* initialViewState: { longitude: -120, latitude: 36, zoom: 6 },
|
|
77
|
+
* controller: true,
|
|
78
|
+
* layers: [layer],
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* React Fiber usage:
|
|
84
|
+
* ```tsx
|
|
85
|
+
* import '@accelint/map-toolkit/deckgl/symbol-layer/fiber';
|
|
86
|
+
* import { BaseMap } from '@accelint/map-toolkit/deckgl';
|
|
87
|
+
* import { View } from '@deckgl-fiber-renderer/dom';
|
|
88
|
+
*
|
|
89
|
+
* function MilitaryMap() {
|
|
90
|
+
* const units = [
|
|
91
|
+
* { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },
|
|
92
|
+
* { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },
|
|
93
|
+
* ];
|
|
94
|
+
*
|
|
95
|
+
* return (
|
|
96
|
+
* <BaseMap id="map" className="w-full h-full">
|
|
97
|
+
* <View id="main" controller />
|
|
98
|
+
* <symbolLayer
|
|
99
|
+
* id="military-units"
|
|
100
|
+
* data={units}
|
|
101
|
+
* getSidc={d => d.sidc}
|
|
102
|
+
* getPosition={d => d.position}
|
|
103
|
+
* getSize={32}
|
|
104
|
+
* defaultSymbolOptions={{ colorMode: 'Dark' }}
|
|
105
|
+
* />
|
|
106
|
+
* </BaseMap>
|
|
107
|
+
* );
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
39
110
|
*/
|
|
40
111
|
var SymbolLayer = class extends IconLayer {
|
|
41
112
|
static defaultProps = defaultProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defaultProps: DefaultProps<SymbolLayerProps>"],"sources":["../../../src/deckgl/symbol-layer/index.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { IconLayer, type IconLayerProps } from '@deck.gl/layers';\nimport ms, { type SymbolOptions } from 'milsymbol';\nimport type {\n AccessorContext,\n AccessorFunction,\n DefaultProps,\n} from '@deck.gl/core';\n\nconst MilSymbol = ms.Symbol;\n\ntype _SymbolLayerProps<TData = unknown> = {\n /**\n * An accessor function that returns the SIDC for a given data point.\n */\n getSidc?: AccessorFunction<TData, string | number | bigint>;\n /**\n * An accessor function that returns symbol options for a given data point.\n */\n getSymbolOptions?: AccessorFunction<TData, SymbolOptions | null>;\n /**\n * Default symbol options to use when rendering symbols.\n */\n defaultSymbolOptions?: SymbolOptions;\n};\n\nexport type SymbolLayerProps<TData = unknown> = _SymbolLayerProps<TData> &\n Omit<\n IconLayerProps<TData>,\n 'getIcon' | 'getColor' | 'iconAtlas' | 'iconMapping'\n >;\n\nconst defaultProps: DefaultProps<SymbolLayerProps> = {\n // biome-ignore lint/suspicious/noExplicitAny: We don't know what the data type is.\n getSidc: { type: 'accessor', value: (x: any) => x.sidc },\n getSymbolOptions: { type: 'accessor', value: () => null },\n getSize: { type: 'accessor', value: 32 },\n defaultSymbolOptions: { type: 'object', value: {} },\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaultProps: DefaultProps<SymbolLayerProps>"],"sources":["../../../src/deckgl/symbol-layer/index.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { IconLayer, type IconLayerProps } from '@deck.gl/layers';\nimport ms, { type SymbolOptions } from 'milsymbol';\nimport type {\n AccessorContext,\n AccessorFunction,\n DefaultProps,\n} from '@deck.gl/core';\n\nconst MilSymbol = ms.Symbol;\n\n/**\n * Internal props specific to SymbolLayer.\n */\ntype _SymbolLayerProps<TData = unknown> = {\n /**\n * An accessor function that returns the SIDC for a given data point.\n */\n getSidc?: AccessorFunction<TData, string | number | bigint>;\n /**\n * An accessor function that returns symbol options for a given data point.\n */\n getSymbolOptions?: AccessorFunction<TData, SymbolOptions | null>;\n /**\n * Default symbol options to use when rendering symbols.\n */\n defaultSymbolOptions?: SymbolOptions;\n};\n\n/**\n * Props for SymbolLayer component.\n * Extends IconLayer props with MIL-STD-2525 symbol rendering support.\n */\nexport type SymbolLayerProps<TData = unknown> = _SymbolLayerProps<TData> &\n Omit<\n IconLayerProps<TData>,\n 'getIcon' | 'getColor' | 'iconAtlas' | 'iconMapping'\n >;\n\nconst defaultProps: DefaultProps<SymbolLayerProps> = {\n // biome-ignore lint/suspicious/noExplicitAny: We don't know what the data type is.\n getSidc: { type: 'accessor', value: (x: any) => x.sidc },\n getSymbolOptions: { type: 'accessor', value: () => null },\n getSize: { type: 'accessor', value: 32 },\n defaultSymbolOptions: { type: 'object', value: {} },\n};\n\n/**\n * A Deck.gl layer for rendering MIL-STD-2525 and APP-6 military symbols.\n *\n * This layer extends IconLayer and automatically generates symbol icons from SIDC codes.\n * It supports multiple symbology standards including MIL-STD-2525 B/C/D/E, STANAG APP6 B/D/E,\n * and FM 1-02.2.\n *\n * Features:\n * - Automatic symbol generation from SIDC codes\n * - Caching for performance optimization\n * - Customizable symbol options per data point\n * - Dark/Light color modes\n *\n * Can be used directly with Deck.gl or as a JSX element with React Fiber:\n * - React Fiber: `<symbolLayer id=\"symbols\" data={[...]} ... />`\n * - Direct: `new SymbolLayer({ id: 'symbols', data: [...], ... })`\n *\n * @example\n * Direct Deck.gl usage:\n * ```typescript\n * import { Deck } from '@deck.gl/core';\n * import { SymbolLayer } from '@accelint/map-toolkit/deckgl/symbol-layer';\n *\n * const layer = new SymbolLayer({\n * id: 'military-symbols',\n * data: [\n * { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },\n * { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },\n * ],\n * getSidc: d => d.sidc,\n * getPosition: d => d.position,\n * getSize: 32,\n * defaultSymbolOptions: {\n * colorMode: 'Dark',\n * size: 100,\n * },\n * });\n *\n * new Deck({\n * initialViewState: { longitude: -120, latitude: 36, zoom: 6 },\n * controller: true,\n * layers: [layer],\n * });\n * ```\n *\n * @example\n * React Fiber usage:\n * ```tsx\n * import '@accelint/map-toolkit/deckgl/symbol-layer/fiber';\n * import { BaseMap } from '@accelint/map-toolkit/deckgl';\n * import { View } from '@deckgl-fiber-renderer/dom';\n *\n * function MilitaryMap() {\n * const units = [\n * { position: [-122.4, 37.74], sidc: 'SFG-UCI----D', name: 'Unit 1' },\n * { position: [-118.2, 34.05], sidc: 'SFG-UCIZ---D', name: 'Unit 2' },\n * ];\n *\n * return (\n * <BaseMap id=\"map\" className=\"w-full h-full\">\n * <View id=\"main\" controller />\n * <symbolLayer\n * id=\"military-units\"\n * data={units}\n * getSidc={d => d.sidc}\n * getPosition={d => d.position}\n * getSize={32}\n * defaultSymbolOptions={{ colorMode: 'Dark' }}\n * />\n * </BaseMap>\n * );\n * }\n * ```\n */\nexport class SymbolLayer<\n TData = unknown,\n // biome-ignore lint/complexity/noBannedTypes: Follows DeckGL format.\n TExtraProps extends {} = {},\n> extends IconLayer<TData, TExtraProps & Required<_SymbolLayerProps<TData>>> {\n static override defaultProps = defaultProps;\n static override layerName = 'SymbolLayer';\n\n /**\n * The default symbol options to use when rendering symbols.\n *\n * @internal\n */\n protected defaultOptions: SymbolOptions;\n\n /**\n * Caches the results of the icon generation\n *\n * @internal\n * @todo Use LRU cache to limit memory usage.\n */\n protected generationCache = new Map<string, string>();\n\n constructor(...args: Partial<SymbolLayerProps<TData>>[]) {\n // Props are frozen after the construction\n const customGetIcons = {\n getIcon: (data: TData, info: AccessorContext<TData>) =>\n this.generateIcon(data, info),\n } as IconLayerProps<TData>;\n\n // biome-ignore lint/suspicious/noExplicitAny: Needed to retype the layer.\n super(...(args as any), customGetIcons as any);\n\n // Default options need to be set in the constructor.\n this.defaultOptions = {\n size: 100,\n colorMode: 'Dark',\n ...this.props.defaultSymbolOptions,\n };\n }\n\n /**\n * Generates an icon using the provided SIDC and symbol options.\n *\n * @param data A point's data\n * @param info Contextual information about the point\n * @returns DeckGL Icon Object\n */\n protected generateIcon = (data: TData, info: AccessorContext<TData>) => {\n const { getSidc, getSymbolOptions } = this.props;\n const sidc = getSidc(data, info).toString();\n\n let currentSymbolOptions = this.defaultOptions;\n\n const localOptions = getSymbolOptions(data, info);\n\n if (localOptions) {\n currentSymbolOptions = {\n ...currentSymbolOptions,\n ...localOptions,\n };\n }\n\n const size = currentSymbolOptions.size as number;\n\n const cacheKey = this.generateCacheKey(sidc, currentSymbolOptions);\n\n if (this.generationCache.has(cacheKey)) {\n const cachedUrl = this.generationCache.get(cacheKey) as string;\n\n return {\n id: cacheKey,\n url: cachedUrl,\n height: size,\n width: size,\n };\n }\n\n const dataUrl = new MilSymbol(sidc, currentSymbolOptions).toDataURL();\n\n this.generationCache.set(cacheKey, dataUrl);\n\n const returnData = {\n id: cacheKey,\n url: dataUrl,\n height: size,\n width: size,\n };\n\n return returnData;\n };\n\n /**\n * Generates a cache key for the given SIDC and symbol options.\n *\n * @param sidc SIDC of the symbol\n * @param options Options used to generate the symbol\n * @returns String key for caching\n */\n protected generateCacheKey(sidc: string, options: SymbolOptions) {\n return `${sidc}-${JSON.stringify(options)}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,YAAY,GAAG;AA8BrB,MAAMA,eAA+C;CAEnD,SAAS;EAAE,MAAM;EAAY,QAAQ,MAAW,EAAE;EAAM;CACxD,kBAAkB;EAAE,MAAM;EAAY,aAAa;EAAM;CACzD,SAAS;EAAE,MAAM;EAAY,OAAO;EAAI;CACxC,sBAAsB;EAAE,MAAM;EAAU,OAAO,EAAE;EAAE;CACpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4ED,IAAa,cAAb,cAIU,UAAmE;CAC3E,OAAgB,eAAe;CAC/B,OAAgB,YAAY;;;;;;CAO5B,AAAU;;;;;;;CAQV,AAAU,kCAAkB,IAAI,KAAqB;CAErD,YAAY,GAAG,MAA0C;EAEvD,MAAM,iBAAiB,EACrB,UAAU,MAAa,SACrB,KAAK,aAAa,MAAM,KAAK,EAChC;AAGD,QAAM,GAAI,MAAc,eAAsB;AAG9C,OAAK,iBAAiB;GACpB,MAAM;GACN,WAAW;GACX,GAAG,KAAK,MAAM;GACf;;;;;;;;;CAUH,AAAU,gBAAgB,MAAa,SAAiC;EACtE,MAAM,EAAE,SAAS,qBAAqB,KAAK;EAC3C,MAAM,OAAO,QAAQ,MAAM,KAAK,CAAC,UAAU;EAE3C,IAAI,uBAAuB,KAAK;EAEhC,MAAM,eAAe,iBAAiB,MAAM,KAAK;AAEjD,MAAI,aACF,wBAAuB;GACrB,GAAG;GACH,GAAG;GACJ;EAGH,MAAM,OAAO,qBAAqB;EAElC,MAAM,WAAW,KAAK,iBAAiB,MAAM,qBAAqB;AAElE,MAAI,KAAK,gBAAgB,IAAI,SAAS,CAGpC,QAAO;GACL,IAAI;GACJ,KAJgB,KAAK,gBAAgB,IAAI,SAAS;GAKlD,QAAQ;GACR,OAAO;GACR;EAGH,MAAM,UAAU,IAAI,UAAU,MAAM,qBAAqB,CAAC,WAAW;AAErE,OAAK,gBAAgB,IAAI,UAAU,QAAQ;AAS3C,SAPmB;GACjB,IAAI;GACJ,KAAK;GACL,QAAQ;GACR,OAAO;GACR;;;;;;;;;CAYH,AAAU,iBAAiB,MAAc,SAAwB;AAC/D,SAAO,GAAG,KAAK,GAAG,KAAK,UAAU,QAAQ"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
//#region src/deckgl/text-layer/character-sets.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Valid keys for predefined character sets.
|
|
4
|
+
* Used for type-safe character set selection.
|
|
5
|
+
*/
|
|
2
6
|
type CharacterSetsKeys = keyof typeof CHARACTER_SETS;
|
|
3
7
|
/**
|
|
4
8
|
* Predefined character sets for TextLayer.
|
|
@@ -6,6 +10,32 @@ type CharacterSetsKeys = keyof typeof CHARACTER_SETS;
|
|
|
6
10
|
* Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,
|
|
7
11
|
* or use AUTO for dynamic optimization based on content.
|
|
8
12
|
* EXPANDED includes ASCII and Latin characters with diacritics for international text.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { TextLayer, CHARACTER_SETS } from '@accelint/map-toolkit/deckgl/text-layer';
|
|
17
|
+
*
|
|
18
|
+
* // Use ASCII-only for better performance
|
|
19
|
+
* const asciiLayer = new TextLayer({
|
|
20
|
+
* id: 'ascii-text',
|
|
21
|
+
* data: [...],
|
|
22
|
+
* characterSet: CHARACTER_SETS.ASCII_ALL,
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Use EXPANDED for international text with diacritics
|
|
26
|
+
* const internationalLayer = new TextLayer({
|
|
27
|
+
* id: 'international-text',
|
|
28
|
+
* data: [...],
|
|
29
|
+
* characterSet: CHARACTER_SETS.EXPANDED,
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Use AUTO for dynamic optimization
|
|
33
|
+
* const autoLayer = new TextLayer({
|
|
34
|
+
* id: 'auto-text',
|
|
35
|
+
* data: [...],
|
|
36
|
+
* characterSet: CHARACTER_SETS.AUTO,
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
9
39
|
*/
|
|
10
40
|
declare const CHARACTER_SETS: Readonly<{
|
|
11
41
|
readonly ALL_NUMBERS: "1234567890";
|
|
@@ -33,6 +33,32 @@ const EXPANDED = `${ASCII_ALL}${LATIN_ALL}`;
|
|
|
33
33
|
* Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,
|
|
34
34
|
* or use AUTO for dynamic optimization based on content.
|
|
35
35
|
* EXPANDED includes ASCII and Latin characters with diacritics for international text.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { TextLayer, CHARACTER_SETS } from '@accelint/map-toolkit/deckgl/text-layer';
|
|
40
|
+
*
|
|
41
|
+
* // Use ASCII-only for better performance
|
|
42
|
+
* const asciiLayer = new TextLayer({
|
|
43
|
+
* id: 'ascii-text',
|
|
44
|
+
* data: [...],
|
|
45
|
+
* characterSet: CHARACTER_SETS.ASCII_ALL,
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // Use EXPANDED for international text with diacritics
|
|
49
|
+
* const internationalLayer = new TextLayer({
|
|
50
|
+
* id: 'international-text',
|
|
51
|
+
* data: [...],
|
|
52
|
+
* characterSet: CHARACTER_SETS.EXPANDED,
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Use AUTO for dynamic optimization
|
|
56
|
+
* const autoLayer = new TextLayer({
|
|
57
|
+
* id: 'auto-text',
|
|
58
|
+
* data: [...],
|
|
59
|
+
* characterSet: CHARACTER_SETS.AUTO,
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
36
62
|
*/
|
|
37
63
|
const CHARACTER_SETS = Object.freeze({
|
|
38
64
|
ALL_NUMBERS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-sets.js","names":[],"sources":["../../../src/deckgl/text-layer/character-sets.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nconst ALL_NUMBERS = '1234567890';\n\nconst ASCII_LETTERS_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';\nconst ASCII_LETTERS_UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst ASCII_SYMBOLS = ' !\"#$%&\\'()*+,-./:;<=>?@[]^_`{|}~';\n\nconst ASCII_LETTERS = `${ASCII_LETTERS_LOWERCASE}${ASCII_LETTERS_UPPERCASE}`;\nconst ASCII_ALPHA_NUMERIC = `${ASCII_LETTERS}${ALL_NUMBERS}`;\nconst ASCII_ALL = `${ASCII_LETTERS}${ALL_NUMBERS}${ASCII_SYMBOLS}`;\n\nconst AUTO = 'auto';\n\nconst LATIN_LETTERS_LOWERCASE = 'àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿß';\nconst LATIN_LETTERS_UPPERCASE = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';\nconst LATIN_SYMBOLS = ' ¡¿¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿×÷';\n\nconst LATIN_LETTERS = `${LATIN_LETTERS_LOWERCASE}${LATIN_LETTERS_UPPERCASE}`;\nconst LATIN_ALPHA_NUMERIC = `${LATIN_LETTERS}${ALL_NUMBERS}`;\nconst LATIN_ALL = `${LATIN_LETTERS}${ALL_NUMBERS}${LATIN_SYMBOLS}`;\n\nconst EXPANDED = `${ASCII_ALL}${LATIN_ALL}`;\n\nexport type CharacterSetsKeys = keyof typeof CHARACTER_SETS;\n\n/**\n * Predefined character sets for TextLayer.\n *\n * Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,\n * or use AUTO for dynamic optimization based on content.\n * EXPANDED includes ASCII and Latin characters with diacritics for international text.\n */\nexport const CHARACTER_SETS = Object.freeze({\n ALL_NUMBERS,\n\n ASCII_ALL,\n ASCII_ALPHA_NUMERIC,\n ASCII_LETTERS,\n ASCII_LETTERS_LOWERCASE,\n ASCII_LETTERS_UPPERCASE,\n ASCII_SYMBOLS,\n\n AUTO,\n EXPANDED,\n\n LATIN_ALL,\n LATIN_ALPHA_NUMERIC,\n LATIN_LETTERS,\n LATIN_LETTERS_LOWERCASE,\n LATIN_LETTERS_UPPERCASE,\n LATIN_SYMBOLS,\n} as const);\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,cAAc;AAEpB,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB,GAAG,0BAA0B;AACnD,MAAM,sBAAsB,GAAG,gBAAgB;AAC/C,MAAM,YAAY,GAAG,gBAAgB,cAAc;AAEnD,MAAM,OAAO;AAEb,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB,GAAG,0BAA0B;AACnD,MAAM,sBAAsB,GAAG,gBAAgB;AAC/C,MAAM,YAAY,GAAG,gBAAgB,cAAc;AAEnD,MAAM,WAAW,GAAG,YAAY
|
|
1
|
+
{"version":3,"file":"character-sets.js","names":[],"sources":["../../../src/deckgl/text-layer/character-sets.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nconst ALL_NUMBERS = '1234567890';\n\nconst ASCII_LETTERS_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';\nconst ASCII_LETTERS_UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst ASCII_SYMBOLS = ' !\"#$%&\\'()*+,-./:;<=>?@[]^_`{|}~';\n\nconst ASCII_LETTERS = `${ASCII_LETTERS_LOWERCASE}${ASCII_LETTERS_UPPERCASE}`;\nconst ASCII_ALPHA_NUMERIC = `${ASCII_LETTERS}${ALL_NUMBERS}`;\nconst ASCII_ALL = `${ASCII_LETTERS}${ALL_NUMBERS}${ASCII_SYMBOLS}`;\n\nconst AUTO = 'auto';\n\nconst LATIN_LETTERS_LOWERCASE = 'àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿß';\nconst LATIN_LETTERS_UPPERCASE = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';\nconst LATIN_SYMBOLS = ' ¡¿¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿×÷';\n\nconst LATIN_LETTERS = `${LATIN_LETTERS_LOWERCASE}${LATIN_LETTERS_UPPERCASE}`;\nconst LATIN_ALPHA_NUMERIC = `${LATIN_LETTERS}${ALL_NUMBERS}`;\nconst LATIN_ALL = `${LATIN_LETTERS}${ALL_NUMBERS}${LATIN_SYMBOLS}`;\n\nconst EXPANDED = `${ASCII_ALL}${LATIN_ALL}`;\n\n/**\n * Valid keys for predefined character sets.\n * Used for type-safe character set selection.\n */\nexport type CharacterSetsKeys = keyof typeof CHARACTER_SETS;\n\n/**\n * Predefined character sets for TextLayer.\n *\n * Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,\n * or use AUTO for dynamic optimization based on content.\n * EXPANDED includes ASCII and Latin characters with diacritics for international text.\n *\n * @example\n * ```typescript\n * import { TextLayer, CHARACTER_SETS } from '@accelint/map-toolkit/deckgl/text-layer';\n *\n * // Use ASCII-only for better performance\n * const asciiLayer = new TextLayer({\n * id: 'ascii-text',\n * data: [...],\n * characterSet: CHARACTER_SETS.ASCII_ALL,\n * });\n *\n * // Use EXPANDED for international text with diacritics\n * const internationalLayer = new TextLayer({\n * id: 'international-text',\n * data: [...],\n * characterSet: CHARACTER_SETS.EXPANDED,\n * });\n *\n * // Use AUTO for dynamic optimization\n * const autoLayer = new TextLayer({\n * id: 'auto-text',\n * data: [...],\n * characterSet: CHARACTER_SETS.AUTO,\n * });\n * ```\n */\nexport const CHARACTER_SETS = Object.freeze({\n ALL_NUMBERS,\n\n ASCII_ALL,\n ASCII_ALPHA_NUMERIC,\n ASCII_LETTERS,\n ASCII_LETTERS_LOWERCASE,\n ASCII_LETTERS_UPPERCASE,\n ASCII_SYMBOLS,\n\n AUTO,\n EXPANDED,\n\n LATIN_ALL,\n LATIN_ALPHA_NUMERIC,\n LATIN_LETTERS,\n LATIN_LETTERS_LOWERCASE,\n LATIN_LETTERS_UPPERCASE,\n LATIN_SYMBOLS,\n} as const);\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,cAAc;AAEpB,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB,GAAG,0BAA0B;AACnD,MAAM,sBAAsB,GAAG,gBAAgB;AAC/C,MAAM,YAAY,GAAG,gBAAgB,cAAc;AAEnD,MAAM,OAAO;AAEb,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB,GAAG,0BAA0B;AACnD,MAAM,sBAAsB,GAAG,gBAAgB;AAC/C,MAAM,YAAY,GAAG,gBAAgB,cAAc;AAEnD,MAAM,WAAW,GAAG,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyChC,MAAa,iBAAiB,OAAO,OAAO;CAC1C;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACD,CAAU"}
|
|
@@ -13,6 +13,35 @@
|
|
|
13
13
|
import { TextLayerProps } from "@deck.gl/layers";
|
|
14
14
|
|
|
15
15
|
//#region src/deckgl/text-layer/default-settings.d.ts
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default settings for TextLayer with opinionated styling.
|
|
19
|
+
*
|
|
20
|
+
* Provides consistent text rendering with white text, black outline,
|
|
21
|
+
* centered alignment, and system font stack for optimal performance.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { TextLayer } from '@accelint/map-toolkit/deckgl/text-layer';
|
|
26
|
+
* import { defaultSettings } from '@accelint/map-toolkit/deckgl/text-layer/default-settings';
|
|
27
|
+
*
|
|
28
|
+
* // Use defaults as-is
|
|
29
|
+
* const layer = new TextLayer({
|
|
30
|
+
* id: 'text',
|
|
31
|
+
* data: [...],
|
|
32
|
+
* ...defaultSettings,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Override specific defaults
|
|
36
|
+
* const customLayer = new TextLayer({
|
|
37
|
+
* id: 'text',
|
|
38
|
+
* data: [...],
|
|
39
|
+
* ...defaultSettings,
|
|
40
|
+
* fontFamily: 'Arial',
|
|
41
|
+
* getSize: 14,
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
16
45
|
declare const defaultSettings: Partial<TextLayerProps>;
|
|
17
46
|
//#endregion
|
|
18
47
|
export { defaultSettings };
|
|
@@ -14,6 +14,34 @@
|
|
|
14
14
|
import { DEFAULT_TEXT_STYLE } from "../text-settings.js";
|
|
15
15
|
|
|
16
16
|
//#region src/deckgl/text-layer/default-settings.ts
|
|
17
|
+
/**
|
|
18
|
+
* Default settings for TextLayer with opinionated styling.
|
|
19
|
+
*
|
|
20
|
+
* Provides consistent text rendering with white text, black outline,
|
|
21
|
+
* centered alignment, and system font stack for optimal performance.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { TextLayer } from '@accelint/map-toolkit/deckgl/text-layer';
|
|
26
|
+
* import { defaultSettings } from '@accelint/map-toolkit/deckgl/text-layer/default-settings';
|
|
27
|
+
*
|
|
28
|
+
* // Use defaults as-is
|
|
29
|
+
* const layer = new TextLayer({
|
|
30
|
+
* id: 'text',
|
|
31
|
+
* data: [...],
|
|
32
|
+
* ...defaultSettings,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Override specific defaults
|
|
36
|
+
* const customLayer = new TextLayer({
|
|
37
|
+
* id: 'text',
|
|
38
|
+
* data: [...],
|
|
39
|
+
* ...defaultSettings,
|
|
40
|
+
* fontFamily: 'Arial',
|
|
41
|
+
* getSize: 14,
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
17
45
|
const defaultSettings = {
|
|
18
46
|
...DEFAULT_TEXT_STYLE,
|
|
19
47
|
fontFamily: "system-ui, sans-serif",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-settings.js","names":["defaultSettings: Partial<DglTextLayerProps>"],"sources":["../../../src/deckgl/text-layer/default-settings.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { DEFAULT_TEXT_STYLE } from '../text-settings';\nimport type { TextLayerProps as DglTextLayerProps } from '@deck.gl/layers';\n\nexport const defaultSettings: Partial<DglTextLayerProps> = {\n ...DEFAULT_TEXT_STYLE,\n fontFamily: 'system-ui, sans-serif',\n getAlignmentBaseline: 'center',\n getTextAnchor: 'middle',\n lineHeight: 1,\n} as const;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-settings.js","names":["defaultSettings: Partial<DglTextLayerProps>"],"sources":["../../../src/deckgl/text-layer/default-settings.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { DEFAULT_TEXT_STYLE } from '../text-settings';\nimport type { TextLayerProps as DglTextLayerProps } from '@deck.gl/layers';\n\n/**\n * Default settings for TextLayer with opinionated styling.\n *\n * Provides consistent text rendering with white text, black outline,\n * centered alignment, and system font stack for optimal performance.\n *\n * @example\n * ```typescript\n * import { TextLayer } from '@accelint/map-toolkit/deckgl/text-layer';\n * import { defaultSettings } from '@accelint/map-toolkit/deckgl/text-layer/default-settings';\n *\n * // Use defaults as-is\n * const layer = new TextLayer({\n * id: 'text',\n * data: [...],\n * ...defaultSettings,\n * });\n *\n * // Override specific defaults\n * const customLayer = new TextLayer({\n * id: 'text',\n * data: [...],\n * ...defaultSettings,\n * fontFamily: 'Arial',\n * getSize: 14,\n * });\n * ```\n */\nexport const defaultSettings: Partial<DglTextLayerProps> = {\n ...DEFAULT_TEXT_STYLE,\n fontFamily: 'system-ui, sans-serif',\n getAlignmentBaseline: 'center',\n getTextAnchor: 'middle',\n lineHeight: 1,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAaA,kBAA8C;CACzD,GAAG;CACH,YAAY;CACZ,sBAAsB;CACtB,eAAe;CACf,YAAY;CACb"}
|