maplibre/legacy/layout/
symbol_feature.rs1use std::cmp::Ordering;
4
5use crate::legacy::{
6 geometry_tile_data::{FeatureType, GeometryCollection, Identifier, Value},
7 style_types::expression,
8 tagged_string::TaggedString,
9};
10
11#[derive(Clone)]
14pub struct VectorGeometryTileFeature {
15 pub geometry: GeometryCollection,
16}
17
18#[derive(Clone)]
20pub struct SymbolGeometryTileFeature {
21 feature: Box<VectorGeometryTileFeature>,
22 pub geometry: GeometryCollection, pub formatted_text: Option<TaggedString>,
24 pub icon: Option<expression::Image>,
25 pub sort_key: f64,
26 pub index: usize,
27}
28
29impl PartialEq<Self> for SymbolGeometryTileFeature {
30 fn eq(&self, other: &Self) -> bool {
32 self.sort_key.eq(&other.sort_key) }
34}
35
36impl PartialOrd for SymbolGeometryTileFeature {
37 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
39 self.sort_key.partial_cmp(&other.sort_key)
40 }
41}
42
43impl SymbolGeometryTileFeature {
44 pub fn get_type(&self) -> FeatureType {
46 FeatureType::Point
48 }
49 pub fn get_value(&self, key: &str) -> Option<&Value> {
51 todo!()
52 }
53 pub fn get_properties(&self) -> &serde_json::Value {
55 todo!()
56 }
57 pub fn get_id(&self) -> Identifier {
59 todo!()
60 }
61 pub fn get_geometries(&self) -> &GeometryCollection {
63 todo!()
64 }
65}
66
67impl SymbolGeometryTileFeature {
68 pub fn new(feature: Box<VectorGeometryTileFeature>) -> Self {
70 Self {
71 geometry: feature.geometry.clone(), feature,
73 formatted_text: None,
74 icon: None,
75 sort_key: 0.0,
76 index: 0,
77 }
78 }
79}