OpenGeodeWeb-Back 5.8.4rc1__py3-none-any.whl → 5.8.5__py3-none-any.whl
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/routes/blueprint_routes.py +7 -70
- opengeodeweb_back/routes/models/blueprint_models.py +0 -8
- opengeodeweb_back/utils_functions.py +36 -0
- {opengeodeweb_back-5.8.4rc1.dist-info → opengeodeweb_back-5.8.5.dist-info}/METADATA +1 -1
- {opengeodeweb_back-5.8.4rc1.dist-info → opengeodeweb_back-5.8.5.dist-info}/RECORD +8 -8
- {opengeodeweb_back-5.8.4rc1.dist-info → opengeodeweb_back-5.8.5.dist-info}/WHEEL +0 -0
- {opengeodeweb_back-5.8.4rc1.dist-info → opengeodeweb_back-5.8.5.dist-info}/licenses/LICENSE +0 -0
- {opengeodeweb_back-5.8.4rc1.dist-info → opengeodeweb_back-5.8.5.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,6 @@ import time
|
|
6
6
|
# Third party imports
|
7
7
|
import flask
|
8
8
|
import opengeode
|
9
|
-
import uuid
|
10
9
|
import werkzeug
|
11
10
|
|
12
11
|
# Local application imports
|
@@ -241,59 +240,16 @@ with open(
|
|
241
240
|
methods=save_viewable_file_json["methods"],
|
242
241
|
)
|
243
242
|
def save_viewable_file():
|
243
|
+
utils_functions.validate_request(flask.request, save_viewable_file_json)
|
244
244
|
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
245
245
|
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
|
246
|
-
utils_functions.validate_request(flask.request, save_viewable_file_json)
|
247
|
-
|
248
246
|
secure_filename = werkzeug.utils.secure_filename(flask.request.json["filename"])
|
249
247
|
file_path = os.path.abspath(os.path.join(UPLOAD_FOLDER, secure_filename))
|
250
248
|
data = geode_functions.load(flask.request.json["input_geode_object"], file_path)
|
251
|
-
generated_id = str(uuid.uuid4()).replace("-", "")
|
252
|
-
|
253
|
-
name = data.name()
|
254
|
-
native_extension = data.native_extension()
|
255
|
-
|
256
|
-
absolute_native_file_path = os.path.join(
|
257
|
-
UPLOAD_FOLDER, generated_id + "." + native_extension
|
258
|
-
)
|
259
|
-
|
260
|
-
saved_viewable_file_path = geode_functions.save_viewable(
|
261
|
-
flask.request.json["input_geode_object"], data, DATA_FOLDER_PATH, generated_id
|
262
|
-
)
|
263
|
-
|
264
|
-
saved_light_viewable_file_path = geode_functions.save_light_viewable(
|
265
|
-
flask.request.json["input_geode_object"],
|
266
|
-
data,
|
267
|
-
DATA_FOLDER_PATH,
|
268
|
-
"light_" + generated_id,
|
269
|
-
)
|
270
|
-
|
271
|
-
f = open(saved_light_viewable_file_path, "rb")
|
272
|
-
binary_light_viewable = f.read()
|
273
|
-
f.close()
|
274
|
-
|
275
|
-
geode_functions.save(
|
276
|
-
flask.request.json["input_geode_object"],
|
277
|
-
data,
|
278
|
-
DATA_FOLDER_PATH,
|
279
|
-
generated_id + "." + native_extension,
|
280
|
-
)
|
281
|
-
os.remove(os.path.join(UPLOAD_FOLDER, secure_filename))
|
282
|
-
object_type = geode_functions.get_object_type(
|
283
|
-
flask.request.json["input_geode_object"]
|
284
|
-
)
|
285
|
-
|
286
|
-
native_file_name = os.path.basename(absolute_native_file_path)
|
287
|
-
viewable_file_name = os.path.basename(saved_viewable_file_path)
|
288
249
|
return flask.make_response(
|
289
|
-
|
290
|
-
"
|
291
|
-
|
292
|
-
"viewable_file_name": viewable_file_name,
|
293
|
-
"id": generated_id,
|
294
|
-
"object_type": object_type,
|
295
|
-
"binary_light_viewable": str(binary_light_viewable, "utf-8"),
|
296
|
-
},
|
250
|
+
utils_functions.generate_native_viewable_and_light_viewable(
|
251
|
+
flask.request.json["input_geode_object"], data, DATA_FOLDER_PATH
|
252
|
+
),
|
297
253
|
200,
|
298
254
|
)
|
299
255
|
|
@@ -315,29 +271,10 @@ def create_point():
|
|
315
271
|
builder = geode_functions.create_builder("PointSet3D", PointSet3D)
|
316
272
|
builder.create_point(opengeode.Point3D([x, y, z]))
|
317
273
|
builder.set_name(title)
|
318
|
-
name = PointSet3D.name()
|
319
|
-
generated_id = str(uuid.uuid4()).replace("-", "")
|
320
|
-
object_type = geode_functions.get_object_type("PointSet3D")
|
321
|
-
saved_native_file_path = geode_functions.save(
|
322
|
-
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id + ".og_pts3d"
|
323
|
-
)
|
324
|
-
saved_viewable_file_path = geode_functions.save_viewable(
|
325
|
-
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id
|
326
|
-
)
|
327
|
-
|
328
|
-
native_file_name = os.path.basename(saved_native_file_path[0])
|
329
|
-
viewable_file_name = os.path.basename(saved_viewable_file_path)
|
330
|
-
|
331
274
|
return flask.make_response(
|
332
|
-
|
333
|
-
"
|
334
|
-
|
335
|
-
"name": name,
|
336
|
-
"native_file_name": native_file_name,
|
337
|
-
"viewable_file_name": viewable_file_name,
|
338
|
-
"object_type": object_type,
|
339
|
-
"geode_object": "PointSet3D",
|
340
|
-
},
|
275
|
+
utils_functions.generate_native_viewable_and_light_viewable(
|
276
|
+
"PointSet3D", PointSet3D, DATA_FOLDER_PATH
|
277
|
+
),
|
341
278
|
200,
|
342
279
|
)
|
343
280
|
|
@@ -17,13 +17,10 @@ with open(os.path.join(schemas, "vtm_component_indices.json"), "r") as file:
|
|
17
17
|
vtm_component_indices_json["route"], methods=vtm_component_indices_json["methods"]
|
18
18
|
)
|
19
19
|
def uuid_to_flat_index():
|
20
|
-
|
21
|
-
print(f"uuid_to_flat_index : {flask.request=}", flush=True)
|
22
20
|
utils_functions.validate_request(flask.request, vtm_component_indices_json)
|
23
21
|
vtm_file_path = os.path.join(
|
24
22
|
flask.current_app.config["DATA_FOLDER_PATH"], flask.request.json["id"] + ".vtm"
|
25
23
|
)
|
26
|
-
|
27
24
|
tree = ET.parse(vtm_file_path)
|
28
25
|
root = tree.find("vtkMultiBlockDataSet")
|
29
26
|
uuid_to_flat_index = {}
|
@@ -60,16 +57,11 @@ with open(os.path.join(schemas, "mesh_components.json"), "r") as file:
|
|
60
57
|
|
61
58
|
@routes.route(mesh_components_json["route"], methods=mesh_components_json["methods"])
|
62
59
|
def extract_uuids_endpoint():
|
63
|
-
print(f"extract_uuids_endpoint : {flask.request=}", flush=True)
|
64
|
-
|
65
60
|
utils_functions.validate_request(flask.request, mesh_components_json)
|
66
|
-
|
67
61
|
file_path = os.path.join(
|
68
62
|
flask.current_app.config["DATA_FOLDER_PATH"], flask.request.json["filename"]
|
69
63
|
)
|
70
|
-
|
71
64
|
if not os.path.exists(file_path):
|
72
65
|
return flask.make_response({"error": "File not found"}, 404)
|
73
|
-
|
74
66
|
uuid_dict = extract_model_uuids(flask.request.json["geode_object"], file_path)
|
75
67
|
return flask.make_response({"uuid_dict": uuid_dict}, 200)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
import os
|
3
3
|
import threading
|
4
4
|
import time
|
5
|
+
import uuid
|
5
6
|
import zipfile
|
6
7
|
|
7
8
|
# Third party imports
|
@@ -10,6 +11,7 @@ import fastjsonschema
|
|
10
11
|
import importlib.metadata as metadata
|
11
12
|
|
12
13
|
# Local application imports
|
14
|
+
from . import geode_functions
|
13
15
|
|
14
16
|
|
15
17
|
def increment_request_counter(current_app):
|
@@ -139,3 +141,37 @@ def handle_exception(e):
|
|
139
141
|
)
|
140
142
|
response.content_type = "application/json"
|
141
143
|
return response
|
144
|
+
|
145
|
+
|
146
|
+
def generate_native_viewable_and_light_viewable(
|
147
|
+
geode_object, data, folder_absolute_path
|
148
|
+
):
|
149
|
+
generated_id = str(uuid.uuid4()).replace("-", "")
|
150
|
+
name = data.name()
|
151
|
+
object_type = geode_functions.get_object_type(geode_object)
|
152
|
+
|
153
|
+
saved_native_file_path = geode_functions.save(
|
154
|
+
geode_object,
|
155
|
+
data,
|
156
|
+
folder_absolute_path,
|
157
|
+
generated_id + "." + data.native_extension(),
|
158
|
+
)
|
159
|
+
saved_viewable_file_path = geode_functions.save_viewable(
|
160
|
+
geode_object, data, folder_absolute_path, generated_id
|
161
|
+
)
|
162
|
+
saved_light_viewable_file_path = geode_functions.save_light_viewable(
|
163
|
+
geode_object, data, folder_absolute_path, "light_" + generated_id
|
164
|
+
)
|
165
|
+
f = open(saved_light_viewable_file_path, "rb")
|
166
|
+
binary_light_viewable = f.read()
|
167
|
+
f.close()
|
168
|
+
|
169
|
+
return {
|
170
|
+
"name": name,
|
171
|
+
"native_file_name": os.path.basename(saved_native_file_path[0]),
|
172
|
+
"viewable_file_name": os.path.basename(saved_viewable_file_path),
|
173
|
+
"id": generated_id,
|
174
|
+
"object_type": object_type,
|
175
|
+
"binary_light_viewable": str(binary_light_viewable, "utf-8"),
|
176
|
+
"geode_object": geode_object,
|
177
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.8.
|
3
|
+
Version: 5.8.5
|
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
|
@@ -3,9 +3,9 @@ opengeodeweb_back/app_config.py,sha256=gJfYxDJOa_PYLqjqgdXacp3W3F109uujE9LGPvzHO
|
|
3
3
|
opengeodeweb_back/geode_functions.py,sha256=EPAM6pw9QwZfoeZjOxycFTKUANw6pdeXr2q3vsnPxt8,9121
|
4
4
|
opengeodeweb_back/geode_objects.py,sha256=13A9FTGugiA9ClSeYkBiCu5QGzm93nm8YJQwiWB4nNw,25995
|
5
5
|
opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
|
6
|
-
opengeodeweb_back/utils_functions.py,sha256=
|
7
|
-
opengeodeweb_back/routes/blueprint_routes.py,sha256=
|
8
|
-
opengeodeweb_back/routes/models/blueprint_models.py,sha256=
|
6
|
+
opengeodeweb_back/utils_functions.py,sha256=RXMdQlCK3bLWYYDhkwOlYCeMpSRjMCejNlqDhxo2VNI,5254
|
7
|
+
opengeodeweb_back/routes/blueprint_routes.py,sha256=uqcDIXa2Q7HRShEEVFJcOB6NAxPAYO1VyBMPxtyKl_0,12334
|
8
|
+
opengeodeweb_back/routes/models/blueprint_models.py,sha256=EPSlgHnxZVeXwdzJ_TBAHlK6SsjXDk3f1sPYWR5eEL4,2183
|
9
9
|
opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=3hgNqkxKDv691JGgjgMoqI_WgH2m7AtEFfjsOIqAz5Y,295
|
10
10
|
opengeodeweb_back/routes/models/schemas/vtm_component_indices.json,sha256=0km8gzawPj-eFodhaGzAgNZjAEOl4wLy24f_Bs3pBlw,217
|
11
11
|
opengeodeweb_back/routes/schemas/allowed_files.json,sha256=pRsGf39LiJpl3zEGLg4IqvRtm7iUx3Wq4Tb4tSFXGV0,234
|
@@ -22,8 +22,8 @@ opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl
|
|
22
22
|
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=m0EqxlvKojXVxK5Csucodu3rq1YMVJPwXJN_Wreb3qc,355
|
23
23
|
opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
|
24
24
|
opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=bya9KGtTmHFWjD-ur0_0UAY2yf3KkMeuNrk6E1UkjLM,358
|
25
|
-
opengeodeweb_back-5.8.
|
26
|
-
opengeodeweb_back-5.8.
|
27
|
-
opengeodeweb_back-5.8.
|
28
|
-
opengeodeweb_back-5.8.
|
29
|
-
opengeodeweb_back-5.8.
|
25
|
+
opengeodeweb_back-5.8.5.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
|
26
|
+
opengeodeweb_back-5.8.5.dist-info/METADATA,sha256=4_hISDbxC9lxSYAmz-fOc6PVRkU8O1H211sk1o6kcwk,3033
|
27
|
+
opengeodeweb_back-5.8.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
28
|
+
opengeodeweb_back-5.8.5.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
29
|
+
opengeodeweb_back-5.8.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|