Skip to content

Commit 61ec058

Browse files
Merge pull request #59 from Geode-solutions/feat/grid_scale
feat(viewer): add grid_scale protocol
2 parents cddff24 + 6100c08 commit 61ec058

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+401
-378
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
### Features
6767

68-
- **polyhedrons**: Color protocol
68+
- **polyhedra**: Color protocol
6969
([`15b35fc`](https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/commit/15b35fcfdda1afc66f4eb4942d9f54006bbc9a0f))
7070

7171

pyproject.toml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,12 @@ where = ["src"]
4141
"opengeodeweb_viewer.rpc.mesh.points.schemas" = ["*.json"]
4242
"opengeodeweb_viewer.rpc.mesh.edges.schemas" = ["*.json"]
4343
"opengeodeweb_viewer.rpc.mesh.polygons.schemas" = ["*.json"]
44-
"opengeodeweb_viewer.rpc.mesh.polyhedrons.schemas" = ["*.json"]
44+
"opengeodeweb_viewer.rpc.mesh.polyhedra.schemas" = ["*.json"]
4545
"opengeodeweb_viewer.rpc.model.schemas" = ["*.json"]
46-
"opengeodeweb_viewer.rpc.model.corners.points.schemas" = ["*.json"]
47-
"opengeodeweb_viewer.rpc.model.lines.points.schemas" = ["*.json"]
48-
"opengeodeweb_viewer.rpc.model.lines.edges.schemas" = ["*.json"]
49-
"opengeodeweb_viewer.rpc.model.surfaces.points.schemas" = ["*.json"]
50-
"opengeodeweb_viewer.rpc.model.surfaces.edges.schemas" = ["*.json"]
51-
"opengeodeweb_viewer.rpc.model.surfaces.polygons.schemas" = ["*.json"]
52-
"opengeodeweb_viewer.rpc.model.blocks.points.schemas" = ["*.json"]
53-
"opengeodeweb_viewer.rpc.model.blocks.edges.schemas" = ["*.json"]
54-
"opengeodeweb_viewer.rpc.model.blocks.polygons.schemas" = ["*.json"]
55-
"opengeodeweb_viewer.rpc.model.blocks.polyhedrons.schemas" = ["*.json"]
46+
"opengeodeweb_viewer.rpc.model.corners.schemas" = ["*.json"]
47+
"opengeodeweb_viewer.rpc.model.lines.schemas" = ["*.json"]
48+
"opengeodeweb_viewer.rpc.model.surfaces.schemas" = ["*.json"]
49+
"opengeodeweb_viewer.rpc.model.blocks.schemas" = ["*.json"]
5650
"opengeodeweb_viewer.rpc.viewer.schemas" = ["*.json"]
5751

5852
[tool.semantic_release]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Standard library imports
2+
import os
3+
4+
# Third party imports
5+
from wslink import register as exportRpc
6+
7+
# Local application imports
8+
from opengeodeweb_viewer.utils_functions import get_schemas_dict, validate_schema
9+
from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView
10+
11+
12+
class VtkMeshPolyhedraView(VtkMeshView):
13+
mesh_polyhedra_prefix = "opengeodeweb_viewer.mesh.polyhedra."
14+
mesh_polyhedra_schemas_dict = get_schemas_dict(
15+
os.path.join(os.path.dirname(__file__), "schemas")
16+
)
17+
18+
def __init__(self):
19+
super().__init__()
20+
21+
@exportRpc(mesh_polyhedra_prefix + mesh_polyhedra_schemas_dict["visibility"]["rpc"])
22+
def setMeshPolyhedraVisibility(self, params):
23+
validate_schema(
24+
params,
25+
self.mesh_polyhedra_schemas_dict["visibility"],
26+
self.mesh_polyhedra_prefix,
27+
)
28+
id, visibility = params["id"], params["visibility"]
29+
self.SetVisibility(id, visibility)
30+
31+
@exportRpc(mesh_polyhedra_prefix + mesh_polyhedra_schemas_dict["color"]["rpc"])
32+
def setMeshPolyhedraColor(self, params):
33+
validate_schema(
34+
params,
35+
self.mesh_polyhedra_schemas_dict["color"],
36+
self.mesh_polyhedra_prefix,
37+
)
38+
id, red, green, blue = (
39+
params["id"],
40+
params["color"]["r"],
41+
params["color"]["g"],
42+
params["color"]["b"],
43+
)
44+
self.SetColor(id, red, green, blue)
45+
46+
@exportRpc(
47+
mesh_polyhedra_prefix + mesh_polyhedra_schemas_dict["vertex_attribute"]["rpc"]
48+
)
49+
def setMeshPolyhedraVertexAttribute(self, params):
50+
validate_schema(
51+
params,
52+
self.mesh_polyhedra_schemas_dict["vertex_attribute"],
53+
self.mesh_polyhedra_prefix,
54+
)
55+
id, name = params["id"], params["name"]
56+
self.displayAttributeOnVertices(id, name)
57+
58+
@exportRpc(
59+
mesh_polyhedra_prefix
60+
+ mesh_polyhedra_schemas_dict["polyhedron_attribute"]["rpc"]
61+
)
62+
def setMeshPolyhedraPolyhedronAttribute(self, params):
63+
validate_schema(
64+
params,
65+
self.mesh_polyhedra_schemas_dict["polyhedron_attribute"],
66+
self.mesh_polyhedra_prefix,
67+
)
68+
id, name = params["id"], params["name"]
69+
self.displayAttributeOnCells(id, name)

src/opengeodeweb_viewer/rpc/mesh/polyhedrons/polyhedrons_protocols.py

Lines changed: 0 additions & 72 deletions
This file was deleted.
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,21 @@
99
from opengeodeweb_viewer.rpc.model.model_protocols import VtkModelView
1010

1111

12-
class VtkModelBlocksPolyhedronsView(VtkModelView):
13-
model_blocks_polyhedrons_prefix = "opengeodeweb_viewer.model.blocks.polyhedrons."
14-
model_blocks_polyhedrons_schemas_dict = get_schemas_dict(
12+
class VtkModelBlocksView(VtkModelView):
13+
model_blocks_prefix = "opengeodeweb_viewer.model.blocks."
14+
model_blocks_schemas_dict = get_schemas_dict(
1515
os.path.join(os.path.dirname(__file__), "schemas")
1616
)
1717

1818
def __init__(self):
1919
super().__init__()
2020

21-
@exportRpc(
22-
model_blocks_polyhedrons_prefix
23-
+ model_blocks_polyhedrons_schemas_dict["visibility"]["rpc"]
24-
)
25-
def setModelBlocksPolyhedronsVisibility(self, params):
21+
@exportRpc(model_blocks_prefix + model_blocks_schemas_dict["visibility"]["rpc"])
22+
def setModelBlocksPolyhedraVisibility(self, params):
2623
validate_schema(
2724
params,
28-
self.model_blocks_polyhedrons_schemas_dict["visibility"],
29-
self.model_blocks_polyhedrons_prefix,
25+
self.model_blocks_schemas_dict["visibility"],
26+
self.model_blocks_prefix,
3027
)
3128
id, block_ids, visibility = (
3229
params["id"],
@@ -35,15 +32,12 @@ def setModelBlocksPolyhedronsVisibility(self, params):
3532
)
3633
self.SetBlocksVisibility(id, block_ids, visibility)
3734

38-
@exportRpc(
39-
model_blocks_polyhedrons_prefix
40-
+ model_blocks_polyhedrons_schemas_dict["color"]["rpc"]
41-
)
42-
def setModelBlocksPolyhedronsColor(self, params):
35+
@exportRpc(model_blocks_prefix + model_blocks_schemas_dict["color"]["rpc"])
36+
def setModelBlocksPolyhedraColor(self, params):
4337
validate_schema(
4438
params,
45-
self.model_blocks_polyhedrons_schemas_dict["color"],
46-
self.model_blocks_polyhedrons_prefix,
39+
self.model_blocks_schemas_dict["color"],
40+
self.model_blocks_prefix,
4741
)
4842
id, block_ids, red, green, blue = (
4943
params["id"],

0 commit comments

Comments
 (0)