root/PleiadesGeocoder/trunk/interfaces/simple.py

Revision 1223, 3.6 kB (checked in by sgillies, 1 year ago)

Restore interfaces.simple module for backwards compatibility

Line 
1 # ===========================================================================
2 # Copyright (C) 2006 Ancient World Mapping Center
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 #
18 # About Pleiades
19 # --------------
20 #
21 # Pleiades is an international research network and associated web portal and
22 # content management system devoted to the study of ancient geography.
23 #
24 # See http://icon.stoa.org/trac/pleiades/wiki.
25 #
26 # Funding for the creation of this software was provided by a grant from the
27 # U.S. National Endowment for the Humanities (http://www.neh.gov).
28 # ===========================================================================
29
30 from zope.interface import Interface, Attribute
31 from zope.app.annotation.interfaces import IAttributeAnnotatable
32
33
34 # IGeoAnnotatableContent and IGeoFolder are markers specifically for
35 # ..geo.GeoItemSimple and GeoCollectionSimple
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 # IGeoreferenceable and IGeoserializable are markers for viewability using
48 # the @@geo and @@edit_geo views. These markers can be reused outside this
49 # particular product.
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 # A georeferencing event
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 # Interfaces to be provided by adapters.
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
Note: See TracBrowser for help on using the browser.