def test_update_markers(self):
     new_geo_types = self.p_types[1:]
     update_georeferenceable_objects(self.portal, new_geo_types)
     for oid in self.obj_ids:
         obj = self.folder[oid]
         if obj.portal_type in new_geo_types:
             self.assertTrue(IGeoreferenceable.providedBy(obj))
         else:
             self.assertFalse(IGeoreferenceable.providedBy(obj))
 def test_add_marker(self):
     new_geo_type = self.p_types[0]
     update_georeferenceable_objects(self.portal, [new_geo_type])
     for oid in self.obj_ids:
         obj = self.folder[oid]
         if obj.portal_type == new_geo_type:
             self.assertTrue(IGeoreferenceable.providedBy(obj))
         else:
             self.assertFalse(IGeoreferenceable.providedBy(obj))
Example #3
0
 def add(self):
     """ Add the markage
     """
     if IGeoreferenceable.providedBy(self.context):
         return
     alsoProvides(self.context, IGeoreferenceable)
     self.context.reindexObject(idxs=['object_provides'])
 def clear(self):
     """ Clear the markage
     """
     if not IGeoreferenceable.providedBy(self.context):
         return
     noLongerProvides(self.context, IGeoreferenceable)
     self.context.reindexObject(idxs=['object_provides'])
Example #5
0
 def clear(self):
     """ Clear the markage
     """
     if not IGeoreferenceable.providedBy(self.context):
         return
     noLongerProvides(self.context, IGeoreferenceable)
     self.context.reindexObject(idxs=['object_provides'])
 def add(self):
     """ Add the markage
     """
     if IGeoreferenceable.providedBy(self.context):
         return
     alsoProvides(self.context, IGeoreferenceable)
     self.context.reindexObject(idxs=['object_provides'])
Example #7
0
 def get_georeference(self):
     if IGeoreferenceable.providedBy(self.context):
         try:
             IWriteGeoreferenced(self.context)
             coord = Coordinates(self.context).coordinates
             self['coordinates'] = coord
         except:
             pass
Example #8
0
 def get_georeference(self):
     if IGeoreferenceable.providedBy(self.context):
         try:
             IWriteGeoreferenced(self.context)
             coord = Coordinates(self.context).coordinates
             self['coordinates'] = coord
         except:
             pass
Example #9
0
def zgeo_geometry_value(obj):
    if isinstance(obj.location, RelationValue):
        if obj.location.isBroken():
            obj.location = None
            raise AttributeError
        contact_obj = obj.location.to_object
    else:
        contact_obj = obj
    if IGeoreferenceable.providedBy(contact_obj):
        # old_geo = IGeoreferenced(obj)
        # old_geo.removeGeoInterface()
        geo = IGeoreferenced(contact_obj)
        if geo.type and geo.coordinates:
            return {'type': geo.type, 'coordinates': geo.coordinates}
    # The catalog expects AttributeErrors when a value can't be found
    raise AttributeError
Example #10
0
def zgeo_geometry_value(obj):
    if isinstance(obj.location, RelationValue):
        if obj.location.isBroken():
            obj.location = None
            raise AttributeError
        contact_obj = obj.location.to_object
    else:
        contact_obj = obj
    if IGeoreferenceable.providedBy(contact_obj):
        # old_geo = IGeoreferenced(obj)
        # old_geo.removeGeoInterface()
        geo = IGeoreferenced(contact_obj)
        if geo.type and geo.coordinates:
            return {
                'type': geo.type,
                'coordinates': geo.coordinates
            }
    # The catalog expects AttributeErrors when a value can't be found
    raise AttributeError
 def isGeoreferenceable(self):
     geo_contenttypes = geo_settings().geo_content_types
     return (
         IGeoreferenceable.providedBy(self.context) and
         self.context.portal_type in geo_contenttypes)
 def test_after_obj_creation(self):
     for oid in self.obj_ids:
         obj = self.portal[oid]
         self.assertTrue(IGeoreferenceable.providedBy(obj))
Example #13
0
 def has_map(self):
     if not IGeoreferenceable.providedBy(self.context):
         return False
     else:
         return True
Example #14
0
 def isGeoreferenceable(self):
     geo_contenttypes = geo_settings().geo_content_types
     return (IGeoreferenceable.providedBy(self.context)
             and self.context.portal_type in geo_contenttypes)
 def test_after_obj_creation(self):
     for oid in self.obj_ids:
         obj = self.folder[oid]
         self.assertFalse(IGeoreferenceable.providedBy(obj))
Example #16
0
 def has_map(self):
     if not IGeoreferenceable.providedBy(self.context):
         return False
     else:
         return True
Example #17
0
 def show_map(self):
     """
     """
     return HAS_GEO_EXTRA and IGeoreferenceable.providedBy(self.context) and not self.context.hide_map
 def isGeoreferenceable(self):
     return IGeoreferenceable.providedBy(self.context)
 def isGeoreferenceable(self):
     return IGeoreferenceable.providedBy(self.context)