maplibre/legacy/
style_types.rs

1//! Translated from https://github.com/maplibre/maplibre-native/blob/4add9ea/include/mbgl/style/types.hpp
2//! and https://github.com/maplibre/maplibre-native/blob/4add9ea/src/mbgl/style/layers/symbol_layer_properties.hpp
3
4use std::{any::TypeId, collections::BTreeSet, marker::PhantomData};
5
6use crate::legacy::{layout::symbol_feature::SymbolGeometryTileFeature, CanonicalTileID};
7
8/// maplibre/maplibre-native#4add9ea original name: SymbolPlacementType
9#[derive(Clone, Copy, PartialEq)]
10pub enum SymbolPlacementType {
11    Point,
12    Line,
13    LineCenter,
14}
15/// maplibre/maplibre-native#4add9ea original name: SymbolAnchorType
16#[derive(Clone, Copy, PartialEq)]
17pub enum SymbolAnchorType {
18    Center,
19    Left,
20    Right,
21    Top,
22    Bottom,
23    TopLeft,
24    TopRight,
25    BottomLeft,
26    BottomRight,
27}
28
29/// maplibre/maplibre-native#4add9ea original name: TextJustifyType
30#[derive(Clone, Copy, PartialEq)]
31pub enum TextJustifyType {
32    Auto,
33    Center,
34    Left,
35    Right,
36}
37/// maplibre/maplibre-native#4add9ea original name: IconTextFitType
38#[derive(Clone, Copy, PartialEq)]
39pub enum IconTextFitType {
40    None,
41    Both,
42    Width,
43    Height,
44}
45
46/// maplibre/maplibre-native#4add9ea original name: TextWritingModeType
47#[derive(PartialOrd, Ord, PartialEq, Eq, Copy, Clone, Debug)]
48pub enum TextWritingModeType {
49    Horizontal = 0,
50    Vertical = 1,
51}
52
53/// maplibre/maplibre-native#4add9ea original name: TextVariableAnchorType
54pub type TextVariableAnchorType = SymbolAnchorType;
55
56/// maplibre/maplibre-native#4add9ea original name: AlignmentType
57#[derive(Clone, Copy, PartialEq)]
58pub enum AlignmentType {
59    Map,
60    Viewport,
61    Auto,
62}
63/// maplibre/maplibre-native#4add9ea original name: TextTransformType
64#[derive(Clone, Copy, PartialEq)]
65pub enum TextTransformType {
66    None,
67    Uppercase,
68    Lowercase,
69}
70/// maplibre/maplibre-native#4add9ea original name: SymbolZOrderType
71#[derive(Clone, Copy, PartialEq)]
72pub enum SymbolZOrderType {
73    Auto,
74    ViewportY,
75    Source,
76}
77/// maplibre/maplibre-native#4add9ea original name: PropertyValue
78#[derive(Clone, PartialEq)]
79pub struct PropertyValue<T> {
80    value: expression::Value,
81    _phandom: PhantomData<T>,
82}
83
84impl<T> Default for PropertyValue<T> {
85    /// maplibre/maplibre-native#4add9ea original name: default
86    fn default() -> Self {
87        // TODO
88        PropertyValue {
89            value: expression::Value::f64(0.0),
90            _phandom: Default::default(),
91        }
92    }
93}
94
95impl<T> PropertyValue<T> {
96    /// maplibre/maplibre-native#4add9ea original name: isUndefined
97    pub fn is_undefined(&self) -> bool {
98        // todo!()
99        false
100    }
101    /// maplibre/maplibre-native#4add9ea original name: isDataDriven
102    pub fn is_data_driven(&self) -> bool {
103        // todo!()
104        false
105    }
106
107    /// maplibre/maplibre-native#4add9ea original name: isZoomant
108    pub fn is_zoomant(&self) -> bool {
109        //  todo!()
110        false
111    }
112}
113
114/// maplibre/maplibre-native#4add9ea original name: PossiblyEvaluatedPropertyValue
115#[derive(Clone, PartialEq)]
116pub struct PossiblyEvaluatedPropertyValue<T> {
117    value: expression::Value,
118    _phandom: PhantomData<T>,
119}
120
121impl<T> Default for PossiblyEvaluatedPropertyValue<T> {
122    /// maplibre/maplibre-native#4add9ea original name: default
123    fn default() -> Self {
124        // TODO
125        PossiblyEvaluatedPropertyValue {
126            value: expression::Value::f64(0.0),
127            _phandom: Default::default(),
128        }
129    }
130}
131
132impl<T> PossiblyEvaluatedPropertyValue<T> {
133    /// maplibre/maplibre-native#4add9ea original name: constantOr
134    pub fn constant_or(&self, constant: T) -> T {
135        todo!()
136    }
137}
138
139pub trait LayoutProperty {
140    /// maplibre/maplibre-native#4add9ea original name: TransitionableType
141    // type TransitionableType = std::nullptr_t;
142
143    type UnevaluatedType;
144    /// maplibre/maplibre-native#4add9ea original name: EvaluatorType
145    // type EvaluatorType = PropertyEvaluator<T>;
146
147    type PossiblyEvaluatedType;
148
149    type Type;
150    const IS_DATA_DRIVEN: bool = false;
151    const IS_OVERRIDABLE: bool = false;
152
153    fn name() -> &'static str;
154
155    fn default_value() -> Self::Type;
156}
157
158pub trait DataDrivenLayoutProperty {
159    /// maplibre/maplibre-native#4add9ea original name: TransitionableType
160    // type TransitionableType = std::nullptr_t;
161
162    type UnevaluatedType: Default;
163    /// maplibre/maplibre-native#4add9ea original name: EvaluatorType
164    //type EvaluatorType = DataDrivenPropertyEvaluator<T>;
165
166    type PossiblyEvaluatedTyp: Default;
167
168    type Type;
169    const IS_DATA_DRIVEN: bool = true;
170    const IS_OVERRIDABLE: bool = false;
171
172    fn name() -> &'static str;
173
174    fn default_value() -> Self::Type;
175}
176
177// text
178/// maplibre/maplibre-native#4add9ea original name: IconAllowOverlap
179pub struct IconAllowOverlap {}
180
181impl LayoutProperty for IconAllowOverlap {
182    type UnevaluatedType = PropertyValue<Self::Type>;
183
184    type PossiblyEvaluatedType = Self::Type;
185
186    type Type = bool;
187
188    fn name() -> &'static str {
189        "icon-allow-overlap"
190    }
191
192    fn default_value() -> <Self as LayoutProperty>::Type {
193        false
194    }
195}
196
197/// maplibre/maplibre-native#4add9ea original name: IconAnchor
198pub struct IconAnchor {}
199
200impl DataDrivenLayoutProperty for IconAnchor {
201    type UnevaluatedType = PropertyValue<Self::Type>;
202
203    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
204
205    type Type = SymbolAnchorType;
206
207    fn name() -> &'static str {
208        "icon-anchor"
209    }
210
211    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
212        SymbolAnchorType::Center
213    }
214}
215
216/// maplibre/maplibre-native#4add9ea original name: IconIgnorePlacement
217pub struct IconIgnorePlacement {}
218
219impl LayoutProperty for IconIgnorePlacement {
220    type UnevaluatedType = PropertyValue<Self::Type>;
221
222    type PossiblyEvaluatedType = Self::Type;
223
224    type Type = bool;
225
226    fn name() -> &'static str {
227        "icon-ignore-placement"
228    }
229
230    fn default_value() -> <Self as LayoutProperty>::Type {
231        false
232    }
233}
234
235/// maplibre/maplibre-native#4add9ea original name: IconImage
236pub struct IconImage {}
237
238impl DataDrivenLayoutProperty for IconImage {
239    type UnevaluatedType = PropertyValue<Self::Type>;
240
241    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
242
243    type Type = expression::Image;
244
245    fn name() -> &'static str {
246        "icon-image"
247    }
248
249    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
250        expression::Image::default()
251    }
252}
253
254/// maplibre/maplibre-native#4add9ea original name: IconKeepUpright
255pub struct IconKeepUpright {}
256
257impl LayoutProperty for IconKeepUpright {
258    type UnevaluatedType = PropertyValue<Self::Type>;
259
260    type PossiblyEvaluatedType = Self::Type;
261
262    type Type = bool;
263
264    fn name() -> &'static str {
265        "icon-keep-upright"
266    }
267
268    fn default_value() -> <Self as LayoutProperty>::Type {
269        false
270    }
271}
272
273/// maplibre/maplibre-native#4add9ea original name: IconOffset
274pub struct IconOffset {}
275
276impl DataDrivenLayoutProperty for IconOffset {
277    type UnevaluatedType = PropertyValue<Self::Type>;
278
279    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
280
281    type Type = [f64; 2];
282
283    fn name() -> &'static str {
284        "icon-offset"
285    }
286
287    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
288        [0.0, 0.0]
289    }
290}
291
292/// maplibre/maplibre-native#4add9ea original name: IconOptional
293pub struct IconOptional {}
294
295impl LayoutProperty for IconOptional {
296    type UnevaluatedType = PropertyValue<Self::Type>;
297
298    type PossiblyEvaluatedType = Self::Type;
299
300    type Type = bool;
301
302    fn name() -> &'static str {
303        "icon-optional"
304    }
305
306    fn default_value() -> <Self as LayoutProperty>::Type {
307        false
308    }
309}
310
311/// maplibre/maplibre-native#4add9ea original name: IconPadding
312pub struct IconPadding {}
313
314impl LayoutProperty for IconPadding {
315    type UnevaluatedType = PropertyValue<Self::Type>;
316
317    type PossiblyEvaluatedType = Self::Type;
318
319    type Type = f64;
320
321    fn name() -> &'static str {
322        "icon-padding"
323    }
324
325    fn default_value() -> <Self as LayoutProperty>::Type {
326        2.0
327    }
328}
329
330/// maplibre/maplibre-native#4add9ea original name: IconPitchAlignment
331pub struct IconPitchAlignment {}
332
333impl LayoutProperty for IconPitchAlignment {
334    type UnevaluatedType = PropertyValue<Self::Type>;
335
336    type PossiblyEvaluatedType = Self::Type;
337
338    type Type = AlignmentType;
339
340    fn name() -> &'static str {
341        "icon-pitch-alignment"
342    }
343
344    fn default_value() -> <Self as LayoutProperty>::Type {
345        AlignmentType::Auto
346    }
347}
348
349/// maplibre/maplibre-native#4add9ea original name: IconRotate
350pub struct IconRotate {}
351
352impl DataDrivenLayoutProperty for IconRotate {
353    type UnevaluatedType = PropertyValue<Self::Type>;
354
355    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
356
357    type Type = f64;
358
359    fn name() -> &'static str {
360        "icon-rotate"
361    }
362
363    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
364        0.0
365    }
366}
367
368/// maplibre/maplibre-native#4add9ea original name: IconRotationAlignment
369pub struct IconRotationAlignment {}
370
371impl LayoutProperty for IconRotationAlignment {
372    type UnevaluatedType = PropertyValue<Self::Type>;
373
374    type PossiblyEvaluatedType = Self::Type;
375
376    type Type = AlignmentType;
377
378    fn name() -> &'static str {
379        "icon-rotation-alignment"
380    }
381
382    fn default_value() -> <Self as LayoutProperty>::Type {
383        AlignmentType::Auto
384    }
385}
386/// maplibre/maplibre-native#4add9ea original name: IconSize
387pub struct IconSize {}
388
389impl DataDrivenLayoutProperty for IconSize {
390    type UnevaluatedType = PropertyValue<Self::Type>;
391
392    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
393
394    type Type = f64;
395
396    fn name() -> &'static str {
397        "icon-size"
398    }
399
400    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
401        1.0
402    }
403}
404
405/// maplibre/maplibre-native#4add9ea original name: IconTextFit
406pub struct IconTextFit {}
407
408impl LayoutProperty for IconTextFit {
409    type UnevaluatedType = PropertyValue<Self::Type>;
410
411    type PossiblyEvaluatedType = Self::Type;
412
413    type Type = IconTextFitType;
414
415    fn name() -> &'static str {
416        "icon-text-fit"
417    }
418
419    fn default_value() -> <Self as LayoutProperty>::Type {
420        IconTextFitType::None
421    }
422}
423/// maplibre/maplibre-native#4add9ea original name: IconTextFitPadding
424pub struct IconTextFitPadding {}
425impl LayoutProperty for IconTextFitPadding {
426    type UnevaluatedType = PropertyValue<Self::Type>;
427
428    type PossiblyEvaluatedType = Self::Type;
429
430    type Type = [f64; 4];
431
432    fn name() -> &'static str {
433        "icon-text-fit-padding"
434    }
435
436    fn default_value() -> <Self as LayoutProperty>::Type {
437        [0.0, 0.0, 0.0, 0.0]
438    }
439}
440
441/// maplibre/maplibre-native#4add9ea original name: SymbolAvoidEdges
442pub struct SymbolAvoidEdges {}
443
444impl LayoutProperty for SymbolAvoidEdges {
445    type UnevaluatedType = PropertyValue<Self::Type>;
446
447    type PossiblyEvaluatedType = Self::Type;
448
449    type Type = bool;
450
451    fn name() -> &'static str {
452        "symbol-avoid-edges"
453    }
454
455    fn default_value() -> <Self as LayoutProperty>::Type {
456        false
457    }
458}
459
460/// maplibre/maplibre-native#4add9ea original name: SymbolPlacement
461pub struct SymbolPlacement {}
462
463impl LayoutProperty for SymbolPlacement {
464    type UnevaluatedType = PropertyValue<Self::Type>;
465
466    type PossiblyEvaluatedType = Self::Type;
467
468    type Type = SymbolPlacementType;
469
470    fn name() -> &'static str {
471        "symbol-placement"
472    }
473
474    fn default_value() -> <Self as LayoutProperty>::Type {
475        SymbolPlacementType::Point
476    }
477}
478
479/// maplibre/maplibre-native#4add9ea original name: SymbolSortKey
480pub struct SymbolSortKey {}
481
482impl DataDrivenLayoutProperty for SymbolSortKey {
483    type UnevaluatedType = PropertyValue<Self::Type>;
484
485    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
486
487    type Type = f64;
488
489    fn name() -> &'static str {
490        "symbol-sort-key"
491    }
492
493    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
494        0.0
495    }
496}
497
498/// maplibre/maplibre-native#4add9ea original name: SymbolSpacing
499pub struct SymbolSpacing {}
500
501impl LayoutProperty for SymbolSpacing {
502    type UnevaluatedType = PropertyValue<Self::Type>;
503
504    type PossiblyEvaluatedType = Self::Type;
505
506    type Type = f64;
507
508    fn name() -> &'static str {
509        "symbol-spacing"
510    }
511
512    fn default_value() -> <Self as LayoutProperty>::Type {
513        250.0
514    }
515}
516
517/// maplibre/maplibre-native#4add9ea original name: SymbolZOrder
518pub struct SymbolZOrder {}
519
520impl LayoutProperty for SymbolZOrder {
521    type UnevaluatedType = PropertyValue<Self::Type>;
522
523    type PossiblyEvaluatedType = Self::Type;
524
525    type Type = SymbolZOrderType;
526
527    fn name() -> &'static str {
528        "symbol-z-order"
529    }
530
531    fn default_value() -> <Self as LayoutProperty>::Type {
532        SymbolZOrderType::Auto
533    }
534}
535/// maplibre/maplibre-native#4add9ea original name: TextAllowOverlap
536pub struct TextAllowOverlap {}
537
538impl LayoutProperty for TextAllowOverlap {
539    type UnevaluatedType = PropertyValue<Self::Type>;
540
541    type PossiblyEvaluatedType = Self::Type;
542
543    type Type = bool;
544
545    fn name() -> &'static str {
546        "text-allow-overlap"
547    }
548
549    fn default_value() -> <Self as LayoutProperty>::Type {
550        false
551    }
552}
553
554/// maplibre/maplibre-native#4add9ea original name: TextAnchor
555pub struct TextAnchor {}
556
557impl DataDrivenLayoutProperty for TextAnchor {
558    type UnevaluatedType = PropertyValue<Self::Type>;
559
560    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
561
562    type Type = SymbolAnchorType;
563
564    fn name() -> &'static str {
565        "text-anchor"
566    }
567
568    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
569        SymbolAnchorType::Center
570    }
571}
572
573/// maplibre/maplibre-native#4add9ea original name: TextField
574pub struct TextField {}
575impl DataDrivenLayoutProperty for TextField {
576    type UnevaluatedType = PropertyValue<Self::Type>;
577
578    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
579
580    type Type = expression::Formatted;
581
582    fn name() -> &'static str {
583        "text-field"
584    }
585
586    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
587        expression::Formatted::default()
588    }
589}
590
591/// maplibre/maplibre-native#4add9ea original name: TextFont
592pub struct TextFont {}
593
594impl DataDrivenLayoutProperty for TextFont {
595    type UnevaluatedType = PropertyValue<Self::Type>;
596
597    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
598
599    type Type = Vec<String>;
600
601    fn name() -> &'static str {
602        "text-font"
603    }
604
605    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
606        vec![
607            "Open Sans Regular".to_string(),
608            "Arial Unicode MS Regular".to_string(),
609        ]
610    }
611}
612
613/// maplibre/maplibre-native#4add9ea original name: TextIgnorePlacement
614pub struct TextIgnorePlacement {}
615
616impl LayoutProperty for TextIgnorePlacement {
617    type UnevaluatedType = PropertyValue<Self::Type>;
618
619    type PossiblyEvaluatedType = Self::Type;
620
621    type Type = bool;
622
623    fn name() -> &'static str {
624        "text-ignore-placement"
625    }
626
627    fn default_value() -> <Self as LayoutProperty>::Type {
628        false
629    }
630}
631
632/// maplibre/maplibre-native#4add9ea original name: TextJustify
633pub struct TextJustify {}
634
635impl DataDrivenLayoutProperty for TextJustify {
636    type UnevaluatedType = PropertyValue<Self::Type>;
637
638    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
639
640    type Type = TextJustifyType;
641
642    fn name() -> &'static str {
643        "text-justify"
644    }
645
646    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
647        TextJustifyType::Center
648    }
649}
650
651/// maplibre/maplibre-native#4add9ea original name: TextKeepUpright
652pub struct TextKeepUpright {}
653
654impl TextKeepUpright {}
655impl LayoutProperty for TextKeepUpright {
656    type UnevaluatedType = PropertyValue<Self::Type>;
657
658    type PossiblyEvaluatedType = Self::Type;
659
660    type Type = bool;
661
662    fn name() -> &'static str {
663        "text-keep-upright"
664    }
665
666    fn default_value() -> <Self as LayoutProperty>::Type {
667        true
668    }
669}
670
671/// maplibre/maplibre-native#4add9ea original name: TextLetterSpacing
672pub struct TextLetterSpacing {}
673
674impl TextLetterSpacing {}
675impl DataDrivenLayoutProperty for TextLetterSpacing {
676    type UnevaluatedType = PropertyValue<Self::Type>;
677
678    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
679
680    type Type = f64;
681
682    fn name() -> &'static str {
683        "text-letter-spacing"
684    }
685
686    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
687        0.0
688    }
689}
690
691/// maplibre/maplibre-native#4add9ea original name: TextLineHeight
692pub struct TextLineHeight {}
693
694impl TextLineHeight {}
695impl LayoutProperty for TextLineHeight {
696    type UnevaluatedType = PropertyValue<Self::Type>;
697
698    type PossiblyEvaluatedType = Self::Type;
699
700    type Type = f64;
701
702    fn name() -> &'static str {
703        "text-line-height"
704    }
705
706    fn default_value() -> <Self as LayoutProperty>::Type {
707        1.2
708    }
709}
710
711/// maplibre/maplibre-native#4add9ea original name: TextMaxAngle
712pub struct TextMaxAngle {}
713
714impl LayoutProperty for TextMaxAngle {
715    type UnevaluatedType = PropertyValue<Self::Type>;
716
717    type PossiblyEvaluatedType = Self::Type;
718
719    type Type = f64;
720
721    fn name() -> &'static str {
722        "text-max-angle"
723    }
724
725    fn default_value() -> <Self as LayoutProperty>::Type {
726        45.0
727    }
728}
729
730/// maplibre/maplibre-native#4add9ea original name: TextMaxWidth
731pub struct TextMaxWidth {}
732
733impl DataDrivenLayoutProperty for TextMaxWidth {
734    type UnevaluatedType = PropertyValue<Self::Type>;
735
736    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
737
738    type Type = f64;
739
740    fn name() -> &'static str {
741        "text-max-width"
742    }
743
744    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
745        10.0
746    }
747}
748
749/// maplibre/maplibre-native#4add9ea original name: TextOffset
750pub struct TextOffset {}
751
752impl DataDrivenLayoutProperty for TextOffset {
753    type UnevaluatedType = PropertyValue<Self::Type>;
754
755    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
756
757    type Type = [f64; 2];
758
759    fn name() -> &'static str {
760        "text-offset"
761    }
762
763    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
764        [0.0, 0.0]
765    }
766}
767
768/// maplibre/maplibre-native#4add9ea original name: TextOptional
769pub struct TextOptional {}
770
771impl LayoutProperty for TextOptional {
772    type UnevaluatedType = PropertyValue<Self::Type>;
773
774    type PossiblyEvaluatedType = Self::Type;
775
776    type Type = bool;
777
778    fn name() -> &'static str {
779        "text-optional"
780    }
781
782    fn default_value() -> <Self as LayoutProperty>::Type {
783        false
784    }
785}
786
787/// maplibre/maplibre-native#4add9ea original name: TextPadding
788pub struct TextPadding {}
789
790impl LayoutProperty for TextPadding {
791    type UnevaluatedType = PropertyValue<Self::Type>;
792
793    type PossiblyEvaluatedType = Self::Type;
794
795    type Type = f64;
796
797    fn name() -> &'static str {
798        "text-padding"
799    }
800
801    fn default_value() -> <Self as LayoutProperty>::Type {
802        2.0
803    }
804}
805
806/// maplibre/maplibre-native#4add9ea original name: TextPitchAlignment
807pub struct TextPitchAlignment {}
808
809impl TextPitchAlignment {}
810impl LayoutProperty for TextPitchAlignment {
811    type UnevaluatedType = PropertyValue<Self::Type>;
812
813    type PossiblyEvaluatedType = Self::Type;
814
815    type Type = AlignmentType;
816
817    fn name() -> &'static str {
818        "text-pitch-alignment"
819    }
820
821    fn default_value() -> <Self as LayoutProperty>::Type {
822        AlignmentType::Auto
823    }
824}
825
826/// maplibre/maplibre-native#4add9ea original name: TextRadialOffset
827pub struct TextRadialOffset {}
828
829impl DataDrivenLayoutProperty for TextRadialOffset {
830    type UnevaluatedType = PropertyValue<Self::Type>;
831
832    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
833
834    type Type = f64;
835
836    fn name() -> &'static str {
837        "text-radial-offset"
838    }
839
840    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
841        0.0
842    }
843}
844
845/// maplibre/maplibre-native#4add9ea original name: TextRotate
846pub struct TextRotate {}
847
848impl DataDrivenLayoutProperty for TextRotate {
849    type UnevaluatedType = PropertyValue<Self::Type>;
850
851    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
852
853    type Type = f64;
854
855    fn name() -> &'static str {
856        "text-rotate"
857    }
858
859    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
860        0.0
861    }
862}
863
864/// maplibre/maplibre-native#4add9ea original name: TextRotationAlignment
865pub struct TextRotationAlignment {}
866
867impl LayoutProperty for TextRotationAlignment {
868    type UnevaluatedType = PropertyValue<Self::Type>;
869    type PossiblyEvaluatedType = Self::Type;
870
871    type Type = AlignmentType;
872
873    fn name() -> &'static str {
874        "text-rotation-alignment"
875    }
876
877    fn default_value() -> <Self as LayoutProperty>::Type {
878        AlignmentType::Auto
879    }
880}
881
882/// maplibre/maplibre-native#4add9ea original name: TextSize
883pub struct TextSize {}
884
885impl DataDrivenLayoutProperty for TextSize {
886    type UnevaluatedType = PropertyValue<Self::Type>;
887
888    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
889
890    type Type = f64;
891
892    fn name() -> &'static str {
893        "text-size"
894    }
895
896    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
897        16.0
898    }
899}
900
901/// maplibre/maplibre-native#4add9ea original name: TextTransform
902pub struct TextTransform {}
903
904impl DataDrivenLayoutProperty for TextTransform {
905    type UnevaluatedType = PropertyValue<Self::Type>;
906
907    type PossiblyEvaluatedTyp = PossiblyEvaluatedPropertyValue<Self::Type>;
908
909    type Type = TextTransformType;
910
911    fn name() -> &'static str {
912        "text-transform"
913    }
914
915    fn default_value() -> <Self as DataDrivenLayoutProperty>::Type {
916        TextTransformType::None
917    }
918}
919
920/// maplibre/maplibre-native#4add9ea original name: TextVariableAnchor
921pub struct TextVariableAnchor {}
922
923impl TextVariableAnchor {}
924impl LayoutProperty for TextVariableAnchor {
925    type UnevaluatedType = PropertyValue<Self::Type>;
926    type PossiblyEvaluatedType = Self::Type;
927
928    type Type = Vec<TextVariableAnchorType>;
929
930    fn name() -> &'static str {
931        "text-variable-anchor"
932    }
933
934    fn default_value() -> <Self as LayoutProperty>::Type {
935        Vec::new()
936    }
937}
938
939/// maplibre/maplibre-native#4add9ea original name: TextWritingMode
940pub struct TextWritingMode {}
941
942impl LayoutProperty for TextWritingMode {
943    type UnevaluatedType = PropertyValue<Self::Type>;
944
945    type PossiblyEvaluatedType = Self::Type;
946
947    type Type = Vec<TextWritingModeType>;
948
949    fn name() -> &'static str {
950        "text-writing-mode"
951    }
952
953    fn default_value() -> <Self as LayoutProperty>::Type {
954        Vec::new()
955    }
956}
957
958/// maplibre/maplibre-native#4add9ea original name: SymbolLayoutProperties_Unevaluated
959#[derive(Clone, Debug)]
960pub struct SymbolLayoutProperties_Unevaluated;
961/// maplibre/maplibre-native#4add9ea original name: SymbolLayoutProperties_PossiblyEvaluated
962#[derive(Clone, Debug)]
963pub struct SymbolLayoutProperties_PossiblyEvaluated;
964
965impl SymbolLayoutProperties_PossiblyEvaluated {
966    /// maplibre/maplibre-native#4add9ea original name: has
967    pub fn has<T: 'static>(&self) -> bool {
968        // todo!() check actual style if property is not empty
969        //     return layout.get<Property>().match([](const typename Property::Type& t) { return !t.is_empty(); },
970        //                                         [](let) { return true; });
971        TypeId::of::<T>() == TypeId::of::<TextField>()
972            || TypeId::of::<T>() == TypeId::of::<TextFont>()
973    }
974}
975
976/// maplibre/maplibre-native#4add9ea original name: SymbolLayoutProperties_Evaluated
977#[derive(Clone)]
978pub struct SymbolLayoutProperties_Evaluated;
979
980pub mod expression {
981    use std::{
982        collections::{BTreeSet, HashMap},
983        rc::Rc,
984    };
985
986    use csscolorparser::Color;
987
988    use crate::legacy::{
989        font_stack::FontStack, layout::symbol_feature::SymbolGeometryTileFeature, CanonicalTileID,
990    };
991
992    /// maplibre/maplibre-native#4add9ea original name: Value
993    #[derive(Clone, PartialEq)]
994    pub enum Value {
995        Color(Color),
996        f64(f64),
997        Object(HashMap<String, Value>),
998    }
999
1000    // TODO
1001    /// maplibre/maplibre-native#4add9ea original name: Image
1002    #[derive(Default, Clone)]
1003    pub struct Image {
1004        pub image_id: String,
1005        pub available: bool,
1006    }
1007    /// maplibre/maplibre-native#4add9ea original name: Formatted
1008    pub struct Formatted {
1009        pub sections: Vec<FormattedSection>,
1010    }
1011
1012    impl Default for Formatted {
1013        /// maplibre/maplibre-native#4add9ea original name: default
1014        fn default() -> Self {
1015            // TODO remove
1016            Formatted {
1017                sections: vec![FormattedSection {
1018                    text: "Aller Anfang ist schwer".to_string(),
1019                    image: None,
1020                    font_scale: None,
1021                    font_stack: None,
1022                    text_color: None,
1023                }],
1024            }
1025        }
1026    }
1027
1028    impl Formatted {
1029        /// maplibre/maplibre-native#4add9ea original name: toString
1030        fn to_string() -> String {
1031            todo!()
1032        }
1033        /// maplibre/maplibre-native#4add9ea original name: toObject
1034        fn to_object() -> Value {
1035            todo!()
1036        }
1037
1038        /// maplibre/maplibre-native#4add9ea original name: empty
1039        fn empty() -> bool {
1040            todo!()
1041        }
1042    }
1043
1044    impl PartialEq for Formatted {
1045        /// maplibre/maplibre-native#4add9ea original name: eq
1046        fn eq(&self, other: &Self) -> bool {
1047            todo!()
1048        }
1049    }
1050
1051    /// maplibre/maplibre-native#4add9ea original name: FormattedSection
1052    #[derive(Default)]
1053    pub struct FormattedSection {
1054        pub text: String,
1055        pub image: Option<Image>,
1056        pub font_scale: Option<f64>,
1057        pub font_stack: Option<FontStack>,
1058        pub text_color: Option<Color>,
1059    }
1060
1061    pub const K_FORMATTED_SECTION_FONT_SCALE: &str = "font-scale";
1062    pub const K_FORMATTED_SECTION_TEXT_FONT: &str = "text-font";
1063    pub const K_FORMATTED_SECTION_TEXT_COLOR: &str = "text-color";
1064
1065    // TODO
1066    /// maplibre/maplibre-native#4add9ea original name: FeatureState
1067    pub type FeatureState = Value;
1068
1069    /// maplibre/maplibre-native#4add9ea original name: EvaluationContext
1070    pub struct EvaluationContext {
1071        zoom: Option<f64>,
1072        accumulated: Option<Value>,
1073        feature: Rc<SymbolGeometryTileFeature>,
1074        color_ramp_parameter: Option<f64>,
1075        // Contains formatted section object, std::unordered_map<std::string, Value>.
1076        formatted_section: Rc<Value>,
1077        feature_state: Rc<FeatureState>,
1078        available_images: Rc<BTreeSet<String>>,
1079        canonical: Rc<CanonicalTileID>,
1080    }
1081}
1082
1083// TODO
1084/// maplibre/maplibre-native#4add9ea original name: PropertyEvaluationParameters(pub
1085pub struct PropertyEvaluationParameters(pub f64);
1086
1087impl SymbolLayoutProperties_Unevaluated {
1088    /// maplibre/maplibre-native#4add9ea original name: get_dynamic
1089    pub fn get_dynamic<T: DataDrivenLayoutProperty>(&self) -> T::UnevaluatedType {
1090        T::UnevaluatedType::default()
1091    }
1092
1093    /// maplibre/maplibre-native#4add9ea original name: evaluate
1094    pub fn evaluate(
1095        &self,
1096        p0: PropertyEvaluationParameters,
1097    ) -> SymbolLayoutProperties_PossiblyEvaluated {
1098        // TODO
1099        SymbolLayoutProperties_PossiblyEvaluated
1100    }
1101}
1102
1103// TODO generated
1104impl SymbolLayoutProperties_PossiblyEvaluated {
1105    /// maplibre/maplibre-native#4add9ea original name: get
1106    pub fn get<T: LayoutProperty>(&self) -> T::Type {
1107        // todo!()
1108        T::default_value()
1109    }
1110    /// maplibre/maplibre-native#4add9ea original name: set
1111    pub fn set<T: LayoutProperty>(&mut self, value: T::Type) {
1112        // todo!()
1113    }
1114
1115    /// maplibre/maplibre-native#4add9ea original name: get_dynamic
1116    pub fn get_dynamic<T: DataDrivenLayoutProperty>(&self) -> T::PossiblyEvaluatedTyp {
1117        T::PossiblyEvaluatedTyp::default()
1118    }
1119
1120    /// maplibre/maplibre-native#4add9ea original name: evaluate
1121    pub fn evaluate<T: DataDrivenLayoutProperty>(
1122        &self,
1123        p0: f64,
1124        p1: &SymbolGeometryTileFeature,
1125        p2: CanonicalTileID,
1126    ) -> T::Type {
1127        //todo!()
1128        T::default_value()
1129    }
1130
1131    /// maplibre/maplibre-native#4add9ea original name: evaluate_feature
1132    pub fn evaluate_feature(
1133        &self,
1134        p0: f64,
1135        p1: &SymbolGeometryTileFeature,
1136    ) -> SymbolLayoutProperties_Evaluated {
1137        //
1138        SymbolLayoutProperties_Evaluated
1139    }
1140
1141    /// maplibre/maplibre-native#4add9ea original name: evaluate4
1142    pub fn evaluate4<T: DataDrivenLayoutProperty>(
1143        &self,
1144        p0: f64,
1145        p1: &SymbolGeometryTileFeature,
1146        available_images: &BTreeSet<String>,
1147        p2: CanonicalTileID,
1148    ) -> T::Type {
1149        //todo!()
1150
1151        //p1.get_value(&T::name());
1152
1153        T::default_value()
1154    }
1155
1156    /// maplibre/maplibre-native#4add9ea original name: evaluate_static
1157    pub fn evaluate_static<T: LayoutProperty>(
1158        &self,
1159        p0: f64,
1160        p1: &SymbolGeometryTileFeature,
1161        p2: CanonicalTileID,
1162    ) -> T::Type {
1163        //todo!()
1164        T::default_value()
1165    }
1166}
1167
1168impl SymbolLayoutProperties_Evaluated {
1169    /// maplibre/maplibre-native#4add9ea original name: get
1170    pub fn get<T: LayoutProperty>(&self) -> T::Type {
1171        //todo!()
1172        T::default_value()
1173    }
1174    /// maplibre/maplibre-native#4add9ea original name: set
1175    pub fn set<T: LayoutProperty>(&mut self, value: T::Type) {
1176        // todo!()
1177    }
1178
1179    /// maplibre/maplibre-native#4add9ea original name: get_dynamic
1180    pub fn get_dynamic<T: DataDrivenLayoutProperty>(&self) -> T::PossiblyEvaluatedTyp {
1181        // todo!()
1182        T::PossiblyEvaluatedTyp::default()
1183    }
1184
1185    /// maplibre/maplibre-native#4add9ea original name: get_eval
1186    pub fn get_eval<T: DataDrivenLayoutProperty>(&self) -> T::Type {
1187        //todo!()
1188        T::default_value()
1189    }
1190
1191    /// maplibre/maplibre-native#4add9ea original name: evaluate
1192    pub fn evaluate<T: DataDrivenLayoutProperty>(
1193        &self,
1194        p0: f64,
1195        p1: &SymbolGeometryTileFeature,
1196        p2: CanonicalTileID,
1197    ) -> T::Type {
1198        //todo!()
1199        T::default_value()
1200    }
1201
1202    /// maplibre/maplibre-native#4add9ea original name: evaluate_static
1203    pub fn evaluate_static<T: LayoutProperty>(
1204        &self,
1205        p0: f64,
1206        p1: &SymbolGeometryTileFeature,
1207        p2: CanonicalTileID,
1208    ) -> T::Type {
1209        //todo!()
1210        T::default_value()
1211    }
1212}