# ===========================================================================
# Copyright (C) 2006 Ancient World Mapping Center
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 
# About Pleiades
# --------------
#
# Pleiades is an international research network and associated web portal and
# content management system devoted to the study of ancient geography. 
#
# See http://icon.stoa.org/trac/pleiades/wiki.
#
# Funding for the creation of this software was provided by a grant from the 
# U.S. National Endowment for the Humanities (http://www.neh.gov).
# ===========================================================================

from zope.interface import Interface, Attribute
from zope.app.annotation.interfaces import IAttributeAnnotatable


# IGeoAnnotatableContent and IGeoFolder are markers specifically for 
# ..geo.GeoItemSimple and GeoCollectionSimple

class IGeoAnnotatableContent(IAttributeAnnotatable):
    """Marker for content.
    """


class IGeoFolder(Interface):
    """Marker for folders of.
    """


# IGeoreferenceable and IGeoserializable are markers for viewability using 
# the @@geo and @@edit_geo views. These markers can be reused outside this
# particular product.

class IGeoreferenceable(Interface):
    """Marks an object that may be annotated with georeferencing properties.
    """
   

class IGeoserializable(Interface):
    """Marks an object that can be serialized eventually to GeoRSS and KML.
    """
   

class IGeoserializableMembersFolder(Interface):
    
    """Marker especially for a Plone site's "Members" folder.
    
    A specific marker is required in order to adapt the member folder
    differently than folders containing AT content types.
    """


# A georeferencing event

class IGeoreferencedEvent(Interface):
    """An event fired when georeferenced.
    """
    
    context = Attribute("The content object that was saved.")


# Interfaces to be provided by adapters.

class IGeoItemSimple(Interface):

    """A simple georeferenced object, analogous to a GeoRSS entry, a KML
    placemark, or a GeoJSON feature.

    The spatial reference system is implicitly lat/long WGS84.
    """

    geom_type = Attribute(
        """Name of geometry type: 'Point', 'LineString', or 'Polygon'"""
        )

    coords = Attribute(
        """GeoJSON-style coordinates tuple(s) with long, lat ordering."""
        )

    __geo_interface__ = Attribute(
        """A mapping that provides Python geo interface. See
        http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface.
        """
        )
    
    def setGeoInterface(geom_type, coords):
        """Set type and coordinates, following the geo interface spec."""

    def isGeoreferenced():
        """Returns True if the item is "on the map", meaning that the item
        has a geometry type and coordinates."""


class IGeoCollectionSimple(Interface):

    """A folder-ish collection of objects that provide IGeoItemSimple.
    """

    def geoItems():
        """Return georeferenced items in the container."""

