def end_join(self, other, k): fault_polyline = self.getPolyline(k) if isinstance(other, Fault): other_polyline = other.getPolyline(k) else: other_polyline = other return GeometryTools.joinPolylines(fault_polyline, other_polyline)
def test_join__polylines(self): l1 = Polyline(init_points=[(0, 1), (1, 1)]) l2 = CPolyline(init_points=[(2, -1), (2, 0)]) l3 = CPolyline(init_points=[(2, 2), (2, 3)]) l4 = Polyline() l5 = CPolyline(init_points=[(0.5, 0), (0.5, 2)]) with self.assertRaises(ValueError): GeometryTools.joinPolylines(l1, l4) with self.assertRaises(ValueError): GeometryTools.joinPolylines(l4, l1) self.assertIsNone(GeometryTools.joinPolylines(l1, l5)) self.assertEqual(GeometryTools.joinPolylines(l1, l2), [(1, 1), (2, 0)])
def test_join__polylines(self): l1 = Polyline( init_points = [(0,1) , (1,1)]) l2 = CPolyline( init_points = [(2,-1) , (2,0)]) l3 = CPolyline( init_points = [(2,2) , (2,3)]) l4 = Polyline( ) l5 = CPolyline( init_points = [(0.5,0),(0.5,2)] ) with self.assertRaises( ValueError ): GeometryTools.joinPolylines( l1 , l4 ) with self.assertRaises( ValueError ): GeometryTools.joinPolylines( l4 , l1 ) self.assertIsNone( GeometryTools.joinPolylines( l1 , l5 )) self.assertEqual( GeometryTools.joinPolylines( l1 , l2 ) , [(1,1) , (2,0)] )