Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Upload PYPI
if: steps.semantic-release.outputs.released == 'true'
run: |
python3 -m pip install twine
python3 -m pip install twine==6.0.1
python3 -m twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Setup NODE
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ __pycache__/
latest_logs
schemas.json
build
src/tests/tests_output/
/src/tests/tests_output/
*.egg-info
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# CHANGELOG


## v1.3.0-rc.2 (2025-02-13)

### Bug Fixes

- **CICD**: Twine 6.0.1
([`430f5c8`](https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/commit/430f5c818a7b2af89f79ab47b81885f2a4f9924d))


## v1.3.0-rc.1 (2025-02-13)

### Features

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


## v1.2.1 (2025-01-16)


Expand Down Expand Up @@ -128,7 +144,7 @@

BREAKING CHANGE: change some rpc names in schemas

### BREAKING CHANGES
### Breaking Changes

- **new rpcs**: Change some rpc names in schemas

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "OpenGeodeWeb-Viewer"
version = "1.2.1"
version = "1.3.0-rc.2"
dynamic = ["dependencies"]
authors = [
{ name="Geode-solutions", email="[email protected]" },
Expand Down Expand Up @@ -41,6 +41,7 @@ where = ["src"]
"opengeodeweb_viewer.rpc.mesh.points.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.mesh.edges.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.mesh.polygons.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.mesh.polyhedrons.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.model.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.viewer.schemas" = ["*.json"]

Expand Down
22 changes: 6 additions & 16 deletions src/opengeodeweb_viewer/object/object_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def applyTextures(self, id, textures):

self.render()


def SetVisibility(self, id, visibility):
actor = self.get_object(id)["actor"]
actor.SetVisibility(visibility)
Expand All @@ -103,7 +102,7 @@ def SetColor(self, id, red, green, blue):
mapper = self.get_object(id)["mapper"]
mapper.ScalarVisibilityOff()
actor = self.get_object(id)["actor"]
actor.GetProperty().SetColor([red, green, blue])
actor.GetProperty().SetColor([red/255, green/255, blue/255])
self.render()

def SetEdgesVisibility(self, id, visibility):
Expand All @@ -116,10 +115,11 @@ def SetEdgesSize(self, id, size):
actor.GetProperty().SetEdgeWidth(size)
self.render()

def SetEdgesColor(self, id, color):
def SetEdgesColor(self, id, red, green, blue):
actor = self.get_object(id)["actor"]
actor.GetProperty().SetEdgeColor(color)
actor.GetProperty().SetEdgeColor([red/255, green/255, blue/255])
self.render()

def SetPointsVisibility(self, id, visibility):
actor = self.get_object(id)["actor"]
actor.GetProperty().SetVertexVisibility(visibility)
Expand All @@ -131,19 +131,9 @@ def SetPointsSize(self, id, size):
actor.GetProperty().SetPointSize(size)
self.render()

def SetPointsColor(self, id, color):
actor = self.get_object(id)["actor"]
actor.GetProperty().SetVertexColor(color)
self.render()

def SetPolygonsVisibility(self, id, visibility):
actor = self.get_object(id)["actor"]
actor.SetVisibility(visibility)
self.render()

def SetPolygonsColor(self, id, color):
def SetPointsColor(self, id, red, green, blue):
actor = self.get_object(id)["actor"]
actor.GetProperty().SetColor(color)
actor.GetProperty().SetVertexColor([red/255, green/255, blue/255])
self.render()

def clearColors(self, id):
Expand Down
4 changes: 2 additions & 2 deletions src/opengeodeweb_viewer/rpc/mesh/edges/edges_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def setMeshEdgesColor(self, params):
print(self.mesh_edges_prefix + self.mesh_edges_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_edges_schemas_dict["color"])
id = params["id"]
red, green, blue = params["color"]["r"]/255, params["color"]["g"]/255, params["color"]["b"]/255
self.SetEdgesColor(id, [red, green, blue])
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetEdgesColor(id, red, green, blue)

@exportRpc(mesh_edges_prefix + mesh_edges_schemas_dict["size"]["rpc"])
def setMeshEdgesSize(self, params):
Expand Down
7 changes: 4 additions & 3 deletions src/opengeodeweb_viewer/rpc/mesh/mesh_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def setMeshColor(self, params):
print(self.mesh_prefix + self.mesh_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_schemas_dict["color"])
id = params["id"]
red, green, blue = params["color"]["r"]/255, params["color"]["g"]/255, params["color"]["b"]/255
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetColor(id, red, green, blue)

def setMeshVertexAttribute(self, id, name):
def displayAttributeOnVertices(self, id, name):
reader = self.get_object(id)["reader"]
points = reader.GetOutput().GetPointData()
points.SetActiveScalars(name)
Expand All @@ -72,7 +72,8 @@ def setMeshVertexAttribute(self, id, name):
mapper.SetScalarRange(points.GetScalars().GetRange())
self.render()

def setMeshPolygonAttribute(self, id, name):

def displayAttributeOnCells(self, id, name):
reader = self.get_object(id)["reader"]
cells = reader.GetOutput().GetCellData()
cells.SetActiveScalars(name)
Expand Down
6 changes: 3 additions & 3 deletions src/opengeodeweb_viewer/rpc/mesh/points/points_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def setMeshPointsColor(self, params):
print(self.mesh_points_prefix + self.mesh_points_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_points_schemas_dict["color"])
id = str(params["id"])
red, green, blue = params["color"]["r"]/255, params["color"]["g"]/255, params["color"]["b"]/255
self.SetPointsColor(id, [red, green, blue])
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetPointsColor(id, red, green, blue)

@exportRpc(mesh_points_prefix + mesh_points_schemas_dict["size"]["rpc"])
def setMeshPointsSize(self, params):
Expand All @@ -45,5 +45,5 @@ def setMeshPointsVertexAttribute(self, params):
validate_schema(params, self.mesh_points_schemas_dict["vertex_attribute"])
id = str(params["id"])
name = str(params["name"])
self.setMeshVertexAttribute(id, name)
self.displayAttributeOnVertices(id, name)

12 changes: 6 additions & 6 deletions src/opengeodeweb_viewer/rpc/mesh/polygons/polygons_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ def setMeshPolygonsVisibility(self, params):
validate_schema(params, self.mesh_polygons_schemas_dict["visibility"])
id = params["id"]
visibility = bool(params["visibility"])
self.SetPolygonsVisibility(id, visibility)

self.SetVisibility(id, visibility)
@exportRpc(mesh_polygons_prefix + mesh_polygons_schemas_dict["color"]["rpc"])
def setMeshPolygonsColor(self, params):
print(self.mesh_polygons_prefix + self.mesh_polygons_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polygons_schemas_dict["color"])
id = params["id"]
red, green, blue = params["color"]["r"]/255, params["color"]["g"]/255, params["color"]["b"]/255
self.SetPolygonsColor(id, [red, green, blue])
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetColor(id, red, green, blue)

@exportRpc(mesh_polygons_prefix + mesh_polygons_schemas_dict["vertex_attribute"]["rpc"])
def setMeshPolygonsVertexAttribute(self, params):
print(self.mesh_polygons_prefix + self.mesh_polygons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polygons_schemas_dict["vertex_attribute"])
id = params["id"]
name = str(params["name"])
self.setMeshVertexAttribute(id, name)
self.displayAttributeOnVertices(id, name)

@exportRpc(mesh_polygons_prefix + mesh_polygons_schemas_dict["polygon_attribute"]["rpc"])
def setMeshPolygonsPolygonAttribute(self, params):
print(self.mesh_polygons_prefix + self.mesh_polygons_schemas_dict["polygon_attribute"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polygons_schemas_dict["polygon_attribute"])
id = params["id"]
name = str(params["name"])
self.setMeshPolygonAttribute(id, name)
self.displayAttributeOnCells(id, name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Standard library imports
import os

# Third party imports
from wslink import register as exportRpc

# Local application imports
from opengeodeweb_viewer.utils_functions import get_schemas_dict, validate_schema
from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView

class VtkMeshPolyhedronsView(VtkMeshView):
mesh_polyhedrons_prefix = "opengeodeweb_viewer.mesh.polyhedrons."
mesh_polyhedrons_schemas_dict = get_schemas_dict(os.path.join(os.path.dirname(__file__), "schemas"))

def __init__(self):
super().__init__()

@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["visibility"]["rpc"])
def setMeshPolyhedronsVisibility(self, params):
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["visibility"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polyhedrons_schemas_dict["visibility"])
id = params["id"]
visibility = bool(params["visibility"])
self.SetVisibility(id, visibility)

@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["color"]["rpc"])
def setMeshPolyhedronsColor(self, params):
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["color"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polyhedrons_schemas_dict["color"])
id = params["id"]
red, green, blue = params["color"]["r"], params["color"]["g"], params["color"]["b"]
self.SetColor(id, red, green, blue)

@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"])
def setMeshPolyhedronsVertexAttribute(self, params):
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polyhedrons_schemas_dict["vertex_attribute"])
id = params["id"]
name = str(params["name"])
self.displayAttributeOnVertices(id, name)

@exportRpc(mesh_polyhedrons_prefix + mesh_polyhedrons_schemas_dict["polyhedron_attribute"]["rpc"])
def setMeshPolyhedronsPolyhedronAttribute(self, params):
print(self.mesh_polyhedrons_prefix + self.mesh_polyhedrons_schemas_dict["vertex_attribute"]["rpc"], f"{params=}", flush=True)
validate_schema(params, self.mesh_polyhedrons_schemas_dict["vertex_attribute"])
id = params["id"]
name = str(params["name"])
self.displayAttributeOnCells(id, name)

46 changes: 46 additions & 0 deletions src/opengeodeweb_viewer/rpc/mesh/polyhedrons/schemas/color.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"rpc": "color",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"color": {
"type": "object",
"properties": {
"r": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"g": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"b": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"a": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 1
}
},
"required": [
"r",
"g",
"b"
],
"additionalProperties": false
}
},
"required": [
"id",
"color"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rpc": "polyhedron_attribute",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rpc": "vertex_attribute",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rpc": "visibility",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"visibility": {
"type": "boolean"
}
},
"required": [
"id",
"visibility"
],
"additionalProperties": false
}
2 changes: 2 additions & 0 deletions src/opengeodeweb_viewer/vtkw_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .rpc.mesh.points.points_protocols import VtkMeshPointsView
from .rpc.mesh.edges.edges_protocols import VtkMeshEdgesView
from .rpc.mesh.polygons.polygons_protocols import VtkMeshPolygonsView
from .rpc.mesh.polyhedrons.polyhedrons_protocols import VtkMeshPolyhedronsView
from .rpc.model.model_protocols import VtkModelView
from .rpc.generic.generic_protocols import VtkGenericView

Expand Down Expand Up @@ -60,6 +61,7 @@ def initialize(self):
self.registerVtkWebProtocol(VtkMeshPointsView())
self.registerVtkWebProtocol(VtkMeshEdgesView())
self.registerVtkWebProtocol(VtkMeshPolygonsView())
self.registerVtkWebProtocol(VtkMeshPolyhedronsView())
self.registerVtkWebProtocol(model_protocols)
self.registerVtkWebProtocol(VtkGenericView(mesh_protocols, model_protocols))

Expand Down
22 changes: 22 additions & 0 deletions src/tests/data/hybrid_solid.vtu
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<UnstructuredGrid>
<Piece NumberOfPoints="11" NumberOfCells="4">
<PointData>
<DataArray type="Float64" Name="toto_on_vertices" format="ascii" NumberOfComponents="1" RangeMin="1" RangeMax="11">1 2 3 4 5 6 7 8 9 10 11 </DataArray>
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="2">0 0 0 1 0 0 2 1 0 1 2 0 0 2 0 0 0 1 1 0 1 2 1 1 1 2 1 0 2 1 1 1 2 </DataArray>
</PointData>
<Points>
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="2">0 0 0 1 0 0 2 1 0 1 2 0 0 2 0 0 0 1 1 0 1 2 1 1 1 2 1 0 2 1 1 1 2 </DataArray>
</Points>
<CellData>
<DataArray type="Float64" Name="toto_on_polyhedra" format="ascii" NumberOfComponents="1" RangeMin="3" RangeMax="6">3 4 5 6 </DataArray>
</CellData>
<Cells>
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="10">0 1 3 4 5 6 8 9 1 2 3 6 7 8 5 6 8 9 10 6 7 8 10 </DataArray>
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="11">8 14 19 23 </DataArray>
<DataArray type="UInt8" Name="types" format="ascii" RangeMin="1" RangeMax="42">12 13 14 10 </DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/tests/data/images/mesh/polyhedrons/color.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading