Changeset 3100
- Timestamp:
- Jun 6, 2006, 3:07:37 PM (18 years ago)
- Location:
- inundation/pmesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pmesh/mesh.py
r3084 r3100 1953 1953 load_mesh.loadASCII.export_points_file(ofile,point_dict) 1954 1954 1955 1956 def import_ungenerate_file(self,ofile, tag=None): 1957 """ 1958 Imports an ungenerate file, from arcGIS into mesh. 1959 1960 ofile is the name of the ungenerated file. 1961 Tag is a string name to be taggged on each segment. 1962 1963 WARNING values are assumed to be absolute. 1964 geo-refs are not taken into account.. 1965 """ 1966 1967 dict = importUngenerateFile(ofile) 1968 default_tag = Segment.get_default_tag() 1969 if tag is not None: 1970 Segment.set_default_tag(str(tag)) 1971 self.addVertsSegs(dict) 1972 Segment.set_default_tag(default_tag) 1973 1974 # change the tag back to it's default 1975 1955 1976 1956 1977 ########### IO CONVERTERS ################## -
inundation/pmesh/test_mesh.py
r3097 r3100 1117 1117 m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4]) 1118 1118 dict = importUngenerateFile(fileName) 1119 os.remove(fileName)1119 #os.remove(fileName) 1120 1120 1121 1121 tag = "DSG" … … 1136 1136 self.failUnless(m.userSegments[10].tag == tag, 1137 1137 'wrong tag.') 1138 1138 1139 ## let's test the method 1140 a = Vertex (0.0, 0.0) #, attributes = [1.1]) 1141 b = Vertex (0.0, 40.0) #, attributes = [1.2]) 1142 c = Vertex (40.0,40.0) #, attributes = [1.3]) 1143 d = Vertex (40.0,0.0) #, attributes = [1.4]) 1144 1145 s1 = Segment(a,b) 1146 s2 = Segment(b,c) 1147 s3 = Segment(c,d) 1148 s4 = Segment(d,a) 1149 1150 m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4]) 1151 1152 tag = "DSG" 1153 initial_tag = "PIG" 1154 Segment.set_default_tag(initial_tag) 1155 m.import_ungenerate_file(fileName, tag=tag) 1156 1157 os.remove(fileName) 1158 1159 self.failUnless(Segment.get_default_tag() == initial_tag, 1160 'Wrong segment list length.') 1161 1162 1163 # have to reset this , since it's a class attribute 1164 Segment.set_default_tag("") 1165 1166 self.failUnless(len(m.userSegments) ==11, 1167 'Wrong segment list length.') 1168 self.failUnless(len(m.userVertices) == 11, 1169 'Wrong vertex list length.') 1170 self.failUnless(m.userSegments[10].vertices[0] == m.userVertices[10], 1171 'bad vertex on segment.') 1172 self.failUnless(m.userSegments[10].vertices[1] == m.userVertices[8], 1173 'Bad segment.') 1174 self.failUnless(m.userSegments[10].tag == tag, 1175 'wrong tag.') 1176 1139 1177 def test_ungenerateFileLoadingII(self): 1140 1178 … … 1169 1207 m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4]) 1170 1208 dict = importUngenerateFile(fileName) 1171 os.remove(fileName)1209 #os.remove(fileName) 1172 1210 1173 1211 tag = "DSG" … … 1179 1217 self.failUnless(len(m.userVertices) == 11, 1180 1218 'Wrong vertex list length.') 1219 1220 # Test the method 1221 a = Vertex (0.0, 0.0) #, attributes = [1.1]) 1222 b = Vertex (0.0, 40.0) #, attributes = [1.2]) 1223 c = Vertex (40.0,40.0) #, attributes = [1.3]) 1224 d = Vertex (40.0,0.0) #, attributes = [1.4]) 1225 1226 s1 = Segment(a,b) 1227 s2 = Segment(b,c) 1228 s3 = Segment(c,d) 1229 s4 = Segment(d,a) 1230 1231 m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4]) 1232 tag = "DSG" 1233 initial_tag = "PIG" 1234 Segment.set_default_tag(initial_tag) 1235 m.import_ungenerate_file(fileName, tag=tag) 1236 1237 os.remove(fileName) 1238 1239 self.failUnless(Segment.get_default_tag() == initial_tag, 1240 'Wrong segment list length.') 1241 1242 1243 self.failUnless(len(m.userSegments) ==10, 1244 'Wrong segment list length.') 1245 self.failUnless(len(m.userVertices) == 11, 1246 'Wrong vertex list length.') 1247 1248 # have to reset this , since it's a class attribute 1249 Segment.set_default_tag("") 1181 1250 1182 1251 def test_addVertsSegs(self):
Note: See TracChangeset
for help on using the changeset viewer.