Changeset 1035


Ignore:
Timestamp:
Mar 8, 2005, 12:15:59 PM (20 years ago)
Author:
duncan
Message:

all meshes now have geo-refs.
added some assertions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/mesh.py

    r1023 r1035  
    2727
    2828import load_mesh
     29from coordinate_transforms.geo_reference import Geo_reference
    2930
    3031SET_COLOUR='red'
    31 
     32DEFAULT_ZONE = 56
    3233   
    3334def gradient_python(x0, y0, x1, y1, x2, y2, q0, q1, q2):
     
    127128    def __init__(self,X,Y, attributes = None):
    128129        __slots__ = ['x','y','attributes']
     130        assert (type(X) == types.FloatType)
    129131        self.x=X
    130132        self.y=Y       
     
    394396        """
    395397        Each segment is specified by listing the vertices of its endpoints
    396         """
    397 
     398        The vertices are Vertex objects
     399        """
    398400        assert(vertex1 != vertex2)
    399401        self.vertices = [vertex1,vertex2 ]
     
    414416            #end.draw(canvas,scale, xoffset, yoffset ) # draw the vertices
    415417            x.append(scale*(end.x + xoffset))
    416             y.append(-1*scale*(end.y + yoffset))  # - since for a canvas - is up
    417         return canvas.create_line(x[0], y[0], x[1], y[1], tags = tags,fill=colour)
     418            y.append(-1*scale*(end.y + yoffset)) # - since for a canvas - is up
     419       
     420        return canvas.create_line(x[0], y[0], x[1], y[1],
     421                                  tags = tags,fill=colour)
    418422    def set_tag(self,tag):
    419423        self.tag = tag
     
    498502
    499503        if geo_reference is None:
    500             self.geo_reference = None
     504            self.geo_reference = Geo_reference(DEFAULT_ZONE,0,0)
    501505        else:
    502506            self.geo_reference = geo_reference
     
    11191123        segment list: [(point1,point2),(p3,p4),...] (Tuples of integers)
    11201124        #segment tag list: [S1Tag, S2Tag, ...] (list of ints)
     1125
     1126        Assume the values are in Eastings and Northings, with no reference
     1127        point
    11211128        """
    11221129
     
    11241131        #index = 0
    11251132        for point in outlineDict['pointlist']:
    1126             v=Vertex(point[0], point[1])
     1133           
     1134            v=Vertex(point[0]-self.geo_reference.xllcorner,
     1135                     point[1]-self.geo_reference.yllcorner)
    11271136            #v.index = index
    11281137            #index +=1
     
    22782287    elif (ofile[-4:]== ".tsh" or ofile[-4:]== ".msh"):
    22792288        dict = load_mesh.loadASCII.import_triangulation(ofile)
    2280         print "********"
    2281         print "zq mesh.dict",dict
    2282         print "********"
     2289        #print "********"
     2290        #print "zq mesh.dict",dict
     2291        #print "********"
    22832292        newmesh= Mesh()
    22842293        newmesh.IOOutline2Mesh(dict)
Note: See TracChangeset for help on using the changeset viewer.