OpenGeodeWeb-Back 5.8.7__tar.gz → 5.9.0rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {opengeodeweb_back-5.8.7/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.9.0rc1}/PKG-INFO +1 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/pyproject.toml +1 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO +1 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/geode_functions.py +22 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/blueprint_routes.py +32 -39
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/models/blueprint_models.py +12 -19
- opengeodeweb_back-5.9.0rc1/src/opengeodeweb_back/routes/models/schemas/mesh_components.json +27 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/models/schemas/vtm_component_indices.json +2 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json +6 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json +6 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/texture_coordinates.json +5 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json +6 -1
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/utils_functions.py +9 -8
- opengeodeweb_back-5.9.0rc1/tests/test_models_routes.py +48 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/tests/test_routes.py +14 -7
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/tests/test_utils_functions.py +12 -12
- opengeodeweb_back-5.8.7/src/opengeodeweb_back/routes/models/schemas/mesh_components.json +0 -20
- opengeodeweb_back-5.8.7/tests/test_models_routes.py +0 -30
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/LICENSE +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/README.md +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/requirements.txt +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/setup.cfg +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/requires.txt +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/top_level.txt +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/__init__.py +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/app_config.py +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/geode_objects.py +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/allowed_files.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/allowed_objects.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/create_point.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/inspect_file.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/missing_files.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/ping.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/save_viewable_file.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/routes/schemas/upload_file.json +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/test_utils.py +0 -0
- {opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/tests/test_geode_functions.py +0 -0
{opengeodeweb_back-5.8.7/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.9.0rc1}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.
|
3
|
+
Version: 5.9.0rc1
|
4
4
|
Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
|
5
5
|
Author-email: Geode-solutions <team-web@geode-solutions.com>
|
6
6
|
Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.
|
3
|
+
Version: 5.9.0rc1
|
4
4
|
Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
|
5
5
|
Author-email: Geode-solutions <team-web@geode-solutions.com>
|
6
6
|
Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/geode_functions.py
RENAMED
@@ -4,6 +4,8 @@ import os
|
|
4
4
|
# Third party imports
|
5
5
|
import opengeode_geosciences as og_gs
|
6
6
|
import opengeode as og
|
7
|
+
import werkzeug
|
8
|
+
import flask
|
7
9
|
|
8
10
|
# Local application imports
|
9
11
|
from .geode_objects import geode_objects_dict
|
@@ -38,6 +40,26 @@ def load(geode_object: str, file_absolute_path: str):
|
|
38
40
|
return geode_object_value(geode_object)["load"](file_absolute_path)
|
39
41
|
|
40
42
|
|
43
|
+
def data_file_path(data_id: str, filename: str) -> str:
|
44
|
+
data_folder_path = flask.current_app.config["DATA_FOLDER_PATH"]
|
45
|
+
return os.path.join(
|
46
|
+
data_folder_path,
|
47
|
+
data_id,
|
48
|
+
werkzeug.utils.secure_filename(filename),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def load_data(geode_object: str, data_id: str, filename: str):
|
53
|
+
file_absolute_path = data_file_path(data_id, filename)
|
54
|
+
return load(geode_object, file_absolute_path)
|
55
|
+
|
56
|
+
|
57
|
+
def upload_file_path(filename):
|
58
|
+
upload_folder = flask.current_app.config["UPLOAD_FOLDER"]
|
59
|
+
secure_filename = werkzeug.utils.secure_filename(filename)
|
60
|
+
return os.path.abspath(os.path.join(upload_folder, secure_filename))
|
61
|
+
|
62
|
+
|
41
63
|
def is_saveable(geode_object: str, data, filename: str):
|
42
64
|
return geode_object_value(geode_object)["is_saveable"](data, filename)
|
43
65
|
|
@@ -97,9 +97,10 @@ def allowed_objects():
|
|
97
97
|
if flask.request.method == "OPTIONS":
|
98
98
|
return flask.make_response({}, 200)
|
99
99
|
|
100
|
-
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
101
100
|
utils_functions.validate_request(flask.request, allowed_objects_json)
|
102
|
-
file_absolute_path =
|
101
|
+
file_absolute_path = geode_functions.upload_file_path(
|
102
|
+
flask.request.json["filename"]
|
103
|
+
)
|
103
104
|
allowed_objects = geode_functions.list_geode_objects(
|
104
105
|
file_absolute_path, flask.request.json["supported_feature"]
|
105
106
|
)
|
@@ -118,12 +119,11 @@ with open(
|
|
118
119
|
methods=missing_files_json["methods"],
|
119
120
|
)
|
120
121
|
def missing_files():
|
121
|
-
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
122
122
|
utils_functions.validate_request(flask.request, missing_files_json)
|
123
|
-
|
123
|
+
file_path = geode_functions.upload_file_path(flask.request.json["filename"])
|
124
124
|
missing_files = geode_functions.missing_files(
|
125
125
|
flask.request.json["input_geode_object"],
|
126
|
-
|
126
|
+
file_path,
|
127
127
|
)
|
128
128
|
has_missing_files = missing_files.has_missing_files()
|
129
129
|
|
@@ -184,11 +184,9 @@ with open(
|
|
184
184
|
methods=inspect_file_json["methods"],
|
185
185
|
)
|
186
186
|
def inspect_file():
|
187
|
-
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
188
187
|
utils_functions.validate_request(flask.request, inspect_file_json)
|
189
188
|
|
190
|
-
|
191
|
-
file_path = os.path.abspath(os.path.join(UPLOAD_FOLDER, secure_filename))
|
189
|
+
file_path = geode_functions.upload_file_path(flask.request.json["filename"])
|
192
190
|
data = geode_functions.load(flask.request.json["input_geode_object"], file_path)
|
193
191
|
class_inspector = geode_functions.inspect(
|
194
192
|
flask.request.json["input_geode_object"], data
|
@@ -209,13 +207,13 @@ with open(
|
|
209
207
|
methods=geode_objects_and_output_extensions_json["methods"],
|
210
208
|
)
|
211
209
|
def geode_objects_and_output_extensions():
|
212
|
-
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
213
210
|
utils_functions.validate_request(
|
214
211
|
flask.request, geode_objects_and_output_extensions_json
|
215
212
|
)
|
213
|
+
file_path = geode_functions.upload_file_path(flask.request.json["filename"])
|
216
214
|
data = geode_functions.load(
|
217
215
|
flask.request.json["input_geode_object"],
|
218
|
-
|
216
|
+
file_path,
|
219
217
|
)
|
220
218
|
geode_objects_and_output_extensions = (
|
221
219
|
geode_functions.geode_objects_output_extensions(
|
@@ -241,14 +239,12 @@ with open(
|
|
241
239
|
)
|
242
240
|
def save_viewable_file():
|
243
241
|
utils_functions.validate_request(flask.request, save_viewable_file_json)
|
244
|
-
|
245
|
-
|
246
|
-
secure_filename = werkzeug.utils.secure_filename(flask.request.json["filename"])
|
247
|
-
file_path = os.path.abspath(os.path.join(UPLOAD_FOLDER, secure_filename))
|
242
|
+
|
243
|
+
file_path = geode_functions.upload_file_path(flask.request.json["filename"])
|
248
244
|
data = geode_functions.load(flask.request.json["input_geode_object"], file_path)
|
249
245
|
return flask.make_response(
|
250
246
|
utils_functions.generate_native_viewable_and_light_viewable(
|
251
|
-
flask.request.json["input_geode_object"], data
|
247
|
+
flask.request.json["input_geode_object"], data
|
252
248
|
),
|
253
249
|
200,
|
254
250
|
)
|
@@ -261,7 +257,6 @@ with open(os.path.join(schemas, "create_point.json"), "r") as file:
|
|
261
257
|
@routes.route(create_point_json["route"], methods=create_point_json["methods"])
|
262
258
|
def create_point():
|
263
259
|
utils_functions.validate_request(flask.request, create_point_json)
|
264
|
-
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
265
260
|
title = flask.request.json["title"]
|
266
261
|
x = flask.request.json["x"]
|
267
262
|
y = flask.request.json["y"]
|
@@ -273,7 +268,7 @@ def create_point():
|
|
273
268
|
builder.set_name(title)
|
274
269
|
return flask.make_response(
|
275
270
|
utils_functions.generate_native_viewable_and_light_viewable(
|
276
|
-
"PointSet3D", PointSet3D
|
271
|
+
"PointSet3D", PointSet3D
|
277
272
|
),
|
278
273
|
200,
|
279
274
|
)
|
@@ -288,12 +283,13 @@ with open(os.path.join(schemas, "texture_coordinates.json"), "r") as file:
|
|
288
283
|
methods=texture_coordinates_json["methods"],
|
289
284
|
)
|
290
285
|
def texture_coordinates():
|
291
|
-
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
292
286
|
utils_functions.validate_request(flask.request, texture_coordinates_json)
|
293
|
-
data = geode_functions.
|
287
|
+
data = geode_functions.load_data(
|
294
288
|
flask.request.json["input_geode_object"],
|
295
|
-
|
289
|
+
flask.request.json["id"],
|
290
|
+
flask.request.json["filename"],
|
296
291
|
)
|
292
|
+
|
297
293
|
texture_coordinates = data.texture_manager().texture_names()
|
298
294
|
|
299
295
|
return flask.make_response({"texture_coordinates": texture_coordinates}, 200)
|
@@ -311,14 +307,13 @@ with open(
|
|
311
307
|
methods=vertex_attribute_names_json["methods"],
|
312
308
|
)
|
313
309
|
def vertex_attribute_names():
|
314
|
-
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
315
310
|
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
flask.request.json["input_geode_object"], file_absolute_path
|
311
|
+
data = geode_functions.load_data(
|
312
|
+
flask.request.json["input_geode_object"],
|
313
|
+
flask.request.json["id"],
|
314
|
+
flask.request.json["filename"],
|
321
315
|
)
|
316
|
+
|
322
317
|
vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
|
323
318
|
|
324
319
|
return flask.make_response(
|
@@ -341,14 +336,13 @@ with open(
|
|
341
336
|
methods=polygon_attribute_names_json["methods"],
|
342
337
|
)
|
343
338
|
def polygon_attribute_names():
|
344
|
-
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
345
339
|
utils_functions.validate_request(flask.request, polygon_attribute_names_json)
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
flask.request.json["input_geode_object"], file_absolute_path
|
340
|
+
data = geode_functions.load_data(
|
341
|
+
flask.request.json["input_geode_object"],
|
342
|
+
flask.request.json["id"],
|
343
|
+
flask.request.json["filename"],
|
351
344
|
)
|
345
|
+
|
352
346
|
polygon_attribute_names = data.polygon_attribute_manager().attribute_names()
|
353
347
|
|
354
348
|
return flask.make_response(
|
@@ -371,14 +365,13 @@ with open(
|
|
371
365
|
methods=polyhedron_attribute_names_json["methods"],
|
372
366
|
)
|
373
367
|
def polyhedron_attribute_names():
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
data = geode_functions.load(
|
380
|
-
flask.request.json["input_geode_object"], file_absolute_path
|
368
|
+
utils_functions.validate_request(flask.request, polyhedron_attribute_names_json)
|
369
|
+
data = geode_functions.load_data(
|
370
|
+
flask.request.json["input_geode_object"],
|
371
|
+
flask.request.json["id"],
|
372
|
+
flask.request.json["filename"],
|
381
373
|
)
|
374
|
+
|
382
375
|
polyhedron_attribute_names = data.polyhedron_attribute_manager().attribute_names()
|
383
376
|
|
384
377
|
return flask.make_response(
|
@@ -18,36 +18,27 @@ with open(os.path.join(schemas, "vtm_component_indices.json"), "r") as file:
|
|
18
18
|
)
|
19
19
|
def uuid_to_flat_index():
|
20
20
|
utils_functions.validate_request(flask.request, vtm_component_indices_json)
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
vtm_file_path = geode_functions.data_file_path(
|
23
|
+
flask.request.json["id"], "viewable.vtm"
|
23
24
|
)
|
24
25
|
tree = ET.parse(vtm_file_path)
|
25
26
|
root = tree.find("vtkMultiBlockDataSet")
|
26
27
|
uuid_to_flat_index = {}
|
27
28
|
current_index = 0
|
28
|
-
|
29
29
|
for elem in root.iter():
|
30
30
|
if "uuid" in elem.attrib and elem.tag == "DataSet":
|
31
31
|
uuid_to_flat_index[elem.attrib["uuid"]] = current_index
|
32
|
-
|
33
32
|
current_index += 1
|
34
|
-
|
35
|
-
return flask.make_response(
|
36
|
-
{"uuid_to_flat_index": uuid_to_flat_index},
|
37
|
-
200,
|
38
|
-
)
|
33
|
+
return flask.make_response({"uuid_to_flat_index": uuid_to_flat_index}, 200)
|
39
34
|
|
40
35
|
|
41
|
-
def extract_model_uuids(
|
42
|
-
model = geode_functions.load(geode_object, file_path)
|
36
|
+
def extract_model_uuids(model):
|
43
37
|
mesh_components = model.mesh_components()
|
44
|
-
|
45
38
|
uuid_dict = {}
|
46
|
-
|
47
39
|
for mesh_component, ids in mesh_components.items():
|
48
40
|
component_name = mesh_component.get()
|
49
41
|
uuid_dict[component_name] = [id.string() for id in ids]
|
50
|
-
|
51
42
|
return uuid_dict
|
52
43
|
|
53
44
|
|
@@ -58,10 +49,12 @@ with open(os.path.join(schemas, "mesh_components.json"), "r") as file:
|
|
58
49
|
@routes.route(mesh_components_json["route"], methods=mesh_components_json["methods"])
|
59
50
|
def extract_uuids_endpoint():
|
60
51
|
utils_functions.validate_request(flask.request, mesh_components_json)
|
61
|
-
|
62
|
-
|
52
|
+
|
53
|
+
model = geode_functions.load_data(
|
54
|
+
flask.request.json["geode_object"],
|
55
|
+
flask.request.json["id"],
|
56
|
+
flask.request.json["filename"],
|
63
57
|
)
|
64
|
-
|
65
|
-
|
66
|
-
uuid_dict = extract_model_uuids(flask.request.json["geode_object"], file_path)
|
58
|
+
|
59
|
+
uuid_dict = extract_model_uuids(model)
|
67
60
|
return flask.make_response({"uuid_dict": uuid_dict}, 200)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"route": "/mesh_components",
|
3
|
+
"methods": [
|
4
|
+
"POST"
|
5
|
+
],
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"id": {
|
9
|
+
"type": "string",
|
10
|
+
"minLength": 1
|
11
|
+
},
|
12
|
+
"filename": {
|
13
|
+
"type": "string",
|
14
|
+
"minLength": 1
|
15
|
+
},
|
16
|
+
"geode_object": {
|
17
|
+
"type": "string",
|
18
|
+
"minLength": 1
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"required": [
|
22
|
+
"id",
|
23
|
+
"filename",
|
24
|
+
"geode_object"
|
25
|
+
],
|
26
|
+
"additionalProperties": false
|
27
|
+
}
|
@@ -12,11 +12,16 @@
|
|
12
12
|
"filename": {
|
13
13
|
"type": "string",
|
14
14
|
"minLength": 1
|
15
|
+
},
|
16
|
+
"id": {
|
17
|
+
"type": "string",
|
18
|
+
"minLength": 1
|
15
19
|
}
|
16
20
|
},
|
17
21
|
"required": [
|
18
22
|
"input_geode_object",
|
19
|
-
"filename"
|
23
|
+
"filename",
|
24
|
+
"id"
|
20
25
|
],
|
21
26
|
"additionalProperties": false
|
22
27
|
}
|
@@ -12,11 +12,16 @@
|
|
12
12
|
"filename": {
|
13
13
|
"type": "string",
|
14
14
|
"minLength": 1
|
15
|
+
},
|
16
|
+
"id": {
|
17
|
+
"type": "string",
|
18
|
+
"minLength": 1
|
15
19
|
}
|
16
20
|
},
|
17
21
|
"required": [
|
18
22
|
"input_geode_object",
|
19
|
-
"filename"
|
23
|
+
"filename",
|
24
|
+
"id"
|
20
25
|
],
|
21
26
|
"additionalProperties": false
|
22
27
|
}
|
@@ -12,11 +12,16 @@
|
|
12
12
|
"filename": {
|
13
13
|
"type": "string",
|
14
14
|
"minLength": 1
|
15
|
+
},
|
16
|
+
"id": {
|
17
|
+
"type": "string",
|
18
|
+
"minLength": 1
|
15
19
|
}
|
16
20
|
},
|
17
21
|
"required": [
|
18
22
|
"input_geode_object",
|
19
|
-
"filename"
|
23
|
+
"filename",
|
24
|
+
"id"
|
20
25
|
],
|
21
26
|
"additionalProperties": false
|
22
27
|
}
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/utils_functions.py
RENAMED
@@ -143,24 +143,25 @@ def handle_exception(e):
|
|
143
143
|
return response
|
144
144
|
|
145
145
|
|
146
|
-
def generate_native_viewable_and_light_viewable(
|
147
|
-
geode_object, data, folder_absolute_path
|
148
|
-
):
|
146
|
+
def generate_native_viewable_and_light_viewable(geode_object, data):
|
149
147
|
generated_id = str(uuid.uuid4()).replace("-", "")
|
148
|
+
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
149
|
+
data_path = os.path.join(DATA_FOLDER_PATH, generated_id)
|
150
150
|
name = data.name()
|
151
151
|
object_type = geode_functions.get_object_type(geode_object)
|
152
152
|
|
153
153
|
saved_native_file_path = geode_functions.save(
|
154
154
|
geode_object,
|
155
155
|
data,
|
156
|
-
|
157
|
-
|
156
|
+
data_path,
|
157
|
+
"native." + data.native_extension(),
|
158
158
|
)
|
159
159
|
saved_viewable_file_path = geode_functions.save_viewable(
|
160
|
-
geode_object, data,
|
160
|
+
geode_object, data, data_path, "viewable"
|
161
161
|
)
|
162
|
+
viewable_file_name = os.path.basename(saved_viewable_file_path)
|
162
163
|
saved_light_viewable_file_path = geode_functions.save_light_viewable(
|
163
|
-
geode_object, data,
|
164
|
+
geode_object, data, data_path, "light_viewable"
|
164
165
|
)
|
165
166
|
f = open(saved_light_viewable_file_path, "rb")
|
166
167
|
binary_light_viewable = f.read()
|
@@ -169,7 +170,7 @@ def generate_native_viewable_and_light_viewable(
|
|
169
170
|
return {
|
170
171
|
"name": name,
|
171
172
|
"native_file_name": os.path.basename(saved_native_file_path[0]),
|
172
|
-
"viewable_file_name":
|
173
|
+
"viewable_file_name": viewable_file_name,
|
173
174
|
"id": generated_id,
|
174
175
|
"object_type": object_type,
|
175
176
|
"binary_light_viewable": str(binary_light_viewable, "utf-8"),
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import os
|
2
|
+
import shutil
|
3
|
+
import flask
|
4
|
+
|
5
|
+
from src.opengeodeweb_back import geode_functions
|
6
|
+
|
7
|
+
|
8
|
+
def test_model_mesh_components(client, test_id):
|
9
|
+
route = f"/models/vtm_component_indices"
|
10
|
+
|
11
|
+
with client.application.app_context():
|
12
|
+
data_path = geode_functions.data_file_path(test_id, "viewable.vtm")
|
13
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
14
|
+
shutil.copy("./tests/data/cube.vtm", data_path)
|
15
|
+
|
16
|
+
response = client.post(route, json={"id": test_id})
|
17
|
+
assert response.status_code == 200
|
18
|
+
|
19
|
+
uuid_dict = response.json["uuid_to_flat_index"]
|
20
|
+
assert isinstance(uuid_dict, dict)
|
21
|
+
|
22
|
+
indices = list(uuid_dict.values())
|
23
|
+
indices.sort()
|
24
|
+
assert all(indices[i] > indices[i - 1] for i in range(1, len(indices)))
|
25
|
+
for uuid in uuid_dict.keys():
|
26
|
+
assert isinstance(uuid, str)
|
27
|
+
|
28
|
+
|
29
|
+
def test_extract_brep_uuids(client, test_id):
|
30
|
+
route = "/models/mesh_components"
|
31
|
+
|
32
|
+
brep_filename = "cube.og_brep"
|
33
|
+
json_data = {"id": test_id, "geode_object": "BRep", "filename": brep_filename}
|
34
|
+
|
35
|
+
with client.application.app_context():
|
36
|
+
data_path = geode_functions.data_file_path(json_data["id"], brep_filename)
|
37
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
38
|
+
shutil.copy(f"./tests/data/{brep_filename}", data_path)
|
39
|
+
response = client.post(route, json=json_data)
|
40
|
+
|
41
|
+
assert response.status_code == 200
|
42
|
+
uuid_dict = response.json["uuid_dict"]
|
43
|
+
assert isinstance(uuid_dict, dict)
|
44
|
+
expected_keys = {"Block", "Line", "Surface", "Corner"}
|
45
|
+
assert any(key in uuid_dict for key in expected_keys)
|
46
|
+
for key, value in uuid_dict.items():
|
47
|
+
assert isinstance(value, list)
|
48
|
+
assert all(isinstance(v, str) for v in value)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# Standard library imports
|
2
2
|
import os
|
3
|
+
import shutil
|
3
4
|
|
4
5
|
# Third party imports
|
5
6
|
from werkzeug.datastructures import FileStorage
|
@@ -170,11 +171,17 @@ def test_save_viewable_file(client):
|
|
170
171
|
test_utils.test_route_wrong_params(client, route, get_full_data)
|
171
172
|
|
172
173
|
|
173
|
-
def test_texture_coordinates(client):
|
174
|
+
def test_texture_coordinates(client, test_id):
|
175
|
+
with client.application.app_context():
|
176
|
+
data_path = geode_functions.data_file_path(test_id, "hat.vtp")
|
177
|
+
os.makedirs(os.path.dirname(data_path), exist_ok=True)
|
178
|
+
shutil.copy("./tests/vertex_attribute.vtp", data_path)
|
179
|
+
|
174
180
|
response = client.post(
|
175
181
|
"/texture_coordinates",
|
176
182
|
json={
|
177
183
|
"input_geode_object": "PolygonalSurface3D",
|
184
|
+
"id": test_id,
|
178
185
|
"filename": "hat.vtp",
|
179
186
|
},
|
180
187
|
)
|
@@ -185,7 +192,7 @@ def test_texture_coordinates(client):
|
|
185
192
|
assert type(texture_coordinate) is str
|
186
193
|
|
187
194
|
|
188
|
-
def test_vertex_attribute_names(client):
|
195
|
+
def test_vertex_attribute_names(client, test_id):
|
189
196
|
route = f"/vertex_attribute_names"
|
190
197
|
for geode_object, value in geode_objects.geode_objects_dict().items():
|
191
198
|
if value["object_type"] == "mesh":
|
@@ -205,6 +212,7 @@ def test_vertex_attribute_names(client):
|
|
205
212
|
def get_full_data():
|
206
213
|
return {
|
207
214
|
"input_geode_object": geode_object,
|
215
|
+
"id": test_id,
|
208
216
|
"filename": f"test.{input_extension}",
|
209
217
|
}
|
210
218
|
|
@@ -221,7 +229,7 @@ def test_vertex_attribute_names(client):
|
|
221
229
|
test_utils.test_route_wrong_params(client, route, get_full_data)
|
222
230
|
|
223
231
|
|
224
|
-
def test_polygon_attribute_names(client):
|
232
|
+
def test_polygon_attribute_names(client, test_id):
|
225
233
|
route = f"/polygon_attribute_names"
|
226
234
|
for geode_object, value in geode_objects.geode_objects_dict().items():
|
227
235
|
if value["object_type"] == "mesh":
|
@@ -241,6 +249,7 @@ def test_polygon_attribute_names(client):
|
|
241
249
|
def get_full_data():
|
242
250
|
return {
|
243
251
|
"input_geode_object": geode_object,
|
252
|
+
"id": test_id,
|
244
253
|
"filename": f"test.{input_extension}",
|
245
254
|
}
|
246
255
|
|
@@ -257,7 +266,7 @@ def test_polygon_attribute_names(client):
|
|
257
266
|
test_utils.test_route_wrong_params(client, route, get_full_data)
|
258
267
|
|
259
268
|
|
260
|
-
def test_polyhedron_attribute_names(client):
|
269
|
+
def test_polyhedron_attribute_names(client, test_id):
|
261
270
|
route = f"/polyhedron_attribute_names"
|
262
271
|
for geode_object, value in geode_objects.geode_objects_dict().items():
|
263
272
|
if value["object_type"] == "mesh":
|
@@ -277,6 +286,7 @@ def test_polyhedron_attribute_names(client):
|
|
277
286
|
def get_full_data():
|
278
287
|
return {
|
279
288
|
"input_geode_object": geode_object,
|
289
|
+
"id": test_id,
|
280
290
|
"filename": f"test.{input_extension}",
|
281
291
|
}
|
282
292
|
|
@@ -292,9 +302,6 @@ def test_polyhedron_attribute_names(client):
|
|
292
302
|
# Test all params
|
293
303
|
test_utils.test_route_wrong_params(client, route, get_full_data)
|
294
304
|
|
295
|
-
# Test all params
|
296
|
-
test_utils.test_route_wrong_params(client, route, get_full_data)
|
297
|
-
|
298
305
|
|
299
306
|
def test_create_point(client):
|
300
307
|
route = f"/create_point"
|
@@ -71,22 +71,22 @@ def test_handle_exception(client):
|
|
71
71
|
assert type(data["code"]) is int
|
72
72
|
|
73
73
|
|
74
|
-
def test_generate_native_viewable_and_light_viewable():
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
def test_generate_native_viewable_and_light_viewable(client):
|
75
|
+
app = client.application
|
76
|
+
with app.app_context():
|
77
|
+
geode_object = "BRep"
|
78
|
+
data = geode_functions.load(geode_object, "./tests/data/test.og_brep")
|
79
|
+
|
80
|
+
result = utils_functions.generate_native_viewable_and_light_viewable(
|
81
|
+
geode_object, data
|
82
|
+
)
|
83
|
+
|
84
84
|
assert type(result) is dict
|
85
85
|
assert type(result["name"]) is str
|
86
86
|
assert type(result["native_file_name"]) is str
|
87
|
-
assert
|
87
|
+
assert result["native_file_name"] == "native.og_brep"
|
88
88
|
assert type(result["viewable_file_name"]) is str
|
89
|
-
assert
|
89
|
+
assert result["viewable_file_name"] == "viewable.vtm"
|
90
90
|
assert type(result["id"]) is str
|
91
91
|
assert re.match(r"[0-9a-f]{32}", result["id"])
|
92
92
|
assert type(result["object_type"]) is str
|
@@ -1,20 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"route": "/mesh_components",
|
3
|
-
"methods": [
|
4
|
-
"POST"
|
5
|
-
],
|
6
|
-
"type": "object",
|
7
|
-
"properties": {
|
8
|
-
"filename": {
|
9
|
-
"type": "string"
|
10
|
-
},
|
11
|
-
"geode_object": {
|
12
|
-
"type": "string"
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"required": [
|
16
|
-
"filename",
|
17
|
-
"geode_object"
|
18
|
-
],
|
19
|
-
"additionalProperties": false
|
20
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
def test_model_mesh_components(client):
|
2
|
-
route = f"/models/vtm_component_indices"
|
3
|
-
get_full_data = lambda: {"id": "cube"}
|
4
|
-
json = get_full_data()
|
5
|
-
response = client.post(route, json=json)
|
6
|
-
assert response.status_code == 200
|
7
|
-
|
8
|
-
uuid_dict = response.json["uuid_to_flat_index"]
|
9
|
-
assert isinstance(uuid_dict, dict)
|
10
|
-
|
11
|
-
indices = list(uuid_dict.values())
|
12
|
-
indices.sort()
|
13
|
-
assert all(indices[i] > indices[i - 1] for i in range(1, len(indices)))
|
14
|
-
for uuid in uuid_dict.keys():
|
15
|
-
assert isinstance(uuid, str)
|
16
|
-
|
17
|
-
|
18
|
-
def test_extract_brep_uuids(client):
|
19
|
-
route = "/models/mesh_components"
|
20
|
-
json_data = {"filename": "cube.og_brep", "geode_object": "BRep"}
|
21
|
-
response = client.post(route, json=json_data)
|
22
|
-
|
23
|
-
assert response.status_code == 200
|
24
|
-
uuid_dict = response.json["uuid_dict"]
|
25
|
-
assert isinstance(uuid_dict, dict)
|
26
|
-
expected_keys = {"Block", "Line", "Surface", "Corner"}
|
27
|
-
assert any(key in uuid_dict for key in expected_keys)
|
28
|
-
for key, value in uuid_dict.items():
|
29
|
-
assert isinstance(value, list)
|
30
|
-
assert all(isinstance(v, str) for v in value)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/requires.txt
RENAMED
File without changes
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/OpenGeodeWeb_Back.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{opengeodeweb_back-5.8.7 → opengeodeweb_back-5.9.0rc1}/src/opengeodeweb_back/geode_objects.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|