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))
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'])
def get_georeference(self): if IGeoreferenceable.providedBy(self.context): try: IWriteGeoreferenced(self.context) coord = Coordinates(self.context).coordinates self['coordinates'] = coord except: pass
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 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))
def has_map(self): if not IGeoreferenceable.providedBy(self.context): return False else: return True
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))
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)