Skip to content

Commit 11865dd

Browse files
feat(vertex attribute): new route/schemas/test/data
1 parent c3715f1 commit 11865dd

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,32 @@ def save_viewable_file():
271271
)
272272

273273

274+
with open(
275+
os.path.join(schemas, "vertex_attribute_names.json"),
276+
"r",
277+
) as file:
278+
vertex_attribute_names_json = json.load(file)
279+
280+
@routes.route(
281+
vertex_attribute_names_json["route"],
282+
methods=vertex_attribute_names_json["methods"],
283+
)
284+
def vertex_attribute_names():
285+
286+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
287+
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
288+
file_absolute_path = os.path.join(UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"]))
289+
data = geode_functions.load(flask.request.json["input_geode_object"], file_absolute_path)
290+
vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
291+
print(f"vertex_attribute_names: {vertex_attribute_names}", flush=True)
292+
return flask.make_response(
293+
{
294+
"vertex_attribute_names": vertex_attribute_names,
295+
},
296+
200,
297+
)
298+
299+
274300
with open(
275301
os.path.join(schemas, "ping.json"),
276302
"r",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"route": "/vertex_attribute_names",
3+
"methods": ["POST"],
4+
"type": "object",
5+
"properties": {
6+
"input_geode_object": {
7+
"type": "string"
8+
},
9+
"filename": {
10+
"type": "string"
11+
}
12+
},
13+
"required": ["input_geode_object", "filename"],
14+
"additionalProperties": false
15+
}

tests/vertex_attribute.vtp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="23" NumberOfPolys="26">
5+
<PointData>
6+
<DataArray type="Float64" Name="geode_implicit_attribute" format="ascii" NumberOfComponents="1" RangeMin="-4.81985569" RangeMax="3.07847285">-4.81986 -4.24426 -3.08307 -2.67472 -3.78427 -1.72952 -3.51395 -1.54156 -3.26163 -1.37705 1.49282 0.476446 3.07847 1.81965 0.15148 -0.00219692 -2.03758 -1.21643 -0.392793 1.04446 -0.159125 -1.41509 -1.36066 </DataArray>
7+
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="2" RangeMin="1.10000002" RangeMax="11">1.1 1.5 4.5 1.4 2.9 3 4.9 3.1 6.4 1.7 6.3 4 8.2 1.9 8.5 4 11 2 10.9 4 10.7 6.9 9.4 6 10.6 8.5 8 7.5 7 5.95 5.8 5.8 1.1 4.5 3 5 5 5.5 6.1 7 5.8 5.8 5.35 4.45 5.35 4.45 </DataArray>
8+
<DataArray type="Float64" Name="gradient_3d_attribute" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="1.01122475">0.212913 0.898437 0 0.17411 0.88882 0 0.188674 0.91656 0 0.129386 0.902004 0 0.0522603 0.892251 0 0.0913028 0.902984 0 0.0494319 0.925332 0 0.0790874 0.944317 0 0.0630148 0.926847 0 0.0606951 0.95661 0 0.0916888 0.990159 0 0.102275 0.986827 0 0.0910002 0.997784 0 0.149679 1.01122 0 0.129961 0.95844 0 nan nan nan 0.18944 0.925768 0 0.188704 0.925194 0 0.172618 0.985506 0 0.149488 0.967933 0 0.14023 0.965619 0 0.0974158 0.875532 0 nan nan nan </DataArray>
9+
<DataArray type="Float64" Name="unique vertices" format="ascii" NumberOfComponents="1" RangeMin="32" RangeMax="63">50 51 55 56 52 57 53 58 54 59 62 61 47 46 60 35 32 33 34 45 35 63 63 </DataArray>
10+
</PointData>
11+
<Points>
12+
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="1.1000000000000001" RangeMax="11">1.1 1.5 0 4.5 1.4 0 2.9 3 3 4.9 3.1 0 6.4 1.7 0 6.3 4 0 8.2 1.9 0 8.5 4 0 11 2 0 10.9 4 3 10.7 6.9 0 9.4 6 0 10.6 8.5 0 8 7.5 0 7 5.95 0 5.8 5.8 0 1.1 4.5 0 3 5 0 5 5.5 0 6.1 7 3 5.8 5.8 0 5.35 4.45 0 5.35 4.45 0 </DataArray>
13+
</Points>
14+
<CellData>
15+
<DataArray type="Float64" Name="implicit_on_polygons" format="ascii" NumberOfComponents="1" RangeMin="-4.04906511" RangeMax="1.79152191">-4.04907 -3.33402 -3.56775 -2.7295 -3.00925 -2.26168 -2.77238 -2.06008 0.197405 1.68258 1.79152 -0.814056 0.815858 -0.304546 -1.03987 -0.579057 -3.3135 -2.11236 -2.32474 -1.42798 0.345606 1.0052 -1.10125 -1.93978 -1.47606 -0.585217 </DataArray>
16+
<DataArray type="Float64" Name="triangle_adjacents" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="4.2949673e+09">4.29497e+09 1 16 2 18 0 4.29497e+09 3 1 4 23 2 4.29497e+09 5 3 6 14 4 4.29497e+09 7 5 4.29497e+09 11 6 4.29497e+09 9 11 4.29497e+09 10 8 9 4.29497e+09 12 7 8 13 13 10 21 11 12 14 5 13 15 14 20 22 0 17 4.29497e+09 16 18 4.29497e+09 1 19 17 24 4.29497e+09 18 15 21 4.29497e+09 12 4.29497e+09 20 4.29497e+09 23 15 4.29497e+09 3 22 4.29497e+09 25 19 4.29497e+09 4.29497e+09 24 </DataArray>
17+
<DataArray type="Float64" Name="triangle_vertices" format="ascii" NumberOfComponents="3" RangeMin="0" RangeMax="22">0 1 2 1 3 2 1 4 3 4 5 3 4 6 5 6 7 5 6 8 7 8 9 7 9 10 11 10 12 11 11 12 13 7 9 11 14 11 13 7 11 14 5 7 14 5 14 20 0 2 16 16 2 17 2 3 17 3 18 17 20 14 19 14 13 19 20 21 5 21 3 5 3 22 18 22 15 18 </DataArray>
18+
</CellData>
19+
<Polys>
20+
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="22">0 1 2 1 3 2 1 4 3 4 5 3 4 6 5 6 7 5 6 8 7 8 9 7 9 10 11 10 12 11 11 12 13 7 9 11 14 11 13 7 11 14 5 7 14 5 14 20 0 2 16 16 2 17 2 3 17 3 18 17 20 14 19 14 13 19 20 21 5 21 3 5 3 22 18 22 15 18 </DataArray>
21+
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="23">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 </DataArray>
22+
</Polys>
23+
</Piece>
24+
</PolyData>
25+
</VTKFile>

0 commit comments

Comments
 (0)