@@ -14,18 +14,17 @@ def __init__(self):
14
14
self .ImageReader = vtk .vtkXMLImageDataReader ()
15
15
16
16
17
- schemas = os .path .join (os .path .dirname (__file__ ), "schemas" )
17
+ schemas = os .path .join (os .path .dirname (__file__ ), "rpc/ schemas" )
18
18
with open (
19
19
os .path .join (schemas , "create_visualization.json" ),
20
20
"r" ,
21
21
) as file :
22
22
create_visualization_json = json .load (file )
23
23
24
- validate_schemas (create_visualization_json )
25
-
26
24
27
25
@exportRpc (create_visualization_json ["rpc" ])
28
- def create_visualization (self ):
26
+ def create_visualization (self , params ):
27
+ validate_schemas (params , create_visualization_json )
29
28
30
29
renderWindow = self .getView ("-1" )
31
30
renderer = renderWindow .GetRenderers ().GetFirstRenderer ()
@@ -43,11 +42,10 @@ def create_visualization(self):
43
42
) as file :
44
43
reset_camera_json = json .load (file )
45
44
46
- validate_schemas (reset_camera_json )
47
-
48
45
49
46
@exportRpc (reset_camera_json ["rpc" ])
50
- def reset_camera (self ):
47
+ def reset_camera (self , params ):
48
+ validate_schemas (params , reset_camera_json )
51
49
renderWindow = self .getView ("-1" )
52
50
renderWindow .GetRenderers ().GetFirstRenderer ().ResetCamera ()
53
51
renderWindow .Render ()
@@ -61,11 +59,10 @@ def reset_camera(self):
61
59
) as file :
62
60
create_object_pipeline_json = json .load (file )
63
61
64
- validate_schemas (create_object_pipeline_json )
65
-
66
62
67
63
@exportRpc (create_object_pipeline_json ["rpc" ])
68
64
def create_object_pipeline (self , params ):
65
+ validate_schemas (create_object_pipeline_json )
69
66
try :
70
67
print (f"{ params = } " , flush = True )
71
68
id = params ["id" ]
@@ -110,11 +107,10 @@ def create_object_pipeline(self, params):
110
107
) as file :
111
108
delete_object_pipeline_json = json .load (file )
112
109
113
- validate_schemas (delete_object_pipeline_json )
114
-
115
110
116
111
@exportRpc (delete_object_pipeline_json ["rpc" ])
117
112
def delete_object_pipeline (self , params ):
113
+ validate_schemas (params , delete_object_pipeline_json )
118
114
print (f"{ params = } " , flush = True )
119
115
id = params ["id" ]
120
116
object = self .get_object (id )
@@ -132,11 +128,10 @@ def delete_object_pipeline(self, params):
132
128
) as file :
133
129
toggle_object_visibility_json = json .load (file )
134
130
135
- validate_schemas (toggle_object_visibility_json )
136
-
137
131
138
132
@exportRpc (toggle_object_visibility_json ["rpc" ])
139
133
def toggle_object_visibility (self , params ):
134
+ validate_schemas (params , toggle_object_visibility_json )
140
135
print (f"{ params = } " , flush = True )
141
136
id = params ["id" ]
142
137
is_visible = params ["is_visible" ]
@@ -152,11 +147,10 @@ def toggle_object_visibility(self, params):
152
147
) as file :
153
148
apply_textures_json = json .load (file )
154
149
155
- validate_schemas (apply_textures_json )
156
-
157
150
158
151
@exportRpc (apply_textures_json ["rpc" ])
159
152
def apply_textures (self , params ):
153
+ validate_schemas (params , apply_textures_json )
160
154
print (f"{ params = } " , flush = True )
161
155
id = params ["id" ]
162
156
textures = params ["textures" ]
@@ -210,11 +204,10 @@ def apply_textures(self, params):
210
204
) as file :
211
205
update_data_json = json .load (file )
212
206
213
- validate_schemas (update_data_json )
214
-
215
207
216
208
@exportRpc (update_data_json ["rpc" ])
217
209
def update_data (self , params ):
210
+ validate_schemas (params , update_data_json )
218
211
print (f"{ params = } " , flush = True )
219
212
id = params ["id" ]
220
213
@@ -241,11 +234,10 @@ def update_data(self, params):
241
234
) as file :
242
235
get_point_position_json = json .load (file )
243
236
244
- validate_schemas (get_point_position_json )
245
-
246
237
247
238
@exportRpc (get_point_position_json ["rpc" ])
248
239
def get_point_position (self , params ):
240
+ validate_schemas (params , get_point_position_json )
249
241
x = float (params ["x" ])
250
242
y = float (params ["y" ])
251
243
print (f"{ x = } " , flush = True )
@@ -263,11 +255,10 @@ def get_point_position(self, params):
263
255
) as file :
264
256
reset_json = json .load (file )
265
257
266
- validate_schemas (reset_json )
267
-
268
258
269
259
@exportRpc (reset_json ["rpc" ])
270
- def reset (self ):
260
+ def reset (self , params ):
261
+ validate_schemas (params , reset_json )
271
262
renderWindow = self .getView ("-1" )
272
263
renderWindow .GetRenderers ().GetFirstRenderer ().RemoveAllViewProps ()
273
264
print ("reset" )
@@ -279,11 +270,10 @@ def reset(self):
279
270
) as file :
280
271
toggle_edge_visibility_json = json .load (file )
281
272
282
- validate_schemas (toggle_edge_visibility_json )
283
-
284
273
285
274
@exportRpc (toggle_edge_visibility_json ["rpc" ])
286
275
def setEdgeVisibility (self , params ):
276
+ validate_schemas (params , toggle_edge_visibility_json )
287
277
print (f"{ params = } " , flush = True )
288
278
id = params ["id" ]
289
279
visibility = bool (params ["visibility" ])
@@ -298,11 +288,10 @@ def setEdgeVisibility(self, params):
298
288
) as file :
299
289
toggle_point_visibility_json = json .load (file )
300
290
301
- validate_schemas (toggle_point_visibility_json )
302
-
303
291
304
292
@exportRpc (toggle_point_visibility_json ["rpc" ])
305
293
def setPointVisibility (self , params ):
294
+ validate_schemas (params , toggle_point_visibility_json )
306
295
id = params ["id" ]
307
296
visibility = bool (params ["visibility" ])
308
297
actor = self .get_object (id )["actor" ]
@@ -316,11 +305,10 @@ def setPointVisibility(self, params):
316
305
) as file :
317
306
point_size_json = json .load (file )
318
307
319
- validate_schemas (point_size_json )
320
-
321
308
322
309
@exportRpc (point_size_json ["rpc" ])
323
310
def setPointSize (self , params ):
311
+ validate_schemas (params , point_size_json )
324
312
id = params ["id" ]
325
313
size = float (params ["size" ])
326
314
actor = self .get_object (id )["actor" ]
@@ -334,11 +322,10 @@ def setPointSize(self, params):
334
322
) as file :
335
323
set_color_json = json .load (file )
336
324
337
- validate_schemas (set_color_json )
338
-
339
325
340
326
@exportRpc (set_color_json ["rpc" ])
341
327
def setColor (self , params ):
328
+ validate_schemas (params , set_color_json )
342
329
id = params ["id" ]
343
330
red = params ["red" ]
344
331
green = params ["green" ]
@@ -355,11 +342,10 @@ def setColor(self, params):
355
342
) as file :
356
343
set_vertex_attribute_json = json .load (file )
357
344
358
- validate_schemas (set_vertex_attribute_json )
359
-
360
345
361
346
@exportRpc (set_vertex_attribute_json ["rpc" ])
362
347
def setVertexAttribute (self , params ):
348
+ validate_schemas (params , set_vertex_attribute_json )
363
349
print (f"{ params = } " , flush = True )
364
350
id = params ["id" ]
365
351
name = params ["name" ]
0 commit comments