Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe 0261 #181

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/recipes/0261-non-rectangular-commenting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Annotation with a Non-Rectangular Polygon
| | **Cookbook URLs** |
|--------------|-------------------|
| **Recipe:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/) |
| **JSON-LD:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json) |

### Method 1 -
```python
--8<-- "docs/recipes/scripts/0261-non-rectangular-commenting-method1.py"
```
24 changes: 24 additions & 0 deletions docs/recipes/scripts/0261-non-rectangular-commenting-method1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from iiif_prezi3 import Manifest, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json", label="Picture of Göttingen taken during the 2019 IIIF Conference")
canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/canvas/p1",
anno_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0001-image",
anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p1/1")
anno = canvas.make_annotation(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0002-svg",
motivation="tagging",
body={"type": "TextualBody",
"language": "de",
"format": "text/plain",
"value": "Gänseliesel-Brunnen"},
target={"type": "SpecificResource",
"source": canvas.id,
"selector": {"type": "SvgSelector",
"value": "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M270.000000,1900.000000 L1530.000000,1900.000000 L1530.000000,1610.000000 L1315.000000,1300.000000 L1200.000000,986.000000 L904.000000,661.000000 L600.000000,986.000000 L500.000000,1300.000000 L270,1630 L270.000000,1900.000000' /></g></svg>"
}
},
anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p2/1")

print(manifest.json(indent=2))