@geode/opengeodeweb-back 0.0.0-semantically-released
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.
- package/.gitattributes +2 -0
- package/.github/workflows/Branch-protection.yml +11 -0
- package/.github/workflows/CD.yml +53 -0
- package/.github/workflows/prepare_pr.yml +11 -0
- package/.pylintrc +536 -0
- package/.pypirc +6 -0
- package/CHANGELOG.md +1223 -0
- package/COPYLEFT +4 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/app.py +54 -0
- package/config.py +29 -0
- package/generate_schemas.js +82 -0
- package/package.json +31 -0
- package/pyproject.toml +48 -0
- package/requirements.in +15 -0
- package/requirements.txt +116 -0
- package/src/OpenGeodeWeb_Back.egg-info/PKG-INFO +74 -0
- package/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +22 -0
- package/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +1 -0
- package/src/OpenGeodeWeb_Back.egg-info/requires.txt +28 -0
- package/src/OpenGeodeWeb_Back.egg-info/top_level.txt +1 -0
- package/src/opengeodeweb_back/__init__.py +0 -0
- package/src/opengeodeweb_back/geode_functions.py +330 -0
- package/src/opengeodeweb_back/geode_objects.py +429 -0
- package/src/opengeodeweb_back/inspector_functions.py +483 -0
- package/src/opengeodeweb_back/routes/blueprint_routes.py +178 -0
- package/src/opengeodeweb_back/routes/schemas/allowed_files.json +20 -0
- package/src/opengeodeweb_back/routes/schemas/allowed_objects.json +16 -0
- package/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +21 -0
- package/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +17 -0
- package/src/opengeodeweb_back/routes/schemas/missing_files.json +16 -0
- package/src/opengeodeweb_back/routes/schemas/upload_file.json +15 -0
- package/tests/__init__.py +0 -0
- package/tests/conftest.py +12 -0
- package/tests/corbi.og_brep +0 -0
- package/tests/data/test.bmp +0 -0
- package/tests/data/test.dat +11 -0
- package/tests/data/test.dev +121 -0
- package/tests/data/test.dxf +4184 -0
- package/tests/data/test.grdecl +2555 -0
- package/tests/data/test.jpg +0 -0
- package/tests/data/test.lso +3637 -0
- package/tests/data/test.ml +78770 -0
- package/tests/data/test.msh +800 -0
- package/tests/data/test.obj +24 -0
- package/tests/data/test.og_brep +0 -0
- package/tests/data/test.og_edc2d +0 -0
- package/tests/data/test.og_edc3d +0 -0
- package/tests/data/test.og_grp +0 -0
- package/tests/data/test.og_hso3d +0 -0
- package/tests/data/test.og_img2d +3 -0
- package/tests/data/test.og_img3d +0 -0
- package/tests/data/test.og_lrgd2d +0 -0
- package/tests/data/test.og_lrgd3d +0 -0
- package/tests/data/test.og_psf2d +0 -0
- package/tests/data/test.og_psf3d +0 -0
- package/tests/data/test.og_pso3d +0 -0
- package/tests/data/test.og_pts2d +0 -0
- package/tests/data/test.og_pts3d +0 -0
- package/tests/data/test.og_rgd2d +0 -0
- package/tests/data/test.og_rgd3d +0 -0
- package/tests/data/test.og_sctn +0 -0
- package/tests/data/test.og_strm +0 -0
- package/tests/data/test.og_tsf2d +0 -0
- package/tests/data/test.og_tsf3d +0 -0
- package/tests/data/test.og_tso3d +0 -0
- package/tests/data/test.og_vts +0 -0
- package/tests/data/test.og_xsctn +0 -0
- package/tests/data/test.ply +20 -0
- package/tests/data/test.png +0 -0
- package/tests/data/test.shp +0 -0
- package/tests/data/test.shx +0 -0
- package/tests/data/test.shz +0 -0
- package/tests/data/test.smesh +2049 -0
- package/tests/data/test.stl +7191 -0
- package/tests/data/test.svg +144 -0
- package/tests/data/test.ts +266 -0
- package/tests/data/test.txt +11 -0
- package/tests/data/test.vo +49 -0
- package/tests/data/test.vti +3 -0
- package/tests/data/test.vtp +212 -0
- package/tests/data/test.vtu +3585 -0
- package/tests/data/test.wl +76 -0
- package/tests/data/test__ascii@@ +1003 -0
- package/tests/test_functions.py +291 -0
- package/tests/test_routes.py +131 -0
- package/tmp.3491.json +0 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
class Result:
|
|
2
|
+
def __init__(self, children: list, route: str, sentence: str = None, value=None):
|
|
3
|
+
self.children = children
|
|
4
|
+
self.is_leaf = len(children) == 0
|
|
5
|
+
self.route = route
|
|
6
|
+
self.value = value
|
|
7
|
+
self.sentence = sentence
|
|
8
|
+
self.list_invalidities = None
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def json_return(Result_list: list):
|
|
12
|
+
json_result = []
|
|
13
|
+
for result in Result_list:
|
|
14
|
+
json_temp = {
|
|
15
|
+
"value": result.value,
|
|
16
|
+
"children": result.children
|
|
17
|
+
if result.is_leaf
|
|
18
|
+
else json_return(result.children),
|
|
19
|
+
"is_leaf": result.is_leaf,
|
|
20
|
+
"route": result.route,
|
|
21
|
+
"sentence": result.sentence if result.sentence != None else result.route,
|
|
22
|
+
}
|
|
23
|
+
json_result.append(json_temp)
|
|
24
|
+
return json_result
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def AdjacencyTests(object: str):
|
|
28
|
+
AdjacencyTests = [
|
|
29
|
+
Result(
|
|
30
|
+
[],
|
|
31
|
+
f"nb_{object}_with_wrong_adjacency",
|
|
32
|
+
f"Number of {object} with invalid adjacencies",
|
|
33
|
+
)
|
|
34
|
+
]
|
|
35
|
+
Wrapper_AdjacencyTests = Result(AdjacencyTests, "Adjacency")
|
|
36
|
+
return Wrapper_AdjacencyTests
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def ColocationTests():
|
|
40
|
+
ColocationTests = [Result([], "nb_colocated_points", "Number of colocated points")]
|
|
41
|
+
Wrapper_ColocationTests = Result(ColocationTests, "Colocation")
|
|
42
|
+
return Wrapper_ColocationTests
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def DegenerationTests():
|
|
46
|
+
DegenerationTests = [
|
|
47
|
+
Result([], "nb_degenerated_edges", "Number of degenerated edges")
|
|
48
|
+
]
|
|
49
|
+
Wrapper_DegenerationTests = Result(DegenerationTests, "Degeneration")
|
|
50
|
+
return Wrapper_DegenerationTests
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def ManifoldTests(objects: list):
|
|
54
|
+
ManifoldTests = []
|
|
55
|
+
for object in objects:
|
|
56
|
+
ManifoldTests.append(
|
|
57
|
+
Result([], f"nb_non_manifold_{object}", f"Number of non manifold {object}")
|
|
58
|
+
)
|
|
59
|
+
Wrapper_ManifoldTests = Result(ManifoldTests, "Manifold")
|
|
60
|
+
return Wrapper_ManifoldTests
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def IntersectionTests():
|
|
64
|
+
IntersectionTests = [
|
|
65
|
+
Result([], "intersecting_elements", "Number of intersecting elements")
|
|
66
|
+
]
|
|
67
|
+
Wrapper_IntersectionTests = Result(IntersectionTests, "Intersection")
|
|
68
|
+
return Wrapper_IntersectionTests
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def TopologyTests(object: str):
|
|
72
|
+
unique_vertices_colocation = [
|
|
73
|
+
Result(
|
|
74
|
+
[],
|
|
75
|
+
"unique_vertices_linked_to_different_points",
|
|
76
|
+
"Number of unique vertices linked to different points in space",
|
|
77
|
+
),
|
|
78
|
+
Result(
|
|
79
|
+
[],
|
|
80
|
+
"colocated_unique_vertices_groups",
|
|
81
|
+
"Number of unique vertices colocated in space",
|
|
82
|
+
),
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
components_are_linked_to_a_unique_vertex = [
|
|
86
|
+
Result(
|
|
87
|
+
[],
|
|
88
|
+
"nb_corners_not_linked_to_a_unique_vertex",
|
|
89
|
+
"Number of corners not linked to a unique vertex",
|
|
90
|
+
),
|
|
91
|
+
Result(
|
|
92
|
+
[],
|
|
93
|
+
"nb_lines_meshed_but_not_linked_to_a_unique_vertex",
|
|
94
|
+
"Number of lines not linked to a unique vertex",
|
|
95
|
+
),
|
|
96
|
+
Result(
|
|
97
|
+
[],
|
|
98
|
+
"nb_surfaces_meshed_but_not_linked_to_a_unique_vertex",
|
|
99
|
+
"Number of surfaces not linked to a unique vertex",
|
|
100
|
+
),
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
invalid_components_topology_unique_vertices = [
|
|
104
|
+
Result(
|
|
105
|
+
[],
|
|
106
|
+
"unique_vertices_not_linked_to_a_component_vertex",
|
|
107
|
+
"Number of unique vertices not linked to a component mesh vertex",
|
|
108
|
+
),
|
|
109
|
+
Result(
|
|
110
|
+
[],
|
|
111
|
+
"multiple_corners_unique_vertices",
|
|
112
|
+
"Unique vertices linked to multiple corners",
|
|
113
|
+
),
|
|
114
|
+
Result(
|
|
115
|
+
[],
|
|
116
|
+
"multiple_internals_corner_vertices",
|
|
117
|
+
"Unique vertices linked to a corner with multiple internal relations",
|
|
118
|
+
),
|
|
119
|
+
Result(
|
|
120
|
+
[],
|
|
121
|
+
"not_internal_nor_boundary_corner_vertices",
|
|
122
|
+
"Unique vertices linked to a corner which is neither internal nor boundary",
|
|
123
|
+
),
|
|
124
|
+
Result(
|
|
125
|
+
[],
|
|
126
|
+
"line_corners_without_boundary_status",
|
|
127
|
+
"Unique vertices linked to a line and a corner not boundary of the line",
|
|
128
|
+
),
|
|
129
|
+
Result(
|
|
130
|
+
[],
|
|
131
|
+
"part_of_not_boundary_nor_internal_line_unique_vertices",
|
|
132
|
+
"Unique vertices part of a line without boundary or internal relations",
|
|
133
|
+
),
|
|
134
|
+
Result(
|
|
135
|
+
[],
|
|
136
|
+
"part_of_line_with_invalid_internal_topology_unique_vertices",
|
|
137
|
+
"Unique vertices part of a line with invalid internal topology relations",
|
|
138
|
+
),
|
|
139
|
+
Result(
|
|
140
|
+
[],
|
|
141
|
+
"part_of_invalid_unique_line_unique_vertices",
|
|
142
|
+
"Unique vertices part of a single line with invalid topology",
|
|
143
|
+
),
|
|
144
|
+
Result(
|
|
145
|
+
[],
|
|
146
|
+
"part_of_lines_but_not_corner_unique_vertices",
|
|
147
|
+
"Unique vertices part of multiple lines with invalid topology",
|
|
148
|
+
),
|
|
149
|
+
Result(
|
|
150
|
+
[],
|
|
151
|
+
"part_of_line_and_not_on_surface_border_unique_vertices",
|
|
152
|
+
"Unique vertices part of a line and a surface but not on the border of the surface mesh",
|
|
153
|
+
),
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
if object == "brep":
|
|
157
|
+
brep_components_are_linked_to_a_unique_vertex = (
|
|
158
|
+
components_are_linked_to_a_unique_vertex
|
|
159
|
+
)
|
|
160
|
+
brep_components_are_linked_to_a_unique_vertex.append(
|
|
161
|
+
Result(
|
|
162
|
+
[],
|
|
163
|
+
"nb_blocks_meshed_but_not_linked_to_a_unique_vertex",
|
|
164
|
+
"Number of blocks not linked to a unique vertex",
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
brep_invalid_components_topology_unique_vertices = (
|
|
169
|
+
invalid_components_topology_unique_vertices
|
|
170
|
+
)
|
|
171
|
+
brep_invalid_components_topology_unique_vertices.append(
|
|
172
|
+
Result(
|
|
173
|
+
[],
|
|
174
|
+
"part_of_not_boundary_nor_internal_surface_unique_vertices",
|
|
175
|
+
"Unique vertices part of a surface which has no boundary or internal relations",
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
brep_invalid_components_topology_unique_vertices.append(
|
|
179
|
+
Result(
|
|
180
|
+
[],
|
|
181
|
+
"part_of_surface_with_invalid_internal_topology_unique_vertices",
|
|
182
|
+
"Unique vertices part of a surface with invalid internal topology",
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
brep_invalid_components_topology_unique_vertices.append(
|
|
186
|
+
Result(
|
|
187
|
+
[],
|
|
188
|
+
"part_of_invalid_unique_surface_unique_vertices",
|
|
189
|
+
"Unique vertices part of a unique surface with invalid topology",
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
brep_invalid_components_topology_unique_vertices.append(
|
|
193
|
+
Result(
|
|
194
|
+
[],
|
|
195
|
+
"part_of_invalid_multiple_surfaces_unique_vertices",
|
|
196
|
+
"Unique vertices part of multiple surfaces with invalid topology",
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
brep_invalid_components_topology_unique_vertices.append(
|
|
200
|
+
Result(
|
|
201
|
+
[],
|
|
202
|
+
"part_of_invalid_blocks_unique_vertices",
|
|
203
|
+
"Unique vertices part of blocks with invalid topology",
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
TopologyTests = [
|
|
208
|
+
Result(
|
|
209
|
+
brep_components_are_linked_to_a_unique_vertex,
|
|
210
|
+
"Meshed components are linked to a unique vertex",
|
|
211
|
+
),
|
|
212
|
+
Result(
|
|
213
|
+
brep_invalid_components_topology_unique_vertices,
|
|
214
|
+
"Unique vertices linked to components with invalid topology",
|
|
215
|
+
),
|
|
216
|
+
Result(
|
|
217
|
+
unique_vertices_colocation, "Unique vertices with colocation issues"
|
|
218
|
+
),
|
|
219
|
+
]
|
|
220
|
+
elif object == "section":
|
|
221
|
+
section_invalid_components_topology_unique_vertices = (
|
|
222
|
+
invalid_components_topology_unique_vertices
|
|
223
|
+
)
|
|
224
|
+
section_invalid_components_topology_unique_vertices.append(
|
|
225
|
+
Result(
|
|
226
|
+
[],
|
|
227
|
+
"part_of_invalid_surfaces_unique_vertices",
|
|
228
|
+
"Unique vertices part of surfaces with invalid topology",
|
|
229
|
+
)
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
TopologyTests = [
|
|
233
|
+
Result(
|
|
234
|
+
components_are_linked_to_a_unique_vertex,
|
|
235
|
+
"Meshed components are linked to a unique vertex",
|
|
236
|
+
),
|
|
237
|
+
Result(
|
|
238
|
+
section_invalid_components_topology_unique_vertices,
|
|
239
|
+
"Unique vertices linked to components with invalid topology",
|
|
240
|
+
),
|
|
241
|
+
Result(
|
|
242
|
+
unique_vertices_colocation, "Unique vertices with colocation issues"
|
|
243
|
+
),
|
|
244
|
+
]
|
|
245
|
+
Wrapper_TopologyTests = Result(TopologyTests, "Topology")
|
|
246
|
+
return Wrapper_TopologyTests
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def ComponentMeshesTests(object: str):
|
|
250
|
+
component_meshes_adjacency = [
|
|
251
|
+
Result(
|
|
252
|
+
[],
|
|
253
|
+
"surfaces_nb_edges_with_wrong_adjacencies",
|
|
254
|
+
"Model component meshes edge adjacencies",
|
|
255
|
+
)
|
|
256
|
+
]
|
|
257
|
+
component_meshes_colocation = [
|
|
258
|
+
Result(
|
|
259
|
+
[],
|
|
260
|
+
"components_nb_colocated_points",
|
|
261
|
+
"Model component meshes point colocation",
|
|
262
|
+
)
|
|
263
|
+
]
|
|
264
|
+
component_meshes_degeneration = [
|
|
265
|
+
Result(
|
|
266
|
+
[],
|
|
267
|
+
"components_nb_degenerated_elements",
|
|
268
|
+
"Model component meshes element degeneration",
|
|
269
|
+
)
|
|
270
|
+
]
|
|
271
|
+
component_meshes_manifold = [
|
|
272
|
+
Result(
|
|
273
|
+
[],
|
|
274
|
+
"component_meshes_nb_non_manifold_vertices",
|
|
275
|
+
"Model component meshes vertex manifold",
|
|
276
|
+
),
|
|
277
|
+
Result(
|
|
278
|
+
[],
|
|
279
|
+
"component_meshes_nb_non_manifold_edges",
|
|
280
|
+
"Model component meshes edge manifold",
|
|
281
|
+
),
|
|
282
|
+
]
|
|
283
|
+
component_meshes_intersection = [
|
|
284
|
+
Result(
|
|
285
|
+
[],
|
|
286
|
+
"intersecting_surfaces_elements",
|
|
287
|
+
"Pairs of component meshes triangles intersecting",
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
|
|
291
|
+
if object == "brep":
|
|
292
|
+
brep_component_meshes_adjacency = component_meshes_adjacency
|
|
293
|
+
brep_component_meshes_adjacency.append(
|
|
294
|
+
Result(
|
|
295
|
+
[],
|
|
296
|
+
"blocks_nb_facets_with_wrong_adjacencies",
|
|
297
|
+
"Model component meshes facet adjacencies",
|
|
298
|
+
)
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
brep_component_meshes_manifold = component_meshes_manifold
|
|
302
|
+
brep_component_meshes_manifold.append(
|
|
303
|
+
Result(
|
|
304
|
+
[],
|
|
305
|
+
"component_meshes_nb_non_manifold_facets",
|
|
306
|
+
"Model component meshes facet manifold",
|
|
307
|
+
)
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
ComponentMeshesTests = [
|
|
311
|
+
Result(brep_component_meshes_adjacency, "Adjacency"),
|
|
312
|
+
Result(component_meshes_colocation, "Colocation"),
|
|
313
|
+
Result(component_meshes_degeneration, "Degeneration"),
|
|
314
|
+
Result(brep_component_meshes_manifold, "Manifold"),
|
|
315
|
+
Result(component_meshes_intersection, "Intersections"),
|
|
316
|
+
]
|
|
317
|
+
|
|
318
|
+
elif object == "section":
|
|
319
|
+
ComponentMeshesTests = [
|
|
320
|
+
Result(component_meshes_adjacency, "Adjacency"),
|
|
321
|
+
Result(component_meshes_colocation, "Colocation"),
|
|
322
|
+
Result(component_meshes_degeneration, "Degeneration"),
|
|
323
|
+
Result(component_meshes_manifold, "Manifold"),
|
|
324
|
+
]
|
|
325
|
+
|
|
326
|
+
Wrapper_ComponentMeshesTests = Result(ComponentMeshesTests, "Component Meshes")
|
|
327
|
+
return Wrapper_ComponentMeshesTests
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def inspectors():
|
|
331
|
+
BRep_Tests = [Result([TopologyTests("brep"), ComponentMeshesTests("brep")], "BRep")]
|
|
332
|
+
CrossSection_Tests = [
|
|
333
|
+
Result(
|
|
334
|
+
[TopologyTests("section"), ComponentMeshesTests("section")], "CrossSection"
|
|
335
|
+
)
|
|
336
|
+
]
|
|
337
|
+
EdgedCurve2D_Tests = [
|
|
338
|
+
Result([ColocationTests(), DegenerationTests()], "EdgedCurve2D")
|
|
339
|
+
]
|
|
340
|
+
EdgedCurve3D_Tests = [
|
|
341
|
+
Result([ColocationTests(), DegenerationTests()], "EdgedCurve3D")
|
|
342
|
+
]
|
|
343
|
+
Graph_Tests = [Result([], "Graph", value=True)]
|
|
344
|
+
HybridSolid3D_Tests = [
|
|
345
|
+
Result(
|
|
346
|
+
[
|
|
347
|
+
AdjacencyTests("facets"),
|
|
348
|
+
ColocationTests(),
|
|
349
|
+
DegenerationTests(),
|
|
350
|
+
ManifoldTests(["edges", "facets", "vertices"]),
|
|
351
|
+
],
|
|
352
|
+
"HybridSolid3D",
|
|
353
|
+
)
|
|
354
|
+
]
|
|
355
|
+
PointSet2D_Tests = [Result([ColocationTests()], "PointSet2D", value=True)]
|
|
356
|
+
PointSet3D_Tests = [Result([ColocationTests()], "PointSet3D", value=True)]
|
|
357
|
+
PolygonalSurface2D_Tests = [
|
|
358
|
+
Result(
|
|
359
|
+
[
|
|
360
|
+
AdjacencyTests("edges"),
|
|
361
|
+
ColocationTests(),
|
|
362
|
+
DegenerationTests(),
|
|
363
|
+
ManifoldTests(["edges", "vertices"]),
|
|
364
|
+
],
|
|
365
|
+
"PolygonalSurface2D",
|
|
366
|
+
)
|
|
367
|
+
]
|
|
368
|
+
PolygonalSurface3D_Tests = [
|
|
369
|
+
Result(
|
|
370
|
+
[
|
|
371
|
+
AdjacencyTests("edges"),
|
|
372
|
+
ColocationTests(),
|
|
373
|
+
DegenerationTests(),
|
|
374
|
+
ManifoldTests(["edges", "vertices"]),
|
|
375
|
+
],
|
|
376
|
+
"PolygonalSurface3D",
|
|
377
|
+
)
|
|
378
|
+
]
|
|
379
|
+
PolyhedralSolid3D_Tests = [
|
|
380
|
+
Result(
|
|
381
|
+
[
|
|
382
|
+
AdjacencyTests("facets"),
|
|
383
|
+
ColocationTests(),
|
|
384
|
+
DegenerationTests(),
|
|
385
|
+
ManifoldTests(["edges", "facets", "vertices"]),
|
|
386
|
+
],
|
|
387
|
+
"PolyhedralSolid3D",
|
|
388
|
+
)
|
|
389
|
+
]
|
|
390
|
+
RegularGrid2D_Tests = [Result([], "RegularGrid2D", value=True)]
|
|
391
|
+
RegularGrid3D_Tests = [Result([], "RegularGrid3D", value=True)]
|
|
392
|
+
Section_Tests = [
|
|
393
|
+
Result([TopologyTests("section"), ComponentMeshesTests("section")], "Section")
|
|
394
|
+
]
|
|
395
|
+
StructuralModel_Tests = [
|
|
396
|
+
Result([TopologyTests("brep"), ComponentMeshesTests("brep")], "StructuralModel")
|
|
397
|
+
]
|
|
398
|
+
TetrahedralSolid3D_Tests = [
|
|
399
|
+
Result(
|
|
400
|
+
[
|
|
401
|
+
AdjacencyTests("facets"),
|
|
402
|
+
ColocationTests(),
|
|
403
|
+
DegenerationTests(),
|
|
404
|
+
ManifoldTests(["edges", "facets", "vertices"]),
|
|
405
|
+
],
|
|
406
|
+
"TetrahedralSolid3D",
|
|
407
|
+
)
|
|
408
|
+
]
|
|
409
|
+
TriangulatedSurface2D_Tests = [
|
|
410
|
+
Result(
|
|
411
|
+
[
|
|
412
|
+
AdjacencyTests("edges"),
|
|
413
|
+
ColocationTests(),
|
|
414
|
+
DegenerationTests(),
|
|
415
|
+
ManifoldTests(["edges", "vertices"]),
|
|
416
|
+
IntersectionTests(),
|
|
417
|
+
],
|
|
418
|
+
"TriangulatedSurface2D",
|
|
419
|
+
)
|
|
420
|
+
]
|
|
421
|
+
TriangulatedSurface3D_Tests = [
|
|
422
|
+
Result(
|
|
423
|
+
[
|
|
424
|
+
AdjacencyTests("edges"),
|
|
425
|
+
ColocationTests(),
|
|
426
|
+
DegenerationTests(),
|
|
427
|
+
ManifoldTests(["edges", "vertices"]),
|
|
428
|
+
IntersectionTests(),
|
|
429
|
+
],
|
|
430
|
+
"TriangulatedSurface3D",
|
|
431
|
+
)
|
|
432
|
+
]
|
|
433
|
+
VertexSet_Tests = [Result([], "VertexSet", value=True)]
|
|
434
|
+
|
|
435
|
+
return {
|
|
436
|
+
"BRep": {"tests_names": BRep_Tests},
|
|
437
|
+
"CrossSection": {
|
|
438
|
+
"tests_names": CrossSection_Tests,
|
|
439
|
+
},
|
|
440
|
+
"EdgedCurve2D": {
|
|
441
|
+
"tests_names": EdgedCurve2D_Tests,
|
|
442
|
+
},
|
|
443
|
+
"EdgedCurve3D": {
|
|
444
|
+
"tests_names": EdgedCurve3D_Tests,
|
|
445
|
+
},
|
|
446
|
+
"Graph": {"tests_names": Graph_Tests},
|
|
447
|
+
"HybridSolid3D": {
|
|
448
|
+
"tests_names": HybridSolid3D_Tests,
|
|
449
|
+
},
|
|
450
|
+
"PointSet2D": {
|
|
451
|
+
"tests_names": PointSet2D_Tests,
|
|
452
|
+
},
|
|
453
|
+
"PointSet3D": {
|
|
454
|
+
"tests_names": PointSet3D_Tests,
|
|
455
|
+
},
|
|
456
|
+
"PolygonalSurface2D": {
|
|
457
|
+
"tests_names": PolygonalSurface2D_Tests,
|
|
458
|
+
},
|
|
459
|
+
"PolygonalSurface3D": {
|
|
460
|
+
"tests_names": PolygonalSurface3D_Tests,
|
|
461
|
+
},
|
|
462
|
+
"PolyhedralSolid3D": {
|
|
463
|
+
"tests_names": PolyhedralSolid3D_Tests,
|
|
464
|
+
},
|
|
465
|
+
"RegularGrid2D": {"tests_names": RegularGrid2D_Tests},
|
|
466
|
+
"RegularGrid3D": {"tests_names": RegularGrid3D_Tests},
|
|
467
|
+
"Section": {
|
|
468
|
+
"tests_names": Section_Tests,
|
|
469
|
+
},
|
|
470
|
+
"StructuralModel": {
|
|
471
|
+
"tests_names": StructuralModel_Tests,
|
|
472
|
+
},
|
|
473
|
+
"TetrahedralSolid3D": {
|
|
474
|
+
"tests_names": TetrahedralSolid3D_Tests,
|
|
475
|
+
},
|
|
476
|
+
"TriangulatedSurface2D": {
|
|
477
|
+
"tests_names": TriangulatedSurface2D_Tests,
|
|
478
|
+
},
|
|
479
|
+
"TriangulatedSurface3D": {
|
|
480
|
+
"tests_names": TriangulatedSurface3D_Tests,
|
|
481
|
+
},
|
|
482
|
+
"VertexSet": {"tests_names": VertexSet_Tests},
|
|
483
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Standard library imports
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
# Third party imports
|
|
6
|
+
import flask
|
|
7
|
+
import flask_cors
|
|
8
|
+
from .. import geode_functions
|
|
9
|
+
import werkzeug
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
routes = flask.Blueprint("routes", __name__)
|
|
13
|
+
flask_cors.CORS(routes)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
schemas = os.path.join(os.path.dirname(__file__), "schemas")
|
|
17
|
+
|
|
18
|
+
with open(
|
|
19
|
+
os.path.join(schemas, "allowed_files.json"),
|
|
20
|
+
"r",
|
|
21
|
+
) as file:
|
|
22
|
+
allowed_files_json = json.load(file)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@routes.route(
|
|
26
|
+
allowed_files_json["route"],
|
|
27
|
+
methods=allowed_files_json["methods"],
|
|
28
|
+
)
|
|
29
|
+
def allowed_files():
|
|
30
|
+
geode_functions.validate_request(flask.request, allowed_files_json)
|
|
31
|
+
extensions = geode_functions.list_input_extensions(flask.request.json["key"])
|
|
32
|
+
return {"status": 200, "extensions": extensions}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
with open(
|
|
36
|
+
os.path.join(schemas, "upload_file.json"),
|
|
37
|
+
"r",
|
|
38
|
+
) as file:
|
|
39
|
+
upload_file_json = json.load(file)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@routes.route(
|
|
43
|
+
upload_file_json["route"],
|
|
44
|
+
methods=upload_file_json["methods"],
|
|
45
|
+
)
|
|
46
|
+
def upload_file():
|
|
47
|
+
if flask.request.method == "OPTIONS":
|
|
48
|
+
return flask.make_response({}, 200)
|
|
49
|
+
|
|
50
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
|
51
|
+
if not os.path.exists(UPLOAD_FOLDER):
|
|
52
|
+
os.mkdir(UPLOAD_FOLDER)
|
|
53
|
+
file = flask.request.files["file"]
|
|
54
|
+
filename = werkzeug.utils.secure_filename(os.path.basename(file.filename))
|
|
55
|
+
file.save(os.path.join(UPLOAD_FOLDER, filename))
|
|
56
|
+
return flask.make_response({"message": "File uploaded"}, 201)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
with open(
|
|
60
|
+
os.path.join(schemas, "allowed_objects.json"),
|
|
61
|
+
"r",
|
|
62
|
+
) as file:
|
|
63
|
+
allowed_objects_json = json.load(file)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@routes.route(
|
|
67
|
+
allowed_objects_json["route"],
|
|
68
|
+
methods=allowed_objects_json["methods"],
|
|
69
|
+
)
|
|
70
|
+
def allowed_objects():
|
|
71
|
+
if flask.request.method == "OPTIONS":
|
|
72
|
+
return flask.make_response({}, 200)
|
|
73
|
+
|
|
74
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
|
75
|
+
geode_functions.validate_request(flask.request, allowed_objects_json)
|
|
76
|
+
file_absolute_path = os.path.join(UPLOAD_FOLDER, flask.request.json["filename"])
|
|
77
|
+
allowed_objects = geode_functions.list_geode_objects(
|
|
78
|
+
file_absolute_path, flask.request.json["key"]
|
|
79
|
+
)
|
|
80
|
+
return flask.make_response({"allowed_objects": allowed_objects}, 200)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
with open(
|
|
84
|
+
os.path.join(schemas, "missing_files.json"),
|
|
85
|
+
"r",
|
|
86
|
+
) as file:
|
|
87
|
+
missing_files_json = json.load(file)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@routes.route(
|
|
91
|
+
missing_files_json["route"],
|
|
92
|
+
methods=missing_files_json["methods"],
|
|
93
|
+
)
|
|
94
|
+
def missing_files():
|
|
95
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
|
96
|
+
geode_functions.validate_request(flask.request, missing_files_json)
|
|
97
|
+
|
|
98
|
+
missing_files = geode_functions.missing_files(
|
|
99
|
+
flask.request.json["input_geode_object"],
|
|
100
|
+
os.path.join(UPLOAD_FOLDER, flask.request.json["filename"]),
|
|
101
|
+
)
|
|
102
|
+
has_missing_files = missing_files.has_missing_files()
|
|
103
|
+
|
|
104
|
+
mandatory_files = []
|
|
105
|
+
for mandatory_file in missing_files.mandatory_files:
|
|
106
|
+
mandatory_files.append(os.path.basename(mandatory_file))
|
|
107
|
+
|
|
108
|
+
additional_files = []
|
|
109
|
+
for additional_file in missing_files.additional_files:
|
|
110
|
+
additional_files.append(os.path.basename(additional_file))
|
|
111
|
+
|
|
112
|
+
return flask.make_response(
|
|
113
|
+
{
|
|
114
|
+
"has_missing_files": has_missing_files,
|
|
115
|
+
"mandatory_files": mandatory_files,
|
|
116
|
+
"additional_files": additional_files,
|
|
117
|
+
},
|
|
118
|
+
200,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
with open(
|
|
123
|
+
os.path.join(schemas, "geographic_coordinate_systems.json"),
|
|
124
|
+
"r",
|
|
125
|
+
) as file:
|
|
126
|
+
geographic_coordinate_systems_json = json.load(file)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@routes.route(
|
|
130
|
+
geographic_coordinate_systems_json["route"],
|
|
131
|
+
methods=geographic_coordinate_systems_json["methods"],
|
|
132
|
+
)
|
|
133
|
+
def crs_converter_geographic_coordinate_systems():
|
|
134
|
+
geode_functions.validate_request(flask.request, geographic_coordinate_systems_json)
|
|
135
|
+
infos = geode_functions.geographic_coordinate_systems(
|
|
136
|
+
flask.request.json["input_geode_object"]
|
|
137
|
+
)
|
|
138
|
+
crs_list = []
|
|
139
|
+
|
|
140
|
+
for info in infos:
|
|
141
|
+
crs = {}
|
|
142
|
+
crs["name"] = info.name
|
|
143
|
+
crs["code"] = info.code
|
|
144
|
+
crs["authority"] = info.authority
|
|
145
|
+
crs_list.append(crs)
|
|
146
|
+
|
|
147
|
+
return flask.make_response({"crs_list": crs_list}, 200)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
with open(
|
|
151
|
+
os.path.join(schemas, "geode_objects_and_output_extensions.json"),
|
|
152
|
+
"r",
|
|
153
|
+
) as file:
|
|
154
|
+
geode_objects_and_output_extensions_json = json.load(file)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@routes.route(
|
|
158
|
+
geode_objects_and_output_extensions_json["route"],
|
|
159
|
+
methods=geode_objects_and_output_extensions_json["methods"],
|
|
160
|
+
)
|
|
161
|
+
def geode_objects_and_output_extensions():
|
|
162
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
|
163
|
+
geode_functions.validate_request(
|
|
164
|
+
flask.request, geode_objects_and_output_extensions_json
|
|
165
|
+
)
|
|
166
|
+
data = geode_functions.load(
|
|
167
|
+
flask.request.json["input_geode_object"],
|
|
168
|
+
os.path.join(UPLOAD_FOLDER, flask.request.json["filename"]),
|
|
169
|
+
)
|
|
170
|
+
geode_objects_and_output_extensions = (
|
|
171
|
+
geode_functions.geode_objects_output_extensions(
|
|
172
|
+
flask.request.json["input_geode_object"], data
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
return flask.make_response(
|
|
176
|
+
{"geode_objects_and_output_extensions": geode_objects_and_output_extensions},
|
|
177
|
+
200,
|
|
178
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/allowed_files",
|
|
3
|
+
"route": "/allowed_files",
|
|
4
|
+
"methods": [
|
|
5
|
+
"POST"
|
|
6
|
+
],
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"key": {
|
|
10
|
+
"type": [
|
|
11
|
+
"string",
|
|
12
|
+
"null"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"key"
|
|
18
|
+
],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/tools/allowed_objects",
|
|
3
|
+
"route": "/allowed_objects",
|
|
4
|
+
"methods": ["POST"],
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"filename": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"key": {
|
|
11
|
+
"type": ["string", "null"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["filename", "key"],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|