Skip to content

Commit 6bdf7df

Browse files
save schemas state
1 parent 0c3ec58 commit 6bdf7df

26 files changed

+265
-99
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"id": {
5+
"type": "string"
6+
},
7+
"color": {
8+
"type": "object",
9+
"properties": {
10+
"red": {
11+
"type": "integer",
12+
"minimum": 0,
13+
"maximum": 255
14+
},
15+
"green": {
16+
"type": "integer",
17+
"minimum": 0,
18+
"maximum": 255
19+
},
20+
"blue": {
21+
"type": "integer",
22+
"minimum": 0,
23+
"maximum": 255
24+
}
25+
},
26+
"required": [
27+
"red",
28+
"green",
29+
"blue"
30+
],
31+
"additionalProperties": false
32+
}
33+
},
34+
"required": [
35+
"id",
36+
"color"
37+
],
38+
"additionalProperties": false
39+
}

src/opengeodeweb_viewer/object/schemas/set_edge_visibility.json

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"id": {
5+
"type": "string"
6+
},
7+
"opacity": {
8+
"type": "number",
9+
"min": 0,
10+
"max": 1
11+
}
12+
},
13+
"required": [
14+
"id",
15+
"opacity"
16+
],
17+
"additionalProperties": false
18+
}

src/opengeodeweb_viewer/object/schemas/set_point_size.json

Whitespace-only changes.

src/opengeodeweb_viewer/object/schemas/set_vertex_visility.json

Whitespace-only changes.

src/opengeodeweb_viewer/object/schemas/set_visibility.json

Whitespace-only changes.

src/opengeodeweb_viewer/rpc/mesh/protocols.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,47 @@
1717
schemas_dir = os.path.join(os.path.dirname(__file__), "schemas")
1818
schemas_dict = get_schemas_dict(schemas_dir)
1919

20-
class VtkMeshView(VtkView):
20+
class VtkMeshView(VtkObjectView):
21+
def __init__(self):
22+
super().__init__()
23+
24+
@exportRpc(schemas_dict["toggle_object_visibility"]["rpc"])
25+
def toggle_object_visibility(self, params):
26+
print(f"{schemas_dict["toggle_object_visibility"]["rpc"]=}", flush=True)
27+
validate_schema(params, schemas_dict["toggle_object_visibility"])
28+
super().SetVisibility(params)
29+
30+
@exportRpc(schemas_dict["set_opacity"]["rpc"])
31+
def SetOpacity(self, params):
32+
print(f"{schemas_dict["set_opacity"]["rpc"]=}", flush=True)
33+
validate_schema(params, schemas_dict["set_opacity"])
34+
super().SetOpacity(params)
35+
36+
@exportRpc(schemas_dict["toggle_edge_visibility"]["rpc"])
37+
def setEdgeVisibility(self, params):
38+
print(f"{schemas_dict["toggle_edge_visibility"]["rpc"]=}", flush=True)
39+
validate_schema(params, schemas_dict["toggle_edge_visibility"])
40+
print(f"{params=}", flush=True)
41+
super().SetEdgeVisibility(params)
42+
43+
@exportRpc(schemas_dict["toggle_point_visibility"]["rpc"])
44+
def setPointVisibility(self, params):
45+
validate_schema(params, schemas_dict["toggle_point_visibility"])
46+
super().SetVertexVisibility(params)
47+
48+
@exportRpc(schemas_dict["set_point_size"]["rpc"])
49+
def setPointSize(self, params):
50+
validate_schema(params, schemas_dict["set_point_size"])
51+
super().SetPointSize(params)
52+
53+
@exportRpc(schemas_dict["set_color"]["rpc"])
54+
def setColor(self, params):
55+
validate_schema(params, schemas_dict["set_color"])
56+
super().SetColor(params)
57+
2158
@exportRpc(schemas_dict["display_vertex_attribute"]["rpc"])
2259
def setVertexAttribute(self, params):
23-
validate_schema(params, display_vertex_attribute_json)
60+
validate_schema(params, schemas_dict["display_vertex_attribute"])
2461
print(f"{params=}", flush=True)
2562
id = params["id"]
2663
name = params["name"]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"rpc": "set_color",
3+
"type": "object",
4+
"properties": {
5+
"id": {
6+
"type": "string"
7+
},
8+
"color": {
9+
"type": "object",
10+
"properties": {
11+
"red": {
12+
"type": "integer",
13+
"minimum": 0,
14+
"maximum": 255
15+
},
16+
"green": {
17+
"type": "integer",
18+
"minimum": 0,
19+
"maximum": 255
20+
},
21+
"blue": {
22+
"type": "integer",
23+
"minimum": 0,
24+
"maximum": 255
25+
}
26+
},
27+
"required": [
28+
"red",
29+
"green",
30+
"blue"
31+
],
32+
"additionalProperties": false
33+
}
34+
},
35+
"required": [
36+
"id",
37+
"color"
38+
],
39+
"additionalProperties": false
40+
}

0 commit comments

Comments
 (0)