55from typing import Any , Dict , Tuple
66
77import rasterio
8- from ..views .web_view import WebView , distinct_colors
98from flask import send_file
109from PIL import ImageColor
1110
11+ from ..views .web_view import distinct_colors , WebView
12+
1213logger : logging .Logger = logging .getLogger (__name__ )
1314
1415
@@ -31,7 +32,7 @@ def __init__(
3132 route_prefix ,
3233 path_cad_file ,
3334 is_geo_reference = False ,
34- )-> None :
35+ ) -> None :
3536 super ().__init__ (main_ui , web_app , route_prefix )
3637
3738 self .main_ui = main_ui
@@ -60,7 +61,7 @@ def process_client_message(self, data: Dict[str, Any]) -> None:
6061 else :
6162 raise ValueError (f"Unknown event { event } " )
6263
63- def add_remove_update_point_observation (self , point_coordinates = None )-> None :
64+ def add_remove_update_point_observation (self , point_coordinates = None ) -> None :
6465 gcp_manager = self .main_ui .gcp_manager
6566 active_gcp = self .main_ui .curr_point
6667 if active_gcp is None :
@@ -98,17 +99,17 @@ def add_remove_update_point_observation(self, point_coordinates=None)->None:
9899 def display_points (self ) -> None :
99100 pass
100101
101- def refocus (self , lat , lon )-> None :
102+ def refocus (self , lat , lon ) -> None :
102103 x , y , z = self .latlon_to_xyz (lat , lon )
103104 self .send_sse_message (
104105 {"x" : x , "y" : y , "z" : z },
105106 event_type = "move_camera" ,
106107 )
107108
108- def highlight_gcp_reprojection (self , * args , ** kwargs )-> None :
109+ def highlight_gcp_reprojection (self , * args , ** kwargs ) -> None :
109110 pass
110111
111- def populate_image_list (self , * args , ** kwargs )-> None :
112+ def populate_image_list (self , * args , ** kwargs ) -> None :
112113 pass
113114
114115 def latlon_to_xyz (self , lat , lon ) -> Tuple [float , float , float ]:
@@ -129,13 +130,13 @@ def xyz_to_latlon(self, x, y, z) -> Tuple[float, float, float]:
129130 lons , lats , alts = rasterio .warp .transform (self .crs , "EPSG:4326" , [x ], [y ], [z ])
130131 return lats [0 ], lons [0 ], alts [0 ]
131132
132- def load_georeference_metadata (self , path_cad_model )-> None :
133+ def load_georeference_metadata (self , path_cad_model ) -> None :
133134 metadata = _load_georeference_metadata (path_cad_model )
134135 self .scale = metadata ["scale" ]
135136 self .crs = metadata ["crs" ]
136137 self .offset = metadata ["offset" ]
137138
138- def sync_to_client (self )-> None :
139+ def sync_to_client (self ) -> None :
139140 """
140141 Sends all the data required to initialize or sync the CAD view
141142 """
@@ -152,7 +153,11 @@ def sync_to_client(self)->None:
152153 for point_id , coords in visible_points_coords .items ():
153154 hex_color = distinct_colors [divmod (hash (point_id ), 19 )[1 ]]
154155 color = ImageColor .getrgb (hex_color )
155- data ["annotations" ][point_id ] = {"coordinates" : coords [:- 1 ], "precision" : coords [- 1 ], "color" : color }
156+ data ["annotations" ][point_id ] = {
157+ "coordinates" : coords [:- 1 ],
158+ "precision" : coords [- 1 ],
159+ "color" : color ,
160+ }
156161
157162 # Add the 3D reprojections of the points
158163 fn_reprojections = Path (
0 commit comments