bridges 3.4.5.dev1__tar.gz → 3.5.0.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.
Files changed (98) hide show
  1. {bridges-3.4.5.dev1/bridges.egg-info → bridges-3.5.0.dev1}/PKG-INFO +11 -3
  2. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/bar_chart.py +17 -17
  3. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/bridges.py +12 -4
  4. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/color.py +52 -28
  5. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/color_grid.py +10 -13
  6. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/connector.py +10 -8
  7. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/cancer_incidence.py +1 -1
  8. bridges-3.5.0.dev1/bridges/data_src_dependent/country.py +99 -0
  9. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/data_source.py +102 -54
  10. bridges-3.5.0.dev1/bridges/data_src_dependent/map_constants.py +73 -0
  11. bridges-3.4.5.dev1/bridges/data_src_dependent/county.py → bridges-3.5.0.dev1/bridges/data_src_dependent/us_county.py +27 -3
  12. bridges-3.4.5.dev1/bridges/data_src_dependent/state.py → bridges-3.5.0.dev1/bridges/data_src_dependent/us_state.py +19 -4
  13. bridges-3.5.0.dev1/bridges/map.py +15 -0
  14. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/tree_element.py +2 -0
  15. bridges-3.5.0.dev1/bridges/us_map.py +110 -0
  16. bridges-3.5.0.dev1/bridges/world_map.py +105 -0
  17. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1/bridges.egg-info}/PKG-INFO +11 -3
  18. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges.egg-info/SOURCES.txt +7 -2
  19. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/setup.py +2 -1
  20. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/LICENSE +0 -0
  21. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/MANIFEST.in +0 -0
  22. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/README.md +0 -0
  23. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/__init__.py +0 -0
  24. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/array.py +0 -0
  25. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/array1d.py +0 -0
  26. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/array2d.py +0 -0
  27. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/array3d.py +0 -0
  28. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/audio_channel.py +0 -0
  29. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/audio_clip.py +0 -0
  30. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/avl_tree_element.py +0 -0
  31. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/bfs_benchmark.py +0 -0
  32. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/bin_tree_element.py +0 -0
  33. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/blocking_game.py +0 -0
  34. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/bst_element.py +0 -0
  35. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/camera.py +0 -0
  36. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/circ_dl_element.py +0 -0
  37. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/circ_sl_element.py +0 -0
  38. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/circle.py +0 -0
  39. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/__init__.py +0 -0
  40. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/actor_movie_imdb.py +0 -0
  41. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/amenity.py +0 -0
  42. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/city.py +0 -0
  43. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/earthquake_usgs.py +0 -0
  44. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/elevation.py +0 -0
  45. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/game.py +0 -0
  46. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/gutenberg_book.py +0 -0
  47. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/gutenberg_meta.py +0 -0
  48. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/lru_cache.py +0 -0
  49. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/movie_actor_wiki_data.py +0 -0
  50. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/osm.py +0 -0
  51. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/reddit.py +0 -0
  52. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/shakespeare.py +0 -0
  53. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/song.py +0 -0
  54. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/data_src_dependent/world_cities.py +0 -0
  55. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/dl_element.py +0 -0
  56. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/edge.py +0 -0
  57. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/element.py +0 -0
  58. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/element_visualizer.py +0 -0
  59. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/game_cell.py +0 -0
  60. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/game_grid.py +0 -0
  61. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/gamebase.py +0 -0
  62. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/gamebase3D.py +0 -0
  63. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/graph_adj_list.py +0 -0
  64. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/graph_adj_matrix.py +0 -0
  65. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/graph_benchmark.py +0 -0
  66. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/grid.py +0 -0
  67. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/input_helper.py +0 -0
  68. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/input_state_machine.py +0 -0
  69. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/kd_tree_element.py +0 -0
  70. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/keypress_listener.py +0 -0
  71. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/light.py +0 -0
  72. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/line_chart.py +0 -0
  73. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/link_visualizer.py +0 -0
  74. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/mesh.py +0 -0
  75. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/ml_element.py +0 -0
  76. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/named_color.py +0 -0
  77. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/named_symbol.py +0 -0
  78. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/non_blocking_game.py +0 -0
  79. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/non_blocking_game3D.py +0 -0
  80. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/page_rank_benchmark.py +0 -0
  81. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/particle_system.py +0 -0
  82. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/polygon.py +0 -0
  83. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/polyline.py +0 -0
  84. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/primitives.py +0 -0
  85. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/rectangle.py +0 -0
  86. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/scene.py +0 -0
  87. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/shortest_path_benchmark.py +0 -0
  88. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/sl_element.py +0 -0
  89. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/socket_connection.py +0 -0
  90. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/sorting_benchmark.py +0 -0
  91. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/symbol.py +0 -0
  92. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/symbol_collection.py +0 -0
  93. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/symbol_group.py +0 -0
  94. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges/text.py +0 -0
  95. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges.egg-info/dependency_links.txt +0 -0
  96. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges.egg-info/requires.txt +0 -0
  97. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/bridges.egg-info/top_level.txt +0 -0
  98. {bridges-3.4.5.dev1 → bridges-3.5.0.dev1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: bridges
3
- Version: 3.4.5.dev1
3
+ Version: 3.5.0.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
@@ -10,11 +10,19 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >3.5.2
12
12
  Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
13
  Requires-Dist: requests>=2.21.0
15
14
  Requires-Dist: webcolors>=1.8.1
16
15
  Requires-Dist: python-socketio[client]>=4.3.0
17
16
  Requires-Dist: SPARQLWrapper>=1.8.4
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
18
26
 
19
27
  # bridges-python
20
28
 
@@ -27,7 +27,7 @@ class BarChart:
27
27
  displayed by hovering on a bar. One can append a string to the
28
28
  value using barchart.tooltip_suffix to specify units in the tooltip if desired.
29
29
 
30
- @sa See tutorial on using BarChart at:
30
+ @sa See tutorial on using BarChart at:
31
31
  https://bridgesuncc.github.io/tutorials/BarChart.html
32
32
  """
33
33
 
@@ -37,7 +37,7 @@ class BarChart:
37
37
  self._c_label = ""
38
38
  self._v_label = ""
39
39
  self._title = ""
40
- self._sub_title = ""
40
+ self._subtitle = ""
41
41
  self._tt_suffix = ""
42
42
  self._orientation = "horizontal"
43
43
  self._series_data = []
@@ -51,49 +51,49 @@ class BarChart:
51
51
  @property
52
52
  def title(self) -> str:
53
53
  """
54
- Title of the plot
54
+ Get title of the plot
55
55
  """
56
56
  return self._title
57
57
 
58
58
  @title.setter
59
59
  def title(self, plot_title: str) -> None:
60
60
  """
61
- Title of the plot
61
+ Set title of the plot
62
62
  """
63
63
  self._title = plot_title
64
64
 
65
65
  @property
66
- def sub_title(self) -> str:
66
+ def subtitle(self) -> str:
67
67
  """
68
- Subtitle of the plot
68
+ Get subtitle of the plot
69
69
  """
70
- return self._sub_title
70
+ return self._subtitle
71
71
 
72
- @sub_title.setter
73
- def sub_title(self, plot_sub_title: str) -> None:
72
+ @subtitle.setter
73
+ def subtitle(self, plot_sub_title: str) -> None:
74
74
  """
75
- Subtitle of the plot
75
+ Set subtitle of the plot
76
76
  """
77
- self._sub_title = plot_sub_title
77
+ self._subtitle = plot_sub_title
78
78
 
79
79
  @property
80
80
  def value_label(self) -> str:
81
81
  """
82
- Label for the value axis
82
+ Get label for the value axis
83
83
  """
84
84
  return self._v_label
85
85
 
86
86
  @value_label.setter
87
87
  def value_label(self, value_label: str) -> None:
88
88
  """
89
- Label for the value axis
89
+ Set label for the value axis
90
90
  """
91
91
  self._v_label = value_label
92
92
 
93
93
  @property
94
94
  def categories_label(self) -> str:
95
95
  """
96
- Label for the categories axis
96
+ Get label for the categories axis
97
97
  """
98
98
  return self._c_label
99
99
 
@@ -107,7 +107,7 @@ class BarChart:
107
107
  @property
108
108
  def orientation(self) -> str:
109
109
  """
110
- Orientation of the bar chart.
110
+ Get orientation of the bar chart.
111
111
 
112
112
  Will always be either "horizontal" or "vertical"
113
113
  """
@@ -136,7 +136,7 @@ class BarChart:
136
136
  @tooltip_suffix.setter
137
137
  def tooltip_suffix(self, suffix: str) -> None:
138
138
  """
139
- the tooltip suffix
139
+ Set the tooltip suffix
140
140
 
141
141
  This string is appended to the values in the hover tooltip.
142
142
  """
@@ -145,7 +145,7 @@ class BarChart:
145
145
  @property
146
146
  def categories(self) -> list[str]:
147
147
  """
148
- Categories for this bar chart
148
+ Get categories for this bar chart
149
149
  """
150
150
  return self._cats
151
151
 
@@ -1,5 +1,6 @@
1
1
  from bridges.connector import *
2
2
  from bridges import ColorGrid
3
+ from bridges.us_map import *
3
4
  import os
4
5
 
5
6
  import json
@@ -32,8 +33,8 @@ class Bridges:
32
33
  @date 2015, 2016, 2017, 2018, 2019, 2020, 2021
33
34
  """
34
35
 
35
- _MaxTitleSize = 50
36
- _MaxDescSize = 250
36
+ _MaxTitleSize = 200
37
+ _MaxDescSize = 1000
37
38
  _projection_options = {"cartesian", "albersusa", "equirectangular", "window"}
38
39
  _debug = False
39
40
 
@@ -171,13 +172,18 @@ class Bridges:
171
172
  def set_map(self, map_info:list):
172
173
  """
173
174
  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
+
174
178
  :param map_info: is a list of state objects with their counties
175
179
  :return: none
176
180
  """
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())
177
184
  self.map = map_info
178
185
 
179
186
 
180
-
181
187
  def post_visualization_link(self, flag:bool):
182
188
  """
183
189
  This method controls (with a flag) if the visualization url is printed to the console or not.
@@ -192,6 +198,8 @@ class Bridges:
192
198
  Returns:
193
199
  None
194
200
  """
201
+ if isinstance(self.ds_handle, Map):
202
+ self.set_map(self.ds_handle)
195
203
  ds_str = ""
196
204
 
197
205
  if self.vis_type == "Tree" or self.vis_type == "BinaryTree" or self.vis_type == "AVLTree" or\
@@ -212,7 +220,7 @@ class Bridges:
212
220
  "map_overlay": self._map_overlay,
213
221
  "element_label_flag": self._element_label_flag,
214
222
  "link_label_flag": self._link_label_flag,
215
- "map": self.map,
223
+ "map": (self.map.get_map_representation() if isinstance(self.map, Map) else self.map),
216
224
  }
217
225
  if self.window is not None and len(self.window) == 4:
218
226
  ds_dict['window'] = self.window
@@ -235,12 +235,28 @@ class Color(object):
235
235
  col_name = None
236
236
  if args:
237
237
  errorcondition = True
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
238
+ if len(args) == 1:
239
+ thetype = type(args[0])
240
+ if thetype == list:
241
+ self.red = args[0][0]
242
+ self.green = args[0][1]
243
+ self.blue = args[0][2]
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
244
260
  if len(args) == 4 or len(args) == 3:
245
261
  self.red = args[0]
246
262
  self.green = args[1]
@@ -248,21 +264,16 @@ class Color(object):
248
264
  if len(args) == 4:
249
265
  self.alpha = args[3]
250
266
  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
261
267
  if errorcondition:
262
268
  raise ValueError("To use Color constructor pass 3 RGB values and a float alpha value or a color name or a Color object")
263
269
  elif kwargs:
264
270
  if 'col_name' in kwargs:
265
271
  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")
266
277
  if 'r' in kwargs:
267
278
  self.red = kwargs['r']
268
279
  if 'red' in kwargs:
@@ -280,12 +291,6 @@ class Color(object):
280
291
  if 'alpha' in kwargs:
281
292
  self.alpha = kwargs['alpha']
282
293
 
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")
289
294
 
290
295
  def get_byte_representation(self) -> list:
291
296
  """
@@ -298,14 +303,24 @@ class Color(object):
298
303
  b = self.blue
299
304
  a = round(255 * self.alpha)
300
305
 
301
- bytebuffer = list()
302
- bytebuffer.append(r)
303
- bytebuffer.append(g)
304
- bytebuffer.append(b)
305
- bytebuffer.append(a)
306
-
306
+ bytebuffer = [r,g,b,a]
307
+
307
308
  return bytebuffer
308
309
 
310
+ def write_byte_representation(self, bytebuffer: list[int]) -> None:
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
+
320
+
321
+
322
+
323
+
309
324
  def __eq__(self, other):
310
325
  """deep equality check, by value of each RGBA value"""
311
326
  if not isinstance(other, self.__class__):
@@ -315,3 +330,12 @@ class Color(object):
315
330
  self.green == other.green and
316
331
  self.blue == other.blue and
317
332
  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,6 +83,7 @@ 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]
86
87
 
87
88
  while pos < self.grid_size[0] * self.grid_size[1]:
88
89
  posY = pos / self.grid_size[1]
@@ -98,27 +99,23 @@ class ColorGrid(Grid):
98
99
  else:
99
100
  total_count += count
100
101
  img_bytes.append(count-1)
101
- last = last.get_byte_representation()
102
-
103
- for k in range(len(last)):
104
- img_bytes.append(last[k])
102
+ last.write_byte_representation(colorbuffer)
103
+ img_bytes.extend(colorbuffer)
105
104
 
106
105
  count = 1
107
106
  last = current
108
107
  if count == 256:
109
108
  total_count += count
110
109
  img_bytes.append(count-1)
111
- last = last.get_byte_representation()
112
- for k in range(len(last)):
113
- img_bytes.append(last[k])
110
+ last.write_byte_representation(colorbuffer)
111
+ img_bytes.extend(colorbuffer)
114
112
  count = 0
115
113
  pos += 1
116
114
  total_count += count
117
115
  if count > 0:
118
116
  img_bytes.append(count-1)
119
- last = last.get_byte_representation()
120
- for k in range(len(last)):
121
- img_bytes.append(last[k])
117
+ last.write_byte_representation(colorbuffer)
118
+ img_bytes.extend(colorbuffer)
122
119
 
123
120
  if total_count != self.grid_size[0] * self.grid_size[1]:
124
121
  print("Something broke in getRLE construction")
@@ -132,14 +129,14 @@ class ColorGrid(Grid):
132
129
  bytearray: representing the colors of grid cells
133
130
  """
134
131
  img_bytes = bytearray()
132
+ colorbuffer = [0, 0, 0, 0]
135
133
  for i in range(self.grid_size[0]):
136
134
  if self.grid[i] is not None:
137
135
  for j in range(self.grid_size[1]):
138
136
  if self.grid[i][j] is not None:
139
137
  color = self.grid[i][j]
140
- color = color.get_byte_representation()
141
- for k in range(len(color)):
142
- img_bytes.append(color[k])
138
+ color.write_byte_representation(colorbuffer)
139
+ img_bytes.extend(colorbuffer)
143
140
  return img_bytes
144
141
 
145
142
  def get_data_structure_representation(self) -> dict:
@@ -9,11 +9,12 @@ class Connector:
9
9
  @brief This is a class for handling calls to the BRIDGES server to transmit JSON to the server and subsequent visualization. It is not intended for external use
10
10
  """
11
11
 
12
- server_url_live = "http://bridges-cs.herokuapp.com"
12
+ server_url_live = "http://assignments.bridgesuncc.org"
13
13
  server_type = "application"
14
- server_url_clone = "http://bridges-clone.herokuapp.com"
14
+ server_url_clone = "http://assignments-clone.bridgesuncc.org"
15
15
  server_url_local = "http://127.0.0.1:3000"
16
- server_url_game = "http://bridges-games.herokuapp.com"
16
+ server_url_game = "http://games.bridgesuncc.org"
17
+ server_url_game_clone = "http://games-clone.bridgesuncc.org"
17
18
 
18
19
  key = ""
19
20
  username =""
@@ -38,7 +39,7 @@ class Connector:
38
39
  """
39
40
  @brief Set the server based on a keyword for url
40
41
  Args:
41
- server: is one of the three string keywords('live', 'clone', 'local') that is passed to change the server that the bridges visualization will be sent to
42
+ server: is one of the three string keywords('live', 'clone', 'games', 'games-clone' 'local') that is passed to change the server that the bridges visualization will be sent to
42
43
  """
43
44
  self.set_server_url(server)
44
45
 
@@ -48,13 +49,14 @@ class Connector:
48
49
  @brief Set the server url (string) that is passed to change the server that the bridges visualization will be sent to
49
50
 
50
51
  Args:
51
- server: is one of the three strings ('live', 'clone', 'local')
52
+ server: is one of the three strings ('live', 'clone', 'games', 'games-clone', 'local')
52
53
  """
53
54
  switcher = {
54
- "live": "http://bridges-cs.herokuapp.com",
55
- "clone": "http://bridges-clone.herokuapp.com",
55
+ "live": "http://assignments.bridgesuncc.org",
56
+ "clone": "http://assignments-clone.bridgesuncc.org",
56
57
  "local": "http://127.0.0.1:3000",
57
- "games": "http://bridges-games.herokuapp.com"
58
+ "games": "http://games.bridgesuncc.org",
59
+ "games-clone": "http://games-clone.bridgesuncc.org"
58
60
  }
59
61
  force = os.getenv("FORCE_BRIDGES_APISERVER", "")
60
62
  if (force != ""):
@@ -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
- http://www.cdc.gov/cancer/npcr/uscs/download_data.htm
15
+ https://www.cdc.gov/united-states-cancer-statistics/public-use/index.html
16
16
  Data: Courtesy of Corgis Datasets, 2017
17
17
 
18
18
  @author Kalpathi Subramanian
@@ -0,0 +1,99 @@
1
+ from bridges.color import *
2
+
3
+ class Country:
4
+ """
5
+ @brief his object stores a Country and links to information
6
+
7
+ This object is used alongside with the WorldMap object. Each country
8
+ has a stroke color and fill color.
9
+
10
+ See tutorial at https://bridgesuncc.github.io/tutorials/Map.html
11
+
12
+ @author Kalpathi Subramanian
13
+ @date Last modified June 7, 2025
14
+ """
15
+
16
+ def __init__(self, country: str):
17
+ """
18
+ @brief Constructor for a specific state
19
+
20
+ @param state sets default values for the state
21
+ """
22
+ self._name = country
23
+ self._alpha2_id = ""
24
+ self._alpha3_id = ""
25
+ self._numeric3_id = 0
26
+ self._stroke_width = 1.
27
+ self._stroke_color = Color('green')
28
+ self._fill_color = Color('lightblue')
29
+
30
+ def __init__(self, name: str, alpha2: str, alpha3: str, numeric3: int):
31
+ """
32
+ @brief Constructor for a specific state
33
+
34
+ @param sets provided values for the country
35
+ """
36
+ self._name = name
37
+ self._alpha2_id = alpha2
38
+ self._alpha3_id = alpha3
39
+ self._numeric3_id = numeric3
40
+ self._stroke_width = 1.
41
+ self._stroke_color = Color('green')
42
+ self._fill_color = Color('lightblue')
43
+
44
+ @property
45
+ def name(self):
46
+ return self._name
47
+
48
+ @name.setter
49
+ def name(self, n):
50
+ self._name = n
51
+
52
+ @property
53
+ def alpha2_id(self):
54
+ return self._alpha2_id
55
+
56
+ @alpha2_id.setter
57
+ def alpha2_id(self, id):
58
+ self._alpha2_id = id
59
+
60
+ @property
61
+ def alpha3_id(self):
62
+ return self._alpha3_id
63
+
64
+ @alpha3_id.setter
65
+ def alpha3_id(self, id):
66
+ self._alpha3_id = id
67
+
68
+ @property
69
+ def numeric3_id(self):
70
+ return self._numeric3_id
71
+
72
+ @numeric3_id.setter
73
+ def numeric3_id(self, id):
74
+ self._numeric3_id = id
75
+
76
+ @property
77
+ def stroke_color(self):
78
+ return self._stroke_color
79
+
80
+ @stroke_color.setter
81
+ def stroke_color(self, value):
82
+ self._stroke_color = value
83
+
84
+ @property
85
+ def stroke_width(self):
86
+ return self._stroke_width
87
+
88
+ @stroke_width.setter
89
+ def stroke_width(self, value):
90
+ self._stroke_width = value
91
+
92
+ @property
93
+ def fill_color(self):
94
+ return self._fill_color
95
+
96
+ @fill_color.setter
97
+ def fill_color(self, value):
98
+ self._fill_color = value
99
+