- Open a 3d point featureset.
- call RemoveShapesAt()
- call Save();
_m contains 0 "M" values. and this will cause outof range exception at this line
PointShapeFile.SaveAs()
{
...
if (M != null) shpStream.WriteLe(M[shp]);
...}
Everywhere else it seems t otbe the rule that ifa file has z then it must have M also.
So this code in
FeatureSet.RemoveShapeAt() fails to copy and remove the M values
if (CoordinateType == CoordinateType.M)
{
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
is I adjust as follows it SEEMS to work
// remove the z values if necessary
if (CoordinateType == CoordinateType.Z)
{
double[] zShape = new double[sr.NumPoints];
Array.Copy(_z, sr.StartIndex, zShape, 0, sr.NumPoints);
z.AddRange(zShape);
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
Who can verify that this is the correct fix?
}
foreach (int index in remaining)
{
if (index < 0 || index >= _shapeIndices.Count) continue;
ShapeRange sr = _shapeIndices[index];
double[] xyShape = new double[sr.NumPoints * 2];
Array.Copy(_vertices, sr.StartIndex*2, xyShape, 0, sr.NumPoints * 2);
vertex.AddRange(xyShape);
// remove the m values if necessary
if (CoordinateType == CoordinateType.M)
{
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
// remove the z values if necessary
if (CoordinateType == CoordinateType.Z)
{
double[] zShape = new double[sr.NumPoints];
Array.Copy(_z, sr.StartIndex, zShape, 0, sr.NumPoints);
z.AddRange(zShape);
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
sr.StartIndex = pointTotal;
pointTotal += sr.NumPoints;
ProgressMeter.Next();
}
Comments: This issue list is no longer active. This issue has been copied to our issue list on github (https://github.com/DotSpatial/DotSpatial/issues) Please check there to find out whether this issue was fixed.
- call RemoveShapesAt()
- call Save();
_m contains 0 "M" values. and this will cause outof range exception at this line
PointShapeFile.SaveAs()
{
...
if (M != null) shpStream.WriteLe(M[shp]);
...}
Everywhere else it seems t otbe the rule that ifa file has z then it must have M also.
So this code in
FeatureSet.RemoveShapeAt() fails to copy and remove the M values
if (CoordinateType == CoordinateType.M)
{
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
is I adjust as follows it SEEMS to work
// remove the z values if necessary
if (CoordinateType == CoordinateType.Z)
{
double[] zShape = new double[sr.NumPoints];
Array.Copy(_z, sr.StartIndex, zShape, 0, sr.NumPoints);
z.AddRange(zShape);
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
Who can verify that this is the correct fix?
}
foreach (int index in remaining)
{
if (index < 0 || index >= _shapeIndices.Count) continue;
ShapeRange sr = _shapeIndices[index];
double[] xyShape = new double[sr.NumPoints * 2];
Array.Copy(_vertices, sr.StartIndex*2, xyShape, 0, sr.NumPoints * 2);
vertex.AddRange(xyShape);
// remove the m values if necessary
if (CoordinateType == CoordinateType.M)
{
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
// remove the z values if necessary
if (CoordinateType == CoordinateType.Z)
{
double[] zShape = new double[sr.NumPoints];
Array.Copy(_z, sr.StartIndex, zShape, 0, sr.NumPoints);
z.AddRange(zShape);
double[] mShape = new double[sr.NumPoints];
Array.Copy(_m, sr.StartIndex, mShape, 0, sr.NumPoints);
m.AddRange(mShape);
}
sr.StartIndex = pointTotal;
pointTotal += sr.NumPoints;
ProgressMeter.Next();
}
Comments: This issue list is no longer active. This issue has been copied to our issue list on github (https://github.com/DotSpatial/DotSpatial/issues) Please check there to find out whether this issue was fixed.