flet-map 0.0.1__py3-none-any.whl → 0.1.0.dev2__py3-none-any.whl

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.

Potentially problematic release.


This version of flet-map might be problematic. Click here for more details.

Files changed (39) hide show
  1. flet_map/__init__.py +30 -1
  2. flet_map/circle_layer.py +156 -0
  3. flet_map/map.py +674 -0
  4. flet_map/map_layer.py +26 -0
  5. flet_map/marker_layer.py +183 -0
  6. flet_map/polygon_layer.py +262 -0
  7. flet_map/polyline_layer.py +292 -0
  8. flet_map/rich_attribution.py +141 -0
  9. flet_map/simple_attribution.py +86 -0
  10. flet_map/text_source_attribution.py +87 -0
  11. flet_map/tile_layer.py +278 -0
  12. flet_map-0.1.0.dev2.dist-info/METADATA +168 -0
  13. flet_map-0.1.0.dev2.dist-info/RECORD +34 -0
  14. {flet_map-0.0.1.dist-info → flet_map-0.1.0.dev2.dist-info}/WHEEL +2 -1
  15. flet_map-0.1.0.dev2.dist-info/top_level.txt +2 -0
  16. flutter/flet_map/CHANGELOG.md +3 -0
  17. flutter/flet_map/LICENSE +201 -0
  18. flutter/flet_map/README.md +3 -0
  19. flutter/flet_map/analysis_options.yaml +4 -0
  20. flutter/flet_map/lib/flet_map.dart +3 -0
  21. flutter/flet_map/lib/src/circle_layer.dart +43 -0
  22. flutter/flet_map/lib/src/create_control.dart +70 -0
  23. flutter/flet_map/lib/src/map.dart +140 -0
  24. flutter/flet_map/lib/src/marker_layer.dart +50 -0
  25. flutter/flet_map/lib/src/polygon_layer.dart +68 -0
  26. flutter/flet_map/lib/src/polyline_layer.dart +80 -0
  27. flutter/flet_map/lib/src/rich_attribution.dart +61 -0
  28. flutter/flet_map/lib/src/simple_attribution.dart +37 -0
  29. flutter/flet_map/lib/src/text_source_attribution.dart +29 -0
  30. flutter/flet_map/lib/src/tile_layer.dart +80 -0
  31. flutter/flet_map/lib/src/utils/attribution_alignment.dart +12 -0
  32. flutter/flet_map/lib/src/utils/map.dart +280 -0
  33. flutter/flet_map/pubspec.lock +831 -0
  34. flutter/flet_map/pubspec.yaml +21 -0
  35. .DS_Store +0 -0
  36. flet_map/.DS_Store +0 -0
  37. flet_map-0.0.1.dist-info/.DS_Store +0 -0
  38. flet_map-0.0.1.dist-info/METADATA +0 -14
  39. flet_map-0.0.1.dist-info/RECORD +0 -7
@@ -0,0 +1,183 @@
1
+ from typing import Any, List, Optional
2
+
3
+ from flet.core.alignment import Alignment
4
+ from flet.core.control import Control, OptionalNumber
5
+ from flet_map.map import MapLatitudeLongitude
6
+ from flet_map.map_layer import MapLayer
7
+ from flet.core.ref import Ref
8
+
9
+
10
+ class Marker(Control):
11
+ """
12
+ A marker displayed on the Map at the specified location through the MarkerLayer.
13
+
14
+ -----
15
+
16
+ Online docs: https://flet.dev/docs/controls/mapmarker
17
+ """
18
+
19
+ def __init__(
20
+ self,
21
+ content: Control,
22
+ coordinates: MapLatitudeLongitude,
23
+ rotate: Optional[bool] = None,
24
+ height: OptionalNumber = None,
25
+ width: OptionalNumber = None,
26
+ alignment: Optional[Alignment] = None,
27
+ #
28
+ # Control
29
+ #
30
+ ref: Optional[Ref] = None,
31
+ visible: Optional[bool] = None,
32
+ data: Any = None,
33
+ ):
34
+ Control.__init__(
35
+ self,
36
+ ref=ref,
37
+ visible=visible,
38
+ data=data,
39
+ )
40
+
41
+ self.content = content
42
+ self.coordinates = coordinates
43
+ self.rotate = rotate
44
+ self.height = height
45
+ self.width = width
46
+ self.alignment = alignment
47
+
48
+ def _get_control_name(self):
49
+ return "map_marker"
50
+
51
+ def _get_children(self):
52
+ return [self.__content]
53
+
54
+ def before_update(self):
55
+ super().before_update()
56
+ self._set_attr_json("alignment", self.__alignment)
57
+ self._set_attr_json("coordinates", self.__coordinates)
58
+
59
+ # content
60
+ @property
61
+ def content(self) -> Optional[Alignment]:
62
+ return self.__content
63
+
64
+ @content.setter
65
+ def content(self, value: Optional[Alignment]):
66
+ self.__content = value
67
+
68
+ # rotate
69
+ @property
70
+ def rotate(self) -> bool:
71
+ return self._get_attr("rotate", data_type="bool", def_value=False)
72
+
73
+ @rotate.setter
74
+ def rotate(self, value: Optional[bool]):
75
+ self._set_attr("rotate", value)
76
+
77
+ # height
78
+ @property
79
+ def height(self) -> float:
80
+ return self._get_attr("height", data_type="float", def_value=30.0)
81
+
82
+ @height.setter
83
+ def height(self, value: OptionalNumber):
84
+ assert value is None or value >= 0, "height cannot be negative"
85
+ self._set_attr("height", value)
86
+
87
+ # width
88
+ @property
89
+ def width(self) -> float:
90
+ return self._get_attr("width", data_type="float", def_value=30.0)
91
+
92
+ @width.setter
93
+ def width(self, value: OptionalNumber):
94
+ assert value is None or value >= 0, "width cannot be negative"
95
+ self._set_attr("width", value)
96
+
97
+ # alignment
98
+ @property
99
+ def alignment(self) -> Optional[Alignment]:
100
+ return self.__alignment
101
+
102
+ @alignment.setter
103
+ def alignment(self, value: Optional[Alignment]):
104
+ self.__alignment = value
105
+
106
+ # coordinates
107
+ @property
108
+ def coordinates(self) -> MapLatitudeLongitude:
109
+ return self.__coordinates
110
+
111
+ @coordinates.setter
112
+ def coordinates(self, value: MapLatitudeLongitude):
113
+ self.__coordinates = value
114
+
115
+
116
+ class MarkerLayer(MapLayer):
117
+ """
118
+ A layer to display Markers.
119
+
120
+ -----
121
+
122
+ Online docs: https://flet.dev/docs/controls/mapmarkerlayer
123
+ """
124
+
125
+ def __init__(
126
+ self,
127
+ markers: List[Marker],
128
+ alignment: Optional[Alignment] = None,
129
+ rotate: Optional[bool] = None,
130
+ #
131
+ # MapLayer
132
+ #
133
+ ref: Optional[Ref] = None,
134
+ visible: Optional[bool] = None,
135
+ data: Any = None,
136
+ ):
137
+ MapLayer.__init__(
138
+ self,
139
+ ref=ref,
140
+ visible=visible,
141
+ data=data,
142
+ )
143
+
144
+ self.markers = markers
145
+ self.alignment = alignment
146
+ self.rotate = rotate
147
+
148
+ def _get_control_name(self):
149
+ return "map_marker_layer"
150
+
151
+ def _get_children(self):
152
+ return self.__markers
153
+
154
+ def before_update(self):
155
+ super().before_update()
156
+ self._set_attr_json("alignment", self.__alignment)
157
+
158
+ # alignment
159
+ @property
160
+ def alignment(self) -> Optional[Alignment]:
161
+ return self.__alignment
162
+
163
+ @alignment.setter
164
+ def alignment(self, value: Optional[Alignment]):
165
+ self.__alignment = value
166
+
167
+ # markers
168
+ @property
169
+ def markers(self) -> List[Marker]:
170
+ return self.__markers
171
+
172
+ @markers.setter
173
+ def markers(self, value: List[Marker]):
174
+ self.__markers = value
175
+
176
+ # rotate
177
+ @property
178
+ def rotate(self) -> bool:
179
+ return self._get_attr("rotate", data_type="bool", def_value=False)
180
+
181
+ @rotate.setter
182
+ def rotate(self, value: Optional[bool]):
183
+ self._set_attr("rotate", value)
@@ -0,0 +1,262 @@
1
+ from typing import Any, List, Optional
2
+
3
+ from flet.core.control import Control, OptionalNumber
4
+ from flet_map.map import MapLatitudeLongitude
5
+ from flet_map.map_layer import MapLayer
6
+ from flet.core.ref import Ref
7
+ from flet.core.text_style import TextStyle
8
+ from flet.core.types import ColorEnums, ColorValue, StrokeCap, StrokeJoin
9
+
10
+
11
+ class PolygonMarker(Control):
12
+ """
13
+ A marker for the PolygonLayer.
14
+
15
+ -----
16
+
17
+ Online docs: https://flet.dev/docs/controls/mappolygonmarker
18
+ """
19
+
20
+ def __init__(
21
+ self,
22
+ coordinates: List[MapLatitudeLongitude],
23
+ label: Optional[str] = None,
24
+ label_text_style: Optional[TextStyle] = None,
25
+ border_color: Optional[ColorValue] = None,
26
+ color: Optional[ColorValue] = None,
27
+ border_stroke_width: OptionalNumber = None,
28
+ disable_holes_border: Optional[bool] = None,
29
+ rotate_label: Optional[bool] = None,
30
+ stroke_cap: Optional[StrokeCap] = None,
31
+ stroke_join: Optional[StrokeJoin] = None,
32
+ #
33
+ # Control
34
+ #
35
+ ref: Optional[Ref] = None,
36
+ visible: Optional[bool] = None,
37
+ data: Any = None,
38
+ ):
39
+ Control.__init__(
40
+ self,
41
+ ref=ref,
42
+ visible=visible,
43
+ data=data,
44
+ )
45
+
46
+ self.coordinates = coordinates
47
+ self.label = label
48
+ self.label_text_style = label_text_style
49
+ self.border_color = border_color
50
+ self.color = color
51
+ self.border_stroke_width = border_stroke_width
52
+ self.disable_holes_border = disable_holes_border
53
+ self.rotate_label = rotate_label
54
+ self.stroke_cap = stroke_cap
55
+ self.stroke_join = stroke_join
56
+
57
+ def _get_control_name(self):
58
+ return "map_polygon_marker"
59
+
60
+ def before_update(self):
61
+ super().before_update()
62
+ self._set_attr_json("coordinates", self.__coordinates)
63
+ if isinstance(self.__label_text_style, TextStyle):
64
+ self._set_attr_json("labelTextStyle", self.__label_text_style)
65
+
66
+ # stroke_cap
67
+ @property
68
+ def stroke_cap(self) -> Optional[StrokeCap]:
69
+ return self.__stroke_cap
70
+
71
+ @stroke_cap.setter
72
+ def stroke_cap(self, value: Optional[StrokeCap]):
73
+ self.__stroke_cap = value
74
+ self._set_enum_attr("strokeCap", value, StrokeCap)
75
+
76
+ # stroke_join
77
+ @property
78
+ def stroke_join(self) -> Optional[StrokeJoin]:
79
+ return self.__stroke_join
80
+
81
+ @stroke_join.setter
82
+ def stroke_join(self, value: Optional[StrokeJoin]):
83
+ self.__stroke_join = value
84
+ self._set_enum_attr("strokeJoin", value, StrokeJoin)
85
+
86
+ # label_text_style
87
+ @property
88
+ def label_text_style(self) -> Optional[TextStyle]:
89
+ return self.__label_text_style
90
+
91
+ @label_text_style.setter
92
+ def label_text_style(self, value: Optional[TextStyle]):
93
+ self.__label_text_style = value
94
+
95
+ # rotate_label
96
+ @property
97
+ def rotate_label(self) -> bool:
98
+ return self._get_attr("rotateLabel", data_type="bool", def_value=False)
99
+
100
+ @rotate_label.setter
101
+ def rotate_label(self, value: Optional[bool]):
102
+ self._set_attr("rotateLabel", value)
103
+
104
+ # label
105
+ @property
106
+ def label(self) -> Optional[str]:
107
+ return self._get_attr("label")
108
+
109
+ @label.setter
110
+ def label(self, value: Optional[str]):
111
+ self._set_attr("label", value)
112
+
113
+ # disable_holes_border
114
+ @property
115
+ def disable_holes_border(self) -> bool:
116
+ return self._get_attr("disableHolesBorder", data_type="bool", def_value=False)
117
+
118
+ @disable_holes_border.setter
119
+ def disable_holes_border(self, value: Optional[bool]):
120
+ self._set_attr("disableHolesBorder", value)
121
+
122
+ # color
123
+ @property
124
+ def color(self) -> Optional[ColorValue]:
125
+ return self.__color
126
+
127
+ @color.setter
128
+ def color(self, value: Optional[ColorValue]):
129
+ self.__color = value
130
+ self._set_enum_attr("color", value, ColorEnums)
131
+
132
+ # border_color
133
+ @property
134
+ def border_color(self) -> Optional[ColorValue]:
135
+ return self.__border_color
136
+
137
+ @border_color.setter
138
+ def border_color(self, value: Optional[ColorValue]):
139
+ self.__border_color = value
140
+ self._set_enum_attr("borderColor", value, ColorEnums)
141
+
142
+ # border_stroke_width
143
+ @property
144
+ def border_stroke_width(self) -> float:
145
+ return self._get_attr("borderStrokeWidth", data_type="float", def_value=0.0)
146
+
147
+ @border_stroke_width.setter
148
+ def border_stroke_width(self, value: OptionalNumber):
149
+ assert value is None or value >= 0, "border_stroke_width cannot be negative"
150
+ self._set_attr("borderStrokeWidth", value)
151
+
152
+ # coordinates
153
+ @property
154
+ def coordinates(self) -> List[MapLatitudeLongitude]:
155
+ return self.__coordinates
156
+
157
+ @coordinates.setter
158
+ def coordinates(self, value: List[MapLatitudeLongitude]):
159
+ self.__coordinates = value
160
+
161
+
162
+ class PolygonLayer(MapLayer):
163
+ """
164
+ A layer to display PolygonMarkers.
165
+
166
+ -----
167
+
168
+ Online docs: https://flet.dev/docs/controls/mappolygonlayer
169
+ """
170
+
171
+ def __init__(
172
+ self,
173
+ polygons: List[PolygonMarker],
174
+ polygon_culling: Optional[bool] = None,
175
+ polygon_labels: Optional[bool] = None,
176
+ draw_labels_last: Optional[bool] = None,
177
+ simplification_tolerance: OptionalNumber = None,
178
+ use_alternative_rendering: Optional[bool] = None,
179
+ #
180
+ # MapLayer
181
+ #
182
+ ref: Optional[Ref] = None,
183
+ visible: Optional[bool] = None,
184
+ data: Any = None,
185
+ ):
186
+ MapLayer.__init__(
187
+ self,
188
+ ref=ref,
189
+ visible=visible,
190
+ data=data,
191
+ )
192
+
193
+ self.polygons = polygons
194
+ self.polygon_culling = polygon_culling
195
+ self.polygon_labels = polygon_labels
196
+ self.draw_labels_last = draw_labels_last
197
+ self.simplification_tolerance = simplification_tolerance
198
+ self.use_alternative_rendering = use_alternative_rendering
199
+
200
+ def _get_control_name(self):
201
+ return "map_polygon_layer"
202
+
203
+ def _get_children(self):
204
+ return self.__polygons
205
+
206
+ # polygons
207
+ @property
208
+ def polygons(self) -> List[PolygonMarker]:
209
+ return self.__polygons
210
+
211
+ @polygons.setter
212
+ def polygons(self, value: List[PolygonMarker]):
213
+ self.__polygons = value
214
+
215
+ # polygon_culling
216
+ @property
217
+ def polygon_culling(self) -> bool:
218
+ return self._get_attr("polygonCulling", data_type="bool", def_value=False)
219
+
220
+ @polygon_culling.setter
221
+ def polygon_culling(self, value: Optional[bool]):
222
+ self._set_attr("polygonCulling", value)
223
+
224
+ # use_alternative_rendering
225
+ @property
226
+ def use_alternative_rendering(self) -> bool:
227
+ return self._get_attr(
228
+ "useAlternativeRendering", data_type="bool", def_value=False
229
+ )
230
+
231
+ @use_alternative_rendering.setter
232
+ def use_alternative_rendering(self, value: Optional[bool]):
233
+ self._set_attr("useAlternativeRendering", value)
234
+
235
+ # polygon_labels
236
+ @property
237
+ def polygon_labels(self) -> bool:
238
+ return self._get_attr("polygonLabels", data_type="bool", def_value=True)
239
+
240
+ @polygon_labels.setter
241
+ def polygon_labels(self, value: Optional[bool]):
242
+ self._set_attr("polygonLabels", value)
243
+
244
+ # simplification_tolerance
245
+ @property
246
+ def simplification_tolerance(self) -> float:
247
+ return self._get_attr(
248
+ "simplificationTolerance", data_type="float", def_value=0.5
249
+ )
250
+
251
+ @simplification_tolerance.setter
252
+ def simplification_tolerance(self, value: OptionalNumber):
253
+ self._set_attr("simplificationTolerance", value)
254
+
255
+ # draw_labels_last
256
+ @property
257
+ def draw_labels_last(self) -> bool:
258
+ return self._get_attr("drawLabelsLast", data_type="bool", def_value=False)
259
+
260
+ @draw_labels_last.setter
261
+ def draw_labels_last(self, value: Optional[bool]):
262
+ self._set_attr("drawLabelsLast", value)