示例#1
0
 def save(self, *args, **kwargs):
     self.apply_manipulators()
     if self.geometry_final:
         self.geometry_final = clean_geometry(self.geometry_final)
     super(SpatialFeature, self).save(*args, **kwargs) # Call the "real" save() method
示例#2
0
文件: views.py 项目: Ecotrust/madrona
                html_response = html_response + result["html"] 

        except manipClass.InvalidGeometryException, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except manipClass.InternalException, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except manipClass.HaltManipulations, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except Exception as e:
            return respond_with_error(message=str(e))      
    #end manipulator for loop      

    #manipulators ran fine and the resulting shape is ready for outbound processing
    new_shape.transform(settings.GEOMETRY_DB_SRID) 
    new_shape.transform(settings.GEOMETRY_CLIENT_SRID)
    new_shape = clean_geometry(new_shape)
    # #we should probably move this static value 20 to a settings variable
    # # new_shape = new_shape.simplify(20, preserve_topology=True)
    # new_shape.transform(settings.GEOMETRY_CLIENT_SRID)
    # new_shape = clean_geometry(new_shape)

    return respond_with_template(html_response, submitted, new_shape, result["success"])

def respond_with_template(status_html, submitted, final_shape, success="1"):
    if final_shape:
        final_shape_kml = display_kml(final_shape)
    else:
        final_shape_kml = ''
    user_shape = parsekml(submitted)
    user_shape.srid = settings.GEOMETRY_CLIENT_SRID
    user_shape.transform(settings.GEOMETRY_DB_SRID)
示例#3
0
                html_response = html_response + result["html"]

        except manipClass.InvalidGeometryException, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except manipClass.InternalException, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except manipClass.HaltManipulations, e:
            return respond_with_template(e.html, submitted, None, e.success)
        except Exception as e:
            return respond_with_error(message=str(e))
    #end manipulator for loop

    #manipulators ran fine and the resulting shape is ready for outbound processing
    new_shape.transform(settings.GEOMETRY_DB_SRID)
    new_shape.transform(settings.GEOMETRY_CLIENT_SRID)
    new_shape = clean_geometry(new_shape)
    # #we should probably move this static value 20 to a settings variable
    # # new_shape = new_shape.simplify(20, preserve_topology=True)
    # new_shape.transform(settings.GEOMETRY_CLIENT_SRID)
    # new_shape = clean_geometry(new_shape)

    return respond_with_template(html_response, submitted, new_shape,
                                 result["success"])


def respond_with_template(status_html, submitted, final_shape, success="1"):
    if final_shape:
        final_shape_kml = display_kml(final_shape)
    else:
        final_shape_kml = ''
    user_shape = parsekml(submitted)
示例#4
0
 def save(self, *args, **kwargs):
     self.apply_manipulators()
     if self.geometry_final:
         self.geometry_final = clean_geometry(self.geometry_final)
     super(SpatialFeature,
           self).save(*args, **kwargs)  # Call the "real" save() method