@@ -766,7 +766,6 @@ def testMultipoint(self):
766
766
assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
767
767
768
768
assert multipoint .insertVertex (6 , 6 , 2 ), "MULTIPOINT append 6,6 at 2 failed"
769
-
770
769
expwkt = "MULTIPOINT(4 4, 5 5, 6 6, 7 7)"
771
770
wkt = multipoint .exportToWkt ()
772
771
assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
@@ -775,19 +774,16 @@ def testMultipoint(self):
775
774
assert not multipoint .deleteVertex (- 1 ), "MULTIPOINT delete at -1 unexpectedly succeeded"
776
775
777
776
assert multipoint .deleteVertex (1 ), "MULTIPOINT delete at 1 failed"
778
-
779
777
expwkt = "MULTIPOINT(4 4, 6 6, 7 7)"
780
778
wkt = multipoint .exportToWkt ()
781
779
assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
782
780
783
781
assert multipoint .deleteVertex (2 ), "MULTIPOINT delete at 2 failed"
784
-
785
782
expwkt = "MULTIPOINT(4 4, 6 6)"
786
783
wkt = multipoint .exportToWkt ()
787
784
assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
788
785
789
786
assert multipoint .deleteVertex (0 ), "MULTIPOINT delete at 2 failed"
790
-
791
787
expwkt = "MULTIPOINT(6 6)"
792
788
wkt = multipoint .exportToWkt ()
793
789
assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
@@ -852,6 +848,49 @@ def testDeleteVertex(self):
852
848
assert not polyline .deleteVertex ( - 5 ), "Delete vertex -5 unexpectedly succeeded"
853
849
assert not polyline .deleteVertex ( 100 ), "Delete vertex 100 unexpectedly succeeded"
854
850
851
+ # 2-3 6-+-7
852
+ # | | | |
853
+ # 0-1 4 5 8-9
854
+ polyline = QgsGeometry .fromWkt ("MULTILINESTRING((0 0, 1 0, 1 1, 2 1,2 0),(3 0, 3 1, 5 1, 5 0, 6 0))" )
855
+ assert polyline .deleteVertex (5 ), "Delete vertex 5 failed"
856
+ expwkt = "MULTILINESTRING((0 0, 1 0, 1 1, 2 1, 2 0), (3 1, 5 1, 5 0, 6 0))"
857
+ wkt = polyline .exportToWkt ()
858
+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
859
+
860
+ assert not polyline .deleteVertex (- 100 ), "Delete vertex -100 unexpectedly succeeded"
861
+ assert not polyline .deleteVertex (100 ), "Delete vertex 100 unexpectedly succeeded"
862
+
863
+ assert polyline .deleteVertex (0 ), "Delete vertex 0 failed"
864
+ expwkt = "MULTILINESTRING((1 0, 1 1, 2 1, 2 0), (3 1, 5 1, 5 0, 6 0))"
865
+ wkt = polyline .exportToWkt ()
866
+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
867
+
868
+ # 5---4
869
+ # | |
870
+ # | 2-3
871
+ # | |
872
+ # 0-1
873
+ polygon = QgsGeometry .fromWkt ("POLYGON((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))" )
874
+
875
+ assert polygon .deleteVertex (2 ), "Delete vertex 2 failed"
876
+ print "FIXME: exportToWkt doesn't put a blanks behind the comma"
877
+ expwkt = "POLYGON((0 0,1 0,2 1,2 2,0 2,0 0))"
878
+ wkt = polygon .exportToWkt ()
879
+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
880
+
881
+ assert polygon .deleteVertex (0 ), "Delete vertex 0 failed"
882
+ expwkt = "POLYGON((1 0,2 1,2 2,0 2,1 0))"
883
+ wkt = polygon .exportToWkt ()
884
+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
885
+
886
+ assert polygon .deleteVertex (4 ), "Delete vertex 4 failed"
887
+ expwkt = "POLYGON((2 1,2 2,0 2,2 1))"
888
+ wkt = polygon .exportToWkt ()
889
+ assert compareWkt ( expwkt , wkt ), "Expected:\n %s\n Got:\n %s\n " % (expwkt , wkt )
890
+
891
+ assert not polygon .deleteVertex (- 100 ), "Delete vertex -100 unexpectedly succeeded"
892
+ assert not polygon .deleteVertex (100 ), "Delete vertex 100 unexpectedly succeeded"
893
+
855
894
# 5-+-4 0-+-9
856
895
# | | | |
857
896
# 6 2-3 1-2 +
0 commit comments