diff --git a/app.py b/app.py index 7d67cf0..772b332 100755 --- a/app.py +++ b/app.py @@ -28,9 +28,11 @@ def object(id: int): return render_template('object.html', object=object) -@app.route("/calibration") -def calibration(): - return render_template('calibration.html') +@app.route("/calibration/") +def calibration(id: int): + conn = db.get() + object = db.Object.get_from_id(id, conn) + return render_template('calibration.html', object=object) @app.route('/static/') diff --git a/templates/calibration.html b/templates/calibration.html index f0e20fa..150724e 100644 --- a/templates/calibration.html +++ b/templates/calibration.html @@ -3,9 +3,10 @@ {% block content %}
+

Visualisation de l'étalonnage de {{ object.name }}

-

Positions 3D des LEDs

+

Positions 3D des LEDs

@@ -15,7 +16,7 @@
-

Vue de la LED selectionnée

+

Vue de la LED selectionnée

diff --git a/templates/object.html b/templates/object.html index 5348076..43068cd 100644 --- a/templates/object.html +++ b/templates/object.html @@ -4,6 +4,14 @@

{{ object.name }}

+
{% endblock content %} diff --git a/ts/Engine.ts b/ts/Engine.ts index 8abf411..b3810f0 100644 --- a/ts/Engine.ts +++ b/ts/Engine.ts @@ -43,6 +43,9 @@ function getImageElementById(id: string): HTMLImageElement { * The class that manages the interface for the calibration visualisation. */ export class Engine { + /** The id of the object to scan. */ + objectId: number; + /** HTML element on which the renderer will be added. */ domElement: HTMLElement; @@ -102,12 +105,15 @@ export class Engine { /** Initialises the engine. */ static async create(domId: string) { + let objectId = parseInt(window.location.pathname.split('/')[2], 10); + let domElement = getElementById(domId); let engine = new Engine(); + engine.objectId = objectId; engine.domElement = domElement; engine.initHtml(); - let request = await fetch('/data/calibration.json'); + let request = await fetch('/data/' + objectId + '/calibration.json'); let calibration = await request.json(); engine.initScene(calibration); engine.initListeners(); @@ -290,7 +296,7 @@ export class Engine { showImage(led: Led): void { if (led.on) { this.selectedObject.innerText = led.name + ' (' + ( this.leds.currentLedIndex + 1) + '/' + this.leds.children.length + ')'; - this.ledView.src = '/data/small/' + led.name; + this.ledView.src = '/data/' + this.objectId + '/' + led.name; this.ledView.style.display = 'block'; } else { this.selectedObject.innerText = 'aucune';