{
// list of points
List<MapPoint> pointsForBuilder = new List<MapPoint>
{
MapPointBuilderEx.CreateMapPoint(0, 0, 2, 3, 1),
MapPointBuilderEx.CreateMapPoint(1, 1, 5, 6),
MapPointBuilderEx.CreateMapPoint(2, 1, 6),
MapPointBuilderEx.CreateMapPoint(0, 0)
};
// will have attributes because it is created with convenience method
Polyline polylineWithAttrs = PolylineBuilderEx.CreatePolyline(pointsForBuilder);
bool hasZ = polylineWithAttrs.HasZ; // hasZ = true
bool hasM = polylineWithAttrs.HasM; // hasM = true
bool hasID = polylineWithAttrs.HasID; // hasID = true
// will not have attributes because it is specified as a parameter
Polyline polylineWithoutAttrs =
PolylineBuilderEx.CreatePolyline(pointsForBuilder, AttributeFlags.None);
hasZ = polylineWithoutAttrs.HasZ; // hasZ = false
hasM = polylineWithoutAttrs.HasM; // hasM = false
hasID = polylineWithoutAttrs.HasID; // hasID = false
// will have attributes because it is created with convenience method
Polygon polygonWithAttrs = PolygonBuilderEx.CreatePolygon(pointsForBuilder);
hasZ = polygonWithAttrs.HasZ; // hasZ = true
hasM = polygonWithAttrs.HasM; // hasM = true
hasID = polygonWithAttrs.HasID; // hasID = true
// will not have attributes because it is specified as a parameter
Polygon polygonWithoutAttrs =
PolygonBuilderEx.CreatePolygon(pointsForBuilder, AttributeFlags.None);
hasZ = polygonWithoutAttrs.HasZ; // hasZ = false
hasM = polygonWithoutAttrs.HasM; // hasM = false
hasID = polygonWithoutAttrs.HasID; // hasID = false
// will not have attributes because it is specified as a parameter
PolylineBuilderEx polylineB =
new PolylineBuilderEx(pointsForBuilder, AttributeFlags.None);
hasZ = polylineB.HasZ; // hasZ = false
hasM = polylineB.HasM; // hasM = false
hasID = polylineB.HasID; // hasID = false
// will have attributes because it is passed an attributed polyline
polylineB = new PolylineBuilderEx(polylineWithAttrs);
hasZ = polylineB.HasZ; // hasZ = true
hasM = polylineB.HasM; // hasM = true
hasID = polylineB.HasID; // hasID = true
// will not have attributes because it is passed a non-attributed polyline
polylineB = new PolylineBuilderEx(polylineWithoutAttrs);
hasZ = polylineB.HasZ; // hasZ = false
hasM = polylineB.HasM; // hasM = false
hasID = polylineB.HasID; // hasID = false
// will not have attributes because it is specified as a parameter
PolygonBuilderEx polygonB = new PolygonBuilderEx(pointsForBuilder, AttributeFlags.None);
hasZ = polygonB.HasZ; // hasZ = false
hasM = polygonB.HasM; // hasM = false
hasID = polygonB.HasID; // hasID = false
// will have attributes because it is passed an attributed polygon
polygonB = new PolygonBuilderEx(polygonWithAttrs);
hasZ = polygonB.HasZ; // hasZ = true
hasM = polygonB.HasM; // hasM = true
hasID = polygonB.HasID; // hasID = true
// will not have attributes because it is passed a non-attributed polygon
polygonB = new PolygonBuilderEx(polygonWithoutAttrs);
hasZ = polygonB.HasZ; // hasZ = true
hasM = polygonB.HasM; // hasM = true
hasID = polygonB.HasID; // hasID = true
}
{
Coordinate2D[] coords = [new Coordinate2D(-2, 2), new Coordinate2D(3, 5), new Coordinate2D(7, 2)];
polyline = PolylineBuilderEx.CreatePolyline(coords); // polyline.HasM = false
bool isMSimple = GeometryEngine.Instance.IsMSimple(polyline); // isMSimple = false
PolylineBuilderEx polylineBuilder = new(polyline)
{
HasM = true
};
polyline = polylineBuilder.ToGeometry();
isMSimple = GeometryEngine.Instance.IsMSimple(polyline); // isMSimple = false
MapPoint point1 = MapPointBuilderEx.CreateMapPoint(-2, 2, -1, 1);
MapPoint point2 = MapPointBuilderEx.CreateMapPoint(3, 5, -2, 2);
MapPoint[] points = [point1, point2];
polyline = PolylineBuilderEx.CreatePolyline(points, AttributeFlags.HasM);
isMSimple = GeometryEngine.Instance.IsMSimple(polyline); // isMSimple = true
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)