Changeset 348

Show
Ignore:
Timestamp:
09/28/06 17:52:27 (2 years ago)
Author:
sgillies
Message:

add adapter to IGeoCollectionSimple

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • GeographicEntityLite/trunk/GeographicEntityLite/adapters/__init__.py

    r321 r348  
    2828# =========================================================================== 
    2929 
    30 from simple import GeoEntitySimple 
     30from simple import GeoEntitySimple, GeoCollectionSimple 
    3131 
  • GeographicEntityLite/trunk/GeographicEntityLite/adapters/simple.py

    r331 r348  
    3030from zope.interface import implements 
    3131 
    32 from Products.PleiadesGeocoder.interfaces import IGeoItemSimple 
     32from Products.PleiadesGeocoder.interfaces import IGeoItemSimple \ 
     33    , IGeoCollectionSimple 
    3334 
    3435class GeoEntitySimple(object): 
     
    101102        return info 
    102103 
     104 
     105class GeoCollectionSimple(object): 
     106     
     107    """Adapter for Folderish collections of GeoItemSimple. 
     108    """ 
     109    implements(IGeoCollectionSimple) 
     110     
     111    def __init__(self, context): 
     112        """Initialize.""" 
     113        self.context = context 
     114         
     115    def geoItems(self): 
     116        try: 
     117            item = IGeoItemSimple(self.context) 
     118            assert(item.isGeoreferenced()) 
     119            return [item] 
     120        except: 
     121            return [] 
     122 
     123    def getItemsInfo(self): 
     124        infos = [] 
     125        for item in self.geoItems(): 
     126            infos.append(item.getInfo()) 
     127        return infos 
     128 
     129    def getBoundingBox(self): 
     130        raise NotImplementedError 
     131         
  • GeographicEntityLite/trunk/GeographicEntityLite/configure.zcml

    r321 r348  
    1010    /> 
    1111 
     12  <adapter 
     13    for=".interfaces.IGeoEntityLite" 
     14    provides="Products.PleiadesGeocoder.interfaces.IGeoCollectionSimple" 
     15    factory=".adapters.GeoCollectionSimple" 
     16    /> 
     17 
    1218  <five:implements 
    1319    class=".content.GeographicEntityLite.GeographicEntityLite" 
  • GeographicEntityLite/trunk/GeographicEntityLite/skins/GeographicEntityLite/geographicentitylite_view.pt

    r345 r348  
    2828            <script 
    2929              tal:define="mapcontext python:query_results[0].getObject(); 
    30                           feature_json string:${context/JSON}; 
    31                           map_json string:${mapcontext/JSON};" 
     30                          feature_json string:${context/json}; 
     31                          map_json string:${mapcontext/json};" 
    3232              defer="defer" 
    3333              type="text/javascript"