Skip to content

Commit aafa229

Browse files
authored
Merge pull request #131 from Geode-solutions/fix/edges_attribute
fix(edge_attribute): Adds missing RPC & shema for mesh edges attribute.
2 parents 0b18528 + 28977d3 commit aafa229

13 files changed

Lines changed: 363 additions & 2 deletions

opengeodeweb_viewer_schemas.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,38 @@
234234
"name"
235235
],
236236
"additionalProperties": false
237+
},
238+
"color_map": {
239+
"$id": "opengeodeweb_viewer.mesh.edges.attribute.edge.color_map",
240+
"rpc": "color_map",
241+
"type": "object",
242+
"properties": {
243+
"id": {
244+
"type": "string",
245+
"minLength": 1
246+
},
247+
"points": {
248+
"type": "array",
249+
"description": "Flat array of [value, r, g, b, ...]",
250+
"items": {
251+
"type": "number"
252+
},
253+
"minItems": 8
254+
},
255+
"minimum": {
256+
"type": "number"
257+
},
258+
"maximum": {
259+
"type": "number"
260+
}
261+
},
262+
"required": [
263+
"id",
264+
"points",
265+
"minimum",
266+
"maximum"
267+
],
268+
"additionalProperties": false
237269
}
238270
},
239271
"vertex": {

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,3 @@ wslink==1.12.4
6161
yarl>=1
6262
# via aiohttp
6363

64-
opengeodeweb-microservice==1.*,>=1.1.1

src/opengeodeweb_viewer/rpc/mesh/edges/attribute/edge/edges_attribute_edge_protocols.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ def setMeshEdgesEdgeName(self, rpc_params: RpcParams) -> None:
3535
)
3636
params = schemas.Name.from_dict(rpc_params)
3737
self.displayAttributeOnCells(params.id, params.name)
38+
39+
@exportRpc(
40+
mesh_edges_attribute_edge_prefix
41+
+ mesh_edges_attribute_edge_schemas_dict["color_map"]["rpc"]
42+
)
43+
def setMeshEdgesEdgeColorMap(self, rpc_params: RpcParams) -> None:
44+
validate_schema(
45+
rpc_params,
46+
self.mesh_edges_attribute_edge_schemas_dict["color_map"],
47+
self.mesh_edges_attribute_edge_prefix,
48+
)
49+
params = schemas.ColorMap.from_dict(rpc_params)
50+
self.setupColorMap(params.id, params.points, params.minimum, params.maximum)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from .name import *
2+
from .color_map import *
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"rpc": "color_map",
3+
"type": "object",
4+
"properties": {
5+
"id": {
6+
"type": "string",
7+
"minLength": 1
8+
},
9+
"points": {
10+
"type": "array",
11+
"description": "Flat array of [value, r, g, b, ...]",
12+
"items": {
13+
"type": "number"
14+
},
15+
"minItems": 8
16+
},
17+
"minimum": {
18+
"type": "number"
19+
},
20+
"maximum": {
21+
"type": "number"
22+
}
23+
},
24+
"required": ["id", "points", "minimum", "maximum"],
25+
"additionalProperties": false
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from dataclasses_json import DataClassJsonMixin
2+
from dataclasses import dataclass
3+
from typing import List
4+
5+
6+
@dataclass
7+
class ColorMap(DataClassJsonMixin):
8+
def __post_init__(self) -> None:
9+
print(self, flush=True)
10+
11+
id: str
12+
maximum: float
13+
minimum: float
14+
points: List[float]
15+
"""Flat array of [value, r, g, b, ...]"""
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
3+
<PolyData>
4+
<Piece NumberOfPoints="37" NumberOfLines="37">
5+
<PointData>
6+
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="3" RangeMin="-0.195351169" RangeMax="1">0.10942 0.532085 1 0.0989554 0.440531 1 0.127689 0.326914 1 -0.0570336 0.453631 1 -0.0440269 0.283532 1 0.0785397 0.338299 1 -0.014577 0.077456 1 0.155983 0.163299 1 0.0333169 0.16082 1 0.321452 0.0802363 1 0.355327 0.212219 1 0.252025 0.158717 1 0.428656 0.359 1 0.299515 0.365925 1 0.316268 0.303525 1 0.318692 0.624577 1 0.210924 0.577468 1 0.314173 0.57517 1 -0.0731802 0.632736 1 -0.0996019 0.598172 1 -0.162041 0.600724 1 -0.147729 0.444528 1 -0.0853436 0.517832 1 -0.0996019 0.598172 1 0.0963617 0.532762 1 0.10407 0.544358 1 -0.195351 0.421707 1 -0.105346 0.266847 1 -0.0987086 0.302912 1 -0.105346 0.266847 1 -0.115428 0.266928 1 -0.118175 0.257315 1 -0.0859438 0.0429719 1 -0.0351803 0.0175902 1 -0.0351803 0.0175902 1 -0.106668 0.248327 1 -0.118175 0.257315 1 </DataArray>
7+
</PointData>
8+
<Points>
9+
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="-0.19535116851329803" RangeMax="1">0.109419576823711 0.53208464384079 1 0.0989554226398468 0.440531343221664 1 0.127689048647881 0.326913595199585 1 -0.0570335872471333 0.453630566596985 1 -0.0440268628299236 0.283532381057739 1 0.0785397067666054 0.338299185037613 1 -0.0145769733935595 0.0774560123682022 1 0.155983060598373 0.163299322128296 1 0.0333169139921665 0.160820126533508 1 0.32145157456398 0.0802362933754921 1 0.35532745718956 0.212218835949898 1 0.252025336027145 0.158717021346092 1 0.428656339645386 0.358999729156494 1 0.29951485991478 0.365925401449203 1 0.316268235445023 0.303525328636169 1 0.31869176030159 0.624576926231384 1 0.210924133658409 0.577467858791351 1 0.314173072576523 0.57517009973526 1 -0.0731801614165306 0.632735967636108 1 -0.0996019020676613 0.598172128200531 1 -0.162041246891022 0.600724041461945 1 -0.147729307413101 0.444528311491013 1 -0.0853436291217804 0.517831742763519 1 -0.0996019020676613 0.598172128200531 1 0.0963616594672203 0.532761991024017 1 0.104069948196411 0.544358432292938 1 -0.195351168513298 0.42170724272728 1 -0.105345673859119 0.266847312450409 1 -0.0987086147069931 0.302912443876266 1 -0.105345673859119 0.266847312450409 1 -0.115427635610104 0.266927510499954 1 -0.118174657225609 0.257315069437027 1 -0.0859437808394432 0.0429718904197216 1 -0.0351803153753281 0.017590157687664 1 -0.0351803153753281 0.017590157687664 1 -0.106668494641781 0.248327031731606 1 -0.118174657225609 0.257315069437027 1 </DataArray>
10+
</Points>
11+
<CellData>
12+
<DataArray type="Float64" Name="cycle_id" format="ascii" NumberOfComponents="1" RangeMin="0" RangeMax="8">0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 6 6 6 6 6 7 7 7 8 8 8 8 8 8 8 8 </DataArray>
13+
<DataArray type="Float64" Name="edges" format="ascii" NumberOfComponents="2" RangeMin="0" RangeMax="36">0 1 1 2 0 2 3 4 4 5 3 5 6 7 7 8 6 8 9 10 10 11 9 11 12 13 13 14 12 14 15 16 16 17 15 17 18 19 19 20 20 21 21 22 22 23 23 24 24 25 18 25 26 27 27 28 26 28 29 30 30 31 31 32 32 33 33 34 34 35 35 36 29 36 </DataArray>
14+
</CellData>
15+
<Lines>
16+
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="36">0 1 1 2 0 2 3 4 4 5 3 5 6 7 7 8 6 8 9 10 10 11 9 11 12 13 13 14 12 14 15 16 16 17 15 17 18 19 19 20 20 21 21 22 22 23 23 24 24 25 18 25 26 27 27 28 26 28 29 30 30 31 31 32 32 33 33 34 34 35 35 36 29 36 </DataArray>
17+
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="37">2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 </DataArray>
18+
</Lines>
19+
</Piece>
20+
</PolyData>
21+
</VTKFile>

tests/data/edged_curve3D.vtp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
3+
<PolyData>
4+
<Piece NumberOfPoints="37" NumberOfLines="37">
5+
<PointData>
6+
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="3" RangeMin="-0.195351169" RangeMax="1">0.10942 0.532085 1 0.0989554 0.440531 1 0.127689 0.326914 1 -0.0570336 0.453631 1 -0.0440269 0.283532 1 0.0785397 0.338299 1 -0.014577 0.077456 1 0.155983 0.163299 1 0.0333169 0.16082 1 0.321452 0.0802363 1 0.355327 0.212219 1 0.252025 0.158717 1 0.428656 0.359 1 0.299515 0.365925 1 0.316268 0.303525 1 0.318692 0.624577 1 0.210924 0.577468 1 0.314173 0.57517 1 -0.0731802 0.632736 1 -0.0996019 0.598172 1 -0.162041 0.600724 1 -0.147729 0.444528 1 -0.0853436 0.517832 1 -0.0996019 0.598172 1 0.0963617 0.532762 1 0.10407 0.544358 1 -0.195351 0.421707 1 -0.105346 0.266847 1 -0.0987086 0.302912 1 -0.105346 0.266847 1 -0.115428 0.266928 1 -0.118175 0.257315 1 -0.0859438 0.0429719 1 -0.0351803 0.0175902 1 -0.0351803 0.0175902 1 -0.106668 0.248327 1 -0.118175 0.257315 1 </DataArray>
7+
</PointData>
8+
<Points>
9+
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="-0.19535116851329803" RangeMax="1">0.109419576823711 0.53208464384079 1 0.0989554226398468 0.440531343221664 1 0.127689048647881 0.326913595199585 1 -0.0570335872471333 0.453630566596985 1 -0.0440268628299236 0.283532381057739 1 0.0785397067666054 0.338299185037613 1 -0.0145769733935595 0.0774560123682022 1 0.155983060598373 0.163299322128296 1 0.0333169139921665 0.160820126533508 1 0.32145157456398 0.0802362933754921 1 0.35532745718956 0.212218835949898 1 0.252025336027145 0.158717021346092 1 0.428656339645386 0.358999729156494 1 0.29951485991478 0.365925401449203 1 0.316268235445023 0.303525328636169 1 0.31869176030159 0.624576926231384 1 0.210924133658409 0.577467858791351 1 0.314173072576523 0.57517009973526 1 -0.0731801614165306 0.632735967636108 1 -0.0996019020676613 0.598172128200531 1 -0.162041246891022 0.600724041461945 1 -0.147729307413101 0.444528311491013 1 -0.0853436291217804 0.517831742763519 1 -0.0996019020676613 0.598172128200531 1 0.0963616594672203 0.532761991024017 1 0.104069948196411 0.544358432292938 1 -0.195351168513298 0.42170724272728 1 -0.105345673859119 0.266847312450409 1 -0.0987086147069931 0.302912443876266 1 -0.105345673859119 0.266847312450409 1 -0.115427635610104 0.266927510499954 1 -0.118174657225609 0.257315069437027 1 -0.0859437808394432 0.0429718904197216 1 -0.0351803153753281 0.017590157687664 1 -0.0351803153753281 0.017590157687664 1 -0.106668494641781 0.248327031731606 1 -0.118174657225609 0.257315069437027 1 </DataArray>
10+
</Points>
11+
<CellData>
12+
<DataArray type="Float64" Name="cycle_id" format="ascii" NumberOfComponents="1" RangeMin="0" RangeMax="8">0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 6 6 6 6 6 7 7 7 8 8 8 8 8 8 8 8 </DataArray>
13+
<DataArray type="Float64" Name="edges" format="ascii" NumberOfComponents="2" RangeMin="0" RangeMax="36">0 1 1 2 0 2 3 4 4 5 3 5 6 7 7 8 6 8 9 10 10 11 9 11 12 13 13 14 12 14 15 16 16 17 15 17 18 19 19 20 20 21 21 22 22 23 23 24 24 25 18 25 26 27 27 28 26 28 29 30 30 31 31 32 32 33 33 34 34 35 35 36 29 36 </DataArray>
14+
</CellData>
15+
<Lines>
16+
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="36">0 1 1 2 0 2 3 4 4 5 3 5 6 7 7 8 6 8 9 10 10 11 9 11 12 13 13 14 12 14 15 16 16 17 15 17 18 19 19 20 20 21 21 22 22 23 23 24 24 25 18 25 26 27 27 28 26 28 29 30 30 31 31 32 32 33 33 34 34 35 35 36 29 36 </DataArray>
17+
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="37">2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 </DataArray>
18+
</Lines>
19+
</Piece>
20+
</PolyData>
21+
</VTKFile>
14.5 KB
Loading
16.6 KB
Loading

0 commit comments

Comments
 (0)