Skip to content

Commit cb96d8f

Browse files
Merge pull request #122 from Geode-solutions/next
Next
2 parents 44bbcae + 9caeae6 commit cb96d8f

File tree

8 files changed

+128
-9
lines changed

8 files changed

+128
-9
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# CHANGELOG
22

33

4+
## v5.6.0-rc.3 (2025-02-28)
5+
6+
7+
## v5.6.0-rc.2 (2025-02-28)
8+
9+
### Bug Fixes
10+
11+
- **createpoint**: Fix create point function
12+
([`1634179`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/16341793ec9cb249ab966f9d076539e2108760de))
13+
14+
- **deps**: Stable
15+
([`a56191f`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/a56191fbb81bb2a7f08a8cf18850d2c3b15a6197))
16+
17+
18+
## v5.6.0-rc.1 (2025-02-28)
19+
20+
### Features
21+
22+
- **routes**: Texture coordinates route/data/schema
23+
([`b29cd27`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/b29cd27028a7a474023f597ad7b6a4c6ebd4855c))
24+
25+
426
## v5.5.1 (2025-02-26)
527

628

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "OpenGeodeWeb-Back"
8-
version = "5.5.1"
8+
version = "5.6.0-rc.3"
99
dynamic = ["dependencies"]
1010
authors = [
1111
{ name="Geode-solutions", email="[email protected]" },

requirements.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ flask[async]==3.1.0
1818
# via
1919
# -r requirements.in
2020
# flask-cors
21-
flask-cors==5.0.0
21+
flask-cors==5.0.1
2222
# via -r requirements.in
23-
geode-background==8.9.3
23+
geode-background==8.9.4
2424
# via
2525
# geode-explicit
2626
# geode-implicit
@@ -35,7 +35,7 @@ geode-common==33.5.0
3535
# geode-numerics
3636
# geode-simplex
3737
# geode-viewables
38-
geode-conversion==6.1.5
38+
geode-conversion==6.1.6
3939
# via
4040
# geode-explicit
4141
# geode-implicit
@@ -51,7 +51,7 @@ geode-numerics==5.2.5
5151
# -r requirements.in
5252
# geode-implicit
5353
# geode-simplex
54-
geode-simplex==9.0.10
54+
geode-simplex==9.0.11
5555
# via
5656
# -r requirements.in
5757
# geode-implicit
@@ -69,7 +69,7 @@ markupsafe==3.0.2
6969
# via
7070
# jinja2
7171
# werkzeug
72-
opengeode-core==15.10.1
72+
opengeode-core==15.12.0
7373
# via
7474
# -r requirements.in
7575
# geode-background
@@ -110,7 +110,7 @@ referencing==0.36.2
110110
# via
111111
# jsonschema
112112
# jsonschema-specifications
113-
rpds-py==0.22.3
113+
rpds-py==0.23.1
114114
# via
115115
# jsonschema
116116
# referencing
@@ -122,3 +122,4 @@ werkzeug==3.1.3
122122
# via
123123
# -r requirements.in
124124
# flask
125+
# flask-cors

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,28 +283,62 @@ def save_viewable_file():
283283
def create_point():
284284
utils_functions.validate_request(flask.request, create_point_json)
285285
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
286+
title = flask.request.json["title"]
286287
x = flask.request.json["x"]
287288
y = flask.request.json["y"]
288289
z = flask.request.json["z"]
289290
class_ = geode_functions.geode_object_class("PointSet3D")
290291
PointSet3D = class_.create()
291292
builder = geode_functions.create_builder("PointSet3D", PointSet3D)
292293
builder.create_point(opengeode.Point3D([x, y, z]))
293-
294+
builder.set_name(title)
295+
name = PointSet3D.name()
294296
generated_id = str(uuid.uuid4()).replace("-", "")
297+
object_type = geode_functions.get_object_type("PointSet3D")
298+
saved_native_file_path = geode_functions.save(
299+
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id + ".og_pts3d"
300+
)
295301
saved_viewable_file_path = geode_functions.save_viewable(
296302
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id
297303
)
298304

305+
native_file_name = os.path.basename(saved_native_file_path[0])
306+
viewable_file_name = os.path.basename(saved_viewable_file_path)
307+
299308
return flask.make_response(
300309
{
301310
"viewable_file_name": os.path.basename(saved_viewable_file_path),
302311
"id": generated_id,
312+
"name": name,
313+
"native_file_name": native_file_name,
314+
"viewable_file_name": viewable_file_name,
315+
"object_type": object_type,
316+
"geode_object": "PointSet3D",
303317
},
304318
200,
305319
)
306320

307321

322+
with open(os.path.join(schemas, "texture_coordinates.json"), "r") as file:
323+
texture_coordinates_json = json.load(file)
324+
325+
326+
@routes.route(
327+
texture_coordinates_json["route"],
328+
methods=texture_coordinates_json["methods"],
329+
)
330+
def texture_coordinates():
331+
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
332+
utils_functions.validate_request(flask.request, texture_coordinates_json)
333+
data = geode_functions.load(
334+
flask.request.json["input_geode_object"],
335+
os.path.join(DATA_FOLDER_PATH, flask.request.json["filename"]),
336+
)
337+
texture_coordinates = data.texture_manager().texture_names()
338+
339+
return flask.make_response({"texture_coordinates": texture_coordinates}, 200)
340+
341+
308342
with open(
309343
os.path.join(schemas, "vertex_attribute_names.json"),
310344
"r",

src/opengeodeweb_back/routes/schemas/create_point.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
],
66
"type": "object",
77
"properties": {
8+
"title": {
9+
"type": "string"
10+
},
811
"x": {
912
"type": "number"
1013
},
@@ -16,6 +19,7 @@
1619
}
1720
},
1821
"required": [
22+
"title",
1923
"x",
2024
"y",
2125
"z"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"route": "/texture_coordinates",
3+
"methods": [
4+
"POST"
5+
],
6+
"type": "object",
7+
"properties": {
8+
"input_geode_object": {
9+
"type": [
10+
"string"
11+
]
12+
},
13+
"filename": {
14+
"type": [
15+
"string"
16+
]
17+
}
18+
},
19+
"required": [
20+
"input_geode_object",
21+
"filename"
22+
],
23+
"additionalProperties": false
24+
}

tests/data/hat.vtp

Lines changed: 19 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_routes.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,21 @@ def get_full_data():
166166
test_utils.test_route_wrong_params(client, route, get_full_data)
167167

168168

169+
def test_texture_coordinates(client):
170+
response = client.post(
171+
"/texture_coordinates",
172+
json={
173+
"input_geode_object": "PolygonalSurface3D",
174+
"filename": "hat.vtp",
175+
},
176+
)
177+
assert response.status_code == 200
178+
texture_coordinates = response.json["texture_coordinates"]
179+
assert type(texture_coordinates) is list
180+
for texture_coordinate in texture_coordinates:
181+
assert type(texture_coordinate) is str
182+
183+
169184
def test_vertex_attribute_names(client):
170185
route = f"/vertex_attribute_names"
171186
for geode_object, value in geode_objects.geode_objects_dict().items():
@@ -279,7 +294,7 @@ def get_full_data():
279294

280295
def test_create_point(client):
281296
route = f"/create_point"
282-
get_full_data = lambda: {"x": 1, "y": 2, "z": 3}
297+
get_full_data = lambda: {"title": "test_point", "x": 1, "y": 2, "z": 3}
283298

284299
# Normal test with all keys
285300
response = client.post(route, json=get_full_data())

0 commit comments

Comments
 (0)