Ignore:
Timestamp:
Jun 19, 2006, 10:30:57 AM (18 years ago)
Author:
duncan
Message:

added function to pmesh.mesh for adding vertices by passing in a geospatial instance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pmesh/mesh.py

    r3100 r3177  
    1313   Geoscience Australia
    1414"""
    15 import load_mesh.loadASCII
    16 import alpha_shape.alpha_shape
    1715
    1816import sys
     
    2927from coordinate_transforms.geo_reference import Geo_reference,DEFAULT_ZONE
    3028from utilities.polygon import point_in_polygon
     29import load_mesh.loadASCII
     30import alpha_shape.alpha_shape
     31from geospatial_data.geospatial_data import Geospatial_data, ensure_geospatial
    3132
    3233SET_COLOUR='red'
     
    609610
    610611   
    611    
     612    def add_vertices(self, data):
     613        data = ensure_geospatial(data)
     614
     615        # get points relative to the mesh geo_ref
     616        points = data.get_data_points(geo_reference=self.geo_reference)
     617        #FIXME finish....
     618   
     619        for point in points:
     620            v=Vertex(point[0], point[1])
     621            self.userVertices.append(v)
     622           
    612623    def add_hole_from_polygon(self, polygon, tags=None, geo_reference=None):
    613624        """
     
    853864       
    854865    def getUserVertices(self):
     866        """
     867        Note: The x,y values will be relative to the mesh geo_reference
     868        This returns a list of vertex objects
     869        """
    855870        return self.userVertices
     871
     872    def get_user_vertices(self, absolute=True):
     873        """
     874        This returns a list of (x,y) values
     875        (maybe it should return a geospatical object?
     876        It makes it a bit confusing though.)
     877        """
     878        pointlist=[]
     879        for vertex in self.userVertices:
     880            pointlist.append([vertex.x,vertex.y])
     881        spat = Geospatial_data(pointlist, geo_reference=self.geo_reference)
     882        return spat.get_data_points(absolute=absolute)
    856883   
    857884    def getUserSegments(self):
Note: See TracChangeset for help on using the changeset viewer.