private GPoints CalculateIntersections(IPolyline polyline, IPolyline polyline2) { IPointCollection pointCollection = (IPointCollection)polyline; int pointCount = pointCollection.PointCount; GPoints result; if (pointCount == 0) { result = null; } else { GPolyLine gPolyLine = new GPolyLine(); gPolyLine.Clear(); for (int i = 0; i < pointCount; i++) { IPoint point = pointCollection.get_Point(i); double x = point.X; double y = point.Y; double z = point.Z - point.M; double z2 = point.Z; gPolyLine.PushBack(new GPoint { X = x, Y = y, Z = z, M = z2 }); } pointCollection = (IPointCollection)polyline2; pointCount = pointCollection.PointCount; if (pointCount == 0) { result = null; } else { GPolyLine gPolyLine2 = new GPolyLine(); gPolyLine2.Clear(); for (int j = 0; j < pointCount; j++) { IPoint point2 = pointCollection.get_Point(j); double x2 = point2.X; double y2 = point2.Y; double z3 = point2.Z - point2.M; double m; if (double.IsNaN(point2.M)) { m = 1.0 + point2.Z; } else { m = point2.Z; } gPolyLine2.PushBack(new GPoint { X = x2, Y = y2, Z = z3, M = m }); } new GPoints(); result = gPolyLine.GetInterPtsToPolyLineWithHeightForTransect(gPolyLine2); } } return(result); }
private GPoints CalculateIntersections(IPolyline baseline, IFeature pFeature, IBasicLayerInfo lineConfig) { IPointCollection pointCollection = (IPointCollection)baseline; int pointCount = pointCollection.PointCount; GPoints result; if (pointCount == 0) { result = null; } else { GPolyLine gPolyLine = new GPolyLine(); gPolyLine.Clear(); for (int i = 0; i < pointCount; i++) { IPoint point = pointCollection.get_Point(i); double x = point.X; double y = point.Y; double z = point.Z - point.M; double z2 = point.Z; gPolyLine.PushBack(new GPoint { X = x, Y = y, Z = z, M = z2 }); } pointCollection = (IPointCollection)pFeature.Shape; pointCount = pointCollection.PointCount; if (pointCount == 0) { result = null; } else { GPolyLine gPolyLine2 = new GPolyLine(); gPolyLine2.Clear(); int qdgcIndex = pFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDGC)); int qdmsIndex = pFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDMS)); int zdgcIndex = pFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDGC)); int zdmsIndex = pFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDMS)); double height = 0; double qdgc = GetDoubleValue(pFeature, qdgcIndex, out height); double zdgc = GetDoubleValue(pFeature, zdgcIndex, out height); double qdms = GetDoubleValue(pFeature, qdmsIndex, out height); double zdms = GetDoubleValue(pFeature, zdmsIndex, out height); if (qdms == 0) { qdms = 1; } if (zdms == 0) { zdms = 1; } IPoint startPoint = pointCollection.Point[0]; IPoint endPoint = pointCollection.Point[pointCollection.PointCount - 1]; gPolyLine2.PushBack(new GPoint { X = startPoint.X, Y = startPoint.Y, Z = qdgc - qdms, M = qdgc }); gPolyLine2.PushBack(new GPoint { X = endPoint.X, Y = endPoint.Y, Z = zdgc - zdms, M = zdgc }); //for (int j = 0; j < pointCount; j++) //{ // IPoint point2 = pointCollection.get_Point(j); // double x2 = point2.X; // double y2 = point2.Y; // double z3 = point2.Z - point2.M; // double m; // if (double.IsNaN(point2.M)) // { // m = 1.0 + point2.Z; // } // else // { // m = point2.Z; // } // gPolyLine2.PushBack(new GPoint // { // X = x2, // Y = y2, // Z = z3, // M = m // }); //} //new GPoints(); result = gPolyLine.GetInterPtsToPolyLineWithHeightForTransect(gPolyLine2); } } return(result); }