Skip to content
Merged

Next #122

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# CHANGELOG


## v5.6.0-rc.3 (2025-02-28)


## v5.6.0-rc.2 (2025-02-28)

### Bug Fixes

- **createpoint**: Fix create point function
([`1634179`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/16341793ec9cb249ab966f9d076539e2108760de))

- **deps**: Stable
([`a56191f`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/a56191fbb81bb2a7f08a8cf18850d2c3b15a6197))


## v5.6.0-rc.1 (2025-02-28)

### Features

- **routes**: Texture coordinates route/data/schema
([`b29cd27`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/b29cd27028a7a474023f597ad7b6a4c6ebd4855c))


## v5.5.1 (2025-02-26)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "OpenGeodeWeb-Back"
version = "5.5.1"
version = "5.6.0-rc.3"
dynamic = ["dependencies"]
authors = [
{ name="Geode-solutions", email="[email protected]" },
Expand Down
13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ flask[async]==3.1.0
# via
# -r requirements.in
# flask-cors
flask-cors==5.0.0
flask-cors==5.0.1
# via -r requirements.in
geode-background==8.9.3
geode-background==8.9.4
# via
# geode-explicit
# geode-implicit
Expand All @@ -35,7 +35,7 @@ geode-common==33.5.0
# geode-numerics
# geode-simplex
# geode-viewables
geode-conversion==6.1.5
geode-conversion==6.1.6
# via
# geode-explicit
# geode-implicit
Expand All @@ -51,7 +51,7 @@ geode-numerics==5.2.5
# -r requirements.in
# geode-implicit
# geode-simplex
geode-simplex==9.0.10
geode-simplex==9.0.11
# via
# -r requirements.in
# geode-implicit
Expand All @@ -69,7 +69,7 @@ markupsafe==3.0.2
# via
# jinja2
# werkzeug
opengeode-core==15.10.1
opengeode-core==15.12.0
# via
# -r requirements.in
# geode-background
Expand Down Expand Up @@ -110,7 +110,7 @@ referencing==0.36.2
# via
# jsonschema
# jsonschema-specifications
rpds-py==0.22.3
rpds-py==0.23.1
# via
# jsonschema
# referencing
Expand All @@ -122,3 +122,4 @@ werkzeug==3.1.3
# via
# -r requirements.in
# flask
# flask-cors
36 changes: 35 additions & 1 deletion src/opengeodeweb_back/routes/blueprint_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,28 +283,62 @@ def save_viewable_file():
def create_point():
utils_functions.validate_request(flask.request, create_point_json)
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
title = flask.request.json["title"]
x = flask.request.json["x"]
y = flask.request.json["y"]
z = flask.request.json["z"]
class_ = geode_functions.geode_object_class("PointSet3D")
PointSet3D = class_.create()
builder = geode_functions.create_builder("PointSet3D", PointSet3D)
builder.create_point(opengeode.Point3D([x, y, z]))

builder.set_name(title)
name = PointSet3D.name()
generated_id = str(uuid.uuid4()).replace("-", "")
object_type = geode_functions.get_object_type("PointSet3D")
saved_native_file_path = geode_functions.save(
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id + ".og_pts3d"
)
saved_viewable_file_path = geode_functions.save_viewable(
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id
)

native_file_name = os.path.basename(saved_native_file_path[0])
viewable_file_name = os.path.basename(saved_viewable_file_path)

return flask.make_response(
{
"viewable_file_name": os.path.basename(saved_viewable_file_path),
"id": generated_id,
"name": name,
"native_file_name": native_file_name,
"viewable_file_name": viewable_file_name,
"object_type": object_type,
"geode_object": "PointSet3D",
},
200,
)


with open(os.path.join(schemas, "texture_coordinates.json"), "r") as file:
texture_coordinates_json = json.load(file)


@routes.route(
texture_coordinates_json["route"],
methods=texture_coordinates_json["methods"],
)
def texture_coordinates():
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
utils_functions.validate_request(flask.request, texture_coordinates_json)
data = geode_functions.load(
flask.request.json["input_geode_object"],
os.path.join(DATA_FOLDER_PATH, flask.request.json["filename"]),
)
texture_coordinates = data.texture_manager().texture_names()

return flask.make_response({"texture_coordinates": texture_coordinates}, 200)


with open(
os.path.join(schemas, "vertex_attribute_names.json"),
"r",
Expand Down
4 changes: 4 additions & 0 deletions src/opengeodeweb_back/routes/schemas/create_point.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
],
"type": "object",
"properties": {
"title": {
"type": "string"
},
"x": {
"type": "number"
},
Expand All @@ -16,6 +19,7 @@
}
},
"required": [
"title",
"x",
"y",
"z"
Expand Down
24 changes: 24 additions & 0 deletions src/opengeodeweb_back/routes/schemas/texture_coordinates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"route": "/texture_coordinates",
"methods": [
"POST"
],
"type": "object",
"properties": {
"input_geode_object": {
"type": [
"string"
]
},
"filename": {
"type": [
"string"
]
}
},
"required": [
"input_geode_object",
"filename"
],
"additionalProperties": false
}
19 changes: 19 additions & 0 deletions tests/data/hat.vtp

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ def get_full_data():
test_utils.test_route_wrong_params(client, route, get_full_data)


def test_texture_coordinates(client):
response = client.post(
"/texture_coordinates",
json={
"input_geode_object": "PolygonalSurface3D",
"filename": "hat.vtp",
},
)
assert response.status_code == 200
texture_coordinates = response.json["texture_coordinates"]
assert type(texture_coordinates) is list
for texture_coordinate in texture_coordinates:
assert type(texture_coordinate) is str


def test_vertex_attribute_names(client):
route = f"/vertex_attribute_names"
for geode_object, value in geode_objects.geode_objects_dict().items():
Expand Down Expand Up @@ -279,7 +294,7 @@ def get_full_data():

def test_create_point(client):
route = f"/create_point"
get_full_data = lambda: {"x": 1, "y": 2, "z": 3}
get_full_data = lambda: {"title": "test_point", "x": 1, "y": 2, "z": 3}

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