@@ -642,6 +642,8 @@ bool QgsGeometry::deleteVertexAt(QgsGeometryVertexIndex atVertex)
642
642
int pointindex = 0 ;
643
643
for (int linenr = 0 ; linenr < *nLines; ++linenr)
644
644
{
645
+ ptr += (sizeof (int ) + 1 );
646
+ newBufferPtr += (sizeof (int ) + 1 );
645
647
nPoints = (int *)ptr;
646
648
ptr += sizeof (int );
647
649
int newNPoint;
@@ -660,6 +662,7 @@ bool QgsGeometry::deleteVertexAt(QgsGeometryVertexIndex atVertex)
660
662
newNPoint = *nPoints;
661
663
}
662
664
memcpy (newBufferPtr, &newNPoint, sizeof (int ));
665
+ newBufferPtr += sizeof (int );
663
666
664
667
for (int pointnr = 0 ; pointnr < *nPoints; ++pointnr)
665
668
{
@@ -873,6 +876,47 @@ bool QgsGeometry::insertVertexBefore(double x, double y, QgsGeometryVertexIndex
873
876
}
874
877
case QGis::WKBMultiLineString:
875
878
{
879
+ int * nLines = (int *)ptr;
880
+ int * nPoints = 0 ; // number of points in a line
881
+ ptr += sizeof (int );
882
+ memcpy (newBufferPtr, nLines, sizeof (int ));
883
+ newBufferPtr += sizeof (int );
884
+ int pointindex = 0 ;
885
+
886
+ for (int linenr = 0 ; linenr < *nLines; ++linenr)
887
+ {
888
+ ptr += (sizeof (int ) + 1 );
889
+ newBufferPtr += (sizeof (int ) + 1 );
890
+ nPoints = (int *)ptr;
891
+ int newNPoints;
892
+ if (vertexnr >= pointindex && vertexnr < (pointindex + (*nPoints)))// point is in this ring
893
+ {
894
+ newNPoints = (*nPoints)+1 ;
895
+ }
896
+ else
897
+ {
898
+ newNPoints = *nPoints;
899
+ }
900
+ memcpy (newBufferPtr, &newNPoints, sizeof (double ));
901
+ newBufferPtr += sizeof (int );
902
+ ptr += sizeof (int );
903
+
904
+ for (int pointnr = 0 ; pointnr < *nPoints; ++pointnr)
905
+ {
906
+ memcpy (newBufferPtr, ptr, sizeof (double ));// x
907
+ memcpy (newBufferPtr+sizeof (double ), ptr+sizeof (double ), sizeof (double ));// y
908
+ ptr += 2 *sizeof (double );
909
+ newBufferPtr += 2 *sizeof (double );
910
+ ++pointindex;
911
+ if (pointindex == vertexnr)
912
+ {
913
+ memcpy (newBufferPtr, &x, sizeof (double ));
914
+ memcpy (newBufferPtr+sizeof (double ), &y, sizeof (double ));
915
+ newBufferPtr += 2 *sizeof (double );
916
+ success = true ;
917
+ }
918
+ }
919
+ }
876
920
break ;
877
921
}
878
922
case QGis::WKBPolygon:
0 commit comments