Changeset 1188

Show
Ignore:
Timestamp:
10/19/07 16:28:39 (1 year ago)
Author:
sgillies
Message:

Add a georeferencing event

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesGeocoder/trunk/geo.py

    r1185 r1188  
    3030from zope.interface import implements 
    3131from zope.app.annotation.interfaces import IAnnotations 
     32 
     33from zope.event import notify 
    3234from persistent.dict import PersistentDict 
    3335 
     
    3739from Products.PleiadesGeocoder.interfaces \ 
    3840    import IGeoreferenceable, IGeoserializable, \ 
    39         IGeoItemSimple, IGeoCollectionSimple 
     41        IGeoItemSimple, IGeoCollectionSimple, IGeoreferencedEvent 
     42 
     43 
     44class GeoreferencedEvent(object): 
     45    """Event to notify that object has been georeferenced. 
     46    """ 
     47    implements(IGeoreferencedEvent) 
     48     
     49    def __init__(self, context): 
     50        self.context = context 
     51 
    4052 
    4153ANNO_KEY = 'geocoder.simple.item' 
     
    90102            """%s is invalid. Supported geometry types are: 'point', 'line', 'polygon', 'box'""" % (geomtype) 
    91103        self.georef['geometryType'] = geomtype 
     104        notify(GeoreferencedEvent(self)) 
    92105 
    93106    def getSpatialCoordinates(self): 
     
    157170                "Insufficient number of ordinates: %s" % str(point) 
    158171        self.georef['spatialCoordinates'] = value.lstrip() 
     172        notify(GeoreferencedEvent(self)) 
    159173 
    160174    def setGeoInterface(self, geomtype, coordinates): 
     
    185199                "Insufficient number of ordinates: %s" % str(point) 
    186200        self.georef['spatialCoordinates'] = value.lstrip() 
     201        notify(GeoreferencedEvent(self)) 
    187202 
    188203    def isGeoreferenced(self): 
     
    303318    def getBoundingBox(self): 
    304319        raise NotImplementedError 
    305          
     320 
     321 
     322 
  • PleiadesGeocoder/trunk/geocode.py

    r1161 r1188  
    2828# =========================================================================== 
    2929 
    30 from Globals import InitializeClass 
    3130from OFS.SimpleItem import SimpleItem 
    3231from OFS.PropertyManager import PropertyManager 
  • PleiadesGeocoder/trunk/interfaces/__init__.py

    r206 r1188  
    3232from simple import IGeoItemSimple, IGeoCollectionSimple 
    3333 
     34from zope.interface import Interface, Attribute 
     35 
     36class IGeoreferencedEvent(Interface): 
     37    """An event fired when georeferenced. 
     38    """ 
     39     
     40    context = Attribute("The content object that was saved.") 
     41