-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwegueConf.py
150 lines (132 loc) · 4 KB
/
wegueConf.py
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
import json
class WegueConfiguration:
"""Contains parameters of a Wegue configuration"""
def __init__(self):
self.colorTheme = {
"themes": {
"light": {
"primary": "#fdbf6f"
}
}
}
self.logo = "https://dummyimage.com/100x100/aaa/fff&text=Wegue"
self.logoSize = 100
self.showCopyrightYear = True
self.mapZoom = 2
self.mapCenter = (0, 0)
self.mapLayers = []
self.modules = {}
def to_file(self, path):
"""Store Wegue configuration as JSON file"""
with open(path, "w") as path:
json.dump(self.__dict__, path, indent=2, ensure_ascii=False)
def add_map_geodata_drag_drop(self):
self.mapGeodataDragDop = {
"formats": ["GeoJSON", "KML"],
"zoomToData": True,
"replaceData": True,
"displayInLayerList": True,
"layerName": "Uploaded Data"
}
def add_permalink(self):
self.permalink = {
"location": "hash",
"layers": True,
"extent": False,
"projection": "EPSG:4326",
"paramPrefix": "",
"history": True
}
def add_overview_map(self):
self.overviewMap = {
"visible": False
}
def add_view_animation(self):
self.viewAnimation = {
"type": "fly",
"options": {
"duration": 3000,
"zoom": 15,
"maxZoom": 15
}
}
def add_layer_list(self):
self.modules["wgu-layerlist"] = {
"target": "menu",
"icon": "layers",
"win": "floating",
"draggable": False,
}
def add_measuretool(self):
self.modules["wgu-measuretool"] = {
"target": "menu",
"win": "floating",
"icon": "photo_size_select_small",
"draggable": False,
"strokeColor": "#c62828",
"fillColor": "rgba(198,40,40,0.2)",
"sketchStrokeColor": "rgba(198,40,40,0.8)",
"sketchFillColor": "rgba(198,40,40,0.1)",
"sketchVertexStrokeColor": "#c62828",
"sketchVertexFillColor": "rgba(198,40,40,0.2)"
}
def add_infoclick(self):
self.modules["wgu-infoclick"] = {
"target": "menu",
"win": "floating",
"icon": "info",
"draggable": False,
"initPos": {
"left": 8,
"top": 74
}
}
def add_button_zoom_to_extent(self):
self.modules["wgu-zoomtomaxextent"] = {
"target": "toolbar",
"darkLayout": True
}
def add_help_window(self):
self.modules["wgu-helpwin"] = {
"target": "toolbar",
"darkLayout": True
}
def add_geocoder(self):
self.modules["wgu-geocoder"] = {
"target": "toolbar",
"darkLayout": True,
"minChars": 2,
"queryDelay": 200,
"selectZoom": 16,
"debug": False,
"placeHolder": "Search address",
"provider": "osm",
"providerOptions": {
"lang": "en-US",
"countrycodes": "",
"limit": 6
}
}
def add_geolocator(self):
self.modules["wgu-geolocator"] = {
"target": "toolbar",
"darkLayout": True
}
def add_maprecorder(self):
self.modules["wgu-maprecorder"] = {
"target": "toolbar",
"win": "floating",
"icon": "mdi-video",
"draggable": False,
"initPos": {
"left": 8,
"top": 230
}
}
def add_attribute_table(self):
self.modules["wgu-attributetable"] = {
"target": "menu",
"win": "floating",
"icon": "table_chart",
"syncTableMapSelection": True
}