1313from opengeodeweb_viewer .utils_functions import get_schemas_dict , validate_schema
1414from opengeodeweb_viewer .object .object_methods import VtkObjectView
1515
16- schemas_dir = os .path .join (os .path .dirname (__file__ ), "schemas" )
17- schemas_dict = get_schemas_dict (schemas_dir )
18- prefix = "opengeodeweb_viewer.mesh."
19-
2016class VtkMeshView (VtkObjectView ):
17+ prefix = "opengeodeweb_viewer.mesh."
18+ schemas_dict = get_schemas_dict (os .path .join (os .path .dirname (__file__ ), "schemas" ))
19+
2120 def __init__ (self ):
2221 super ().__init__ ()
23- self .prefix = prefix
24- self .schemas_dict = schemas_dict
2522
2623 @exportRpc (prefix + schemas_dict ["register" ]["rpc" ])
2724 def registerMesh (self , params ):
28- print (schemas_dict ["register" ]["rpc" ], params , flush = True )
29- validate_schema (params , schemas_dict ["register" ])
25+ print (self . schemas_dict ["register" ]["rpc" ], f" { params = } " , flush = True )
26+ validate_schema (params , self . schemas_dict ["register" ])
3027 id = params ["id" ]
3128 file_name = params ["file_name" ]
3229 try :
3330 reader = vtk .vtkXMLGenericDataObjectReader ()
3431 filter = {}
3532 mapper = vtk .vtkDataSetMapper ()
3633 mapper .SetInputConnection (reader .GetOutputPort ())
37- self .register (id , file_name , reader , filter , mapper )
34+ self .registerObject (id , file_name , reader , filter , mapper )
3835 except Exception as e :
3936 print ("error : " , str (e ), flush = True )
4037
4138 @exportRpc (prefix + schemas_dict ["deregister" ]["rpc" ])
4239 def deregisterMesh (self , params ):
43- print (schemas_dict ["deregister" ]["rpc" ], params , flush = True )
44- validate_schema (params , schemas_dict ["deregister" ])
40+ print (self . schemas_dict ["deregister" ]["rpc" ], f" { params = } " , flush = True )
41+ validate_schema (params , self . schemas_dict ["deregister" ])
4542 id = params ["id" ]
46- self .deregister (id )
43+ self .deregisterObject (id )
4744
4845 @exportRpc (prefix + schemas_dict ["set_visibility" ]["rpc" ])
4946 def SetMeshVisibility (self , params ):
50- print (schemas_dict ["set_visibility" ]["rpc" ], params , flush = True )
51- validate_schema (params , schemas_dict ["set_visibility" ])
47+ print (self . schemas_dict ["set_visibility" ]["rpc" ], f" { params = } " , flush = True )
48+ validate_schema (params , self . schemas_dict ["set_visibility" ])
5249 id = params ["id" ]
5350 visibility = bool (params ["visibility" ])
5451 self .SetVisibility (id , visibility )
5552
5653 @exportRpc (prefix + schemas_dict ["set_opacity" ]["rpc" ])
5754 def setMeshOpacity (self , params ):
58- print (schemas_dict ["set_opacity" ]["rpc" ], params , flush = True )
59- validate_schema (params , schemas_dict ["set_opacity" ])
55+ print (self . schemas_dict ["set_opacity" ]["rpc" ], f" { params = } " , flush = True )
56+ validate_schema (params , self . schemas_dict ["set_opacity" ])
6057 id = params ["id" ]
6158 opacity = float (params ["opacity" ])
6259 self .SetOpacity (id , opacity )
6360
6461 @exportRpc (prefix + schemas_dict ["set_edge_visibility" ]["rpc" ])
6562 def setMeshEdgeVisibility (self , params ):
66- print (schemas_dict ["set_edge_visibility" ]["rpc" ], params , flush = True )
67- validate_schema (params , schemas_dict ["set_edge_visibility" ])
63+ print (self . schemas_dict ["set_edge_visibility" ]["rpc" ], f" { params = } " , flush = True )
64+ validate_schema (params , self . schemas_dict ["set_edge_visibility" ])
6865 id = params ["id" ]
6966 visibility = bool (params ["visibility" ])
7067 self .SetEdgeVisibility (id , visibility )
7168
7269 @exportRpc (prefix + schemas_dict ["set_point_visibility" ]["rpc" ])
7370 def setMeshPointVisibility (self , params ):
74- print (schemas_dict ["set_point_visibility" ]["rpc" ], params , flush = True )
75- validate_schema (params , schemas_dict ["set_point_visibility" ])
71+ print (self . schemas_dict ["set_point_visibility" ]["rpc" ], f" { params = } " , flush = True )
72+ validate_schema (params , self . schemas_dict ["set_point_visibility" ])
7673 id = params ["id" ]
7774 visibility = bool (params ["visibility" ])
7875 self .SetVertexVisibility (id , visibility )
7976
8077 @exportRpc (prefix + schemas_dict ["set_point_size" ]["rpc" ])
8178 def setMeshPointSize (self , params ):
82- print (schemas_dict ["set_point_size" ]["rpc" ], params , flush = True )
83- validate_schema (params , schemas_dict ["set_point_size" ])
79+ print (self . schemas_dict ["set_point_size" ]["rpc" ], f" { params = } " , flush = True )
80+ validate_schema (params , self . schemas_dict ["set_point_size" ])
8481 id = params ["id" ]
8582 size = float (params ["size" ])
8683 self .SetPointSize (id , size )
8784
8885 @exportRpc (prefix + schemas_dict ["set_color" ]["rpc" ])
8986 def setMeshColor (self , params ):
90- print (schemas_dict ["set_color" ]["rpc" ], params , flush = True )
91- validate_schema (params , schemas_dict ["set_color" ])
87+ print (self . schemas_dict ["set_color" ]["rpc" ], f" { params = } " , flush = True )
88+ validate_schema (params , self . schemas_dict ["set_color" ])
9289 id = params ["id" ]
9390 red = params ["red" ]
9491 green = params ["green" ]
@@ -97,8 +94,8 @@ def setMeshColor(self, params):
9794
9895 @exportRpc (prefix + schemas_dict ["display_vertex_attribute" ]["rpc" ])
9996 def setVertexAttribute (self , params ):
100- print (schemas_dict ["display_vertex_attribute" ]["rpc" ], params , flush = True )
101- validate_schema (params , schemas_dict ["display_vertex_attribute" ])
97+ print (self . schemas_dict ["display_vertex_attribute" ]["rpc" ], f" { params = } " , flush = True )
98+ validate_schema (params , self . schemas_dict ["display_vertex_attribute" ])
10299 id = params ["id" ]
103100 name = params ["name" ]
104101 reader = self .get_object (id )["reader" ]
@@ -112,8 +109,8 @@ def setVertexAttribute(self, params):
112109
113110 @exportRpc (prefix + schemas_dict ["display_polygon_attribute" ]["rpc" ])
114111 def setPolygonAttribute (self , params ):
115- print (schemas_dict ["display_polygon_attribute" ]["rpc" ], params , flush = True )
116- validate_schema (params , schemas_dict ["display_polygon_attribute" ])
112+ print (self . schemas_dict ["display_polygon_attribute" ]["rpc" ], f" { params = } " , flush = True )
113+ validate_schema (params , self . schemas_dict ["display_polygon_attribute" ])
117114 id = params ["id" ]
118115 name = params ["name" ]
119116 reader = self .get_object (id )["reader" ]
0 commit comments