Skip to content

Commit d79292e

Browse files
wip(classes): new layout
1 parent 66836bc commit d79292e

34 files changed

+582
-353
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ __pycache__/
99
latest_logs
1010
schemas.json
1111
build
12+
src/tests/tests_output/
1213
*.egg-info

generate_schemas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function return_json_schema(directoryPath, folder_path, project_name) {
6262
return acc;
6363
}, folders_schemas);
6464
} else {
65-
var new_folder_path = folder_path + "/" + folder.name;
65+
var new_folder_path = folder_path + "." + folder.name;
6666
var test = return_json_schema(folder.path, new_folder_path, project_name);
6767
folders_schemas[folder.name] = test;
6868
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Local application imports
2+
import VtkView from "./vtk_protocol.py"
3+
4+
schemas = os.path.join(os.path.dirname(__file__), "rpc/schemas")
5+
6+
with open(os.path.join(schemas, "display_vertex_attribute.json"), "r") as file:
7+
display_vertex_attribute_json = json.load(file)
8+
9+
10+
@exportRpc(display_vertex_attribute_json["rpc"])
11+
def setVertexAttribute(self, params):
12+
validate_schemas(params, display_vertex_attribute_json)
13+
print(f"{params=}", flush=True)
14+
id = params["id"]
15+
name = params["name"]
16+
mapper = self.get_object(id)["mapper"]
17+
mapper.SelectColorArray(name)
18+
mapper.ScalarVisibilityOn()
19+
mapper.SetScalarModeToUsePointFieldData()
20+
self.render()
21+
22+
@exportRpc("opengeode.attribute.polygon")
23+
def setPolygonAttribute(self, id, name):
24+
store = self.getObject(id)
25+
cpp = store["cpp"]
26+
print(cpp.nb_polygons())
27+
cells = store["vtk"].GetCellData()
28+
print(store["vtk"].GetNumberOfCells())
29+
manager = cpp.polygon_attribute_manager()
30+
if not manager.attribute_exists(name):
31+
return
32+
if not cells.HasArray(name):
33+
data = self.computeAttributeData(manager, name)
34+
cells.AddArray(data)
35+
cells.SetActiveScalars(name)
36+
mapper = store["mapper"]
37+
mapper.ScalarVisibilityOn()
38+
mapper.SetScalarModeToUseCellData()
39+
mapper.SetScalarRange(cells.GetScalars().GetRange())
40+
self.render()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"rpc": "display_polygon_attribute",
3+
"type": "object",
4+
"properties": {
5+
"id": {
6+
"type": "string"
7+
},
8+
"name": {
9+
"type": "string"
10+
}
11+
},
12+
"required": [
13+
"id",
14+
"name"
15+
],
16+
"additionalProperties": false
17+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"rpc": "set_vertex_attribute",
2+
"rpc": "display_vertex_attribute",
33
"type": "object",
44
"properties": {
55
"id": {
@@ -9,6 +9,9 @@
99
"type": "string"
1010
}
1111
},
12-
"required": ["id", "name"],
12+
"required": [
13+
"id",
14+
"name"
15+
],
1316
"additionalProperties": false
14-
}
17+
}

src/opengeodeweb_viewer/rpc/model/protocols.py

Whitespace-only changes.

0 commit comments

Comments
 (0)