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</p> 22<div id="annotation-zone"> 23<img id="annotation-image" src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}"> 24{% for region in resource.regions %} 25{% if region.json.type == "bbox" %} 26<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 27<rect x="{{ region.json.shape.x * size[0] }}" 28y="{{ region.json.shape.y * size[1] }}" 29width="{{ region.json.shape.w * size[0] }}" 30height="{{ region.json.shape.h * size[1] }}" 31fill="none" class="shape-bbox shape" 32></rect> 33{% set centre_x = region.json.shape.x + region.json.shape.w / 2 %} 34{% set centre_y = region.json.shape.y + region.json.shape.h / 2 %} 35</svg> 36{% elif region.json.type == "polygon" %} 37<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 38<polygon points="{% for point in region.json.shape %}{{ point.x * size[0] }},{{ point.y * size[1] }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon> 39{% set top = region.json.shape | sort(attribute='y') | last %} 40{% set left = region.json.shape | sort(attribute='x') | first %} 41{% set bottom = region.json.shape | sort(attribute='y') | first %} 42{% set right = region.json.shape | sort(attribute='x') | last %} 43{% set centre_x = (left.x + right.x) / 2 %} 44{% set centre_y = (top.y + bottom.y) / 2 %} 45</svg> 46{% elif region.json.type == "polyline" %} 47<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 48<polyline points="{% for point in region.json.shape %}{{ point.x * size[0] }},{{ point.y * size[1] }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline> 49{# Median point #} 50{% set centre_x = region.json.shape | map(attribute="x") | median %} 51{% set centre_y = region.json.shape | map(attribute="y") | median %} 52</svg> 53{% elif region.json.type == "point" %} 54<svg class="shape-container-viewonly" viewBox="0 0 {{ size[0] }} {{ size[1] }}"> 55<circle cx="{{ region.json.shape.x * size[0] }}" cy="{{ region.json.shape.y * size[1] }}" r="0" fill="none" class="shape-point shape"></circle> 56</svg> 57{% endif %} 58{{ shape_label(centre_x, centre_y, region.object_id) }} 59{% endfor %} 60</div> 61<x-buttonbox> 62<label> 63<input type="checkbox" id="show-shapes" checked> 64Show shapes 65</label> 66<label> 67<input type="checkbox" id="show-objects" checked> 68Show objects 69</label> 70</x-buttonbox> 71{% set licences = resource.licences | map(attribute="licence") | list %} 72{% set contains = resource.regions | map(attribute="object_id") | set | select | sort | list %} 73<x-vbox> 74<div class="icon-explainer"> 75<span>Type</span> 76<span>{{ resource.nature.id }}</span> 77<span>File format</span> 78<span>{{ resource.file_format }}</span> 79<span>Size</span> 80<span>{{ size[0] }}×{{ size[1] }}</span> 81<span>Number of regions</span> 82<span>{{ resource.regions | length }}</span> 83<span>Number of labelled regions</span> 84<span>{{ resource.regions | selectattr("object_id") | list | length }}</span> 85<span>Date uploaded</span> 86<span>{{ resource.timestamp }}</span> 87</div> 88Contains objects: {{ contains | join(", ") }} 89<x-hbox style="justify-content: space-between"> 90<small class="picture-licensing-info"> 91Available under: 92{% for licence in licences %} 93<a href="{{ licence.info_url }}" target="_blank"> 94{{ licence.title }} 95</a> 96{% if not loop.last %}, {% endif %} 97{% endfor %} 98</small> 99<x-vbox class="picture-licence-logos"> 100{% for licence in licences %} 101{% if licence.logo_url %} 102{% if licence.info_url %} 103<a href="{{ licence.info_url }}" target="_blank" tabindex="-1"> 104{# An equivalent link already exists, only one is focusable #} 105<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo"> 106</a> 107{% else %} 108<img src="{{ licence.logo_url }}" alt="{{ licence.title }}" class="licence-logo"> 109{% endif %} 110{% endif %} 111{% endfor %} 112</x-vbox> 113</x-hbox> 114</x-vbox> 115</x-frame> 116{% endblock %}