small-annotation-display.html
ASCII text
1{% macro annotation_display(resource) %} 2<div class="annotation-zone"> 3<img src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}"> 4{% for region in resource.regions %} 5{% if region.json.type == "bbox" %} 6<svg class="shape-container" viewBox="0 0 1 1" preserveAspectRatio="none"> 7<rect x="{{ region.json.shape.x }}" 8y="{{ region.json.shape.y }}" 9width="{{ region.json.shape.w }}" 10height="{{ region.json.shape.h }}" 11fill="none" class="shape-bbox shape" 12></rect> 13</svg> 14{% elif region.json.type == "polygon" %} 15<svg class="shape-container" viewBox="0 0 1 1" preserveAspectRatio="none"> 16<polygon points="{% for point in region.json.shape %}{{ point.x }},{{ point.y }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon> 17</svg> 18{% elif region.json.type == "polyline" %} 19<svg class="shape-container" viewBox="0 0 1 1" preserveAspectRatio="none"> 20<polyline points="{% for point in region.json.shape %}{{ point.x }},{{ point.y }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline> 21</svg> 22{% elif region.json.type == "point" %} 23<svg class="shape-container" viewBox="0 0 1 1" preserveAspectRatio="none"> 24<circle cx="{{ region.json.shape.x }}" cy="{{ region.json.shape.y }}" r="0" fill="none" class="shape-point shape"></circle> 25</svg> 26{% endif %} 27{% endfor %} 28</div> 29{% endmacro %}