bridges 3.4.5__tar.gz → 3.4.5.dev1__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.
- {bridges-3.4.5/bridges.egg-info → bridges-3.4.5.dev1}/PKG-INFO +2 -11
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/bar_chart.py +6 -6
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/bridges.py +4 -12
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/color.py +28 -52
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/color_grid.py +13 -10
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/cancer_incidence.py +1 -1
- bridges-3.4.5/bridges/data_src_dependent/us_county.py → bridges-3.4.5.dev1/bridges/data_src_dependent/county.py +3 -27
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/data_source.py +11 -29
- bridges-3.4.5/bridges/data_src_dependent/us_state.py → bridges-3.4.5.dev1/bridges/data_src_dependent/state.py +4 -19
- {bridges-3.4.5 → bridges-3.4.5.dev1/bridges.egg-info}/PKG-INFO +2 -11
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges.egg-info/SOURCES.txt +2 -5
- {bridges-3.4.5 → bridges-3.4.5.dev1}/setup.py +1 -1
- bridges-3.4.5/bridges/map.py +0 -15
- bridges-3.4.5/bridges/us_map.py +0 -104
- bridges-3.4.5/bridges/world_map.py +0 -50
- {bridges-3.4.5 → bridges-3.4.5.dev1}/LICENSE +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/MANIFEST.in +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/README.md +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/__init__.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/array.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/array1d.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/array2d.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/array3d.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/audio_channel.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/audio_clip.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/avl_tree_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/bfs_benchmark.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/bin_tree_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/blocking_game.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/bst_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/camera.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/circ_dl_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/circ_sl_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/circle.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/connector.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/__init__.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/actor_movie_imdb.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/amenity.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/city.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/earthquake_usgs.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/elevation.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/game.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/gutenberg_book.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/gutenberg_meta.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/lru_cache.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/movie_actor_wiki_data.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/osm.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/reddit.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/shakespeare.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/song.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/data_src_dependent/world_cities.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/dl_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/edge.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/element_visualizer.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/game_cell.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/game_grid.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/gamebase.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/gamebase3D.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/graph_adj_list.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/graph_adj_matrix.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/graph_benchmark.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/grid.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/input_helper.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/input_state_machine.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/kd_tree_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/keypress_listener.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/light.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/line_chart.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/link_visualizer.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/mesh.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/ml_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/named_color.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/named_symbol.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/non_blocking_game.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/non_blocking_game3D.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/page_rank_benchmark.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/particle_system.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/polygon.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/polyline.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/primitives.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/rectangle.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/scene.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/shortest_path_benchmark.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/sl_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/socket_connection.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/sorting_benchmark.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/symbol.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/symbol_collection.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/symbol_group.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/text.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges/tree_element.py +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges.egg-info/dependency_links.txt +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges.egg-info/requires.txt +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/bridges.egg-info/top_level.txt +0 -0
- {bridges-3.4.5 → bridges-3.4.5.dev1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: bridges
|
|
3
|
-
Version: 3.4.5
|
|
3
|
+
Version: 3.4.5.dev1
|
|
4
4
|
Summary: Bridging Real-world Infrastructure Designed to Goal-align, Engage, and Stimulate, an NSF TUES
|
|
5
5
|
Home-page: https://github.com/BridgesUNCC/bridges-python
|
|
6
6
|
Author: BRIDGES
|
|
@@ -15,15 +15,6 @@ Requires-Dist: requests>=2.21.0
|
|
|
15
15
|
Requires-Dist: webcolors>=1.8.1
|
|
16
16
|
Requires-Dist: python-socketio[client]>=4.3.0
|
|
17
17
|
Requires-Dist: SPARQLWrapper>=1.8.4
|
|
18
|
-
Dynamic: author
|
|
19
|
-
Dynamic: author-email
|
|
20
|
-
Dynamic: classifier
|
|
21
|
-
Dynamic: description
|
|
22
|
-
Dynamic: description-content-type
|
|
23
|
-
Dynamic: home-page
|
|
24
|
-
Dynamic: requires-dist
|
|
25
|
-
Dynamic: requires-python
|
|
26
|
-
Dynamic: summary
|
|
27
18
|
|
|
28
19
|
# bridges-python
|
|
29
20
|
|
|
@@ -37,7 +37,7 @@ class BarChart:
|
|
|
37
37
|
self._c_label = ""
|
|
38
38
|
self._v_label = ""
|
|
39
39
|
self._title = ""
|
|
40
|
-
self.
|
|
40
|
+
self._sub_title = ""
|
|
41
41
|
self._tt_suffix = ""
|
|
42
42
|
self._orientation = "horizontal"
|
|
43
43
|
self._series_data = []
|
|
@@ -63,18 +63,18 @@ class BarChart:
|
|
|
63
63
|
self._title = plot_title
|
|
64
64
|
|
|
65
65
|
@property
|
|
66
|
-
def
|
|
66
|
+
def sub_title(self) -> str:
|
|
67
67
|
"""
|
|
68
68
|
Subtitle of the plot
|
|
69
69
|
"""
|
|
70
|
-
return self.
|
|
70
|
+
return self._sub_title
|
|
71
71
|
|
|
72
|
-
@
|
|
73
|
-
def
|
|
72
|
+
@sub_title.setter
|
|
73
|
+
def sub_title(self, plot_sub_title: str) -> None:
|
|
74
74
|
"""
|
|
75
75
|
Subtitle of the plot
|
|
76
76
|
"""
|
|
77
|
-
self.
|
|
77
|
+
self._sub_title = plot_sub_title
|
|
78
78
|
|
|
79
79
|
@property
|
|
80
80
|
def value_label(self) -> str:
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from bridges.connector import *
|
|
2
2
|
from bridges import ColorGrid
|
|
3
|
-
from bridges.us_map import *
|
|
4
3
|
import os
|
|
5
4
|
|
|
6
5
|
import json
|
|
@@ -33,8 +32,8 @@ class Bridges:
|
|
|
33
32
|
@date 2015, 2016, 2017, 2018, 2019, 2020, 2021
|
|
34
33
|
"""
|
|
35
34
|
|
|
36
|
-
_MaxTitleSize =
|
|
37
|
-
_MaxDescSize =
|
|
35
|
+
_MaxTitleSize = 50
|
|
36
|
+
_MaxDescSize = 250
|
|
38
37
|
_projection_options = {"cartesian", "albersusa", "equirectangular", "window"}
|
|
39
38
|
_debug = False
|
|
40
39
|
|
|
@@ -172,18 +171,13 @@ class Bridges:
|
|
|
172
171
|
def set_map(self, map_info:list):
|
|
173
172
|
"""
|
|
174
173
|
This method serializes all the state and county objects in the map_info for sending to the server
|
|
175
|
-
|
|
176
|
-
See tutorial at https://bridgesuncc.github.io/tutorials/Map.html
|
|
177
|
-
|
|
178
174
|
:param map_info: is a list of state objects with their counties
|
|
179
175
|
:return: none
|
|
180
176
|
"""
|
|
181
|
-
if isinstance(map_info, Map):
|
|
182
|
-
self.set_map_overlay(map_info.get_overlay())
|
|
183
|
-
self.set_coord_system_type(map_info.get_projection())
|
|
184
177
|
self.map = map_info
|
|
185
178
|
|
|
186
179
|
|
|
180
|
+
|
|
187
181
|
def post_visualization_link(self, flag:bool):
|
|
188
182
|
"""
|
|
189
183
|
This method controls (with a flag) if the visualization url is printed to the console or not.
|
|
@@ -198,8 +192,6 @@ class Bridges:
|
|
|
198
192
|
Returns:
|
|
199
193
|
None
|
|
200
194
|
"""
|
|
201
|
-
if isinstance(self.ds_handle, Map):
|
|
202
|
-
self.set_map(self.ds_handle)
|
|
203
195
|
ds_str = ""
|
|
204
196
|
|
|
205
197
|
if self.vis_type == "Tree" or self.vis_type == "BinaryTree" or self.vis_type == "AVLTree" or\
|
|
@@ -220,7 +212,7 @@ class Bridges:
|
|
|
220
212
|
"map_overlay": self._map_overlay,
|
|
221
213
|
"element_label_flag": self._element_label_flag,
|
|
222
214
|
"link_label_flag": self._link_label_flag,
|
|
223
|
-
"map":
|
|
215
|
+
"map": self.map,
|
|
224
216
|
}
|
|
225
217
|
if self.window is not None and len(self.window) == 4:
|
|
226
218
|
ds_dict['window'] = self.window
|
|
@@ -235,28 +235,12 @@ class Color(object):
|
|
|
235
235
|
col_name = None
|
|
236
236
|
if args:
|
|
237
237
|
errorcondition = True
|
|
238
|
-
if len(args) == 1:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
self.alpha = args[0][3]
|
|
245
|
-
errorcondition=False
|
|
246
|
-
elif thetype is str:
|
|
247
|
-
col_name = args[0]
|
|
248
|
-
try:
|
|
249
|
-
web_color = webcolors.name_to_rgb(col_name)
|
|
250
|
-
self.set_color(web_color.red, web_color.green, web_color.blue)
|
|
251
|
-
errorcondition=False
|
|
252
|
-
except ValueError:
|
|
253
|
-
raise ValueError(col_name + " is not a valid color name")
|
|
254
|
-
elif thetype is Color:
|
|
255
|
-
self.red = args[0].red
|
|
256
|
-
self.green = args[0].green
|
|
257
|
-
self.blue = args[0].blue
|
|
258
|
-
self.alpha = args[0].alpha
|
|
259
|
-
errorcondition = False
|
|
238
|
+
if len(args) == 1 and type(args[0]) == list:
|
|
239
|
+
self.red = args[0][0]
|
|
240
|
+
self.green = args[0][1]
|
|
241
|
+
self.blue = args[0][2]
|
|
242
|
+
self.alpha = args[0][3]
|
|
243
|
+
errorcondition=False
|
|
260
244
|
if len(args) == 4 or len(args) == 3:
|
|
261
245
|
self.red = args[0]
|
|
262
246
|
self.green = args[1]
|
|
@@ -264,16 +248,21 @@ class Color(object):
|
|
|
264
248
|
if len(args) == 4:
|
|
265
249
|
self.alpha = args[3]
|
|
266
250
|
errorcondition = False
|
|
251
|
+
elif len(args) == 1:
|
|
252
|
+
if type(args[0]) is str:
|
|
253
|
+
col_name = args[0]
|
|
254
|
+
errorcondition=False
|
|
255
|
+
elif type(args[0]) is Color:
|
|
256
|
+
self.red = args[0].red
|
|
257
|
+
self.green = args[0].green
|
|
258
|
+
self.blue = args[0].blue
|
|
259
|
+
self.alpha = args[0].alpha
|
|
260
|
+
errorcondition = False
|
|
267
261
|
if errorcondition:
|
|
268
262
|
raise ValueError("To use Color constructor pass 3 RGB values and a float alpha value or a color name or a Color object")
|
|
269
263
|
elif kwargs:
|
|
270
264
|
if 'col_name' in kwargs:
|
|
271
265
|
col_name = kwargs['col_name']
|
|
272
|
-
try:
|
|
273
|
-
web_color = webcolors.name_to_rgb(col_name)
|
|
274
|
-
self.set_color(web_color.red, web_color.green, web_color.blue)
|
|
275
|
-
except ValueError:
|
|
276
|
-
raise ValueError(col_name + " is not a valid color name")
|
|
277
266
|
if 'r' in kwargs:
|
|
278
267
|
self.red = kwargs['r']
|
|
279
268
|
if 'red' in kwargs:
|
|
@@ -291,6 +280,12 @@ class Color(object):
|
|
|
291
280
|
if 'alpha' in kwargs:
|
|
292
281
|
self.alpha = kwargs['alpha']
|
|
293
282
|
|
|
283
|
+
if col_name is not None:
|
|
284
|
+
try:
|
|
285
|
+
web_color = webcolors.name_to_rgb(col_name)
|
|
286
|
+
self.set_color(web_color.red, web_color.green, web_color.blue)
|
|
287
|
+
except ValueError:
|
|
288
|
+
raise ValueError(col_name + " is not a valid color name")
|
|
294
289
|
|
|
295
290
|
def get_byte_representation(self) -> list:
|
|
296
291
|
"""
|
|
@@ -303,24 +298,14 @@ class Color(object):
|
|
|
303
298
|
b = self.blue
|
|
304
299
|
a = round(255 * self.alpha)
|
|
305
300
|
|
|
306
|
-
bytebuffer =
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"""
|
|
312
|
-
Writes the RGBA values as list of ints from 0-255
|
|
313
|
-
Assumes bytebuffer is a list of size 4
|
|
314
|
-
"""
|
|
315
|
-
bytebuffer[0] = self.red
|
|
316
|
-
bytebuffer[1] = self.green
|
|
317
|
-
bytebuffer[2] = self.blue
|
|
318
|
-
bytebuffer[3] = round(255 * self.alpha)
|
|
319
|
-
|
|
301
|
+
bytebuffer = list()
|
|
302
|
+
bytebuffer.append(r)
|
|
303
|
+
bytebuffer.append(g)
|
|
304
|
+
bytebuffer.append(b)
|
|
305
|
+
bytebuffer.append(a)
|
|
320
306
|
|
|
321
|
-
|
|
307
|
+
return bytebuffer
|
|
322
308
|
|
|
323
|
-
|
|
324
309
|
def __eq__(self, other):
|
|
325
310
|
"""deep equality check, by value of each RGBA value"""
|
|
326
311
|
if not isinstance(other, self.__class__):
|
|
@@ -330,12 +315,3 @@ class Color(object):
|
|
|
330
315
|
self.green == other.green and
|
|
331
316
|
self.blue == other.blue and
|
|
332
317
|
self.alpha == other.alpha)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
def _get_representation(self):
|
|
336
|
-
'''
|
|
337
|
-
Should not be needed externally.
|
|
338
|
-
This is used internally to derive BRIDGES JSON representation for colors
|
|
339
|
-
'''
|
|
340
|
-
return [str(self.red), str(self.green),
|
|
341
|
-
str(self.blue), str(self.alpha)]
|
|
@@ -83,7 +83,6 @@ class ColorGrid(Grid):
|
|
|
83
83
|
total_count = 0
|
|
84
84
|
pos = 0
|
|
85
85
|
last = self.grid[0][0]
|
|
86
|
-
colorbuffer = [0, 0, 0, 0]
|
|
87
86
|
|
|
88
87
|
while pos < self.grid_size[0] * self.grid_size[1]:
|
|
89
88
|
posY = pos / self.grid_size[1]
|
|
@@ -99,23 +98,27 @@ class ColorGrid(Grid):
|
|
|
99
98
|
else:
|
|
100
99
|
total_count += count
|
|
101
100
|
img_bytes.append(count-1)
|
|
102
|
-
last.
|
|
103
|
-
|
|
101
|
+
last = last.get_byte_representation()
|
|
102
|
+
|
|
103
|
+
for k in range(len(last)):
|
|
104
|
+
img_bytes.append(last[k])
|
|
104
105
|
|
|
105
106
|
count = 1
|
|
106
107
|
last = current
|
|
107
108
|
if count == 256:
|
|
108
109
|
total_count += count
|
|
109
110
|
img_bytes.append(count-1)
|
|
110
|
-
last.
|
|
111
|
-
|
|
111
|
+
last = last.get_byte_representation()
|
|
112
|
+
for k in range(len(last)):
|
|
113
|
+
img_bytes.append(last[k])
|
|
112
114
|
count = 0
|
|
113
115
|
pos += 1
|
|
114
116
|
total_count += count
|
|
115
117
|
if count > 0:
|
|
116
118
|
img_bytes.append(count-1)
|
|
117
|
-
last.
|
|
118
|
-
|
|
119
|
+
last = last.get_byte_representation()
|
|
120
|
+
for k in range(len(last)):
|
|
121
|
+
img_bytes.append(last[k])
|
|
119
122
|
|
|
120
123
|
if total_count != self.grid_size[0] * self.grid_size[1]:
|
|
121
124
|
print("Something broke in getRLE construction")
|
|
@@ -129,14 +132,14 @@ class ColorGrid(Grid):
|
|
|
129
132
|
bytearray: representing the colors of grid cells
|
|
130
133
|
"""
|
|
131
134
|
img_bytes = bytearray()
|
|
132
|
-
colorbuffer = [0, 0, 0, 0]
|
|
133
135
|
for i in range(self.grid_size[0]):
|
|
134
136
|
if self.grid[i] is not None:
|
|
135
137
|
for j in range(self.grid_size[1]):
|
|
136
138
|
if self.grid[i][j] is not None:
|
|
137
139
|
color = self.grid[i][j]
|
|
138
|
-
color.
|
|
139
|
-
|
|
140
|
+
color = color.get_byte_representation()
|
|
141
|
+
for k in range(len(color)):
|
|
142
|
+
img_bytes.append(color[k])
|
|
140
143
|
return img_bytes
|
|
141
144
|
|
|
142
145
|
def get_data_structure_representation(self) -> dict:
|
|
@@ -12,7 +12,7 @@ class CancerIncidence:
|
|
|
12
12
|
This object is generally not created by the user, to see how its created check
|
|
13
13
|
out bridges::data_src_dependent::data_source::get_cancer_incident_data()
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
http://www.cdc.gov/cancer/npcr/uscs/download_data.htm
|
|
16
16
|
Data: Courtesy of Corgis Datasets, 2017
|
|
17
17
|
|
|
18
18
|
@author Kalpathi Subramanian
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
from bridges.color import *
|
|
2
1
|
|
|
3
|
-
class USCounty:
|
|
4
|
-
"""
|
|
5
|
-
@brief Class that holds US County information
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
has a stroke color and fill color attributes. Each county has a geoid
|
|
9
|
-
and FIPS code for identification. The geoid is used as the key in the
|
|
10
|
-
USState object to effic
|
|
3
|
+
class County:
|
|
11
4
|
|
|
12
|
-
Each County object contains its county name, state name, geoid, fips code,
|
|
13
|
-
stroke color, stroke width, fill color, stroke color
|
|
14
|
-
|
|
15
|
-
A tutorial on how to use the these objects is available at:
|
|
16
|
-
https://bridgesuncc.github.io/tutorials/Map.html
|
|
17
|
-
|
|
18
|
-
@author Erik Saule, Kalpathi Subramanian
|
|
19
|
-
@date 12/30/24
|
|
20
|
-
"""
|
|
21
5
|
def __init__(self, id: str, code: str, county: str, state: str):
|
|
22
|
-
"""
|
|
23
|
-
@brief Constructor with county related parameters
|
|
24
|
-
|
|
25
|
-
@param id GeoId of the county
|
|
26
|
-
@param code FIPS ID Code of the county
|
|
27
|
-
@param county name of county
|
|
28
|
-
@param state state containing county
|
|
29
|
-
"""
|
|
30
6
|
self._geoid = id
|
|
31
7
|
self._fips_code = code
|
|
32
8
|
self._county_name = county
|
|
33
9
|
self._state_name = state
|
|
34
|
-
self._stroke_color =
|
|
10
|
+
self._stroke_color = 'green'
|
|
35
11
|
self._stroke_width = 0.5
|
|
36
|
-
self._fill_color =
|
|
12
|
+
self._fill_color = 'blue'
|
|
37
13
|
self._hide = False
|
|
38
14
|
|
|
39
15
|
@property
|
|
@@ -22,8 +22,8 @@ from bridges.data_src_dependent.amenity import *
|
|
|
22
22
|
from bridges.data_src_dependent.actor_movie_imdb import *
|
|
23
23
|
from bridges.color_grid import ColorGrid
|
|
24
24
|
from bridges.color import Color
|
|
25
|
-
from bridges.data_src_dependent.
|
|
26
|
-
from bridges.data_src_dependent.
|
|
25
|
+
from bridges.data_src_dependent.state import *
|
|
26
|
+
from bridges.data_src_dependent.county import *
|
|
27
27
|
from SPARQLWrapper import SPARQLWrapper, JSON
|
|
28
28
|
|
|
29
29
|
|
|
@@ -229,11 +229,8 @@ def get_world_cities_data(**kwargs) -> List[City]:
|
|
|
229
229
|
return wrapper
|
|
230
230
|
|
|
231
231
|
|
|
232
|
-
def
|
|
233
|
-
|
|
234
|
-
returns a list of USState objects.
|
|
235
|
-
See https://bridgesuncc.github.io/tutorials/Map.html on how to use these objects
|
|
236
|
-
'''
|
|
232
|
+
def get_map(state_name = []):
|
|
233
|
+
|
|
237
234
|
wrapper = []
|
|
238
235
|
|
|
239
236
|
url = "http://bridgesdata.herokuapp.com/api/us_map?state="
|
|
@@ -251,33 +248,18 @@ def get_us_map_county_data(state_name = [], view_counties = True):
|
|
|
251
248
|
state_info = r['data']
|
|
252
249
|
|
|
253
250
|
for i in range(len(state_info)):
|
|
254
|
-
temp_state =
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
current_county['properties']['COUNTY_STATE_CODE'],
|
|
262
|
-
current_county['properties']['COUNTY_STATE_NAME']))
|
|
251
|
+
temp_state = State(state_info[i]['_id']["input"])
|
|
252
|
+
for j in range(len(state_info[i]['counties'])):
|
|
253
|
+
current_county = state_info[i]['counties'][j]
|
|
254
|
+
temp_state.counties.append(County(current_county['properties']['GEOID'],
|
|
255
|
+
current_county['properties']['FIPS_CODE'],
|
|
256
|
+
current_county['properties']['COUNTY_STATE_CODE'],
|
|
257
|
+
current_county['properties']['COUNTY_STATE_NAME']))
|
|
263
258
|
wrapper.append(temp_state)
|
|
264
259
|
|
|
265
260
|
return wrapper
|
|
266
261
|
|
|
267
262
|
|
|
268
|
-
all_states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"]
|
|
269
|
-
|
|
270
|
-
def get_us_map_data():
|
|
271
|
-
'''
|
|
272
|
-
See https://bridgesuncc.github.io/tutorials/Map.html on how to use these objects
|
|
273
|
-
'''
|
|
274
|
-
return get_us_map_county_data(all_states, False)
|
|
275
|
-
|
|
276
|
-
def get_all_us_map_county_data():
|
|
277
|
-
'''
|
|
278
|
-
See https://bridgesuncc.github.io/tutorials/Map.html on how to use these objects
|
|
279
|
-
'''
|
|
280
|
-
return get_us_map_county_data(all_states, True)
|
|
281
263
|
|
|
282
264
|
def _parse_actor_movie_imdb(item) -> ActorMovieIMDB:
|
|
283
265
|
"""
|
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
from bridges.color import *
|
|
2
1
|
|
|
3
|
-
class USState:
|
|
4
|
-
"""
|
|
5
|
-
@brief Class for USState and its attributes
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
fill color, and a list of counties
|
|
9
|
-
A tutorial on how to use the these objects is available at:
|
|
10
|
-
https://bridgesuncc.github.io/tutorials/Map.html
|
|
11
|
-
|
|
12
|
-
@author Erik Saule, Kalpathi Subramanian
|
|
13
|
-
@date Last modified Dec 30, 2024
|
|
14
|
-
"""
|
|
3
|
+
class State:
|
|
15
4
|
|
|
16
5
|
def __init__(self, state: str):
|
|
17
|
-
"""
|
|
18
|
-
@brief Constructor for a specific state
|
|
19
|
-
|
|
20
|
-
@param state sets default values for the state
|
|
21
|
-
"""
|
|
22
6
|
self._state_name = state
|
|
23
|
-
self._stroke_color =
|
|
7
|
+
self._stroke_color = 'blue'
|
|
24
8
|
self._counties = []
|
|
25
9
|
self._view_counties = True
|
|
26
10
|
self._stroke_width = 0.5
|
|
27
|
-
self._fill_color =
|
|
11
|
+
self._fill_color = 'blue'
|
|
12
|
+
|
|
28
13
|
|
|
29
14
|
@property
|
|
30
15
|
def state_name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: bridges
|
|
3
|
-
Version: 3.4.5
|
|
3
|
+
Version: 3.4.5.dev1
|
|
4
4
|
Summary: Bridging Real-world Infrastructure Designed to Goal-align, Engage, and Stimulate, an NSF TUES
|
|
5
5
|
Home-page: https://github.com/BridgesUNCC/bridges-python
|
|
6
6
|
Author: BRIDGES
|
|
@@ -15,15 +15,6 @@ Requires-Dist: requests>=2.21.0
|
|
|
15
15
|
Requires-Dist: webcolors>=1.8.1
|
|
16
16
|
Requires-Dist: python-socketio[client]>=4.3.0
|
|
17
17
|
Requires-Dist: SPARQLWrapper>=1.8.4
|
|
18
|
-
Dynamic: author
|
|
19
|
-
Dynamic: author-email
|
|
20
|
-
Dynamic: classifier
|
|
21
|
-
Dynamic: description
|
|
22
|
-
Dynamic: description-content-type
|
|
23
|
-
Dynamic: home-page
|
|
24
|
-
Dynamic: requires-dist
|
|
25
|
-
Dynamic: requires-python
|
|
26
|
-
Dynamic: summary
|
|
27
18
|
|
|
28
19
|
# bridges-python
|
|
29
20
|
|
|
@@ -42,7 +42,6 @@ bridges/keypress_listener.py
|
|
|
42
42
|
bridges/light.py
|
|
43
43
|
bridges/line_chart.py
|
|
44
44
|
bridges/link_visualizer.py
|
|
45
|
-
bridges/map.py
|
|
46
45
|
bridges/mesh.py
|
|
47
46
|
bridges/ml_element.py
|
|
48
47
|
bridges/named_color.py
|
|
@@ -65,8 +64,6 @@ bridges/symbol_collection.py
|
|
|
65
64
|
bridges/symbol_group.py
|
|
66
65
|
bridges/text.py
|
|
67
66
|
bridges/tree_element.py
|
|
68
|
-
bridges/us_map.py
|
|
69
|
-
bridges/world_map.py
|
|
70
67
|
bridges.egg-info/PKG-INFO
|
|
71
68
|
bridges.egg-info/SOURCES.txt
|
|
72
69
|
bridges.egg-info/dependency_links.txt
|
|
@@ -77,6 +74,7 @@ bridges/data_src_dependent/actor_movie_imdb.py
|
|
|
77
74
|
bridges/data_src_dependent/amenity.py
|
|
78
75
|
bridges/data_src_dependent/cancer_incidence.py
|
|
79
76
|
bridges/data_src_dependent/city.py
|
|
77
|
+
bridges/data_src_dependent/county.py
|
|
80
78
|
bridges/data_src_dependent/data_source.py
|
|
81
79
|
bridges/data_src_dependent/earthquake_usgs.py
|
|
82
80
|
bridges/data_src_dependent/elevation.py
|
|
@@ -89,6 +87,5 @@ bridges/data_src_dependent/osm.py
|
|
|
89
87
|
bridges/data_src_dependent/reddit.py
|
|
90
88
|
bridges/data_src_dependent/shakespeare.py
|
|
91
89
|
bridges/data_src_dependent/song.py
|
|
92
|
-
bridges/data_src_dependent/
|
|
93
|
-
bridges/data_src_dependent/us_state.py
|
|
90
|
+
bridges/data_src_dependent/state.py
|
|
94
91
|
bridges/data_src_dependent/world_cities.py
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="bridges",
|
|
8
|
-
version="3.4.5",
|
|
8
|
+
version="3.4.5.dev1",
|
|
9
9
|
author="BRIDGES",
|
|
10
10
|
author_email="bridges.uncc@gmail.com",
|
|
11
11
|
description="Bridging Real-world Infrastructure Designed to Goal-align, Engage, and Stimulate, an NSF TUES",
|
bridges-3.4.5/bridges/map.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
class Map:
|
|
3
|
-
'''This is meant to be a base class for all map visualization'''
|
|
4
|
-
'''Likely never instantiated explicitly'''
|
|
5
|
-
def __init__(self):
|
|
6
|
-
pass
|
|
7
|
-
|
|
8
|
-
def get_projection(self):
|
|
9
|
-
return None
|
|
10
|
-
|
|
11
|
-
def get_overlay(self):
|
|
12
|
-
return None
|
|
13
|
-
|
|
14
|
-
def get_map_representation(self):
|
|
15
|
-
return None
|
bridges-3.4.5/bridges/us_map.py
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
from bridges.map import *
|
|
2
|
-
|
|
3
|
-
class USMap(Map):
|
|
4
|
-
"""
|
|
5
|
-
@brief This class provides an API to building, displaying and
|
|
6
|
-
manipulating US maps and counties in BRIDGES
|
|
7
|
-
|
|
8
|
-
In the current implementation, we can draw a US map with all state
|
|
9
|
-
boundaries, a map with all US state and county boundaries, or
|
|
10
|
-
specify a set of states and display the state and/or county
|
|
11
|
-
boundaries.
|
|
12
|
-
|
|
13
|
-
Functions are provided to access each US state or county and color
|
|
14
|
-
its boundary or its interior using the stroke color and fill color
|
|
15
|
-
functions. This lets us build map based applications where the fill
|
|
16
|
-
fill color can be used to represent different data attributes, such
|
|
17
|
-
population counts, election statistics or any attribute at the state
|
|
18
|
-
or county level.
|
|
19
|
-
|
|
20
|
-
See the Maps tutorials for examples of the usage of the US Map API at
|
|
21
|
-
https://bridgesuncc.github.io/tutorials/Map.html
|
|
22
|
-
|
|
23
|
-
"""
|
|
24
|
-
def get_projection(self):
|
|
25
|
-
return "albersusa"
|
|
26
|
-
|
|
27
|
-
def get_overlay(self):
|
|
28
|
-
return True
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def get_data_structure_type(self):
|
|
32
|
-
"""
|
|
33
|
-
Getter for the data structure type as a JSON string
|
|
34
|
-
Returns
|
|
35
|
-
str: the data structure type
|
|
36
|
-
"""
|
|
37
|
-
return "us_map"
|
|
38
|
-
|
|
39
|
-
def get_data_structure_representation(self):
|
|
40
|
-
"""
|
|
41
|
-
Getter for the data structure's JSON representatoin
|
|
42
|
-
Returns:
|
|
43
|
-
str: the data structure representation
|
|
44
|
-
"""
|
|
45
|
-
#This is only used to make a dummy data structure for use when
|
|
46
|
-
#the map is passed as a datastructure and not as an overlay
|
|
47
|
-
return {"map_dummy": True}
|
|
48
|
-
|
|
49
|
-
def _county_to_obj(self, co):
|
|
50
|
-
return {
|
|
51
|
-
"_geoid" : co.geoid,
|
|
52
|
-
"_fips_code" : co.fips_code,
|
|
53
|
-
"_county_name": co.county_name,
|
|
54
|
-
"_state_name": co.state_name,
|
|
55
|
-
"_stroke_color": co.stroke_color._get_representation(),
|
|
56
|
-
"_stroke_width": co.stroke_width,
|
|
57
|
-
"_fill_color": co.fill_color._get_representation(),
|
|
58
|
-
"_hide" : co.hide
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
def _state_to_obj(self, st):
|
|
63
|
-
return {
|
|
64
|
-
"_state_name" : st.state_name,
|
|
65
|
-
"_stroke_color" : st.stroke_color._get_representation(),
|
|
66
|
-
"_stroke_width": st.stroke_width,
|
|
67
|
-
"_fill_color": st.fill_color._get_representation(),
|
|
68
|
-
"_view_counties": st.view_counties,
|
|
69
|
-
"_counties": [self._county_to_obj(st.counties[i]) for i in range(0,len(st.counties)) ]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
def get_map_representation(self):
|
|
73
|
-
"""
|
|
74
|
-
@brief gets the JSON representation of the map data
|
|
75
|
-
|
|
76
|
-
Uses functions to convert the state and country attributes to objects
|
|
77
|
-
before serialization into a JSON string
|
|
78
|
-
"""
|
|
79
|
-
data = [ self._state_to_obj(self._states[i]) for i in range(0,len(self._states)) ]
|
|
80
|
-
|
|
81
|
-
return data
|
|
82
|
-
|
|
83
|
-
def __init__(self,states = []):
|
|
84
|
-
"""
|
|
85
|
-
@brief Constructor: creates an objecdt with the given state data
|
|
86
|
-
|
|
87
|
-
@param states state and county information for a set of states
|
|
88
|
-
"""
|
|
89
|
-
self._states = states
|
|
90
|
-
|
|
91
|
-
@property
|
|
92
|
-
def states(self):
|
|
93
|
-
'''
|
|
94
|
-
Returns a list of USState objects
|
|
95
|
-
'''
|
|
96
|
-
return self._states
|
|
97
|
-
|
|
98
|
-
@states.setter
|
|
99
|
-
def states(self, value):
|
|
100
|
-
'''
|
|
101
|
-
value: a list of USState objects
|
|
102
|
-
'''
|
|
103
|
-
self._states = value
|
|
104
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
from bridges.map import *
|
|
2
|
-
|
|
3
|
-
class WorldMap(Map):
|
|
4
|
-
"""
|
|
5
|
-
@brief This class provides an API to displaying world maps in BRIDGES
|
|
6
|
-
|
|
7
|
-
See the Maps tutorials for examples of the usage of the US Map API at
|
|
8
|
-
https://bridgesuncc.github.io/tutorials/Map.html
|
|
9
|
-
|
|
10
|
-
"""
|
|
11
|
-
def get_projection(self):
|
|
12
|
-
return "equirectangular"
|
|
13
|
-
|
|
14
|
-
def get_overlay(self):
|
|
15
|
-
return True
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def get_data_structure_type(self):
|
|
19
|
-
"""
|
|
20
|
-
Getter for the data structure type as a JSON string
|
|
21
|
-
Returns
|
|
22
|
-
str: the data structure type
|
|
23
|
-
"""
|
|
24
|
-
return "world_map"
|
|
25
|
-
|
|
26
|
-
def get_data_structure_representation(self):
|
|
27
|
-
"""
|
|
28
|
-
Getter for the data structure's JSON representatoin
|
|
29
|
-
Returns:
|
|
30
|
-
str: the data structure representation
|
|
31
|
-
"""
|
|
32
|
-
#This is only used to make a dummy data structure for use when
|
|
33
|
-
#the map is passed as a datastructure and not as an overlay
|
|
34
|
-
return {"map_dummy": True}
|
|
35
|
-
|
|
36
|
-
def get_map_representation(self):
|
|
37
|
-
"""
|
|
38
|
-
@brief gets the JSON representation of the map data
|
|
39
|
-
|
|
40
|
-
Uses functions to convert the state and country attributes to objects
|
|
41
|
-
before serialization into a JSON string
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
return "all"
|
|
45
|
-
|
|
46
|
-
def __init__(self):
|
|
47
|
-
"""
|
|
48
|
-
@brief Constructor: creates an object
|
|
49
|
-
|
|
50
|
-
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|