コード例 #1
0
ファイル: CHitAnalyse.cs プロジェクト: secondii/Yutai
        public void Analyse_Horizontal(IFeatureCursor pFeaCursor)
        {
            double             double1    = this.double_1 * 0.0005;
            IProximityOperator ipolyline1 = (IProximityOperator)this.baselineSimpleLine;
            IFeature           feature    = pFeaCursor.NextFeature();

            if (feature == null)
            {
                return;
            }
            int num  = -1;
            int num1 = -1;
            int num2 = -1;


            IBasicLayerInfo lineConfig     = m_config.GetBasicLayerInfo(feature.Class.AliasName) as IBasicLayerInfo;
            IPipelineLayer  pipelineLayer  = m_config.GetPipelineLayer(feature.Class as IFeatureClass);
            IPipelineLayer  pipelineLayer0 = m_config.GetPipelineLayer(baselineFC);

            num  = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GJ));
            num1 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.DMCC));
            num2 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ));

            if (num2 >= 0)
            {
                if ((num >= 0 ? true : num1 >= 0))
                {
                    while (feature != null)
                    {
                        IPolyline polyline = this.SimplifyPolyline(feature.Shape as IPolyline);
                        double    num3     = 0;
                        double    num4     = this.GetPipeGJ(feature, num, num1, out num3);
                        if (num4 < 10)
                        {
                            num4 = 10;
                        }
                        num4 = num4 * 0.0005;
                        double num5 = ipolyline1.ReturnDistance(polyline);
                        num5 = num5 - double1 - num4;
                        if (num5 >= 0.001)
                        {
                            string            str   = feature.get_Value(num2).ToString();
                            CHitAnalyse.CItem cItem = new CHitAnalyse.CItem()
                            {
                                _OID          = feature.OID,
                                _sKind        = str,
                                _dHorDistance = num5,
                                _dHorBase     = 0,
                                _pClass       = (IFeatureClass)feature.Class
                            };
                            cItem._dHorBase =
                                (double)
                                CommonUtils.GetPipeLineAlarmHrzDistByFeatureClassName2(m_config,
                                                                                       baselineFC.AliasName, feature.Class.AliasName, this.baseFeature, feature);
                            this.list_0.Add(cItem);
                            feature = pFeaCursor.NextFeature();
                        }
                        else
                        {
                            feature = pFeaCursor.NextFeature();
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: CHitAnalyse.cs プロジェクト: secondii/Yutai
        public void Analyse_Vertical(IFeatureCursor pFeaCursor)
        {
            double double0 = this.double_0 * 0.0005;
            ITopologicalOperator ipolyline1 = (ITopologicalOperator)this.baselineSimpleLine;
            IFeature             feature    = pFeaCursor.NextFeature();

            if (feature == null)
            {
                return;
            }
            int num  = -1;
            int num1 = -1;
            int num2 = -1;

            IBasicLayerInfo lineConfig     = m_config.GetBasicLayerInfo(feature.Class.AliasName) as IBasicLayerInfo;
            IPipelineLayer  pipelineLayer  = m_config.GetPipelineLayer(feature.Class as IFeatureClass);
            IPipelineLayer  pipelineLayer0 = m_config.GetPipelineLayer(baselineFC);

            if (feature != null)
            {
                num  = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GJ));
                num1 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.DMCC));
                num2 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ));
            }
            if (num2 >= 0)
            {
                if ((num >= 0 ? true : num1 >= 0))
                {
                    int lineConfigHeightFlag = (int)lineConfig.HeightType;
                    // this.m_app.PipeConfig.getLineConfig_HeightFlag(CommonUtils.GetSmpClassName(feature.Class.AliasName));
                    while (feature != null)
                    {
                        IPolyline shape    = feature.Shape as IPolyline;
                        IPolyline polyline = this.SimplifyPolyline(shape);
                        double    num3     = 0;
                        this.GetPipeGJ(feature, num, num1, out num3);
                        if (num3 < 10)
                        {
                            num3 = 10;
                        }
                        num3 = num3 * 0.0005;
                        IGeometry geometry = ipolyline1.Intersect(polyline, (esriGeometryDimension)1);
                        if (geometry != null)
                        {
                            IPoint point = null;
                            if (geometry is IPoint)
                            {
                                point = (IPoint)geometry;
                            }
                            else if (geometry is IMultipoint)
                            {
                                IPointCollection pointCollection = (IPointCollection)geometry;
                                if (pointCollection.PointCount > 0)
                                {
                                    point = pointCollection.get_Point(0);
                                }
                            }
                            if (point != null)
                            {
                                int    num4 = this.method_3(this.baselineSimpleLine, point);
                                double num5 = this.CalculateZAlongLine(this.baselineShape, point, num4);
                                if (this.heightType == 0)
                                {
                                    num5 = num5 - double0;
                                }
                                else if (2 == this.heightType)
                                {
                                    num5 = num5 + double0;
                                }
                                int    num6 = this.method_3(polyline, point);
                                double num7 = this.CalculateZAlongLine(shape, point, num6);
                                if (lineConfigHeightFlag == 0)
                                {
                                    num7 = num7 - num3;
                                }
                                else if (2 == lineConfigHeightFlag)
                                {
                                    num7 = num7 + num3;
                                }
                                double num8 = Math.Abs(num5 - num7);
                                if (num8 >= 0.001)
                                {
                                    string            str   = feature.get_Value(num2).ToString();
                                    CHitAnalyse.CItem cItem = new CHitAnalyse.CItem()
                                    {
                                        _OID          = feature.OID,
                                        _sKind        = str,
                                        _dVerDistance = num8,
                                        _dVerBase     = 0,
                                        _pClass       = (IFeatureClass)feature.Class
                                    };
                                    string str1 = this.GetPipeMSFS(feature);
                                    string str2 = this.GetPipeMSFS(this.baseFeature);
                                    cItem._dVerBase =
                                        (double)
                                        CommonUtils.GetPipeLineAlarmVerDistByFeatureClassName(m_config,
                                                                                              pipelineLayer0.ClassCode, pipelineLayer.ClassCode, str2, str1);
                                    this.list_0.Add(cItem);
                                }
                                else
                                {
                                    feature = pFeaCursor.NextFeature();
                                    continue;
                                }
                            }
                        }
                        feature = pFeaCursor.NextFeature();
                    }
                }
            }
        }
コード例 #3
0
ファイル: CHitAnalyse.cs プロジェクト: secondii/Yutai
        public void Analyse_Hit(IFeatureCursor pFeaCursor)
        {
            double num;
            double double0 = this.double_0 * 0.0005;
            double double1 = this.double_1 * 0.0005;
            ITopologicalOperator ipolyline1        = (ITopologicalOperator)this.baselineSimpleLine;
            IProximityOperator   proximityOperator = (IProximityOperator)this.baselineSimpleLine;
            IPointCollection     ipolyline0        = (IPointCollection)this.baselineShape;
            int qdgcIdx = -1;
            int qdmsIdx = -1;
            int zdgcIdx = -1;
            int zdmsIdx = -1;

            double z    = ipolyline0.get_Point(0).Z;
            double num1 = z;

            for (int i = 1; i < ipolyline0.PointCount; i++)
            {
                double z1 = ipolyline0.get_Point(i).Z;
                if (z > z1)
                {
                    z = z1;
                }
                if (num1 < z1)
                {
                    num1 = z1;
                }
            }
            if (this.heightType == 0)
            {
                z    = z - double0;
                num1 = num1 - double0;
            }
            else if (2 == this.heightType)
            {
                z    = z + double0;
                num1 = num1 + double0;
            }
            IFeature feature = pFeaCursor.NextFeature();

            if (feature == null)
            {
                return;
            }

            IBasicLayerInfo lineConfig = m_config.GetBasicLayerInfo(feature.Class.AliasName) as IBasicLayerInfo;
            int             num2       = -1;
            int             num3       = -1;
            int             num4       = -1;

            if (feature != null)
            {
                num2 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GJ));
                num3 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.DMCC));
                num4 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ));
                if (!IsMUsing)
                {
                    qdgcIdx = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDGC));
                    qdmsIdx = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDMS));
                    zdgcIdx = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDGC));
                    zdmsIdx = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDMS));
                }
            }
            if (num4 >= 0)
            {
                if ((num2 >= 0 ? true : num3 >= 0))
                {
                    //!+ 要判断lineConfigHeightFlag 和 enumPipelineHeightType的对应关系
                    int lineConfigHeightFlag = (int)lineConfig.HeightType;
                    //this.m_app.PipeConfig.getLineConfig_HeightFlag(CommonUtils.GetSmpClassName(feature.Class.AliasName));
                    while (feature != null)
                    {
                        IPolyline shape    = feature.Shape as IPolyline;
                        IPolyline polyline = this.SimplifyPolyline(shape);
                        double    num5     = 0;
                        double    num6     = this.GetPipeGJ(feature, num2, num3, out num5);
                        if (num6 < 10)
                        {
                            num6 = 10;
                        }
                        num6 = num6 * 0.0005;
                        if (num5 < 10)
                        {
                            num5 = 10;
                        }
                        num5 = num5 * 0.0005;
                        IPoint    point    = null;
                        IGeometry geometry = ipolyline1.Intersect(polyline, (esriGeometryDimension)1);
                        if (geometry != null)
                        {
                            if (geometry is IPoint)
                            {
                                point = (IPoint)geometry;
                            }
                            else if (geometry is IMultipoint)
                            {
                                IPointCollection pointCollection = (IPointCollection)geometry;
                                if (pointCollection.PointCount > 0)
                                {
                                    point = pointCollection.get_Point(0);
                                }
                            }
                        }
                        if (point == null)
                        {
                            CHitAnalyse.CItem cItem = new CHitAnalyse.CItem();
                            string            str   = feature.get_Value(num4).ToString();
                            cItem._OID    = feature.OID;
                            cItem._sKind  = str;
                            cItem._pClass = (IFeatureClass)feature.Class;
                            num           = proximityOperator.ReturnDistance(polyline);
                            num           = num - double1 - num6;
                            if (num >= 0.001)
                            {
                                cItem._dHorDistance = num;
                                cItem._dHorBase     = 0;
                                IPointCollection pointCollection1 = (IPointCollection)shape;
                                double           z2;
                                if (IsMUsing)
                                {
                                    z2 = pointCollection1.get_Point(0).Z - pointCollection1.get_Point(0).M;
                                }
                                else
                                {
                                    double pHeight = 0;
                                    z2 = GetDoubleValue(feature, qdgcIdx, out pHeight) -
                                         GetDoubleValue(feature, qdmsIdx, out pHeight);
                                }
                                double num7 = z2;
                                if (IsMUsing)
                                {
                                    for (int j = 1; j < pointCollection1.PointCount; j++)
                                    {
                                        double z3 = pointCollection1.get_Point(j).Z - pointCollection1.get_Point(j).M;
                                        if (z2 > z3)
                                        {
                                            z2 = z3;
                                        }
                                        if (num7 < z3)
                                        {
                                            num7 = z3;
                                        }
                                    }
                                }
                                else
                                {
                                    double pHeight = 0;
                                    double z3      = GetDoubleValue(feature, zdgcIdx, out pHeight) -
                                                     GetDoubleValue(feature, zdmsIdx, out pHeight);
                                    if (z2 > z3)
                                    {
                                        z2 = z3;
                                    }
                                    if (num7 < z3)
                                    {
                                        num7 = z3;
                                    }
                                }
                                if (lineConfigHeightFlag == 0)
                                {
                                    z2   = z2 - num5;
                                    num7 = num7 - num5;
                                }
                                else if (2 == lineConfigHeightFlag)
                                {
                                    z2   = z2 + num5;
                                    num7 = num7 + num5;
                                }
                                if (z > num7)
                                {
                                    num = z - num7;
                                    num = num - double0 - num5;
                                    if (num < 0.001)
                                    {
                                        num = 0;
                                    }
                                }
                                else if (z2 <= num1)
                                {
                                    num = 0;
                                }
                                else
                                {
                                    num = z2 - num1;
                                    num = num - double0 - num5;
                                    if (num < 0.001)
                                    {
                                        num = 0;
                                    }
                                }
                                cItem._dVerDistance = num;
                                cItem._dVerBase     = 0;
                                cItem._dHorBase     =
                                    (double)
                                    CommonUtils.GetPipeLineAlarmHrzDistByFeatureClassName2(m_config,
                                                                                           CommonUtils.GetSmpClassName(this.baselineFC.AliasName),
                                                                                           CommonUtils.GetSmpClassName(feature.Class.AliasName), this.baseFeature, feature);
                                string str1 = this.GetPipeMSFS(feature);
                                string str2 = this.GetPipeMSFS(this.baseFeature);
                                cItem._dVerBase =
                                    (double)
                                    CommonUtils.GetPipeLineAlarmVerDistByFeatureClassName(m_config,
                                                                                          CommonUtils.GetSmpClassName(this.baselineFC.AliasName),
                                                                                          CommonUtils.GetSmpClassName(feature.Class.AliasName), str2, str1);
                                this.list_0.Add(cItem);
                            }
                            else
                            {
                                feature = pFeaCursor.NextFeature();
                                continue;
                            }
                        }
                        else
                        {
                            int    num8 = this.method_3(this.baselineSimpleLine, point);
                            double num9 = 0;
                            if (IsMUsing)
                            {
                                num9 = this.CalculateZ(this.baselineShape, point, num8);
                            }
                            else
                            {
                                num9 = this.CalculateZ(this.baselineShape, point, num8, feature, qdgcIdx, zdgcIdx);
                            }

                            if (this.heightType == 0)
                            {
                                num9 = num9 - double0;
                            }
                            else if (2 == this.heightType)
                            {
                                num9 = num9 + double0;
                            }
                            int    num10 = this.method_3(polyline, point);
                            double num11 = 0;
                            if (IsMUsing)
                            {
                                num11 = this.CalculateZAlongLine(shape, point, num10);
                            }
                            else
                            {
                                num11 = this.CalculateZAlongLine(shape, point, num10, feature, qdgcIdx, qdmsIdx, zdgcIdx,
                                                                 zdmsIdx);
                            }

                            if (lineConfigHeightFlag == 0)
                            {
                                num11 = num11 - num5;
                            }
                            else if (2 == lineConfigHeightFlag)
                            {
                                num11 = num11 + num5;
                            }
                            num = Math.Abs(num9 - num11);
                            if (num >= 0.001)
                            {
                                string            str3 = feature.get_Value(num4).ToString();
                                CHitAnalyse.CItem pipeLineAlarmHrzDistByFeatureClassName2 = new CHitAnalyse.CItem()
                                {
                                    _OID          = feature.OID,
                                    _sKind        = str3,
                                    _dVerDistance = num,
                                    _dVerBase     = 0,
                                    _dHorDistance = 0,
                                    _dHorBase     = 0,
                                    _pClass       = (IFeatureClass)feature.Class
                                };
                                pipeLineAlarmHrzDistByFeatureClassName2._dHorBase =
                                    (double)
                                    CommonUtils.GetPipeLineAlarmHrzDistByFeatureClassName2(m_config,
                                                                                           CommonUtils.GetSmpClassName(this.baselineFC.AliasName),
                                                                                           CommonUtils.GetSmpClassName(feature.Class.AliasName), this.baseFeature, feature);
                                string str4 = this.GetPipeMSFS(feature);
                                string str5 = this.GetPipeMSFS(this.baseFeature);
                                pipeLineAlarmHrzDistByFeatureClassName2._dVerBase =
                                    (double)
                                    CommonUtils.GetPipeLineAlarmVerDistByFeatureClassName(m_config,
                                                                                          CommonUtils.GetSmpClassName(this.baselineFC.AliasName),
                                                                                          CommonUtils.GetSmpClassName(feature.Class.AliasName), str5, str4);
                                this.list_0.Add(pipeLineAlarmHrzDistByFeatureClassName2);
                            }
                            else
                            {
                                feature = pFeaCursor.NextFeature();
                                continue;
                            }
                        }
                        feature = pFeaCursor.NextFeature();
                    }
                }
            }
        }