-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/color bar #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Feat/color bar #121
Changes from all commits
9c2aca1
13eec4a
b6be71c
69083aa
3086f1a
2510cfc
16a8fe8
6eaa40a
ac8183b
bbffeb3
4f09594
0afbe7e
540e4ca
7460325
d89007a
5abce2a
3411729
89fe79b
a36e482
9b90ac5
dea10d7
e9d071d
421fc92
04a8862
66ad44c
4f6cd7c
f1500af
dfc7831
ddf89cb
59413a5
53c3800
f4273b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,4 +61,3 @@ wslink==1.12.4 | |
| yarl>=1 | ||
| # via aiohttp | ||
|
|
||
| opengeodeweb-microservice==1.*,>=1.0.13 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Standard library imports | ||
| import os | ||
|
|
||
| # Third party imports | ||
| from wslink import register as exportRpc # type: ignore | ||
| from opengeodeweb_microservice.schemas import get_schemas_dict | ||
|
|
||
| # Local application imports | ||
| from opengeodeweb_viewer.utils_functions import ( | ||
| validate_schema, | ||
| RpcParams, | ||
| ) | ||
| from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView | ||
| from . import schemas | ||
|
|
||
|
|
||
| class VtkMeshCellsAttributeCellView(VtkMeshView): | ||
| mesh_cells_attribute_cell_prefix = "opengeodeweb_viewer.mesh.cells.attribute.cell." | ||
| mesh_cells_attribute_cell_schemas_dict = get_schemas_dict( | ||
| os.path.join(os.path.dirname(__file__), "schemas") | ||
| ) | ||
|
|
||
| def __init__(self) -> None: | ||
| super().__init__() | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_cell_prefix | ||
| + mesh_cells_attribute_cell_schemas_dict["name"]["rpc"] | ||
| ) | ||
| def setMeshCellsCellAttribute(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_cell_schemas_dict["name"], | ||
| self.mesh_cells_attribute_cell_prefix, | ||
| ) | ||
| params = schemas.Name.from_dict(rpc_params) | ||
| self.displayAttributeOnCells(params.id, params.name) | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_cell_prefix | ||
| + mesh_cells_attribute_cell_schemas_dict["scalar_range"]["rpc"] | ||
| ) | ||
| def setMeshCellsCellScalarRange(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_cell_schemas_dict["scalar_range"], | ||
| self.mesh_cells_attribute_cell_prefix, | ||
| ) | ||
| params = schemas.ScalarRange.from_dict(rpc_params) | ||
| self.displayScalarRange(params.id, params.minimum, params.maximum) | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_cell_prefix | ||
| + mesh_cells_attribute_cell_schemas_dict["color_map"]["rpc"] | ||
| ) | ||
| def setMeshCellsCellColorMap(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_cell_schemas_dict["color_map"], | ||
| self.mesh_cells_attribute_cell_prefix, | ||
| ) | ||
| params = schemas.ColorMap.from_dict(rpc_params) | ||
| self.setupColorMap(params.id, params.points, params.minimum, params.maximum) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .scalar_range import * | ||
| from .name import * | ||
| from .color_map import * |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "rpc": "color_map", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "points": { | ||
| "type": "array", | ||
| "description": "Flat array of [value, r, g, b, ...]", | ||
| "items": { | ||
| "type": "number" | ||
| }, | ||
| "minItems": 8 | ||
| }, | ||
| "minimum": { | ||
| "type": "number" | ||
| }, | ||
| "maximum": { | ||
| "type": "number" | ||
| } | ||
| }, | ||
| "required": ["id", "points", "minimum", "maximum"], | ||
| "additionalProperties": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,15 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
| from typing import List | ||
|
|
||
|
|
||
| @dataclass | ||
| class PolygonScalarRange(DataClassJsonMixin): | ||
| class ColorMap(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| id: str | ||
| maximum: float | ||
| minimum: float | ||
| points: List[float] | ||
| """Flat array of [value, r, g, b, ...]""" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "rpc": "cell_attribute", | ||
| "rpc": "name", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "rpc": "cell_scalar_range", | ||
| "rpc": "scalar_range", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Standard library imports | ||
| import os | ||
|
|
||
| # Third party imports | ||
| from wslink import register as exportRpc # type: ignore | ||
| from opengeodeweb_microservice.schemas import get_schemas_dict | ||
|
|
||
| # Local application imports | ||
| from opengeodeweb_viewer.utils_functions import ( | ||
| validate_schema, | ||
| RpcParams, | ||
| ) | ||
| from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView | ||
| from . import schemas | ||
|
|
||
|
|
||
| class VtkMeshCellsAttributeVertexView(VtkMeshView): | ||
| mesh_cells_attribute_vertex_prefix = ( | ||
| "opengeodeweb_viewer.mesh.cells.attribute.vertex." | ||
| ) | ||
| mesh_cells_attribute_vertex_schemas_dict = get_schemas_dict( | ||
| os.path.join(os.path.dirname(__file__), "schemas") | ||
| ) | ||
|
|
||
| def __init__(self) -> None: | ||
| super().__init__() | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_vertex_prefix | ||
| + mesh_cells_attribute_vertex_schemas_dict["name"]["rpc"] | ||
| ) | ||
| def setMeshCellsVertexName(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_vertex_schemas_dict["name"], | ||
| self.mesh_cells_attribute_vertex_prefix, | ||
| ) | ||
| params = schemas.Name.from_dict(rpc_params) | ||
| self.displayAttributeOnVertices(params.id, params.name) | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_vertex_prefix | ||
| + mesh_cells_attribute_vertex_schemas_dict["scalar_range"]["rpc"] | ||
| ) | ||
| def setMeshCellsVertexScalarRange(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_vertex_schemas_dict["scalar_range"], | ||
| self.mesh_cells_attribute_vertex_prefix, | ||
| ) | ||
| params = schemas.ScalarRange.from_dict(rpc_params) | ||
| self.displayScalarRange(params.id, params.minimum, params.maximum) | ||
|
|
||
| @exportRpc( | ||
| mesh_cells_attribute_vertex_prefix | ||
| + mesh_cells_attribute_vertex_schemas_dict["color_map"]["rpc"] | ||
| ) | ||
| def setMeshCellsVertexColorMap(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.mesh_cells_attribute_vertex_schemas_dict["color_map"], | ||
| self.mesh_cells_attribute_vertex_prefix, | ||
| ) | ||
| params = schemas.ColorMap.from_dict(rpc_params) | ||
| self.setupColorMap(params.id, params.points, params.minimum, params.maximum) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .scalar_range import * | ||
| from .name import * | ||
| from .color_map import * |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "rpc": "color_map", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "points": { | ||
| "type": "array", | ||
| "description": "Flat array of [value, r, g, b, ...]", | ||
| "items": { | ||
| "type": "number" | ||
| }, | ||
| "minItems": 8 | ||
| }, | ||
| "minimum": { | ||
| "type": "number" | ||
| }, | ||
| "maximum": { | ||
| "type": "number" | ||
| } | ||
| }, | ||
| "required": ["id", "points", "minimum", "maximum"], | ||
| "additionalProperties": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
| from typing import List | ||
|
|
||
|
|
||
| @dataclass | ||
| class ColorMap(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| id: str | ||
| maximum: float | ||
| minimum: float | ||
| points: List[float] | ||
| """Flat array of [value, r, g, b, ...]""" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "rpc": "vertex_attribute", | ||
| "rpc": "name", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "rpc": "vertex_scalar_range", | ||
| "rpc": "scalar_range", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [mypy] reported by reviewdog 🐶
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [mypy] reported by reviewdog 🐶
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [mypy] reported by reviewdog 🐶
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,7 +94,7 @@ def setMeshCellsVertexColorMap(self, rpc_params: RpcParams) -> None: | |
| self.mesh_cells_prefix, | ||
| ) | ||
| params = schemas.VertexColorMap.from_dict(rpc_params) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [mypy] reported by reviewdog 🐶 |
||
| self.setupColorMap(params.id, params.points) | ||
| self.setupColorMap(params.id, params.points, params.minimum, params.maximum) | ||
|
|
||
| @exportRpc(mesh_cells_prefix + mesh_cells_schemas_dict["cell_color_map"]["rpc"]) | ||
| def setMeshCellsCellColorMap(self, rpc_params: RpcParams) -> None: | ||
|
|
@@ -104,4 +104,4 @@ def setMeshCellsCellColorMap(self, rpc_params: RpcParams) -> None: | |
| self.mesh_cells_prefix, | ||
| ) | ||
| params = schemas.CellColorMap.from_dict(rpc_params) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [mypy] reported by reviewdog 🐶 |
||
| self.setupColorMap(params.id, params.points) | ||
| self.setupColorMap(params.id, params.points, params.minimum, params.maximum) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,2 @@ | ||
| from .visibility import * | ||
| from .vertex_scalar_range import * | ||
| from .vertex_color_map import * | ||
| from .vertex_attribute import * | ||
| from .color import * | ||
| from .cell_scalar_range import * | ||
| from .cell_color_map import * | ||
| from .cell_attribute import * |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Module has no attribute "VertexAttribute" [attr-defined]
OpenGeodeWeb-Viewer/src/opengeodeweb_viewer/rpc/mesh/cells/cells_protocols.py
Line 54 in 04a8862