bbox/polygon durch selections ersetzen

- bbox und polygon Felder in Directus versteckt (Daten bleiben)
- Alle Auswahlen laufen nur noch über das selections-Feld
- CanvasObject, DirectusObject, API und Zeichenlogik umgestellt
- Objekte mit mehreren Auswahlen werden korrekt auf Canvas gezeichnet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:36:22 +02:00
parent 807c733770
commit e18d9a5796
5 changed files with 31 additions and 47 deletions

8
app.py
View File

@@ -79,7 +79,7 @@ def directus_objects():
token = request.headers.get("Authorization", "")
if request.method == "GET":
picture_id = request.args.get("picture_id", "")
fields = "id,bbox,polygon,selections,user_notes,parent,status,picture"
fields = "id,selections,user_notes,parent,status,picture"
path = f"/items/objects?filter[picture][_eq]={picture_id}&fields={fields}&sort=date_created"
data, status = _directus("GET", path, token)
return jsonify(data), status
@@ -771,8 +771,6 @@ def crop_image():
"id": obj_id,
"created_at": timestamp,
"source_filename": data["filename"],
"mode": processed_selections[0]["mode"], # Legacy-Feld
"bbox": processed_selections[0]["bbox"], # Legacy-Feld
"image_file": out_image_name,
"hierarchy": 1,
"parent_id": None,
@@ -780,10 +778,8 @@ def crop_image():
"position_de": data.get("position_de", ""),
"action_de": data.get("action_de", ""),
"condition_de": data.get("condition_de", ""),
"selections": processed_selections, # Neue Feld: alle Auswahlen nummeriert
"selections": processed_selections,
}
if processed_selections[0]["mode"] == "polygon":
meta["polygon"] = processed_selections[0]["polygon"] # Legacy-Feld
else:
# Legacy-Format: einzelne Auswahl (für Rückwärtskompatibilität)