This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 197
/
TechniqueParams.ts
1645 lines (1530 loc) · 48.6 KB
/
TechniqueParams.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE
* SPDX-License-Identifier: Apache-2.0
*/
import { JsonExpr } from "./Expr";
import { InterpolatedPropertyDefinition } from "./InterpolatedPropertyDefs";
/**
* The style type of the line caps.
*/
export type LineCaps = "Square" | "Round" | "None" | "TriangleOut" | "TriangleIn";
/**
* The style type of the line dashes.
*/
export type LineDashes = "Square" | "Round" | "Diamond";
/**
* Defines how to interpret the units.
*/
export type MetricUnit = "Meter" | "Pixel";
/**
* Standard kinds of geometry.
* @deprecated See {@link BaseTechniqueParams.kind}.
*/
export enum StandardGeometryKind {
/**
* Used in the enabledKinds/disabledKinds filter to match any kind.
*/
All = "_all_",
/**
* Background geometry.
*/
Background = "background",
/**
* Terrain geometry.
*/
Terrain = "terrain",
/**
* Default value for the FillTechnique.
*/
Area = "area",
/**
* Default value for all line techniques.
*/
Line = "line",
/**
* Default value for the FillTechnique.
*/
Water = "water",
/**
* Political borders.
*/
Border = "border",
/**
* Basis for all roads.
*/
Road = "road",
/**
* Default value for the ExtrudedPolygonTechnique.
*/
Building = "building",
/**
* Default value for the TextTechnique, LineMarkerTechnique and the PoiTechnique.
*/
Label = "label",
/**
* Anything that may show up last.
*/
Detail = "detail"
}
/**
* The kind of geometry is used to group objects together,
* allowing the group to be hidden or displayed.
*
* @remarks
* Any string can be used to specify the kind of the technique in a style in the theme file. Is is
* suggested to specify multiple kinds for specific types of data. For a highway, the following list
* of kinds is suggested:
*```json
* ["line", "road", "road:highway"]
*```
* If it is a tunnel for a highway:
*```json
* ["line", "road", "road:highway", "tunnel", "road:tunnel", "road:highway:tunnel"]
*```
* If specified in this way, specific types of data (here: highway roads) can be enabled and/or
* disabled.
* @deprecated See {@link BaseTechniqueParams.kind}.
*/
export type GeometryKind = string | StandardGeometryKind;
// See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md#ignoredeclarationmerge
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const GeometryKind = StandardGeometryKind;
/**
* Decorate property type with possible dynamic variants.
*/
export type DynamicProperty<T> = T | JsonExpr | InterpolatedPropertyDefinition<T>;
/**
* Length literals.
*
* @remarks
* Description of length units inside a style. Supports literal values (interpreted as `m`), `m` and
* `px`(i.e. `80`, `14px`, `0.6m`, etc.).
*/
export type StyleLength = string | number;
/**
* Color literals.
*
* @remarks
* Description of colors inside a style. Supports hex values as well as CSS hex, rgb and hsl values
* (i.e. `0xffffff`, `#f00fab`, `#aaa`, `rgb(255, 0 120)`, `hsl(360, 100%, 100%)`, etc.).
*/
export type StyleColor = string | number;
/**
* A set of {@link GeometryKind}s.
*/
export class GeometryKindSet extends Set {
/**
* Return `true` if the Set is a superset of the set 'subset'.
*/
isSuperset(subset: Set<any>): boolean {
for (const elem of subset) {
if (!this.has(elem)) {
return false;
}
}
return true;
}
/**
* Return `true` if the Set intersects Set 'set'.
*/
hasIntersection(set: any) {
for (const elem of set) {
if (this.has(elem)) {
return true;
}
}
return false;
}
/**
* Return `true` if the Set either intersects Set 'set' (if set is a Set), of has element 'set'
* if set is not a Set.
*/
hasOrIntersects(set: any) {
if (set instanceof Set) {
return this.hasIntersection(set);
}
return this.has(set);
}
/**
* Return `true` if this set and the array of elements share at least a single element.
*/
hasOrIntersectsArray(subset: any[]) {
for (const elem of subset) {
if (this.has(elem)) {
return true;
}
}
return false;
}
}
/**
* Common attributes or all [[Technique]]s.
*/
export interface BaseTechniqueParams {
/**
* The name used to identify materials created from this technique.
*/
id?: string;
/**
* The render order of the objects created using this technique.
*
* @remarks
* If not specified in style file monotonically increasing
* values according to style position in file.
*/
renderOrder?: DynamicProperty<number>;
/**
* The category of this technique.
*
* @remarks
* The category is used in conjunction with {@link Theme.priorities}
* to assign render orders to the objects created by this {@link Style}.
*/
category?: DynamicProperty<string>;
/**
* Optional. If `true` or `Pickability.transient`, no IDs will be saved for the geometry
* this style creates. Default is `Pickability.onlyVisible`, which allows all pickable and
* visible objects to be picked, Pickability.all, will also allow invisible objects to be
* picked.
* @defaultValue `Pickability.onlyVisible`
* The boolean option is for backwardscompatibilty, please use the Pickability.
*
*
* TODO: deprecate and rename to something that makes more sense
*/
transient?: boolean | Pickability;
/**
* Distance to the camera `(0.0 = camera position, 1.0 = farPlane) at which the object start
* fading out (opacity decreases).
*/
fadeNear?: DynamicProperty<number>;
/**
* Distance to the camera (0.0 = camera position, 1.0 = farPlane) at which the object has zero
* opacity and stops fading out. An undefined value disables fading.
*/
fadeFar?: DynamicProperty<number>;
/**
* Specified kind of geometry.
*
* @remarks
* One kind is set as default in the technique, and can be overridden in the style.
*
* @deprecated Use {@link enabled} with expressions based on `['dynamic-properties']` operator.
* See "object picking" example.
*/
kind?: GeometryKind | GeometryKindSet;
/**
* Runtime filtering of techniques.
*
* Use with `['dynamic-properties']` operator for dynamic feature highlight, highlighig etc.
*
* @see Picking example
*/
enabled?: DynamicProperty<boolean>;
/**
* Set to 'true' if line should appear transparent.
*
* @remarks
* Rendering transparent lines may come with a
* slight performance impact.
* See https://threejs.org/docs/#api/en/materials/Material.transparent.
*/
transparent?: DynamicProperty<boolean>;
/**
* Defines which side of faces will be rendered - front, back or both.
* See https://threejs.org/docs/#api/en/materials/Material.side.
*/
side?: DynamicProperty<number>;
/**
* Minimal zoom level. If the current zoom level is smaller, the technique will not be used.
*/
minZoomLevel?: DynamicProperty<number>;
/**
* Maximum zoom level. If the current zoom level is equal to or greater, the technique will not be used.
*/
maxZoomLevel?: DynamicProperty<number>;
/**
* If `true`, geometry height won't be scaled on projection. Enable it for projections with
* variable scale factor (e.g. mercator) to avoid distortions in geometry with great heights and
* latitude spans. E.g. a large object with even height would look oblique to the ground plane
* on mercator unless this property is set to `true`.
*
* @defaultValue `true` for geometries stored at level less than `12`.
*/
constantHeight?: boolean;
}
export enum TextureCoordinateType {
/**
* Texture coordinates are in tile space.
*
* @remarks
* SW of the tile will have (0,0) and NE will have (1,1).
*/
TileSpace = "tile-space",
/**
* Texture coordinates are in equirectangular space.
*
* @remarks
* (u, v) = ( (longitude+180) / 360, (latitude+90) / 180).
*/
EquirectangularSpace = "equirectangular-space",
/**
* Texture coordinates in feature space.
*
* @remarks
* To compute texture coordinates in feature space,
* the feature must have a property named `bbox` with value
* the tuple `[west, south, east, north]`.
*/
FeatureSpace = "feature-space"
}
/**
* Standard technique parameters.
*/
export interface StandardTechniqueParams extends BaseTechniqueParams {
/**
* Color of the feature in hexadecimal or CSS-style notation, for example: `"#e4e9ec"`,
* `"#fff"`, `"rgb(255, 0, 0)"`, or `"hsl(35, 11%, 88%)"`.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.color.
* @format color-hex
*/
color?: DynamicProperty<StyleColor>;
/**
* A value of `true` creates a wireframe geometry. (May not be supported with all techniques).
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.wireframe.
*/
wireframe?: boolean;
/**
* If `vertexColors` is `true`, every vertex has color information, which is interpolated
* between vertices.
* See https://threejs.org/docs/#api/en/materials/Material.vertexColors.
*/
vertexColors?: boolean;
/**
* How rough the material appears. `0.0` means a smooth mirror reflection. `1.0` means fully
* diffuse. Default is `1.0`.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.roughness.
*/
roughness?: DynamicProperty<number>;
/**
* How much the material is like a metal. Nonmetallic materials such as wood or stone use `0.0`,
* metallic ones use `1.0`, with nothing (usually) in between. Default is `0.0`. A value between
* `0.0` and `1.0` can be used for a rusty metal look. If `metalnessMap` is also provided, both
* values are multiplied.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.metalness.
*/
metalness?: DynamicProperty<number>;
/**
* The material will not be rendered if the opacity is lower than this value.
* See https://threejs.org/docs/#api/en/materials/Material.alphaTest.
*/
alphaTest?: DynamicProperty<number>;
/**
* Skip rendering clobbered pixels.
* See https://threejs.org/docs/#api/en/materials/Material.depthTest.
*/
depthTest?: DynamicProperty<boolean>;
/**
* For transparent lines, set a value between 0.0 for totally transparent, to 1.0 for totally
* opaque.
* See https://threejs.org/docs/#api/en/materials/Material.opacity.
*/
opacity?: DynamicProperty<number>;
/**
* Emissive (light) color of the material, essentially a solid color unaffected by other
* lighting. Default is black.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.emissive.
* @format color-hex
*/
emissive?: DynamicProperty<StyleColor>;
/**
* Intensity of the emissive light. Modulates the emissive color. Default is `1`.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.emissiveIntensity.
*/
emissiveIntensity?: DynamicProperty<number>;
/**
* The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of
* the material. It is used with environment mapping modes `THREE.CubeRefractionMapping` and
* `THREE.EquirectangularRefractionMapping`. The refraction ratio should not exceed `1`. Default
* is `0.98`.
* See https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.refractionRatio.
*/
refractionRatio?: DynamicProperty<number>;
/**
* Whether and how texture coordinates should be generated. No texture coordinates are
* generated if `undefined`.
* Should be set if any texture assigned (e.g. `map`, `normalMap`, ...).
*/
textureCoordinateType?: TextureCoordinateType;
/*
* URL or texture buffer that should be used as color map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.map
*/
map?: string | TextureBuffer;
mapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as normal map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.normalMap
*/
normalMap?: string | TextureBuffer;
normalMapType?: number;
normalMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as displacement map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.displacementMap
*/
displacementMap?: string | TextureBuffer;
displacementMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as roughness map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.roughnessMap
*/
roughnessMap?: string | TextureBuffer;
roughnessMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as emissive map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.emissiveMap
*/
emissiveMap?: string | TextureBuffer;
emissiveMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as bump map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.bumpMap
*/
bumpMap?: string | TextureBuffer;
bumpMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as metalness map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.metalnessMap
*/
metalnessMap?: string | TextureBuffer;
metalnessMapProperties?: TextureProperties;
/**
* URL or texture buffer that should be used as alpha map. See:
* https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.alphaMap
*/
alphaMap?: string | TextureBuffer;
alphaMapProperties?: TextureProperties;
}
/**
* Possible parameters of [[PointTechnique]].
*/
export interface PointTechniqueParams extends BaseTechniqueParams {
/**
* Color of a point in hexadecimal or CSS-style notation, for example: `"#e4e9ec"`, `"#fff"`,
* `"rgb(255, 0, 0)"`, or `"hsl(35, 11%, 88%)"`.
* @format color-hex
*/
color?: DynamicProperty<StyleColor>;
/**
* URL of a texture image to be loaded.
*/
texture?: string;
/**
* For transparent lines, set a value between 0.0 for totally transparent, to 1.0 for totally
* opaque.
*/
opacity?: DynamicProperty<number>;
/**
* Size of point in pixels.
*/
size?: number;
/**
* Whether to enable picking on these points.
*/
enablePicking?: boolean;
}
/**
* Define the stacking option. Enum values for theme file are in "kebab-case".
*/
export enum PoiStackMode {
/**
* Show in a stack.
*/
Show = "show-in-stack",
/**
* Do not show in a stack.
*/
Hide = "hide-in-stack",
/**
* Show category parent in the stack.
*/
ShowParent = "show-parent"
}
/**
* Define the pickability of an object.
*/
export enum Pickability {
/**
* Pickable if visible.
*/
onlyVisible = "only-visible",
/**
* Not Pickable at all.
*/
transient = "transient",
/**
* All objects of this type pickable.
*/
all = "all"
}
/**
* Converts backwards compatible transient property to pure {@type Pickabilty} object
*
* @param transient The transient property from the style
*/
export function transientToPickability(transient?: boolean | Pickability): Pickability {
let pickability: Pickability = Pickability.onlyVisible;
if (transient !== undefined && transient !== null) {
pickability =
typeof transient === "string"
? transient
: transient === true
? Pickability.transient
: Pickability.onlyVisible;
}
return pickability;
}
/**
* Defines options (tokens) supported for text placements defined via [[placements]] attribute.
*
* @remarks
* Possible values are defined as vertical placement letter and horizontal letter, where
* one of the axis may be ignored and then assumed centered. Moving clock-wise, we have:
* `TL` (top-left), `T` (top-center), `TR` (top-right), `R` (center-right), `BR` (bottom-right),
* `B` (bottom-center), `BL` (bottom-left), `L` (left), `C` (center-center).
* Alternatively instead of `T`, `B`, `L`, `R` geographic directions may be used accordingly:
* `NW` (north-west), `N` (north), `NE` (north-east), `E` (east), `SE` (south-east), `S` (south),
* `SW` (south-west), `W` (west).
*/
export enum PlacementToken {
TopLeft = "TL",
Top = "T",
TopRight = "TR",
Right = "R",
BottomRight = "BR",
Bottom = "B",
BottomLeft = "BL",
Left = "L",
Center = "C",
NorthWest = "NW",
North = "N",
NorthEast = "NE",
East = "E",
SouthEast = "SE",
South = "S",
SouthWest = "SW",
West = "W"
}
/**
* Technique that describes icons with labels. Used in [[PoiTechnique]] and [[LineMarkerTechnique]]
* (for road shields).
*/
export interface MarkerTechniqueParams extends BaseTechniqueParams {
/**
* Text to be displayed for feature.
*
* @remarks
* Defaults to first defined:
* - feature property `label` if present in technique (deprecated)
* - `["get", "name:short"]` is `useAbbreviation` is true
* - `["get", "iso_code"]` is `useIsoCode` is true
* - `["get", "name:$LANGUAGE"]` for each specified language
* - `["get", "name"]`
*
* See [[ExtendedTileInfo.getFeatureText]]
*/
text?: DynamicProperty<string>;
/**
* Field name of object containing the text to be rendered.
*
* @deprecated Use `["get", "FIELD"]`.
*/
label?: string;
/**
* If `true`, the abbreviation (field `name:short`) of the elements is used as text.
*
* @deprecated Use proper expression with [`get`, `name:short`] for this purpose.
*/
useAbbreviation?: boolean;
/**
* If `true`, the iso code (field 'iso_code') of the elements is used as text.
* The `iso_code` field contains the ISO 3166-1 2-letter country code.
*
* @deprecated Use proper expression with [`get`, `iso_code`] for this purpose.
*/
useIsoCode?: boolean;
/**
* Priority of marker, defaults to `0`. Markers with highest priority get placed first.
*/
priority?: DynamicProperty<number>;
/**
* Minimum zoomLevel at which to display the label text. No default.
*/
textMinZoomLevel?: DynamicProperty<number>;
/**
* Maximum zoomLevel at which to display the label text. No default.
*/
textMaxZoomLevel?: DynamicProperty<number>;
/**
* Minimum zoomLevel at which to display the label icon. No default.
*/
iconMinZoomLevel?: DynamicProperty<number>;
/**
* Maximum zoomLevel at which to display the label icon. No default.
*/
iconMaxZoomLevel?: DynamicProperty<number>;
/**
* Icon color.
*
* @remarks
* If specified, combined using multiplication with color value read from icon texture.
* Works best for grayscale or monochromatic textures.
*/
iconColor?: StyleColor;
/**
* Icon brightness.
*
* @remarks
* Factor that multiplies a color on top of the icon texture (and `iconColor`) with `0` being
* fully black as final output, `1` being the original rgb colors of the texture.
*
* @defaultValue `1`
*/
iconBrightness?: number;
/**
* Scaling factor of icon. Defaults to 0.5, reducing the size ot 50% in the distance.
*/
distanceScale?: number;
/**
* If `false`, text may overlap markers.
* @defaultValue `false`
*/
textMayOverlap?: boolean;
/**
* If `false`, the icon may overlap text and other icons of lower priority.
*
* @remarks
* If not defined, the
* property value from `textMayOverlap` will be used.
* @defaultValue `false`
*/
iconMayOverlap?: boolean;
/**
* If `false`, text will not reserve screen space, other markers will be able to overlap.
* @defaultValue `true`
*/
textReserveSpace?: boolean;
/**
* If `false`, icon will not reserve screen space, other markers will be able to overlap.
*
* @remarks
* If not defined, the property value from `iconReserveSpace` will be used.
* @defaultValue `true`
*/
iconReserveSpace?: boolean;
/**
* If `false`, text will not be rendered during animations. Defaults to `true`.
*/
renderTextDuringMovements?: boolean;
/**
* If `true`, the label will always be rendered on top.
*
* @remarks
* If overlapping with other labels with
* this flag set, the render order is undefined.
* @defaultValue `false`
*/
alwaysOnTop?: boolean;
/**
* If `true`, icon will appear even if the text part is blocked by other labels.
*
* @remarks
* @defaultValue `false`
*/
textIsOptional?: boolean;
/**
* Should be displayed on map or not. Defaults to `true`.
*/
showOnMap?: boolean;
/**
* Specify stack mode. Defaults to `ShowInStack`.
*/
stackMode?: PoiStackMode;
/**
* Minimal distance between markers in screen pixels.
*/
minDistance?: number;
/**
* If `true`, text will appear even if the icon is blocked by other labels.
*
* @defaultValue `false`
*/
iconIsOptional?: boolean;
/**
* Fading time for labels in seconds.
*/
textFadeTime?: number;
/**
* Fading time for icons in seconds.
*/
iconFadeTime?: number;
/**
* Horizontal offset (to the right) in screen pixels.
*/
xOffset?: DynamicProperty<number>;
/**
* Vertical offset (up) in screen pixels.
*/
yOffset?: DynamicProperty<number>;
/**
* Horizontal offset (to the right) in screen pixels.
*/
iconXOffset?: DynamicProperty<number>;
/**
* Vertical offset (up) in screen pixels.
*/
iconYOffset?: DynamicProperty<number>;
/**
* Scaling factor of icon.
*/
iconScale?: number;
/**
* Vertical height in pixels, controls vertical scaling. Overrides `iconScale`.
*/
screenHeight?: DynamicProperty<number>;
/**
* Horizontal height in pixels, controls horizontal scaling. Overrides `iconScale`.
*/
screenWidth?: DynamicProperty<number>;
/**
* Name of the POI table which should be used for this POI.
*/
poiTable?: string;
/**
* Fixed name to identify POI options in the POI table.
*
* @remarks
* If `poiName` has a value, this value
* supersedes any value read from the field referenced in `poiNameField`.
*/
poiName?: string;
/**
* Name of the field to evaluate to get the name of the POI options in the POI table.
*/
poiNameField?: string;
/**
* The name of either the {@link ImageTexture} in {@link Theme.imageTextures} or the user image
* cached in {@link @here/harp-mapview#userImageCache} to be rendered as marker.
*/
imageTexture?: DynamicProperty<string>;
/**
* Field name to extract imageTexture content from, if imageTexture refers to an
* [[ImageTexture]] definition.
*/
imageTextureField?: string;
/**
* Prefix for `imageTexture` if `imageTextureField` is used.
*/
imageTexturePrefix?: string;
/**
* Postfix for `imageTexture` if `imageTextureField` is used.
*/
imageTexturePostfix?: string;
/**
* Name of the text style.
*/
style?: string;
/**
* Name of the preferred [[Font]] to be used when rendering.
*/
fontName?: string;
/**
* Size of the text (pixels).
*/
size?: DynamicProperty<number>;
/**
* Size of the text background (pixels).
*/
backgroundSize?: DynamicProperty<number>;
/**
* Glyph style to apply for the currently active [[Font]].
*/
fontStyle?: "Regular" | "Bold" | "Italic" | "BoldItalic";
/**
* Glyph variant to apply for the currently active [[Font]].
*/
fontVariant?: "Regular" | "AllCaps" | "SmallCaps";
/**
* Glyph local rotation (radians).
*/
rotation?: number;
/**
* Text color in hexadecimal or CSS-style notation, for example: `"#e4e9ec"`, `"#fff"`,
* `"rgb(255, 0, 0)"`, or `"hsl(35, 11%, 88%)"`.
* @format color-hex
*/
color?: DynamicProperty<StyleColor>;
/**
* Text background color in hexadecimal or CSS-style notation, for example: `"#e4e9ec"`,
* `"#fff"`, `"rgb(255, 0, 0)"`, or `"hsl(35, 11%, 88%)"`.
* @format color-hex
*/
backgroundColor?: DynamicProperty<StyleColor>;
/**
* For transparent text, set a value between 0.0 for totally transparent, to 1.0 for totally
* opaque.
*/
opacity?: DynamicProperty<number>;
/**
* Background text opacity value.
*/
backgroundOpacity?: DynamicProperty<number>;
/**
* Inter-glyph spacing (pixels). Scaled by `size`.
*/
tracking?: DynamicProperty<number>;
/**
* Inter-line spacing (pixels). Scaled by `size`.
*/
leading?: DynamicProperty<number>;
/**
* Maximum number of lines for this label.
*/
maxLines?: DynamicProperty<number>;
/**
* Maximum line width (pixels).
*/
lineWidth?: DynamicProperty<number>;
/**
* [[TextCanvas]] rotation (radians).
*/
canvasRotation?: DynamicProperty<number>;
/**
* Line typesetting rotation (radians).
*/
lineRotation?: DynamicProperty<number>;
/**
* Wrapping (line-breaking) mode.
*/
wrappingMode?: DynamicProperty<"None" | "Character" | "Word">;
/**
* Text position regarding the baseline.
*
* @note The [[placements]] attribute may override the alignment settings.
*/
hAlignment?: DynamicProperty<"Left" | "Center" | "Right">;
/**
* Text position inside a line.
*
* @note The [[placements]] attribute may supersede it.
*/
vAlignment?: DynamicProperty<"Above" | "Center" | "Below">;
/**
* Text label positions relative to the label central position (anchor point).
*
* @remarks
* This attribute defines a comma separated tokens of possible text placements
* relative to label central position (anchor), for example: "TL, TR, C".
* Keep in mind that horizontal placement defines text position in opposite way to
* the alignment, so the text `R` placed (located on the **right side** of label position)
* will be the same as `Left` aligned by deduction. On other side vertical placement is quite
* similar to vertical alignment so `T` placement corresponds with `Above` alignment.
*
* @note This attribute may override [[hAlignment]] and [[vAlignment]] if defined.
*/
placements?: string;
/**
* World space offset in meters applied to the icon along the ground plane, i.e. tangent
* to the local space up vector.
*
* @remarks
* Valid only for icons which have the
* "offset_direction" property as an attribute of the data, which specifies an angle in degrees
* in which direction the offset should take place, i.e. 0 degrees is north, 90 is east etc.
*/
worldOffset?: DynamicProperty<number>;
}
export interface LineTechniqueParams extends BaseTechniqueParams {
/**
* Color of a line in hexadecimal or CSS-style notation, for example: `"#e4e9ec"`, `"#fff"`,
* `"rgb(255, 0, 0)"`, or `"hsl(35, 11%, 88%)"`.
* @format color-hex
*/
color: DynamicProperty<StyleColor>;
/**
* For transparent lines, set a value between 0.0 for totally transparent, to 1.0 for totally
* opaque.
*/
opacity?: DynamicProperty<number>;
/**
* Width of line in pixels. WebGL implementations will normally render all lines with 1 pixel
* width, and ignore this value.
*/
lineWidth: DynamicProperty<number>;
}
/**
* Declares a geometry as a segment.
*/
export interface SegmentsTechniqueParams extends BaseTechniqueParams {
/**
* Color of segments in a hexadecimal notation, for example: `"#e4e9ec"` or `"#fff"`.
* @format color-hex
*/
color: DynamicProperty<StyleColor>;
/**
* For transparent lines, set a value between `0.0` for fully transparent, to `1.0` for fully
* opaque.
*/
opacity?: DynamicProperty<number>;
/**
* Width of a line in meters.
*/
lineWidth: DynamicProperty<number>;
}
/**
* Declares a a geometry as a polygon.
*/
export interface PolygonalTechniqueParams {
/**
* Whether to use polygon offset. Default is false.
*
* @remarks
* This corresponds to the
* GL_POLYGON_OFFSET_FILL WebGL feature.
*
* PolygonOffset is used to raise the geometry towards the geometry (for depth calculation
* only). Default is false.
*
* See here: https://sites.google.com/site/threejstuts/home/polygon_offset
*
* To activate polygonOffset these values have to be set to pull the line "forwards":
*
* transparent: true
*
* polygonOffset: true
*
* polygonOffsetFactor : -1.0, (as an example, see link above)
*
* polygonOffsetUnits: -1 (as an example, see link above)
*/
polygonOffset?: boolean;
/**
* Sets the polygon offset factor. Default is 0.
*/
polygonOffsetFactor?: DynamicProperty<number>;
/**
* Sets the polygon offset units. Default is 0.
*/
polygonOffsetUnits?: DynamicProperty<number>;
/**
* Skip rendering clobbered pixels.
* See https://threejs.org/docs/#api/en/materials/Material.depthTest.
* @defaultValue `false`
*/
depthTest?: DynamicProperty<boolean>;
/**
* Sets the polygon outline color.
* @format color-hex
*/
lineColor?: DynamicProperty<StyleColor>;