@@ -14,18 +14,17 @@ def __init__(self):
1414 self .ImageReader = vtk .vtkXMLImageDataReader ()
1515
1616
17- schemas = os .path .join (os .path .dirname (__file__ ), "schemas" )
17+ schemas = os .path .join (os .path .dirname (__file__ ), "rpc/ schemas" )
1818with open (
1919 os .path .join (schemas , "create_visualization.json" ),
2020 "r" ,
2121) as file :
2222 create_visualization_json = json .load (file )
2323
24- validate_schemas (create_visualization_json )
25-
2624
2725@exportRpc (create_visualization_json ["rpc" ])
28- def create_visualization (self ):
26+ def create_visualization (self , params ):
27+ validate_schemas (params , create_visualization_json )
2928
3029 renderWindow = self .getView ("-1" )
3130 renderer = renderWindow .GetRenderers ().GetFirstRenderer ()
@@ -43,11 +42,10 @@ def create_visualization(self):
4342) as file :
4443 reset_camera_json = json .load (file )
4544
46- validate_schemas (reset_camera_json )
47-
4845
4946@exportRpc (reset_camera_json ["rpc" ])
50- def reset_camera (self ):
47+ def reset_camera (self , params ):
48+ validate_schemas (params , reset_camera_json )
5149 renderWindow = self .getView ("-1" )
5250 renderWindow .GetRenderers ().GetFirstRenderer ().ResetCamera ()
5351 renderWindow .Render ()
@@ -61,11 +59,10 @@ def reset_camera(self):
6159) as file :
6260 create_object_pipeline_json = json .load (file )
6361
64- validate_schemas (create_object_pipeline_json )
65-
6662
6763@exportRpc (create_object_pipeline_json ["rpc" ])
6864def create_object_pipeline (self , params ):
65+ validate_schemas (create_object_pipeline_json )
6966 try :
7067 print (f"{ params = } " , flush = True )
7168 id = params ["id" ]
@@ -110,11 +107,10 @@ def create_object_pipeline(self, params):
110107) as file :
111108 delete_object_pipeline_json = json .load (file )
112109
113- validate_schemas (delete_object_pipeline_json )
114-
115110
116111@exportRpc (delete_object_pipeline_json ["rpc" ])
117112def delete_object_pipeline (self , params ):
113+ validate_schemas (params , delete_object_pipeline_json )
118114 print (f"{ params = } " , flush = True )
119115 id = params ["id" ]
120116 object = self .get_object (id )
@@ -132,11 +128,10 @@ def delete_object_pipeline(self, params):
132128) as file :
133129 toggle_object_visibility_json = json .load (file )
134130
135- validate_schemas (toggle_object_visibility_json )
136-
137131
138132@exportRpc (toggle_object_visibility_json ["rpc" ])
139133def toggle_object_visibility (self , params ):
134+ validate_schemas (params , toggle_object_visibility_json )
140135 print (f"{ params = } " , flush = True )
141136 id = params ["id" ]
142137 is_visible = params ["is_visible" ]
@@ -152,11 +147,10 @@ def toggle_object_visibility(self, params):
152147) as file :
153148 apply_textures_json = json .load (file )
154149
155- validate_schemas (apply_textures_json )
156-
157150
158151@exportRpc (apply_textures_json ["rpc" ])
159152def apply_textures (self , params ):
153+ validate_schemas (params , apply_textures_json )
160154 print (f"{ params = } " , flush = True )
161155 id = params ["id" ]
162156 textures = params ["textures" ]
@@ -210,11 +204,10 @@ def apply_textures(self, params):
210204) as file :
211205 update_data_json = json .load (file )
212206
213- validate_schemas (update_data_json )
214-
215207
216208@exportRpc (update_data_json ["rpc" ])
217209def update_data (self , params ):
210+ validate_schemas (params , update_data_json )
218211 print (f"{ params = } " , flush = True )
219212 id = params ["id" ]
220213
@@ -241,11 +234,10 @@ def update_data(self, params):
241234) as file :
242235 get_point_position_json = json .load (file )
243236
244- validate_schemas (get_point_position_json )
245-
246237
247238@exportRpc (get_point_position_json ["rpc" ])
248239def get_point_position (self , params ):
240+ validate_schemas (params , get_point_position_json )
249241 x = float (params ["x" ])
250242 y = float (params ["y" ])
251243 print (f"{ x = } " , flush = True )
@@ -263,11 +255,10 @@ def get_point_position(self, params):
263255) as file :
264256 reset_json = json .load (file )
265257
266- validate_schemas (reset_json )
267-
268258
269259@exportRpc (reset_json ["rpc" ])
270- def reset (self ):
260+ def reset (self , params ):
261+ validate_schemas (params , reset_json )
271262 renderWindow = self .getView ("-1" )
272263 renderWindow .GetRenderers ().GetFirstRenderer ().RemoveAllViewProps ()
273264 print ("reset" )
@@ -279,11 +270,10 @@ def reset(self):
279270) as file :
280271 toggle_edge_visibility_json = json .load (file )
281272
282- validate_schemas (toggle_edge_visibility_json )
283-
284273
285274@exportRpc (toggle_edge_visibility_json ["rpc" ])
286275def setEdgeVisibility (self , params ):
276+ validate_schemas (params , toggle_edge_visibility_json )
287277 print (f"{ params = } " , flush = True )
288278 id = params ["id" ]
289279 visibility = bool (params ["visibility" ])
@@ -298,11 +288,10 @@ def setEdgeVisibility(self, params):
298288) as file :
299289 toggle_point_visibility_json = json .load (file )
300290
301- validate_schemas (toggle_point_visibility_json )
302-
303291
304292@exportRpc (toggle_point_visibility_json ["rpc" ])
305293def setPointVisibility (self , params ):
294+ validate_schemas (params , toggle_point_visibility_json )
306295 id = params ["id" ]
307296 visibility = bool (params ["visibility" ])
308297 actor = self .get_object (id )["actor" ]
@@ -316,11 +305,10 @@ def setPointVisibility(self, params):
316305) as file :
317306 point_size_json = json .load (file )
318307
319- validate_schemas (point_size_json )
320-
321308
322309@exportRpc (point_size_json ["rpc" ])
323310def setPointSize (self , params ):
311+ validate_schemas (params , point_size_json )
324312 id = params ["id" ]
325313 size = float (params ["size" ])
326314 actor = self .get_object (id )["actor" ]
@@ -334,11 +322,10 @@ def setPointSize(self, params):
334322) as file :
335323 set_color_json = json .load (file )
336324
337- validate_schemas (set_color_json )
338-
339325
340326@exportRpc (set_color_json ["rpc" ])
341327def setColor (self , params ):
328+ validate_schemas (params , set_color_json )
342329 id = params ["id" ]
343330 red = params ["red" ]
344331 green = params ["green" ]
@@ -355,11 +342,10 @@ def setColor(self, params):
355342) as file :
356343 set_vertex_attribute_json = json .load (file )
357344
358- validate_schemas (set_vertex_attribute_json )
359-
360345
361346@exportRpc (set_vertex_attribute_json ["rpc" ])
362347def setVertexAttribute (self , params ):
348+ validate_schemas (params , set_vertex_attribute_json )
363349 print (f"{ params = } " , flush = True )
364350 id = params ["id" ]
365351 name = params ["name" ]
0 commit comments