Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        private double method_2(IPolyline polyline, IPolyline polyline2)
        {
            IPointCollection pointCollection = (IPointCollection)polyline;
            int    pointCount = pointCollection.PointCount;
            double result;

            if (pointCount == 0)
            {
                result = 0.0;
            }
            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;
                    double m     = point.M;
                    gPolyLine.PushBack(new GPoint
                    {
                        X = x,
                        Y = y,
                        Z = z,
                        M = m
                    });
                }
                pointCollection = (IPointCollection)polyline2;
                pointCount      = pointCollection.PointCount;
                if (pointCount == 0)
                {
                    result = 0.0;
                }
                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 z2     = point2.Z;
                        double m2     = point2.M;
                        gPolyLine2.PushBack(new GPoint
                        {
                            X = x2,
                            Y = y2,
                            Z = z2,
                            M = m2
                        });
                    }
                    GPoints gPoints = new GPoints();
                    gPoints = gPolyLine.GetInterPtsToPolyLineWithHeight(gPolyLine2);
                    long   num  = (long)gPoints.Size();
                    double num2 = -1.0;
                    int    num3 = 0;
                    while ((long)num3 < num)
                    {
                        GPoint gPoint = gPoints[num3];
                        double num4   = this.method_5(gPoint.M, gPoint.Z);
                        if (num3 == 0)
                        {
                            num2 = num4;
                        }
                        else if (num2 > num4)
                        {
                            num2 = num4;
                        }
                        num3++;
                    }
                    result = num2;
                }
            }
            return(result);
        }