diff --git a/parts/maps/elab-annotated.png b/parts/maps/elab-annotated.png new file mode 100644 index 0000000..85b4d41 Binary files /dev/null and b/parts/maps/elab-annotated.png differ diff --git a/parts/server.py b/parts/server.py index 0f5d227..6ba1f44 100755 --- a/parts/server.py +++ b/parts/server.py @@ -212,7 +212,8 @@ def query(filter_dummy, query): return json.dumps(l) @app.route(baseURL+'/map/') -def getMap(containerID): +@app.route(baseURL+'/map//') +def getMap(containerID, annotate=None): s = 'select map, overlay from containers where id = :id;' r = db_engine.execute(text(s), id=containerID) l = [] @@ -233,6 +234,13 @@ def getMap(containerID): # width, height = pointer.size # pointerLayer.paste(pointer, (x - int(width/2), y-int(height/2))) mapimage = Image.alpha_composite(mapImage, overlayImage) + if annotate=='a': + try: + annotationName = mapFile.split('.')[0] + '-annotated.' + mapFile.split('.')[1] + annotationImage = Image.open('maps/' + annotationName).convert("RGBA") + mapimage = Image.alpha_composite(mapimage, annotationImage) + except FileNotFoundError: + pass return serveImage(mapimage) diff --git a/parts/static/script.js b/parts/static/script.js index 7780fd3..129994a 100755 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -23,6 +23,11 @@ function init_edit(partID) { $('input[name=notes-input]').show(); $('table#details tr#notes td p').hide(); + // make map have names of containers for this one click + if (!$('img#map').attr('src').endsWith('/a')){ + $('img#map').attr('src', $('img#map').attr('src') + '/a') + } + // var newButton = '
'; // $('.round-button-left').replaceWith(newButton); $('#edit-button').html(''); @@ -41,7 +46,11 @@ function new_entry() { init_edit(-1); overlay_in(); container_onchange(); - + + // make map have names of containers for this one click + if (!$('img#map').attr('src').endsWith('/a')){ + $('img#map').attr('src', $('img#map').attr('src') + '/a') + } } function end_edit() {