Skip to content

Commit b4980d2

Browse files
feat(protocols): global custom_protocols to be able to add manually
1 parent 0517c3e commit b4980d2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/opengeodeweb_viewer/vtkw_server.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Standard library imports
22
import argparse
33
import os
4-
import sys
54

65
# Third party imports
76
import vtk
@@ -31,6 +30,17 @@ class _Server(vtk_wslink.ServerProtocol):
3130
authKey = "wslink-secret"
3231
view = None
3332
debug = False
33+
custom_protocols = []
34+
mesh_protocols = VtkMeshView()
35+
model_protocols = VtkModelView()
36+
custom_protocols.append(VtkView())
37+
custom_protocols.append(VtkViewerView())
38+
custom_protocols.append(mesh_protocols)
39+
custom_protocols.append(VtkMeshPointsView())
40+
custom_protocols.append(VtkMeshEdgesView())
41+
custom_protocols.append(VtkMeshPolygonsView())
42+
custom_protocols.append(model_protocols)
43+
custom_protocols.append(VtkGenericView(mesh_protocols, model_protocols))
3444

3545
@staticmethod
3646
def add_arguments(parser):
@@ -53,16 +63,9 @@ def initialize(self):
5363
self.setSharedObject("db", dict())
5464

5565
# Custom API
56-
mesh_protocols = VtkMeshView()
57-
model_protocols = VtkModelView()
58-
self.registerVtkWebProtocol(VtkView())
59-
self.registerVtkWebProtocol(VtkViewerView())
60-
self.registerVtkWebProtocol(mesh_protocols)
61-
self.registerVtkWebProtocol(VtkMeshPointsView())
62-
self.registerVtkWebProtocol(VtkMeshEdgesView())
63-
self.registerVtkWebProtocol(VtkMeshPolygonsView())
64-
self.registerVtkWebProtocol(model_protocols)
65-
self.registerVtkWebProtocol(VtkGenericView(mesh_protocols, model_protocols))
66+
print("Nb protocols", len(_Server.custom_protocols))
67+
for protocol in _Server.custom_protocols:
68+
self.registerVtkWebProtocol(protocol)
6669

6770
# tell the C++ web app to use no encoding.
6871
# ParaViewWebPublishImageDelivery must be set to decode=False to match.

0 commit comments

Comments
 (0)