Skip to content

Commit 5e1c175

Browse files
add unit tests for cell & polygon attributes
1 parent 85b013f commit 5e1c175

File tree

10 files changed

+86
-8
lines changed

10 files changed

+86
-8
lines changed

opengeodeweb_viewer_schemas.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@
122122
"additionalProperties": false
123123
},
124124
"cell_attribute": {
125-
"$id": "opengeodeweb_viewer.mesh.cells.polygon_attribute",
126-
"rpc": "polygon_attribute",
125+
"$id": "opengeodeweb_viewer.mesh.cells.cell_attribute",
126+
"rpc": "cell_attribute",
127127
"type": "object",
128128
"properties": {
129129
"id": {
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"rpc": "polygon_attribute",
2+
"rpc": "cell_attribute",
33
"type": "object",
44
"properties": {
55
"id": {
@@ -11,9 +11,6 @@
1111
"minLength": 1
1212
}
1313
},
14-
"required": [
15-
"id",
16-
"name"
17-
],
14+
"required": ["id", "name"],
1815
"additionalProperties": false
19-
}
16+
}
52.9 KB
Loading
11.1 KB
Loading
15.6 KB
Loading
8.03 KB
Loading
13 KB
Loading
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="46" NumberOfPolys="46">
5+
<PointData>
6+
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="2" RangeMin="-61.7243652" RangeMax="76.1532211">-61.7244 14.6963 -60.8099 -0.979751 -56.2378 27.1065 -43.1744 -5.29066 -38.8635 22.1424 -16.3945 -4.63749 -15.0882 19.791 16.5252 22.7956 20.1829 -4.76813 35.9895 -5.4213 40.3005 24.8857 41.3455 4.11496 42.6519 13.1287 33.7787 9.14871 41.0601 23.4894 41.9389 13.273 37.3251 -4.85291 42.2685 4.15511 51.0568 24.4781 54.682 -5.95145 68.5236 23.3796 71.0502 14.7011 71.4896 -6.94013 73.9064 1.62847 58.4724 7.35799 59.7405 17.2398 50.9449 17.0185 -60.8195 -1.62315 -59.9003 -12.2605 -56.4858 -21.5847 -41.7773 -5.69425 -33.1098 -28.0196 -20.3712 -4.9063 -1.46031 -27.757 0.640906 -5.16895 14.1675 -27.8883 16.9253 -5.03762 36.2302 -5.69425 40.4326 -27.1003 49.1001 -5.82558 67.6171 -30.6461 71.1628 -7.53281 74.446 -15.5437 76.1532 -25.2618 65.4426 -17.0775 52.7354 -17.3143 </DataArray>
7+
</PointData>
8+
<Points>
9+
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="-61.724365234375" RangeMax="76.153221130371094">-61.724365234375 14.6962766647339 0 -60.8099250793457 -0.979751348495483 0 -56.2377586364746 27.1064682006836 0 -43.1743965148926 -5.29066038131714 0 -38.8634872436523 22.142391204834 0 -16.3945140838623 -4.63749170303345 0 -15.0881767272949 19.7909870147705 0 16.5251502990723 22.7955627441406 0 20.18288230896 -4.76812744140625 0 35.9895477294922 -5.42129564285278 0 40.3004531860352 24.8856983184814 0 41.3455276489258 4.11495876312256 0 42.65185546875 13.1286745071411 0 33.7787322998047 9.14871406555176 0 41.0600929260254 23.4894065856934 0 41.9389266967773 13.2729911804199 0 37.325065612793 -4.8529109954834 0 42.2684898376465 4.15511226654053 0 51.0568084716797 24.4780941009521 0 54.6819877624512 -5.95145130157471 0 68.5235900878906 23.3795547485352 0 71.0502166748047 14.7010917663574 0 71.4896469116211 -6.94013404846191 0 73.9064254760742 1.62847137451172 0 58.4723815917969 7.35799360275269 0 59.7404937744141 17.2398090362549 0 50.9449157714844 17.0184726715088 0 -60.8195457458496 -1.62315285205841 0 -59.9002723693848 -12.2605400085449 0 -56.4857978820801 -21.5846691131592 0 -41.7773132324219 -5.694251537323 0 -33.1098175048828 -28.0196323394775 0 -20.3712139129639 -4.90629720687866 0 -1.46030735969543 -27.7569789886475 0 0.640906095504761 -5.16894960403442 0 14.1674613952637 -27.8883056640625 0 16.9253005981445 -5.03762483596802 0 36.2301902770996 -5.694251537323 0 40.4326171875 -27.1003494262695 0 49.1001129150391 -5.8255763053894 0 67.6170501708984 -30.6461448669434 0 71.162841796875 -7.53281211853027 0 74.4459838867188 -15.5436840057373 0 76.1532211303711 -25.261791229248 0 65.4426422119141 -17.0774612426758 0 52.7353782653809 -17.3142528533936 0 </DataArray>
10+
</Points>
11+
<CellData>
12+
<DataArray type="Float64" Name="triangle_vertices" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="45">6 5 4 4 0 2 3 1 0 8 6 7 5 3 4 13 9 8 4 3 0 13 8 7 8 5 6 13 7 10 13 11 9 13 12 11 13 10 12 24 19 17 24 22 19 24 17 15 26 24 15 26 14 18 24 21 23 25 21 24 25 18 20 19 16 17 25 20 21 26 25 24 24 23 22 26 15 14 26 18 25 32 31 30 44 42 43 36 35 34 44 39 41 45 44 40 31 29 30 37 35 36 30 28 27 30 29 28 45 38 37 44 43 40 45 39 44 44 41 42 45 40 38 45 37 39 35 33 34 33 31 32 34 33 32 38 35 37 </DataArray>
13+
<DataArray type="Float64" Name="triangle_adjacents" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="4.2949673e+09">8 4 4.29497e+09 6 4.29497e+09 4.29497e+09 4.29497e+09 4.29497e+09 6 8 4.29497e+09 7 4.29497e+09 6 0 10 4.29497e+09 7 4 2 1 5 3 9 4.29497e+09 0 3 7 4.29497e+09 12 11 4.29497e+09 5 12 4.29497e+09 10 9 4.29497e+09 11 14 21 15 24 4.29497e+09 13 13 4.29497e+09 16 23 15 25 25 4.29497e+09 26 19 4.29497e+09 24 22 18 23 26 4.29497e+09 22 4.29497e+09 4.29497e+09 13 20 4.29497e+09 19 26 19 16 18 4.29497e+09 14 16 4.29497e+09 17 17 20 23 43 32 4.29497e+09 39 4.29497e+09 37 33 42 4.29497e+09 38 4.29497e+09 39 38 37 40 4.29497e+09 35 27 45 29 4.29497e+09 35 4.29497e+09 4.29497e+09 32 4.29497e+09 34 40 45 41 28 4.29497e+09 31 41 30 31 30 4.29497e+09 28 31 4.29497e+09 36 36 4.29497e+09 38 4.29497e+09 44 29 4.29497e+09 27 44 42 43 4.29497e+09 4.29497e+09 33 36 </DataArray>
14+
</CellData>
15+
<Polys>
16+
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="45">6 5 4 4 0 2 3 1 0 8 6 7 5 3 4 13 9 8 4 3 0 13 8 7 8 5 6 13 7 10 13 11 9 13 12 11 13 10 12 24 19 17 24 22 19 24 17 15 26 24 15 26 14 18 24 21 23 25 21 24 25 18 20 19 16 17 25 20 21 26 25 24 24 23 22 26 15 14 26 18 25 32 31 30 44 42 43 36 35 34 44 39 41 45 44 40 31 29 30 37 35 36 30 28 27 30 29 28 45 38 37 44 43 40 45 39 44 44 41 42 45 40 38 45 37 39 35 33 34 33 31 32 34 33 32 38 35 37 </DataArray>
17+
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="46">3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 135 138 </DataArray>
18+
</Polys>
19+
</Piece>
20+
</PolyData>
21+
</VTKFile>

tests/mesh/cells/test_mesh_cells_protocols.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,29 @@ def test_cells_visibility(
4848
[{"id": id, "visibility": False}],
4949
)
5050
assert server.compare_image("mesh/cells/visibility.jpeg") == True
51+
52+
def test_cells_vertex_attribute(
53+
server: ServerMonitor, dataset_factory: Callable[..., str]
54+
) -> None:
55+
56+
test_register(server, dataset_factory)
57+
58+
server.call(
59+
VtkMeshCellsView.mesh_cells_prefix
60+
+ VtkMeshCellsView.mesh_cells_schemas_dict["vertex_attribute"]["rpc"],
61+
[{"id": id, "name": "points"}],
62+
)
63+
assert server.compare_image("mesh/cells/vertex_attribute.jpeg") == True
64+
65+
def test_cells_cell_attribute(
66+
server: ServerMonitor, dataset_factory: Callable[..., str]
67+
) -> None:
68+
69+
test_register(server, dataset_factory)
70+
71+
server.call(
72+
VtkMeshCellsView.mesh_cells_prefix
73+
+ VtkMeshCellsView.mesh_cells_schemas_dict["cell_attribute"]["rpc"],
74+
[{"id": id, "name": "RGB_data"}],
75+
)
76+
assert server.compare_image("mesh/cells/cell_attribute.jpeg") == True

tests/mesh/polygons/test_mesh_polygons_protocols.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Callable
33

44
# Third party imports
5+
from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView
56
from opengeodeweb_viewer.rpc.mesh.polygons.polygons_protocols import VtkMeshPolygonsView
67

78
# Local application imports
@@ -35,3 +36,36 @@ def test_polygons_visibility(
3536
[{"id": "123456789", "visibility": False}],
3637
)
3738
assert server.compare_image("mesh/polygons/visibility.jpeg") == True
39+
40+
41+
def test_polygons_vertex_attribute(
42+
server: ServerMonitor, dataset_factory: Callable[..., str]
43+
) -> None:
44+
45+
test_register_mesh(server, dataset_factory)
46+
47+
server.call(
48+
VtkMeshPolygonsView.mesh_polygons_prefix
49+
+ VtkMeshPolygonsView.mesh_polygons_schemas_dict["vertex_attribute"]["rpc"],
50+
[{"id": "123456789", "name": "lambert2SG"}],
51+
)
52+
assert server.compare_image("mesh/polygons/vertex_attribute.jpeg") == True
53+
54+
def test_polygons_polygon_attribute(
55+
server: ServerMonitor, dataset_factory: Callable[..., str]
56+
) -> None:
57+
58+
dataset_factory(id="123456789", viewable_file="triangulated_surface2d.vtp")
59+
60+
server.call(
61+
VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["register"]["rpc"],
62+
[{"id": "123456789"}],
63+
)
64+
assert server.compare_image("mesh/polygons/register.jpeg") == True
65+
66+
server.call(
67+
VtkMeshPolygonsView.mesh_polygons_prefix
68+
+ VtkMeshPolygonsView.mesh_polygons_schemas_dict["polygon_attribute"]["rpc"],
69+
[{"id": "123456789", "name": "triangle_vertices"}],
70+
)
71+
assert server.compare_image("mesh/polygons/polygon_attribute.jpeg") == True

0 commit comments

Comments
 (0)