|
23 | 23 | get_schemas_dict, |
24 | 24 | validate_schema, |
25 | 25 | RpcParams, |
26 | | - RpcParamsWithColor, |
27 | | - RpcParamsWithList, |
28 | 26 | ) |
29 | 27 | from opengeodeweb_viewer.vtk_protocol import VtkView |
30 | 28 | from . import schemas |
@@ -97,7 +95,7 @@ def resetVisualization(self, rpc_params: RpcParams) -> None: |
97 | 95 | self.render() |
98 | 96 |
|
99 | 97 | @exportRpc(viewer_prefix + viewer_schemas_dict["set_background_color"]["rpc"]) |
100 | | - def setBackgroundColor(self, rpc_params: RpcParamsWithColor) -> None: |
| 98 | + def setBackgroundColor(self, rpc_params: RpcParams) -> None: |
101 | 99 | validate_schema( |
102 | 100 | rpc_params, |
103 | 101 | self.viewer_schemas_dict["set_background_color"], |
@@ -147,16 +145,16 @@ def takeScreenshot(self, rpc_params: RpcParams) -> dict[str, str | bytes]: |
147 | 145 | w2if.ReadFrontBufferOff() |
148 | 146 | w2if.Update() |
149 | 147 | output_extension = params.output_extension |
150 | | - if output_extension == "png": |
| 148 | + if output_extension == schemas.OutputExtension.PNG: |
151 | 149 | writer = vtkPNGWriter() |
152 | | - elif output_extension in ["jpg", "jpeg"]: |
| 150 | + elif output_extension == schemas.OutputExtension.JPG: |
153 | 151 | if not include_background: |
154 | 152 | raise Exception("output_extension not supported with background") |
155 | 153 | writer = vtkJPEGWriter() |
156 | 154 | else: |
157 | 155 | raise Exception("output_extension not supported") |
158 | 156 |
|
159 | | - new_filename = params.filename + "." + output_extension |
| 157 | + new_filename = params.filename + "." + output_extension.value |
160 | 158 | file_path = os.path.join(self.DATA_FOLDER_PATH, new_filename) |
161 | 159 | writer.SetFileName(file_path) |
162 | 160 | writer.SetInputConnection(w2if.GetOutputPort()) |
@@ -219,7 +217,7 @@ def computeEpsilon(self, renderer: vtkRenderer, z: float) -> float: |
219 | 217 | return math.sqrt(epsilon) * 0.0125 |
220 | 218 |
|
221 | 219 | @exportRpc(viewer_prefix + viewer_schemas_dict["picked_ids"]["rpc"]) |
222 | | - def pickedIds(self, rpc_params: RpcParamsWithList) -> dict[str, list[str]]: |
| 220 | + def pickedIds(self, rpc_params: RpcParams) -> dict[str, list[str]]: |
223 | 221 | validate_schema( |
224 | 222 | rpc_params, self.viewer_schemas_dict["picked_ids"], self.viewer_prefix |
225 | 223 | ) |
@@ -275,11 +273,11 @@ def updateCamera(self, rpc_params: RpcParams) -> None: |
275 | 273 | renderWindow = self.getView("-1") |
276 | 274 | camera = renderWindow.GetRenderers().GetFirstRenderer().GetActiveCamera() |
277 | 275 |
|
278 | | - camera.SetFocalPoint(*camara_options.focal_point) |
279 | | - camera.SetViewUp(*camara_options.view_up) |
280 | | - camera.SetPosition(*camara_options.position) |
281 | | - camera.SetViewAngle(camara_options.view_angle) |
282 | | - camera.SetClippingRange(*camara_options.clipping_range) |
| 276 | + camera.SetFocalPoint(camera_options.focal_point) |
| 277 | + camera.SetViewUp(camera_options.view_up) |
| 278 | + camera.SetPosition(camera_options.position) |
| 279 | + camera.SetViewAngle(camera_options.view_angle) |
| 280 | + camera.SetClippingRange(camera_options.clipping_range) |
283 | 281 | self.render() |
284 | 282 |
|
285 | 283 | @exportRpc(viewer_prefix + viewer_schemas_dict["render_now"]["rpc"]) |
|
0 commit comments