private static List <WKSPointVA> GetFromEnumVertex([NotNull] IMultiPatch multiPatch) { var pts = (IPointCollection)multiPatch; int pointCount = pts.PointCount; var result = new List <WKSPointVA>(pointCount); IEnumVertex enumVertex = pts.EnumVertices; enumVertex.Reset(); IPoint p = new PointClass(); int part; int vertex; for (enumVertex.QueryNext(p, out part, out vertex); vertex >= 0; enumVertex.QueryNext(p, out part, out vertex)) { var pnt = new WKSPointVA(); double x; double y; p.QueryCoords(out x, out y); pnt.m_x = x; pnt.m_y = y; pnt.m_z = p.Z; pnt.m_m = p.M; pnt.m_id = p.ID; result.Add(pnt); } return(result); }
/// <summary> /// Converts an Esri enumerable interface to a DotNet IEnumerable. /// </summary> /// <param name="esriEnum">An enumerable Esri interface.</param> /// <returns>The adapted dotnet enumeration.</returns> public static IEnumerable <IPoint> Enumerate(this IEnumVertex esriEnum) { IPoint point; int partIndex; int vertexIndex; esriEnum.Reset(); esriEnum.Next(out point, out partIndex, out vertexIndex); while (point != null) { yield return(point); esriEnum.Next(out point, out partIndex, out vertexIndex); } }
/// <summary> /// INTERPOLATE ELEVATION VALUES FOR VERTICES /// </summary> /// <param name="analysisSurface">Analysis surface</param> /// <param name="vertices">Enumeration of vertices</param> internal static void InterpolateVertices(AnalysisSurface analysisSurface, IEnumVertex vertices) { // RESET ENUM vertices.Reset(); // ITERATE VERTICES IPoint outVertex; int partIndex; int vertexIndex; vertices.Next(out outVertex, out partIndex, out vertexIndex); while (outVertex != null) { // GET ELEVATION AT POINT LOCATION double elev = Helper.GetSurfaceElevation(analysisSurface, outVertex); // ASSIGN Z USING ELEVATION outVertex.Z = elev; // GET NEXT VERTEX vertices.Next(out outVertex, out partIndex, out vertexIndex); } }
private int CheckZRange([NotNull] IFeature feature, [NotNull] IPointCollection points) { IEnumVertex enumPoints = points.EnumVertices; enumPoints.Reset(); var errorPointsBelow = new List <IPoint>(); var errorPointsAbove = new List <IPoint>(); IPoint currentPoint; int partIndex; int segmentIndex; enumPoints.Next(out currentPoint, out partIndex, out segmentIndex); double zMax = double.MinValue; double zMin = double.MaxValue; while (currentPoint != null) { double z = currentPoint.Z; if (!IsAllowed(z)) { if (z < _minimumZValue) { errorPointsBelow.Add(GeometryFactory.Clone(currentPoint)); } else if (z > _maximumZValue) { errorPointsAbove.Add(GeometryFactory.Clone(currentPoint)); } if (z < zMin) { zMin = z; } else if (z > zMax) { zMax = z; } } enumPoints.Next(out currentPoint, out partIndex, out segmentIndex); } var errorCount = 0; if (errorPointsBelow.Count > 0) { errorCount += ReportError(GetErrorMessageBelow(errorPointsBelow, zMin), GetErrorGeometry(errorPointsBelow), null, _shapeFieldName, (IRow)feature); } if (errorPointsAbove.Count > 0) { string message = GetErrorMessageAbove(errorPointsAbove, zMax); errorCount += ReportError(message, GetErrorGeometry(errorPointsAbove), null, _shapeFieldName, (IRow)feature); } return(errorCount); }