picture.html
HTML document, ASCII text
1{% extends "default.html" %} 2{% block title %}Picture {{ resource.title }} | gigadata{% endblock %} 3{% macro shape_label(x, y, text) %} 4{% if text %} 5<a class="shape-label" style="left: {{ x * 100 }}%; top: {{ y * 100 }}%" href="/object/{{ text }}"> 6{{ text }} 7</a> 8{% endif %} 9{% endmacro %} 10{% block content %} 11<x-frame style="--width: 768px"> 12<h1>{{ resource.title }}</h1> 13<p>{{ resource.description }}</p> 14<p> 15<a href="{{ resource.origin_url }}">Original source</a> | 16<a href="/raw/picture/{{ resource.id }}">View</a> | 17<a href="/raw/picture/{{ resource.id }}" download="GigadataPicture_{{ resource.id }}{{ file_extension }}">Download</a> | 18<a href="/picture/{{ resource.id }}/annotate">Annotate</a> | 19<a href="/picture/{{ resource.id }}/put-annotations-form">Submit JSON annotations</a> | 20<a href="/picture/{{ resource.id }}/get-annotations">Download annotations</a> | 21<a href="/picture/{{ resource.id }}/edit-metadata">Edit title or description</a> | 22<a href="/picture/{{ resource.id }}/copy">Copy</a> 23</p> 24<details> 25<summary>Delete</summary> 26<a href="/picture/{{ resource.id }}/delete">Delete</a> 27</details> 28<div id="annotation-zone"> 29<img id="annotation-image" src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}"> 30{% for region in resource.regions %} 31{% if region.json.type == "bbox" %} 32<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 33<rect x="{{ region.json.shape.x * size[0] }}" 34y="{{ region.json.shape.y * size[1] }}" 35width="{{ region.json.shape.w * size[0] }}" 36height="{{ region.json.shape.h * size[1] }}" 37fill="none" class="shape-bbox shape" 38></rect> 39{% set centre_x = region.json.shape.x + region.json.shape.w / 2 %} 40{% set centre_y = region.json.shape.y + region.json.shape.h / 2 %} 41</svg> 42{% elif region.json.type == "polygon" %} 43<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 44<polygon points="{% for point in region.json.shape %}{{ point.x * size[0] }},{{ point.y * size[1] }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon> 45{% set top = region.json.shape | sort(attribute='y') | last %} 46{% set left = region.json.shape | sort(attribute='x') | first %} 47{% set bottom = region.json.shape | sort(attribute='y') | first %} 48{% set right = region.json.shape | sort(attribute='x') | last %} 49{% set centre_x = (left.x + right.x) / 2 %} 50{% set centre_y = (top.y + bottom.y) / 2 %} 51</svg> 52{% elif region.json.type == "polyline" %} 53<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 54<polyline points="{% for point in region.json.shape %}{{ point.x * size[0] }},{{ point.y * size[1] }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline> 55{# Median point #} 56{% set centre_x = region.json.shape | map(attribute="x") | median %} 57{% set centre_y = region.json.shape | map(attribute="y") | median %} 58</svg> 59{% elif region.json.type == "point" %} 60<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 61<circle cx="{{ region.json.shape.x * size[0] }}" cy="{{ region.json.shape.y * size[1] }}" r="0" fill="none" class="shape-point shape"></circle> 62</svg> 63{% endif %} 64{{ shape_label(centre_x, centre_y, region.object_id) }} 65{% endfor %} 66</div> 67<x-buttonbox> 68<label> 69<input type="checkbox" id="show-shapes" checked> 70Show shapes 71</label> 72<label> 73<input type="checkbox" id="show-objects" checked> 74Show objects 75</label> 76</x-buttonbox> 77{% set licences = resource.licences | map(attribute="licence") | list %} 78{% set contains = resource.regions | map(attribute="object_id") | set | select | sort | list %} 79<x-vbox> 80<div class="icon-explainer"> 81<span>Type</span> 82<span>{{ resource.nature.id }}</span> 83<span>File format</span> 84<span>{{ resource.file_format }}</span> 85<span>Size</span> 86<span>{{ size[0] }}×{{ size[1] }}</span> 87<span>Number of regions</span> 88<span>{{ resource.regions | length }}</span> 89<span>Number of labelled regions</span> 90<span>{{ resource.regions | selectattr("object_id") | list | length }}</span> 91<span>Date uploaded</span> 92<span>{{ resource.timestamp }}</span> 93</div> 94Contains objects: {{ contains | join(", ") }} 95<x-hbox style="justify-content: space-between"> 96<small class="picture-licensing-info"> 97Available under: 98{% for licence in licences %} 99<a href="{{ licence.info_url }}" target="_blank"> 100{{ licence.title }} 101</a> 102{% if not loop.last %}, {% endif %} 103{% endfor %} 104</small> 105<x-vbox class="picture-licence-logos"> 106{% for licence in licences %} 107{% if licence.logo_url %} 108{% if licence.info_url %} 109<a href="{{ licence.info_url }}" target="_blank" tabindex="-1"> 110{# An equivalent link already exists, only one is focusable #} 111<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo"> 112</a> 113{% else %} 114<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo"> 115{% endif %} 116{% endif %} 117{% endfor %} 118</x-vbox> 119</x-hbox> 120</x-vbox> 121</x-frame> 122{% endblock %}