Changeset 9203
- Timestamp:
- Jun 19, 2014, 6:49:04 PM (10 years ago)
- Location:
- trunk/anuga_core/source/anuga/utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/utilities/spatialInputUtil.py
r9201 r9203 264 264 segLen=(seg_unitVec_x**2+seg_unitVec_y**2)**0.5 265 265 if(segLen==0.): 266 print line267 print 'Pt'268 print pt269 raise Exception, 'Line has repeated points '266 #print line 267 #print 'Pt' 268 #print pt 269 raise Exception, 'Line has repeated points: Line %s Pt %s' % (str(line),str(pt)) 270 270 seg_unitVec_x=seg_unitVec_x/segLen 271 271 seg_unitVec_y=seg_unitVec_y/segLen … … 472 472 if(L1_L2_intersect.GetGeometryCount()==1): 473 473 if(not check_polygon_is_small(L1_L2_intersect, buf, tol2)): 474 print L1_L2_intersect.GetEnvelope()475 raise Exception, 'line intersection is not allowed '474 #print L1_L2_intersect.GetEnvelope() 475 raise Exception, 'line intersection is not allowed. Envelope %s '% str(L1_L2_intersect.GetEnvelope()) 476 476 # Seems to need special treatment with only 1 intersection point 477 477 intersectionPts=[L1_L2_intersect.Centroid().GetPoint()] -
trunk/anuga_core/source/anuga/utilities/test_spatialInputUtil.py
r9201 r9203 16 16 from anuga.utilities import spatialInputUtil as su 17 17 18 # pull -v argument from command line 19 verbose = anuga.get_args().verbose 18 20 19 21 class Test_spatialInputUtil(unittest.TestCase): … … 206 208 seg2_wkb=su.ListPts2Wkb(seg2,geometry_type='line') 207 209 208 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose= False)210 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose=verbose) 209 211 newSeg1=su.Wkb2ListPts(newSeg1) 210 212 newSeg2=su.Wkb2ListPts(newSeg2) … … 221 223 seg1_wkb=su.ListPts2Wkb(seg1,geometry_type='line') 222 224 seg2_wkb=su.ListPts2Wkb(seg2,geometry_type='line') 223 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose= False)225 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose=verbose) 224 226 newSeg1=su.Wkb2ListPts(newSeg1) 225 227 newSeg2=su.Wkb2ListPts(newSeg2) … … 241 243 seg2_wkb=su.ListPts2Wkb(seg2,geometry_type='line') 242 244 243 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose= False,\245 newSeg1,newSeg2=su.addIntersectionPtsToLines(seg1_wkb,seg2_wkb,verbose=verbose,\ 244 246 point_movement_threshold=0.01) 245 247 newSeg1=su.Wkb2ListPts(newSeg1) … … 327 329 newBP, newBL, newRW=su.add_intersections_to_domain_features(bounding_polygon,\ 328 330 breakLines, riverWalls, point_movement_threshold=0.02,\ 329 verbose= False)331 verbose=verbose) 330 332 assert False 331 333 except: 332 334 assert True 333 335 336 #print 'After first add_iinersections' 334 337 ################################################################# 335 338 # Fix the riverwall, and it should work … … 339 342 newBP, newBL, newRW=su.add_intersections_to_domain_features(bounding_polygon,\ 340 343 breakLines, riverWalls, point_movement_threshold=0.02,\ 341 verbose= False)344 verbose=verbose) 342 345 343 346 return … … 346 349 if __name__ == "__main__": 347 350 suite = unittest.makeSuite(Test_spatialInputUtil, 'test') 348 runner = unittest.TextTestRunner( )351 runner = unittest.TextTestRunner(verbosity=1) 349 352 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.