-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/model components tools #132
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
72dfe4f
temp
MaxNumerique b8ffd36
points visibility & edges visibility
MaxNumerique 2b17983
temporary RPCs
MaxNumerique f615b9b
Merge branch 'feat/model_components_tools' of https://github.com/Geod…
MaxNumerique 7810551
Apply prepare changes
MaxNumerique 3e1821b
feat(component_color): add new rpc for model_components
MaxNumerique 27db1ca
Apply prepare changes
MaxNumerique File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.1.1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
57 changes: 57 additions & 0 deletions
57
src/opengeodeweb_viewer/rpc/model/blocks/edges/model_surfaces_edges_protocols.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Standard library imports | ||
| import os | ||
|
|
||
| # Third party imports | ||
| from wslink import register as exportRpc | ||
| from opengeodeweb_microservice.schemas import get_schemas_dict | ||
|
|
||
| # Local application imports | ||
| from opengeodeweb_viewer.utils_functions import validate_schema, RpcParams | ||
| from opengeodeweb_viewer.rpc.model.model_protocols import VtkModelView | ||
| from . import schemas | ||
|
|
||
|
|
||
| class VtkModelBlocksEdgesView(VtkModelView): | ||
| model_blocks_edges_prefix = "opengeodeweb_viewer.model.blocks.edges." | ||
| model_blocks_edges_schemas_dict = get_schemas_dict( | ||
| os.path.join(os.path.dirname(__file__), "schemas") | ||
| ) | ||
|
|
||
| def __init__(self) -> None: | ||
| super().__init__() | ||
|
|
||
| @exportRpc( | ||
| model_blocks_edges_prefix + model_blocks_edges_schemas_dict["visibility"]["rpc"] | ||
| ) | ||
| def setModelBlocksEdgesVisibility(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_edges_schemas_dict["visibility"], | ||
| self.model_blocks_edges_prefix, | ||
| ) | ||
| params = schemas.Visibility.from_dict(rpc_params) | ||
| self.SetEdgesVisibility(params.id, params.visibility) | ||
|
|
||
| @exportRpc( | ||
| model_blocks_edges_prefix + model_blocks_edges_schemas_dict["color"]["rpc"] | ||
| ) | ||
| def setModelBlocksEdgesColor(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_edges_schemas_dict["color"], | ||
| self.model_blocks_edges_prefix, | ||
| ) | ||
| params = schemas.Color.from_dict(rpc_params) | ||
| self.SetEdgesColor(params.id, params.color.r, params.color.g, params.color.b) | ||
|
|
||
| @exportRpc( | ||
| model_blocks_edges_prefix + model_blocks_edges_schemas_dict["width"]["rpc"] | ||
| ) | ||
| def setModelBlocksEdgesWidth(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_edges_schemas_dict["width"], | ||
| self.model_blocks_edges_prefix, | ||
| ) | ||
| params = schemas.Width.from_dict(rpc_params) | ||
| self.SetEdgesWidth(params.id, params.width) | ||
3 changes: 3 additions & 0 deletions
3
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .width import * | ||
| from .visibility import * | ||
| from .color import * |
40 changes: 40 additions & 0 deletions
40
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/color.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "rpc": "color", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "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 | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/color.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
| from typing import Optional | ||
|
|
||
|
|
||
| @dataclass | ||
| class ColorClass(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| b: int | ||
| g: int | ||
| r: int | ||
| a: Optional[float] = None | ||
|
|
||
|
|
||
| @dataclass | ||
| class Color(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| color: ColorClass | ||
| id: str |
15 changes: 15 additions & 0 deletions
15
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/visibility.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "rpc": "visibility", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "visibility": { | ||
| "type": "boolean" | ||
| } | ||
| }, | ||
| "required": ["id", "visibility"], | ||
| "additionalProperties": false | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/visibility.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass | ||
| class Visibility(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| id: str | ||
| visibility: bool |
15 changes: 15 additions & 0 deletions
15
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/width.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "rpc": "width", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "width": { | ||
| "type": "number" | ||
| } | ||
| }, | ||
| "required": ["id", "width"], | ||
| "additionalProperties": false | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/opengeodeweb_viewer/rpc/model/blocks/edges/schemas/width.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass | ||
| class Width(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| id: str | ||
| width: float |
Empty file.
53 changes: 53 additions & 0 deletions
53
src/opengeodeweb_viewer/rpc/model/blocks/points/model_surfaces_points_protocols.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import os | ||
| from wslink import register as exportRpc | ||
|
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 🐶 |
||
| from opengeodeweb_microservice.schemas import get_schemas_dict | ||
| from opengeodeweb_viewer.utils_functions import validate_schema, RpcParams | ||
| from opengeodeweb_viewer.rpc.model.model_protocols import VtkModelView | ||
| from . import schemas | ||
|
|
||
|
|
||
| class VtkModelBlocksPointsView(VtkModelView): | ||
| model_blocks_points_prefix = "opengeodeweb_viewer.model.blocks.points." | ||
| model_blocks_points_schemas_dict = get_schemas_dict( | ||
| os.path.join(os.path.dirname(__file__), "schemas") | ||
| ) | ||
|
|
||
| def __init__(self) -> None: | ||
| super().__init__() | ||
|
|
||
| @exportRpc( | ||
| model_blocks_points_prefix | ||
| + model_blocks_points_schemas_dict["visibility"]["rpc"] | ||
| ) | ||
| def setModelBlocksPointsVisibility(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_points_schemas_dict["visibility"], | ||
| self.model_blocks_points_prefix, | ||
| ) | ||
| params = schemas.Visibility.from_dict(rpc_params) | ||
| self.SetPointsVisibility(params.id, params.visibility) | ||
|
|
||
| @exportRpc( | ||
| model_blocks_points_prefix + model_blocks_points_schemas_dict["size"]["rpc"] | ||
| ) | ||
| def setModelBlocksPointsSize(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_points_schemas_dict["size"], | ||
| self.model_blocks_points_prefix, | ||
| ) | ||
| params = schemas.Size.from_dict(rpc_params) | ||
| self.SetPointsSize(params.id, params.size) | ||
|
|
||
| @exportRpc( | ||
| model_blocks_points_prefix + model_blocks_points_schemas_dict["color"]["rpc"] | ||
| ) | ||
| def setModelBlocksPointsColor(self, rpc_params: RpcParams) -> None: | ||
| validate_schema( | ||
| rpc_params, | ||
| self.model_blocks_points_schemas_dict["color"], | ||
| self.model_blocks_points_prefix, | ||
| ) | ||
| params = schemas.Color.from_dict(rpc_params) | ||
| self.SetPointsColor(params.id, params.color.r, params.color.g, params.color.b) | ||
3 changes: 3 additions & 0 deletions
3
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .visibility import * | ||
| from .size import * | ||
| from .color import * |
40 changes: 40 additions & 0 deletions
40
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/color.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "rpc": "color", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "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 | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/color.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
| from typing import Optional | ||
|
|
||
|
|
||
| @dataclass | ||
| class ColorClass(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| b: int | ||
| g: int | ||
| r: int | ||
| a: Optional[float] = None | ||
|
|
||
|
|
||
| @dataclass | ||
| class Color(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| color: ColorClass | ||
| id: str |
15 changes: 15 additions & 0 deletions
15
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/size.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "rpc": "size", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "size": { | ||
| "type": "number" | ||
| } | ||
| }, | ||
| "required": ["id", "size"], | ||
| "additionalProperties": false | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/size.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from dataclasses_json import DataClassJsonMixin | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass | ||
| class Size(DataClassJsonMixin): | ||
| def __post_init__(self) -> None: | ||
| print(self, flush=True) | ||
|
|
||
| id: str | ||
| size: float |
15 changes: 15 additions & 0 deletions
15
src/opengeodeweb_viewer/rpc/model/blocks/points/schemas/visibility.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "rpc": "visibility", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "visibility": { | ||
| "type": "boolean" | ||
| } | ||
| }, | ||
| "required": ["id", "visibility"], | ||
| "additionalProperties": false | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 🐶
Skipping analyzing "wslink": module is installed, but missing library stubs or py.typed marker [import-untyped]