| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
from zope.interface import Interface, Attribute |
|---|
| 31 |
from zope.app.annotation.interfaces import IAttributeAnnotatable |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
class IGeoAnnotatableContent(IAttributeAnnotatable): |
|---|
| 38 |
"""Marker for content. |
|---|
| 39 |
""" |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
class IGeoFolder(Interface): |
|---|
| 43 |
"""Marker for folders of. |
|---|
| 44 |
""" |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
class IGeoreferenceable(Interface): |
|---|
| 52 |
"""Marks an object that may be annotated with georeferencing properties. |
|---|
| 53 |
""" |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
class IGeoserializable(Interface): |
|---|
| 57 |
"""Marks an object that can be serialized eventually to GeoRSS and KML. |
|---|
| 58 |
""" |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
class IGeoserializableMembersFolder(Interface): |
|---|
| 62 |
|
|---|
| 63 |
"""Marker especially for a Plone site's "Members" folder. |
|---|
| 64 |
|
|---|
| 65 |
A specific marker is required in order to adapt the member folder |
|---|
| 66 |
differently than folders containing AT content types. |
|---|
| 67 |
""" |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
class IGeoreferencedEvent(Interface): |
|---|
| 73 |
"""An event fired when georeferenced. |
|---|
| 74 |
""" |
|---|
| 75 |
|
|---|
| 76 |
context = Attribute("The content object that was saved.") |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
class IGeoItemSimple(Interface): |
|---|
| 82 |
|
|---|
| 83 |
"""A simple georeferenced object, analogous to a GeoRSS entry, a KML |
|---|
| 84 |
placemark, or a GeoJSON feature. |
|---|
| 85 |
|
|---|
| 86 |
The spatial reference system is implicitly lat/long WGS84. |
|---|
| 87 |
""" |
|---|
| 88 |
|
|---|
| 89 |
geom_type = Attribute( |
|---|
| 90 |
"""Name of geometry type: 'Point', 'LineString', or 'Polygon'""" |
|---|
| 91 |
) |
|---|
| 92 |
|
|---|
| 93 |
coords = Attribute( |
|---|
| 94 |
"""GeoJSON-style coordinates tuple(s) with long, lat ordering.""" |
|---|
| 95 |
) |
|---|
| 96 |
|
|---|
| 97 |
__geo_interface__ = Attribute( |
|---|
| 98 |
"""A mapping that provides Python geo interface. See |
|---|
| 99 |
http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface. |
|---|
| 100 |
""" |
|---|
| 101 |
) |
|---|
| 102 |
|
|---|
| 103 |
def setGeoInterface(geom_type, coords): |
|---|
| 104 |
"""Set type and coordinates, following the geo interface spec.""" |
|---|
| 105 |
|
|---|
| 106 |
def isGeoreferenced(): |
|---|
| 107 |
"""Returns True if the item is "on the map", meaning that the item |
|---|
| 108 |
has a geometry type and coordinates.""" |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
class IGeoCollectionSimple(Interface): |
|---|
| 112 |
|
|---|
| 113 |
"""A folder-ish collection of objects that provide IGeoItemSimple. |
|---|
| 114 |
""" |
|---|
| 115 |
|
|---|
| 116 |
def geoItems(): |
|---|
| 117 |
"""Return georeferenced items in the container.""" |
|---|
| 118 |
|
|---|