flet-map 0.1.0__tar.gz
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.
- flet_map-0.1.0/PKG-INFO +168 -0
- flet_map-0.1.0/README.md +154 -0
- flet_map-0.1.0/pyproject.toml +36 -0
- flet_map-0.1.0/setup.cfg +4 -0
- flet_map-0.1.0/src/flet_map/__init__.py +30 -0
- flet_map-0.1.0/src/flet_map/circle_layer.py +156 -0
- flet_map-0.1.0/src/flet_map/map.py +674 -0
- flet_map-0.1.0/src/flet_map/map_layer.py +26 -0
- flet_map-0.1.0/src/flet_map/marker_layer.py +183 -0
- flet_map-0.1.0/src/flet_map/polygon_layer.py +262 -0
- flet_map-0.1.0/src/flet_map/polyline_layer.py +292 -0
- flet_map-0.1.0/src/flet_map/rich_attribution.py +141 -0
- flet_map-0.1.0/src/flet_map/simple_attribution.py +86 -0
- flet_map-0.1.0/src/flet_map/text_source_attribution.py +87 -0
- flet_map-0.1.0/src/flet_map/tile_layer.py +278 -0
- flet_map-0.1.0/src/flet_map.egg-info/PKG-INFO +168 -0
- flet_map-0.1.0/src/flet_map.egg-info/SOURCES.txt +37 -0
- flet_map-0.1.0/src/flet_map.egg-info/dependency_links.txt +1 -0
- flet_map-0.1.0/src/flet_map.egg-info/requires.txt +1 -0
- flet_map-0.1.0/src/flet_map.egg-info/top_level.txt +2 -0
- flet_map-0.1.0/src/flutter/flet_map/CHANGELOG.md +3 -0
- flet_map-0.1.0/src/flutter/flet_map/LICENSE +201 -0
- flet_map-0.1.0/src/flutter/flet_map/README.md +3 -0
- flet_map-0.1.0/src/flutter/flet_map/analysis_options.yaml +4 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/flet_map.dart +3 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/circle_layer.dart +43 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/create_control.dart +70 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/map.dart +140 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/marker_layer.dart +50 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/polygon_layer.dart +68 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/polyline_layer.dart +80 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/rich_attribution.dart +61 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/simple_attribution.dart +37 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/text_source_attribution.dart +29 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/tile_layer.dart +80 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/utils/attribution_alignment.dart +12 -0
- flet_map-0.1.0/src/flutter/flet_map/lib/src/utils/map.dart +280 -0
- flet_map-0.1.0/src/flutter/flet_map/pubspec.lock +831 -0
- flet_map-0.1.0/src/flutter/flet_map/pubspec.yaml +21 -0
flet_map-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: flet-map
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Map control for Flet
|
|
5
|
+
Author-email: Flet contributors <hello@flet.dev>
|
|
6
|
+
Project-URL: Homepage, https://flet.dev
|
|
7
|
+
Project-URL: Documentation, https://flet.dev/docs/controls/map
|
|
8
|
+
Project-URL: Repository, https://github.com/flet-dev/flet-map
|
|
9
|
+
Project-URL: Issues, https://github.com/flet-dev/flet-map/issues
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: flet>=0.25.2
|
|
14
|
+
|
|
15
|
+
# Map control for Flet
|
|
16
|
+
|
|
17
|
+
`Map` control for Flet.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Add `flet-map` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```py
|
|
26
|
+
|
|
27
|
+
import random
|
|
28
|
+
import flet as ft
|
|
29
|
+
import flet_map as map
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def main(page: ft.Page):
|
|
33
|
+
marker_layer_ref = ft.Ref[map.MarkerLayer]()
|
|
34
|
+
circle_layer_ref = ft.Ref[map.CircleLayer]()
|
|
35
|
+
|
|
36
|
+
def handle_tap(e: map.MapTapEvent):
|
|
37
|
+
print(e)
|
|
38
|
+
if e.name == "tap":
|
|
39
|
+
marker_layer_ref.current.markers.append(
|
|
40
|
+
map.Marker(
|
|
41
|
+
content=ft.Icon(
|
|
42
|
+
ft.Icons.LOCATION_ON, color=ft.cupertino_colors.DESTRUCTIVE_RED
|
|
43
|
+
),
|
|
44
|
+
coordinates=e.coordinates,
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
elif e.name == "secondary_tap":
|
|
48
|
+
circle_layer_ref.current.circles.append(
|
|
49
|
+
map.CircleMarker(
|
|
50
|
+
radius=random.randint(5, 10),
|
|
51
|
+
coordinates=e.coordinates,
|
|
52
|
+
color=ft.Colors.random_color(),
|
|
53
|
+
border_color=ft.Colors.random_color(),
|
|
54
|
+
border_stroke_width=4,
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
page.update()
|
|
58
|
+
|
|
59
|
+
def handle_event(e: map.MapEvent):
|
|
60
|
+
print(e)
|
|
61
|
+
|
|
62
|
+
page.add(
|
|
63
|
+
ft.Text("Click anywhere to add a Marker, right-click to add a CircleMarker."),
|
|
64
|
+
map.Map(
|
|
65
|
+
expand=True,
|
|
66
|
+
initial_center=map.MapLatitudeLongitude(15, 10),
|
|
67
|
+
initial_zoom=4.2,
|
|
68
|
+
interaction_configuration=map.MapInteractionConfiguration(
|
|
69
|
+
flags=map.MapInteractiveFlag.ALL
|
|
70
|
+
),
|
|
71
|
+
on_init=lambda e: print(f"Initialized Map"),
|
|
72
|
+
on_tap=handle_tap,
|
|
73
|
+
on_secondary_tap=handle_tap,
|
|
74
|
+
on_long_press=handle_tap,
|
|
75
|
+
on_event=lambda e: print(e),
|
|
76
|
+
layers=[
|
|
77
|
+
map.TileLayer(
|
|
78
|
+
url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
79
|
+
on_image_error=lambda e: print("TileLayer Error"),
|
|
80
|
+
),
|
|
81
|
+
map.RichAttribution(
|
|
82
|
+
attributions=[
|
|
83
|
+
map.TextSourceAttribution(
|
|
84
|
+
text="OpenStreetMap Contributors",
|
|
85
|
+
on_click=lambda e: e.page.launch_url(
|
|
86
|
+
"https://openstreetmap.org/copyright"
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
map.TextSourceAttribution(
|
|
90
|
+
text="Flet",
|
|
91
|
+
on_click=lambda e: e.page.launch_url("https://flet.dev"),
|
|
92
|
+
),
|
|
93
|
+
]
|
|
94
|
+
),
|
|
95
|
+
map.SimpleAttribution(
|
|
96
|
+
text="Flet",
|
|
97
|
+
alignment=ft.alignment.top_right,
|
|
98
|
+
on_click=lambda e: print("Clicked SimpleAttribution"),
|
|
99
|
+
),
|
|
100
|
+
map.MarkerLayer(
|
|
101
|
+
ref=marker_layer_ref,
|
|
102
|
+
markers=[
|
|
103
|
+
map.Marker(
|
|
104
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
105
|
+
coordinates=map.MapLatitudeLongitude(30, 15),
|
|
106
|
+
),
|
|
107
|
+
map.Marker(
|
|
108
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
109
|
+
coordinates=map.MapLatitudeLongitude(10, 10),
|
|
110
|
+
),
|
|
111
|
+
map.Marker(
|
|
112
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
113
|
+
coordinates=map.MapLatitudeLongitude(25, 45),
|
|
114
|
+
),
|
|
115
|
+
],
|
|
116
|
+
),
|
|
117
|
+
map.CircleLayer(
|
|
118
|
+
ref=circle_layer_ref,
|
|
119
|
+
circles=[
|
|
120
|
+
map.CircleMarker(
|
|
121
|
+
radius=10,
|
|
122
|
+
coordinates=map.MapLatitudeLongitude(16, 24),
|
|
123
|
+
color=ft.Colors.RED,
|
|
124
|
+
border_color=ft.Colors.BLUE,
|
|
125
|
+
border_stroke_width=4,
|
|
126
|
+
),
|
|
127
|
+
],
|
|
128
|
+
),
|
|
129
|
+
map.PolygonLayer(
|
|
130
|
+
polygons=[
|
|
131
|
+
map.PolygonMarker(
|
|
132
|
+
label="Popular Touristic Area",
|
|
133
|
+
label_text_style=ft.TextStyle(
|
|
134
|
+
color=ft.Colors.BLACK,
|
|
135
|
+
size=15,
|
|
136
|
+
weight=ft.FontWeight.BOLD,
|
|
137
|
+
),
|
|
138
|
+
color=ft.Colors.with_opacity(0.3, ft.Colors.BLUE),
|
|
139
|
+
coordinates=[
|
|
140
|
+
map.MapLatitudeLongitude(10, 10),
|
|
141
|
+
map.MapLatitudeLongitude(30, 15),
|
|
142
|
+
map.MapLatitudeLongitude(25, 45),
|
|
143
|
+
],
|
|
144
|
+
),
|
|
145
|
+
],
|
|
146
|
+
),
|
|
147
|
+
map.PolylineLayer(
|
|
148
|
+
polylines=[
|
|
149
|
+
map.PolylineMarker(
|
|
150
|
+
border_stroke_width=3,
|
|
151
|
+
border_color=ft.Colors.RED,
|
|
152
|
+
gradient_colors=[ft.Colors.BLACK, ft.Colors.BLACK],
|
|
153
|
+
color=ft.Colors.with_opacity(0.6, ft.Colors.GREEN),
|
|
154
|
+
coordinates=[
|
|
155
|
+
map.MapLatitudeLongitude(10, 10),
|
|
156
|
+
map.MapLatitudeLongitude(30, 15),
|
|
157
|
+
map.MapLatitudeLongitude(25, 45),
|
|
158
|
+
],
|
|
159
|
+
),
|
|
160
|
+
],
|
|
161
|
+
),
|
|
162
|
+
],
|
|
163
|
+
),
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
ft.app(main)
|
|
168
|
+
```
|
flet_map-0.1.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Map control for Flet
|
|
2
|
+
|
|
3
|
+
`Map` control for Flet.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Add `flet-map` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```py
|
|
12
|
+
|
|
13
|
+
import random
|
|
14
|
+
import flet as ft
|
|
15
|
+
import flet_map as map
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def main(page: ft.Page):
|
|
19
|
+
marker_layer_ref = ft.Ref[map.MarkerLayer]()
|
|
20
|
+
circle_layer_ref = ft.Ref[map.CircleLayer]()
|
|
21
|
+
|
|
22
|
+
def handle_tap(e: map.MapTapEvent):
|
|
23
|
+
print(e)
|
|
24
|
+
if e.name == "tap":
|
|
25
|
+
marker_layer_ref.current.markers.append(
|
|
26
|
+
map.Marker(
|
|
27
|
+
content=ft.Icon(
|
|
28
|
+
ft.Icons.LOCATION_ON, color=ft.cupertino_colors.DESTRUCTIVE_RED
|
|
29
|
+
),
|
|
30
|
+
coordinates=e.coordinates,
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
elif e.name == "secondary_tap":
|
|
34
|
+
circle_layer_ref.current.circles.append(
|
|
35
|
+
map.CircleMarker(
|
|
36
|
+
radius=random.randint(5, 10),
|
|
37
|
+
coordinates=e.coordinates,
|
|
38
|
+
color=ft.Colors.random_color(),
|
|
39
|
+
border_color=ft.Colors.random_color(),
|
|
40
|
+
border_stroke_width=4,
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
page.update()
|
|
44
|
+
|
|
45
|
+
def handle_event(e: map.MapEvent):
|
|
46
|
+
print(e)
|
|
47
|
+
|
|
48
|
+
page.add(
|
|
49
|
+
ft.Text("Click anywhere to add a Marker, right-click to add a CircleMarker."),
|
|
50
|
+
map.Map(
|
|
51
|
+
expand=True,
|
|
52
|
+
initial_center=map.MapLatitudeLongitude(15, 10),
|
|
53
|
+
initial_zoom=4.2,
|
|
54
|
+
interaction_configuration=map.MapInteractionConfiguration(
|
|
55
|
+
flags=map.MapInteractiveFlag.ALL
|
|
56
|
+
),
|
|
57
|
+
on_init=lambda e: print(f"Initialized Map"),
|
|
58
|
+
on_tap=handle_tap,
|
|
59
|
+
on_secondary_tap=handle_tap,
|
|
60
|
+
on_long_press=handle_tap,
|
|
61
|
+
on_event=lambda e: print(e),
|
|
62
|
+
layers=[
|
|
63
|
+
map.TileLayer(
|
|
64
|
+
url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
65
|
+
on_image_error=lambda e: print("TileLayer Error"),
|
|
66
|
+
),
|
|
67
|
+
map.RichAttribution(
|
|
68
|
+
attributions=[
|
|
69
|
+
map.TextSourceAttribution(
|
|
70
|
+
text="OpenStreetMap Contributors",
|
|
71
|
+
on_click=lambda e: e.page.launch_url(
|
|
72
|
+
"https://openstreetmap.org/copyright"
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
map.TextSourceAttribution(
|
|
76
|
+
text="Flet",
|
|
77
|
+
on_click=lambda e: e.page.launch_url("https://flet.dev"),
|
|
78
|
+
),
|
|
79
|
+
]
|
|
80
|
+
),
|
|
81
|
+
map.SimpleAttribution(
|
|
82
|
+
text="Flet",
|
|
83
|
+
alignment=ft.alignment.top_right,
|
|
84
|
+
on_click=lambda e: print("Clicked SimpleAttribution"),
|
|
85
|
+
),
|
|
86
|
+
map.MarkerLayer(
|
|
87
|
+
ref=marker_layer_ref,
|
|
88
|
+
markers=[
|
|
89
|
+
map.Marker(
|
|
90
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
91
|
+
coordinates=map.MapLatitudeLongitude(30, 15),
|
|
92
|
+
),
|
|
93
|
+
map.Marker(
|
|
94
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
95
|
+
coordinates=map.MapLatitudeLongitude(10, 10),
|
|
96
|
+
),
|
|
97
|
+
map.Marker(
|
|
98
|
+
content=ft.Icon(ft.Icons.LOCATION_ON),
|
|
99
|
+
coordinates=map.MapLatitudeLongitude(25, 45),
|
|
100
|
+
),
|
|
101
|
+
],
|
|
102
|
+
),
|
|
103
|
+
map.CircleLayer(
|
|
104
|
+
ref=circle_layer_ref,
|
|
105
|
+
circles=[
|
|
106
|
+
map.CircleMarker(
|
|
107
|
+
radius=10,
|
|
108
|
+
coordinates=map.MapLatitudeLongitude(16, 24),
|
|
109
|
+
color=ft.Colors.RED,
|
|
110
|
+
border_color=ft.Colors.BLUE,
|
|
111
|
+
border_stroke_width=4,
|
|
112
|
+
),
|
|
113
|
+
],
|
|
114
|
+
),
|
|
115
|
+
map.PolygonLayer(
|
|
116
|
+
polygons=[
|
|
117
|
+
map.PolygonMarker(
|
|
118
|
+
label="Popular Touristic Area",
|
|
119
|
+
label_text_style=ft.TextStyle(
|
|
120
|
+
color=ft.Colors.BLACK,
|
|
121
|
+
size=15,
|
|
122
|
+
weight=ft.FontWeight.BOLD,
|
|
123
|
+
),
|
|
124
|
+
color=ft.Colors.with_opacity(0.3, ft.Colors.BLUE),
|
|
125
|
+
coordinates=[
|
|
126
|
+
map.MapLatitudeLongitude(10, 10),
|
|
127
|
+
map.MapLatitudeLongitude(30, 15),
|
|
128
|
+
map.MapLatitudeLongitude(25, 45),
|
|
129
|
+
],
|
|
130
|
+
),
|
|
131
|
+
],
|
|
132
|
+
),
|
|
133
|
+
map.PolylineLayer(
|
|
134
|
+
polylines=[
|
|
135
|
+
map.PolylineMarker(
|
|
136
|
+
border_stroke_width=3,
|
|
137
|
+
border_color=ft.Colors.RED,
|
|
138
|
+
gradient_colors=[ft.Colors.BLACK, ft.Colors.BLACK],
|
|
139
|
+
color=ft.Colors.with_opacity(0.6, ft.Colors.GREEN),
|
|
140
|
+
coordinates=[
|
|
141
|
+
map.MapLatitudeLongitude(10, 10),
|
|
142
|
+
map.MapLatitudeLongitude(30, 15),
|
|
143
|
+
map.MapLatitudeLongitude(25, 45),
|
|
144
|
+
],
|
|
145
|
+
),
|
|
146
|
+
],
|
|
147
|
+
),
|
|
148
|
+
],
|
|
149
|
+
),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
ft.app(main)
|
|
154
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flet-map"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Map control for Flet"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Flet contributors", email = "hello@flet.dev" }
|
|
8
|
+
]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"License :: OSI Approved :: Apache Software License",
|
|
11
|
+
]
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"flet>=0.25.2",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://flet.dev"
|
|
19
|
+
Documentation = "https://flet.dev/docs/controls/map"
|
|
20
|
+
Repository = "https://github.com/flet-dev/flet-map"
|
|
21
|
+
Issues = "https://github.com/flet-dev/flet-map/issues"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.package-data]
|
|
24
|
+
"flutter.flet_map" = ["**/*"]
|
|
25
|
+
|
|
26
|
+
[tool.uv]
|
|
27
|
+
dev-dependencies = [
|
|
28
|
+
"flet[all]>=0.25.2",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
license-files = []
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["setuptools"]
|
|
36
|
+
build-backend = "setuptools.build_meta"
|
flet_map-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from flet_map.circle_layer import CircleLayer, CircleMarker
|
|
2
|
+
from flet_map.map import (
|
|
3
|
+
Map,
|
|
4
|
+
MapEvent,
|
|
5
|
+
MapEventSource,
|
|
6
|
+
MapHoverEvent,
|
|
7
|
+
MapInteractionConfiguration,
|
|
8
|
+
MapInteractiveFlag,
|
|
9
|
+
MapLatitudeLongitude,
|
|
10
|
+
MapLatitudeLongitudeBounds,
|
|
11
|
+
MapMultiFingerGesture,
|
|
12
|
+
MapPointerDeviceType,
|
|
13
|
+
MapPointerEvent,
|
|
14
|
+
MapPositionChangeEvent,
|
|
15
|
+
MapTapEvent,
|
|
16
|
+
)
|
|
17
|
+
from flet_map.marker_layer import Marker, MarkerLayer
|
|
18
|
+
from flet_map.polygon_layer import PolygonLayer, PolygonMarker
|
|
19
|
+
from flet_map.polyline_layer import (
|
|
20
|
+
DashedStrokePattern,
|
|
21
|
+
DottedStrokePattern,
|
|
22
|
+
PatternFit,
|
|
23
|
+
PolylineLayer,
|
|
24
|
+
PolylineMarker,
|
|
25
|
+
SolidStrokePattern,
|
|
26
|
+
)
|
|
27
|
+
from flet_map.rich_attribution import RichAttribution
|
|
28
|
+
from flet_map.simple_attribution import SimpleAttribution
|
|
29
|
+
from flet_map.text_source_attribution import TextSourceAttribution
|
|
30
|
+
from flet_map.tile_layer import MapTileLayerEvictErrorTileStrategy, TileLayer
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
from typing import Any, List, Optional, Union
|
|
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.types import ColorEnums, ColorValue
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CircleMarker(Control):
|
|
11
|
+
"""
|
|
12
|
+
A circular marker displayed on the Map at the specified location through the CircleLayer.
|
|
13
|
+
|
|
14
|
+
-----
|
|
15
|
+
|
|
16
|
+
Online docs: https://flet.dev/docs/controls/mapcirclemarker
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
radius: Union[int, float],
|
|
22
|
+
coordinates: MapLatitudeLongitude,
|
|
23
|
+
color: Optional[ColorValue] = None,
|
|
24
|
+
border_color: Optional[ColorValue] = None,
|
|
25
|
+
border_stroke_width: OptionalNumber = None,
|
|
26
|
+
use_radius_in_meter: Optional[bool] = None,
|
|
27
|
+
#
|
|
28
|
+
# Control
|
|
29
|
+
#
|
|
30
|
+
ref: Optional[Ref] = None,
|
|
31
|
+
visible: Optional[bool] = None,
|
|
32
|
+
data: Any = None,
|
|
33
|
+
):
|
|
34
|
+
|
|
35
|
+
Control.__init__(
|
|
36
|
+
self,
|
|
37
|
+
ref=ref,
|
|
38
|
+
visible=visible,
|
|
39
|
+
data=data,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
self.coordinates = coordinates
|
|
43
|
+
self.color = color
|
|
44
|
+
self.border_color = border_color
|
|
45
|
+
self.border_stroke_width = border_stroke_width
|
|
46
|
+
self.use_radius_in_meter = use_radius_in_meter
|
|
47
|
+
self.radius = radius
|
|
48
|
+
|
|
49
|
+
def _get_control_name(self):
|
|
50
|
+
return "map_circle_marker"
|
|
51
|
+
|
|
52
|
+
def before_update(self):
|
|
53
|
+
super().before_update()
|
|
54
|
+
self._set_attr_json("coordinates", self.__coordinates)
|
|
55
|
+
|
|
56
|
+
# use_radius_in_meter
|
|
57
|
+
@property
|
|
58
|
+
def use_radius_in_meter(self) -> bool:
|
|
59
|
+
return self._get_attr("useRadiusInMeter", data_type="bool", def_value=False)
|
|
60
|
+
|
|
61
|
+
@use_radius_in_meter.setter
|
|
62
|
+
def use_radius_in_meter(self, value: Optional[bool]):
|
|
63
|
+
self._set_attr("useRadiusInMeter", value)
|
|
64
|
+
|
|
65
|
+
# color
|
|
66
|
+
@property
|
|
67
|
+
def color(self) -> Optional[ColorValue]:
|
|
68
|
+
return self.__color
|
|
69
|
+
|
|
70
|
+
@color.setter
|
|
71
|
+
def color(self, value: Optional[ColorValue]):
|
|
72
|
+
self.__color = value
|
|
73
|
+
self._set_enum_attr("color", value, ColorEnums)
|
|
74
|
+
|
|
75
|
+
# border_color
|
|
76
|
+
@property
|
|
77
|
+
def border_color(self) -> Optional[ColorValue]:
|
|
78
|
+
return self.__border_color
|
|
79
|
+
|
|
80
|
+
@border_color.setter
|
|
81
|
+
def border_color(self, value: Optional[ColorValue]):
|
|
82
|
+
self.__border_color = value
|
|
83
|
+
self._set_enum_attr("borderColor", value, ColorEnums)
|
|
84
|
+
|
|
85
|
+
# radius
|
|
86
|
+
@property
|
|
87
|
+
def radius(self) -> Union[int, float]:
|
|
88
|
+
return self._get_attr("radius", data_type="float")
|
|
89
|
+
|
|
90
|
+
@radius.setter
|
|
91
|
+
def radius(self, value: Union[int, float]):
|
|
92
|
+
self._set_attr("radius", value)
|
|
93
|
+
|
|
94
|
+
# border_stroke_width
|
|
95
|
+
@property
|
|
96
|
+
def border_stroke_width(self) -> OptionalNumber:
|
|
97
|
+
return self._get_attr("borderStrokeWidth", data_type="float")
|
|
98
|
+
|
|
99
|
+
@border_stroke_width.setter
|
|
100
|
+
def border_stroke_width(self, value: OptionalNumber):
|
|
101
|
+
assert value is None or value >= 0, "border_stroke_width cannot be negative"
|
|
102
|
+
self._set_attr("borderStrokeWidth", value)
|
|
103
|
+
|
|
104
|
+
# coordinates
|
|
105
|
+
@property
|
|
106
|
+
def coordinates(self) -> MapLatitudeLongitude:
|
|
107
|
+
return self.__coordinates
|
|
108
|
+
|
|
109
|
+
@coordinates.setter
|
|
110
|
+
def coordinates(self, value: MapLatitudeLongitude):
|
|
111
|
+
self.__coordinates = value
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class CircleLayer(MapLayer):
|
|
115
|
+
"""
|
|
116
|
+
A layer to display CircleMarkers.
|
|
117
|
+
|
|
118
|
+
-----
|
|
119
|
+
|
|
120
|
+
Online docs: https://flet.dev/docs/controls/mapcirclelayer
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
def __init__(
|
|
124
|
+
self,
|
|
125
|
+
circles: List[CircleMarker],
|
|
126
|
+
#
|
|
127
|
+
# MapLayer
|
|
128
|
+
#
|
|
129
|
+
ref: Optional[Ref] = None,
|
|
130
|
+
visible: Optional[bool] = None,
|
|
131
|
+
data: Any = None,
|
|
132
|
+
):
|
|
133
|
+
|
|
134
|
+
MapLayer.__init__(
|
|
135
|
+
self,
|
|
136
|
+
ref=ref,
|
|
137
|
+
visible=visible,
|
|
138
|
+
data=data,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
self.circles = circles
|
|
142
|
+
|
|
143
|
+
def _get_control_name(self):
|
|
144
|
+
return "map_circle_layer"
|
|
145
|
+
|
|
146
|
+
def _get_children(self):
|
|
147
|
+
return self.__circles
|
|
148
|
+
|
|
149
|
+
# circles
|
|
150
|
+
@property
|
|
151
|
+
def circles(self) -> List[CircleMarker]:
|
|
152
|
+
return self.__circles
|
|
153
|
+
|
|
154
|
+
@circles.setter
|
|
155
|
+
def circles(self, value: List[CircleMarker]):
|
|
156
|
+
self.__circles = value
|