예제 #1
0
 def result(self, clipped_shape, html="", success="1"):
     clipped_shape = ensure_clean(clipped_shape, settings.GEOMETRY_DB_SRID)
     return {
         "clipped_shape": clipped_shape,
         "html": html,
         "success": success
     }
예제 #2
0
    def apply_manipulators(self, force=False):
        if force or (self.geometry_orig and not self.geometry_final):
            logger.debug("applying manipulators to %r" % self)

            target_shape = self.geometry_orig.transform(GEOMETRY_CLIENT_SRID, clone=True).wkt
            logger.debug("active manipulators: %r" % self.active_manipulators)
            result = False
            for manipulator in self.active_manipulators:
                m = manipulator(target_shape)
                result = m.manipulate()
                target_shape = result['clipped_shape'].wkt
            if not result:
                raise Exception("No result returned - maybe manipulators did not run?")
            geo = result['clipped_shape']
            geo.transform(GEOMETRY_DB_SRID)
            ensure_clean(geo, GEOMETRY_DB_SRID)
            if geo:
                self.geometry_final = geo
            else:
                raise Exception('Could not pre-process geometry')
예제 #3
0
    def apply_manipulators(self, force=False):
        if force or (self.geometry_orig and not self.geometry_final):
            logger.debug("applying manipulators to %r" % self)

            target_shape = self.geometry_orig.transform(GEOMETRY_CLIENT_SRID, clone=True).wkt
            logger.debug("active manipulators: %r" % self.active_manipulators)
            result = False
            for manipulator in self.active_manipulators:
                m = manipulator(target_shape)
                result = m.manipulate()
                target_shape = result['clipped_shape'].wkt
            if not result:
                raise Exception("No result returned - maybe manipulators did not run?")
            geo = result['clipped_shape']
            geo.transform(GEOMETRY_DB_SRID)
            ensure_clean(geo, GEOMETRY_DB_SRID)
            if geo:
                self.geometry_final = geo
            else:
                raise Exception('Could not pre-process geometry')
 def result(self, clipped_shape, html="", success="1"):
     clipped_shape = ensure_clean(clipped_shape, settings.GEOMETRY_DB_SRID)
     return {"clipped_shape": clipped_shape, "html": html, "success": success}