pass down the same SpatialReference
This commit is contained in:
+7
-1
@@ -37,7 +37,13 @@ public class MultipatchFeatureToSpeckleConverter : ITypedConverter<ACG.Multipatc
|
||||
int ptCount = target.GetPatchPointCount(idx);
|
||||
for (int ptIdx = ptStartIndex; ptIdx < ptStartIndex + ptCount; ptIdx++)
|
||||
{
|
||||
pointList.Add(_pointConverter.Convert(target.Points[ptIdx]));
|
||||
ACG.MapPoint newPt = new ACG.MapPointBuilderEx(
|
||||
target.Points[ptIdx].X,
|
||||
target.Points[ptIdx].Y,
|
||||
target.Points[ptIdx].Z,
|
||||
target.SpatialReference
|
||||
).ToGeometry();
|
||||
pointList.Add(_pointConverter.Convert(newPt));
|
||||
}
|
||||
allPoints.Add(pointList);
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ public class MultipointFeatureToSpeckleConverter : ITypedConverter<ACG.Multipoin
|
||||
List<SOG.Point> multipoint = new();
|
||||
foreach (ACG.MapPoint point in target.Points)
|
||||
{
|
||||
multipoint.Add(_pointConverter.Convert(point));
|
||||
ACG.MapPoint newPt = new ACG.MapPointBuilderEx(point.X, point.Y, point.Z, target.SpatialReference).ToGeometry();
|
||||
multipoint.Add(_pointConverter.Convert(newPt));
|
||||
}
|
||||
|
||||
return multipoint;
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ public class PolygonFeatureToSpeckleConverter : ITypedConverter<ACG.Polygon, IRe
|
||||
for (int idx = 0; idx < partCount; idx++)
|
||||
{
|
||||
ACG.ReadOnlySegmentCollection segmentCollection = target.Parts[idx];
|
||||
segmentCollection.SpatialReference = target.SpatialReference;
|
||||
SOG.Polyline polyline = _segmentConverter.Convert(segmentCollection);
|
||||
|
||||
bool isExteriorRing = target.IsExteriorRing(idx);
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ public class PolyineFeatureToSpeckleConverter : ITypedConverter<ACG.Polyline, IR
|
||||
|
||||
foreach (var segmentCollection in polylineToConvert.Parts)
|
||||
{
|
||||
segmentCollection.SpatialReference = target.SpatialReference;
|
||||
polylineList.Add(_segmentConverter.Convert(segmentCollection));
|
||||
}
|
||||
return polylineList;
|
||||
|
||||
+15
-8
@@ -60,13 +60,22 @@ public class SegmentCollectionToSpeckleConverter : ITypedConverter<ACG.ReadOnlyS
|
||||
{
|
||||
foreach (ACG.Segment? subSegment in subSegments)
|
||||
{
|
||||
ACG.MapPoint startPt = new ACG.MapPointBuilderEx(
|
||||
subSegment.StartPoint.X,
|
||||
subSegment.StartPoint.Y,
|
||||
subSegment.StartPoint.Z,
|
||||
target.SpatialReference
|
||||
).ToGeometry();
|
||||
ACG.MapPoint endPt = new ACG.MapPointBuilderEx(
|
||||
subSegment.EndPoint.X,
|
||||
subSegment.EndPoint.Y,
|
||||
subSegment.EndPoint.Z,
|
||||
target.SpatialReference
|
||||
).ToGeometry();
|
||||
|
||||
AddPtsToPolylinePts(
|
||||
points,
|
||||
new List<SOG.Point>()
|
||||
{
|
||||
_pointConverter.Convert(subSegment.StartPoint),
|
||||
_pointConverter.Convert(subSegment.EndPoint)
|
||||
}
|
||||
new List<SOG.Point>() { _pointConverter.Convert(startPt), _pointConverter.Convert(endPt) }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -85,14 +94,12 @@ public class SegmentCollectionToSpeckleConverter : ITypedConverter<ACG.ReadOnlyS
|
||||
}
|
||||
|
||||
// check the last point, remove if coincides with the first. Assign as Closed instead
|
||||
bool closed = false;
|
||||
if (
|
||||
Math.Round(points[^1].x, 6) == Math.Round(points[0].x, 6)
|
||||
&& Math.Round(points[^1].y, 6) == Math.Round(points[0].y, 6)
|
||||
&& Math.Round(points[^1].z, 6) == Math.Round(points[0].z, 6)
|
||||
)
|
||||
{
|
||||
closed = true;
|
||||
points.RemoveAt(points.Count - 1);
|
||||
}
|
||||
|
||||
@@ -100,7 +107,7 @@ public class SegmentCollectionToSpeckleConverter : ITypedConverter<ACG.ReadOnlyS
|
||||
new()
|
||||
{
|
||||
value = points.SelectMany(pt => new[] { pt.x, pt.y, pt.z, }).ToList(),
|
||||
closed = closed,
|
||||
closed = true,
|
||||
units = _contextStack.Current.SpeckleUnits
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user