示例#1
0
 public void FillValue()
 {
     if (this.myfields != null)
     {
         IFeatureClass   featureClass = this.SelectLayer.FeatureClass;
         IBasicLayerInfo layerInfo    = pPipeCfg.GetBasicLayerInfo(featureClass);
         int             num          = this.myfields.FindField(layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.QDMS));
         if (num > 0)
         {
             this.myfield = this.myfields.Field[num];
             this.listBox1.Items.Clear();
             List <string> values = new List <string>();
             CommonHelper.GetUniqueValues((ITable)featureClass,
                                          layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.QDMS), values);
             this.listBox1.Items.AddRange(values.ToArray());
         }
     }
 }
示例#2
0
        private void ValidateField()
        {
            int selectedIndex = this.LayerBox.SelectedIndex;

            if (selectedIndex >= 0)
            {
                this.SelectLayer = null;
                if (this.MapControl != null)
                {
                    this.SelectLayer = ((SimpleQueryByDiaUI.LayerboxItem) this.LayerBox.SelectedItem).m_pPipeLayer;
                    if (this.SelectLayer != null)
                    {
                        IBasicLayerInfo layerInfo = pPipeCfg.GetBasicLayerInfo(this.SelectLayer.FeatureClass);
                        this.myfields = this.SelectLayer.FeatureClass.Fields;
                        this.strGJ    = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ);
                        ;
                        this.strKG = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.DMCC);
                        ;
                        if (this.myfields.FindField(this.strGJ) < 0)
                        {
                            this.radioButton1.Enabled = false;
                            this.OperateBox.Enabled   = false;
                            this.ValueBox1.Enabled    = false;
                            this.ValueBox2.Enabled    = false;
                            this.radioButton1.Checked = false;
                        }
                        else
                        {
                            this.radioButton1.Enabled = true;
                            this.OperateBox.Enabled   = true;
                            this.ValueBox1.Enabled    = true;
                            this.ValueBox2.Enabled    = true;
                        }
                        if (this.myfields.FindField(this.strKG) < 0)
                        {
                            this.radioButton2.Enabled = false;
                            this.radioButton2.Checked = false;
                            this.OperateBox2.Enabled  = false;
                            this.ValueBox3.Enabled    = false;
                        }
                        else
                        {
                            this.radioButton2.Enabled = true;
                            this.OperateBox2.Enabled  = true;
                            this.ValueBox3.Enabled    = true;
                        }
                    }
                }
            }
        }
示例#3
0
        public static float GetPipeLineAlarmHrzDistByFeatureClassName2(IPipelineConfig config, string strFeaClassName1,
                                                                       string strFeaClassName2, IFeature pFeature1, IFeature pFeature2)
        {
            float           single;
            string          str;
            string          str1;
            IBasicLayerInfo pipeLayer1            = config.GetBasicLayerInfo(strFeaClassName1);
            IBasicLayerInfo pipeLayer2            = config.GetBasicLayerInfo(strFeaClassName2);
            IPipelineLayer  pipeline1             = config.GetPipelineLayer(pipeLayer1.FeatureClass);
            IPipelineLayer  pipeline2             = config.GetPipelineLayer(pipeLayer2.FeatureClass);
            object          pipeLineAlarmHrzDist2 = CommonUtils.GetPipeLineAlarmHrzDist2(config, pipeline1.ClassCode,
                                                                                         pipeline2.ClassCode, pFeature1, pFeature2, pipeLayer1, pipeLayer2);

            if (pipeLineAlarmHrzDist2 != null)
            {
                single = (!Convert.IsDBNull(pipeLineAlarmHrzDist2) ? Convert.ToSingle(pipeLineAlarmHrzDist2) : 0f);
            }
            else
            {
                single = 0f;
            }

            return(single);
        }
示例#4
0
        public static float GetPipeLineAlarmVerDistByFeatureClassName(IPipelineConfig config, string className1,
                                                                      string className2, string strBuryKind1, string strBuryKind2)
        {
            float           single;
            string          str;
            string          str1;
            IBasicLayerInfo pipeLayer1           = config.GetBasicLayerInfo(className1);
            IBasicLayerInfo pipeLayer2           = config.GetBasicLayerInfo(className2);
            IPipelineLayer  pipeline1            = config.GetPipelineLayer(pipeLayer1.FeatureClass);
            IPipelineLayer  pipeline2            = config.GetPipelineLayer(pipeLayer2.FeatureClass);
            object          pipeLineAlarmVerDist = CommonUtils.GetPipeLineAlarmVerDist(config, pipeline1.ClassCode,
                                                                                       pipeline2.ClassCode, strBuryKind1, strBuryKind2);

            if (pipeLineAlarmVerDist != null)
            {
                single = (!Convert.IsDBNull(pipeLineAlarmVerDist) ? Convert.ToSingle(pipeLineAlarmVerDist) : 0f);
            }
            else
            {
                single = 0f;
            }

            return(single);
        }
示例#5
0
        private bool FindPipePointLayer()
        {
            int  selectedIndex = this.LayerBox.SelectedIndex;
            bool result;

            if (selectedIndex < 0)
            {
                result = false;
            }
            else
            {
                this.ifeatureLayer_0 = null;
                if (this.MapControl == null)
                {
                    result = false;
                }
                else
                {
                    string strDstName = this.LayerBox.SelectedItem.ToString();
                    this.ifeatureLayer_0 = (IFeatureLayer)CommonUtils.GetLayerByName(this.m_iApp.FocusMap, strDstName);
                    if (this.ifeatureLayer_0 == null)
                    {
                        result = false;
                    }
                    else
                    {
                        IBasicLayerInfo basicLayerInfo = pPipeCfg.GetBasicLayerInfo(ifeatureLayer_0.FeatureClass);
                        if (basicLayerInfo.DataType != enumPipelineDataType.Point)
                        {
                            this.btnAnalyse.Enabled = false;
                            result = false;
                        }
                        else
                        {
                            this.btnAnalyse.Enabled = true;
                            _basicLayerInfo         = basicLayerInfo;
                            //string values=basicLayerInfo.GetField(PipeConfigWordHelper.PointWords.FSW).DomainValues;
                            FillValues();
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#6
0
        private bool ValidateField()
        {
            int  selectedIndex = this.LayerBox.SelectedIndex;
            bool result;

            if (selectedIndex < 0)
            {
                result = false;
            }
            else
            {
                this.SelectLayer = null;
                if (this.MapControl == null)
                {
                    result = false;
                }
                else
                {
                    this.SelectLayer = ((SimpleQueryByJdxzUI.LayerboxItem) this.LayerBox.SelectedItem).m_pPipeLayer;
                    if (this.SelectLayer == null)
                    {
                        result = false;
                    }
                    else
                    {
                        this.myfields = this.SelectLayer.FeatureClass.Fields;
                        IBasicLayerInfo layerInfo = pPipeCfg.GetBasicLayerInfo(this.SelectLayer.FeatureClass);

                        this.strDX = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.TZW);
                        // this.pPipeCfg.GetPointTableFieldName("点性");
                        if (this.myfields.FindField(this.strDX) < 0)
                        {
                            this.QueryBut.Enabled = false;
                            result = false;
                        }
                        else
                        {
                            this.QueryBut.Enabled = true;
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#7
0
        public void GetValues(ArrayList Values)
        {
            Values.Clear();
            if (this._networkInfo.LayerPoint == null)
            {
                return;
            }
            IBasicLayerInfo pipePoint =
                m_Config.GetBasicLayerInfo(this._networkInfo.LayerPoint.FeatureClass.AliasName) as IBasicLayerInfo;

            //IPipePoint pipePoint = m_Config.GetSubLayer(this._networkInfo.LayerPoint, enumPipelineDataType.Point) as IPipePoint;

            //string text = CRegOperator.GetRegistryKey().GetValue("节点性质字段值", "").ToString();
            string text = pipePoint.GetField(PipeConfigWordHelper.PointWords.FSW).DomainValues;

            for (int num = text.IndexOf("/"); num != -1; num = text.IndexOf("/"))
            {
                Values.Add(text.Substring(0, num));
                text = text.Substring(num + 1, text.Length - num - 1);
            }
        }
示例#8
0
        private void QueryBut_Click(object sender, EventArgs e)
        {
            string text          = "";
            int    selectedIndex = this.LayerBox.SelectedIndex;

            if (selectedIndex >= 0)
            {
                this.SelectLayer = null;
                if (this.MapControl != null)
                {
                    this.SelectLayer = ((SimpleQueryByDataUI.LayerboxItem) this.LayerBox.SelectedItem).m_pPipeLayer;
                    if (this.SelectLayer != null)
                    {
                        this.myfields = this.SelectLayer.FeatureClass.Fields;
                        IBasicLayerInfo layerInfo = pPipeCfg.GetBasicLayerInfo(this.SelectLayer.FeatureClass);
                        string          text2;
                        if (this.radioButton1.Checked)
                        {
                            text2 = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.MSRQ);
                            ; // this.pPipeCfg.GetPointTableFieldName("建设年代");
                        }
                        else
                        {
                            text2 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.MSRQ);
                            // this.pPipeCfg.GetLineTableFieldName("建设年代");
                        }
                        int num = this.myfields.FindField(text2);
                        if (num < 0)
                        {
                            MessageBox.Show(@"图层中日期字段没有找到!请检查配置文件!");
                        }
                        else
                        {
                            IField field = this.myfields.Field[num];
                            if (field.Type == (esriFieldType)4)
                            {
                                switch (this.OperateBox.SelectedIndex)
                                {
                                case 0:
                                    text  = text2;
                                    text += "<= '";
                                    text += this.dateTimePicker1.Value.ToShortDateString();
                                    text += "'";
                                    break;

                                case 1:
                                    text  = text2;
                                    text += ">= '";
                                    text += this.dateTimePicker1.Value.ToShortDateString();
                                    text += "'";
                                    break;

                                case 2:
                                    text  = text2;
                                    text += "= '";
                                    text += this.dateTimePicker1.Value.ToShortDateString();
                                    text += "'";
                                    break;

                                case 3:
                                    text  = text2;
                                    text += ">= '";
                                    text += this.dateTimePicker1.Value.ToShortDateString();
                                    text += "'and ";
                                    text += text2;
                                    text += "<= '";
                                    text += this.dateTimePicker2.Value.ToShortDateString();
                                    text += "'";
                                    break;
                                }
                            }
                            else if (field.Type == (esriFieldType)5)
                            {
                                if (this.SelectLayer.DataSourceType == "Personal Geodatabase Feature Class")
                                {
                                    switch (this.OperateBox.SelectedIndex)
                                    {
                                    case 0:
                                        text  = text2;
                                        text += "<= #";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "#";
                                        break;

                                    case 1:
                                        text  = text2;
                                        text += ">= #";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "#";
                                        break;

                                    case 2:
                                        text  = text2;
                                        text += "= #";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "#";
                                        break;

                                    case 3:
                                        text  = text2;
                                        text += ">= #";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "# and ";
                                        text += text2;
                                        text += "<= #";
                                        text += this.dateTimePicker2.Value.ToShortDateString();
                                        text += "#";
                                        break;
                                    }
                                }
                                if (this.SelectLayer.DataSourceType == "SDE Feature Class")
                                {
                                    switch (this.OperateBox.SelectedIndex)
                                    {
                                    case 0:
                                        text  = text2;
                                        text += "<= TO_DATE('";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "','YYYY-MM-DD')";
                                        break;

                                    case 1:
                                        text  = text2;
                                        text += ">= TO_DATE('";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "','YYYY-MM-DD')";
                                        break;

                                    case 2:
                                        text  = text2;
                                        text += "= TO_DATE('";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "','YYYY-MM-DD')";
                                        break;

                                    case 3:
                                        text  = text2;
                                        text += ">= TO_DATE('";
                                        text += this.dateTimePicker1.Value.ToShortDateString();
                                        text += "','YYYY-MM-DD') and ";
                                        text += text2;
                                        text += "<= TO_DATE('";
                                        text += this.dateTimePicker2.Value.ToShortDateString();
                                        text += "','YYYY-MM-DD')";
                                        break;
                                    }
                                }
                            }
                            IFeatureClass  featureClass  = this.SelectLayer.FeatureClass;
                            ISpatialFilter spatialFilter = new SpatialFilter();
                            spatialFilter.WhereClause = text;
                            if (this.GeometrySet.Checked)
                            {
                                if (this.m_ipGeo != null)
                                {
                                    spatialFilter.Geometry = (this.m_ipGeo);
                                }
                                spatialFilter.SpatialRel = (esriSpatialRelEnum)(1);
                            }
                            IFeatureCursor pCursor = featureClass.Search(spatialFilter, false);
                            //修改为插件事件,因为结果显示窗体为插件拥有。
                            _plugin.FireQueryResultChanged(new QueryResultArgs(pCursor,
                                                                               (IFeatureSelection)this.SelectLayer, spatialFilter));
                        }
                    }
                }
            }
        }
示例#9
0
        private bool ValidateField()
        {
            int  selectedIndex = this.LayerBox.SelectedIndex;
            bool result;

            if (selectedIndex < 0)
            {
                result = false;
            }
            else
            {
                this.SelectLayer = null;
                if (this.MapControl == null)
                {
                    result = false;
                }
                else
                {
                    this.SelectLayer = ((SimpleQueryByAddressUI1.LayerboxItem) this.LayerBox.SelectedItem).m_pPipeLayer;
                    if (this.SelectLayer == null)
                    {
                        result = false;
                    }
                    else
                    {
                        this.myfields = this.SelectLayer.FeatureClass.Fields;
                        IBasicLayerInfo layerInfo = pPipeCfg.GetBasicLayerInfo(this.SelectLayer.FeatureClass);
                        if (this.radioButton1.Checked)
                        {
                            this.FieldBox.Text = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.SZDL);
                            // this.pPipeCfg.GetPointTableFieldName("所在道路");
                            this.FindField = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.TZW);
                            // this.pPipeCfg.GetPointTableFieldName("点性");
                        }
                        else
                        {
                            this.FieldBox.Text = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.SZDL);
                            // this.pPipeCfg.GetLineTableFieldName("所在道路");
                            this.FindField = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ);
                            // this.pPipeCfg.GetLineTableFieldName("管径");
                            this.FindField1 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.DMCC);
                            // this.pPipeCfg.GetLineTableFieldName("断面尺寸");
                        }
                        if (this.myfields.FindField(this.FindField) < 0 && this.myfields.FindField(this.FindField1) < 0)
                        {
                            this.ValueBox.Enabled = false;
                            this.AllBut.Enabled   = false;
                            this.NoneBut.Enabled  = false;
                            this.RevBut.Enabled   = false;
                        }
                        else
                        {
                            this.ValueBox.Enabled = true;
                            this.AllBut.Enabled   = true;
                            this.NoneBut.Enabled  = true;
                            this.RevBut.Enabled   = true;
                        }
                        if (this.myfields.FindField(this.FieldBox.Text) < 0)
                        {
                            this.QueryBut.Enabled = false;
                            result = false;
                        }
                        else
                        {
                            this.QueryBut.Enabled = true;
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#10
0
        public void GetBaseLine(IPoint point)
        {
            string str;
            string str1;
            string str2;

            this.timer_0.Stop();
            this.dataGridView1.Rows.Clear();
            IMap     map     = this.m_app.FocusMap;
            IFeature feature = ((IEnumFeature)map.FeatureSelection).Next();

            if (feature == null ? true : feature.FeatureType != esriFeatureType.esriFTSimpleEdge)
            {
                this.m_commonDistAls.m_pBaseLine = null;
                this.btAnalyse.Enabled           = false;
                this.m_app.FocusMap.ClearSelection();
                this.m_app.ActiveView.Refresh();
                //this.tbPipeWidthOrHeight.Text = "";
                return;
            }
            IFeatureLayer pLayer =
                CommonUtils.GetLayerByFeatureClassName(m_app.FocusMap, ((IDataset)feature.Class).Name) as IFeatureLayer;
            IPipelineLayer  pipeLayer = m_config.GetPipelineLayer(feature.Class as IFeatureClass);
            IBasicLayerInfo pipeLine  = m_config.GetBasicLayerInfo(feature.Class as IFeatureClass);

            if (pipeLine == null)
            {
                this.m_commonDistAls.m_pBaseLine = null;
                this.btAnalyse.Enabled           = false;
                this.m_app.FocusMap.ClearSelection();
                this.m_app.ActiveView.Refresh();
                return;
            }
            List <IBasicLayerInfo> basicInfos      = pipeLayer.GetLayers(enumPipelineDataType.Junction);
            IFeatureClass          junFeatureClass = basicInfos.Count > 0 ? basicInfos[0].FeatureClass : null;
            //需要重新获取边信息
            IGeometricNetwork      geometricNetwork = ((INetworkClass)junFeatureClass).GeometricNetwork;
            IFeatureClassContainer featureDataset   = geometricNetwork.FeatureDataset as IFeatureClassContainer;
            IPointToEID            pointToEIDClass  = new PointToEID();

            pointToEIDClass.SourceMap        = (m_app.FocusMap);
            pointToEIDClass.GeometricNetwork = (geometricNetwork);
            pointToEIDClass.SnapTolerance    = (m_app.ActiveView.Extent.Width / 200.0);
            int    edgeID   = 0;
            IPoint location = null;
            double percent  = 0;

            pointToEIDClass.GetNearestEdge(point, out edgeID, out location, out percent);
            if (edgeID == 0)
            {
                return;
            }

            int          userClassID;
            int          userID;
            int          userSubID;
            INetElements network = geometricNetwork.Network as INetElements;

            network.QueryIDs(edgeID, esriElementType.esriETEdge, out userClassID, out userID, out userSubID);
            IFeatureClass lineClass   = featureDataset.ClassByID[userClassID] as IFeatureClass;
            IFeature      lineFeature = lineClass.GetFeature(userID);
            IGeometry     shape       = lineFeature.Shape;

            if (shape.GeometryType == esriGeometryType.esriGeometryPolyline)
            {
                this.ipolyline_0 = CommonUtils.GetPolylineDeepCopy((IPolyline)shape);
                this.m_commonDistAls.m_pFeature     = feature;
                this.m_commonDistAls.m_pBaseLine    = this.ipolyline_0;
                this.m_commonDistAls.m_strLayerName = feature.Class.AliasName;
                //int num = feature.Fields.FindField("埋设方式");
                int num = lineFeature.Fields.FindField(pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.MSFS));
                str = (num == -1 ? "" : this.GetDBObjectValue(lineFeature.get_Value(num)));
                this.m_commonDistAls.m_strBuryKind = str;
                int num1 = lineFeature.Fields.FindField(pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.GJ));
                str1 = (num1 == -1 ? "" : this.GetDBObjectValue(lineFeature.get_Value(num1)));
                num1 = feature.Fields.FindField(pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.DMCC));
                str2 = (num1 == -1 ? "" : lineFeature.get_Value(num1).ToString());
                string str3 = "";
                if (str1 != "")
                {
                    str3 = str1;
                }
                if (str2 != "")
                {
                    str3 = str2;
                }
                this.m_commonDistAls.m_dDiameter = this.m_commonDistAls.GetDiameterFromString(str3.Trim());
                IEdgeFeature edgeFeature = (IEdgeFeature)lineFeature;
                this.m_commonDistAls.m_nBaseLineFromID = edgeFeature.FromJunctionEID;
                this.m_commonDistAls.m_nBaseLineToID   = edgeFeature.ToJunctionEID;
                this.btAnalyse.Enabled             = this.m_commonDistAls.m_pBaseLine != null;
                this.chitAnalyse_0.PipeLayer_Class = lineFeature.Class as IFeatureClass;
                this.chitAnalyse_0.BaseLine_OID    = lineFeature.OID;
                _baseLayerInfo = pipeLine;
            }
            else
            {
                MessageBox.Show("所选择的管线多于一条,或者不是管线!");
            }
        }
示例#11
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                int       num       = -1;
                DataTable dataTable = new DataTable();
                dataTable.Columns.Clear();
                _waitForm.Count = _featureLayers.Count;
                int i = 0;
                _waitForm.Worker.ReportProgress(i++, "状态: 正在汇总,请稍候...");
                if (_pointRadioChecked)
                {
                    if (!dataTable.Columns.Contains("层名"))
                    {
                        dataTable.Columns.Add("层名", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("点性"))
                    {
                        dataTable.Columns.Add("点性", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("个数"))
                    {
                        dataTable.Columns.Add("个数", typeof(int));
                    }
                    if (!dataTable.Columns.Contains("总数"))
                    {
                        dataTable.Columns.Add("总数", typeof(int));
                    }
                    int num2 = 0;
                    foreach (IFeatureLayer featureLayer in _featureLayers)
                    {
                        if (_waitForm.Worker.CancellationPending)
                        {
                            break;
                        }
                        _waitForm.Worker.ReportProgress(i++, "状态: 正在汇总 " + featureLayer.Name + ",请稍候...");
                        int      num3      = 0;
                        IFields  fields    = featureLayer.FeatureClass.Fields;
                        IYTField fieldInfo = pPipeCfg.GetSpecialField(featureLayer.FeatureClass.AliasName,
                                                                      PipeConfigWordHelper.PointWords.TZW);
                        if (fieldInfo == null)
                        {
                            continue;
                        }
                        string pointTableFieldName = fieldInfo.Name;
                        int    num4 = fields.FindField(pointTableFieldName);
                        if (num4 >= 0)
                        {
                            string         name          = featureLayer.Name;
                            ISpatialFilter spatialFilter = new SpatialFilter();
                            IFeatureClass  featureClass  = featureLayer.FeatureClass;
                            if (_isGeometrySet)
                            {
                                if (this.m_ipGeo != null)
                                {
                                    spatialFilter.Geometry = (this.m_ipGeo);
                                }
                                spatialFilter.SpatialRel = (esriSpatialRelEnum)(1);
                            }
                            ISelectionSet selectionSet = featureClass.Select(spatialFilter, (esriSelectionType)3,
                                                                             (esriSelectionOption)1, null);
                            ITableSort tableSort = new TableSort();
                            tableSort.Fields       = (pointTableFieldName);
                            tableSort.SelectionSet = (selectionSet);
                            tableSort.Sort(null);
                            ICursor rows = tableSort.Rows;
                            object  obj  = null;
                            int     num5 = 1;
                            IRow    row;
                            while ((row = rows.NextRow()) != null)
                            {
                                if (_waitForm.Worker.CancellationPending)
                                {
                                    break;
                                }
                                object obj2 = row.Value[num4];
                                if (obj == null || !this.ColumnEqual(obj, obj2))
                                {
                                    if (obj == null)
                                    {
                                        obj = obj2;
                                    }
                                    else
                                    {
                                        dataTable.Rows.Add(new object[]
                                        {
                                            name,
                                            obj,
                                            num5
                                        });
                                        num3 += num5;
                                        obj   = obj2;
                                        num5  = 1;
                                    }
                                }
                                else
                                {
                                    num5++;
                                }
                            }
                            num3 += num5;
                            num2 += num3;
                            dataTable.Rows.Add(new object[]
                            {
                                name,
                                obj,
                                num5,
                                num3
                            });
                        }
                    }
                    object[] array = new object[4];
                    array.SetValue("合计", 1);
                    array.SetValue(num2, 3);
                    dataTable.Rows.Add(array);
                }
                else
                {
                    if (!dataTable.Columns.Contains("层名"))
                    {
                        dataTable.Columns.Add("层名", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("规格"))
                    {
                        dataTable.Columns.Add("规格", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("材质"))
                    {
                        dataTable.Columns.Add("材质", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("条数"))
                    {
                        dataTable.Columns.Add("条数", typeof(int));
                    }
                    if (!dataTable.Columns.Contains("长度"))
                    {
                        dataTable.Columns.Add("长度", typeof(double));
                    }
                    if (!dataTable.Columns.Contains("总条数"))
                    {
                        dataTable.Columns.Add("总条数", typeof(int));
                    }
                    if (!dataTable.Columns.Contains("总长度"))
                    {
                        dataTable.Columns.Add("总长度", typeof(double));
                    }
                    int    num6 = 0;
                    double num7 = 0.0;
                    foreach (IFeatureLayer featureLayer in _featureLayers)
                    {
                        if (_waitForm.Worker.CancellationPending)
                        {
                            break;
                        }
                        _waitForm.Worker.ReportProgress(i++, "状态: 正在汇总 " + featureLayer.Name + ",请稍候...");
                        int             num8               = 0;
                        double          num9               = 0.0;
                        IFields         fields2            = featureLayer.FeatureClass.Fields;
                        IBasicLayerInfo layerInfo          = pPipeCfg.GetBasicLayerInfo(featureLayer.FeatureClass);
                        string          lineTableFieldName = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ);

                        int    num4 = fields2.FindField(lineTableFieldName);
                        string lineTableFieldName2 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.DMCC);
                        // this.pPipeCfg.GetLineTableFieldName("断面尺寸");
                        int    num10 = fields2.FindField(lineTableFieldName2);
                        string lineTableFieldName3 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GXCZ);
                        // this.pPipeCfg.GetLineTableFieldName("材质");
                        int num11 = fields2.FindField(lineTableFieldName3);
                        for (int k = 0; k < fields2.FieldCount; k++)
                        {
                            IField field = fields2.Field[k];
                            if (field.Type == (esriFieldType)7)
                            {
                                num = k;
                                break;
                            }
                        }
                        if (num4 >= 0 || num10 >= 0)
                        {
                            string         name           = featureLayer.Name;
                            ISpatialFilter spatialFilter2 = new SpatialFilter();
                            IFeatureClass  featureClass2  = featureLayer.FeatureClass;
                            if (_isGeometrySet)
                            {
                                if (this.m_ipGeo != null)
                                {
                                    spatialFilter2.Geometry = (this.m_ipGeo);
                                }
                                spatialFilter2.SpatialRel = (esriSpatialRelEnum)(1);
                            }
                            ISelectionSet selectionSet2 = featureClass2.Select(spatialFilter2, (esriSelectionType)3,
                                                                               (esriSelectionOption)1, null);
                            ITableSort tableSort2 = new TableSort();
                            tableSort2.Fields = (string.Concat(new string[]
                            {
                                lineTableFieldName,
                                ",",
                                lineTableFieldName2,
                                ",",
                                lineTableFieldName3
                            }));
                            tableSort2.SelectionSet = (selectionSet2);
                            tableSort2.Sort(null);
                            ICursor rows2 = tableSort2.Rows;
                            object  obj3  = null;
                            object  obj4  = null;
                            int     num12 = 1;
                            IRow    row2;
                            double  num13 = 0.0;
                            while ((row2 = rows2.NextRow()) != null)
                            {
                                if (_waitForm.Worker.CancellationPending)
                                {
                                    break;
                                }
                                object obj5 = row2.Value[num4];
                                if (obj5 is DBNull || obj5.ToString() == "0")
                                {
                                    obj5 = row2.Value[num10];
                                }
                                object obj6 = row2.Value[num11];
                                if (row2.Value[num] is DBNull)
                                {
                                    continue;
                                }
                                IPolyline        polyline        = (IPolyline)row2.Value[num];
                                IPointCollection pointCollection = (IPointCollection)polyline;
                                double           num14           = 0.0;
                                for (int l = 0; l < pointCollection.PointCount - 1; l++)
                                {
                                    IPoint point  = pointCollection.Point[l];
                                    IPoint point2 = pointCollection.Point[l + 1];
                                    num14 +=
                                        Math.Sqrt(Math.Pow(point.X - point2.X, 2.0) +
                                                  Math.Pow(point.Y - point2.Y, 2.0) +
                                                  Math.Pow(point.Z - point.M - point2.Z + point2.M, 2.0));
                                }
                                if (obj3 == null || !this.ColumnEqual(obj3, obj5))
                                {
                                    if (obj3 == null)
                                    {
                                        obj3   = obj5;
                                        num13 += num14;
                                    }
                                    else
                                    {
                                        num13 = Math.Round(num13, 3);
                                        dataTable.Rows.Add(new object[]
                                        {
                                            name,
                                            obj3,
                                            obj4,
                                            num12,
                                            num13
                                        });
                                        num8 += num12;
                                        num9 += num13;
                                        obj3  = obj5;
                                        obj4  = null;
                                        num13 = num14;
                                        num12 = 1;
                                    }
                                }
                                else if (obj4 == null || !this.ColumnEqual(obj4, obj6))
                                {
                                    if (obj4 == null)
                                    {
                                        obj4   = obj6;
                                        num13 += num14;
                                        num12++;
                                    }
                                    else
                                    {
                                        num13 = Math.Round(num13, 3);
                                        dataTable.Rows.Add(new object[]
                                        {
                                            name,
                                            obj3,
                                            obj4,
                                            num12,
                                            num13
                                        });
                                        num8 += num12;
                                        num9 += num13;
                                        num13 = num14;
                                        obj4  = obj6;
                                        num12 = 1;
                                    }
                                }
                                else
                                {
                                    num13 += num14;
                                    num12++;
                                }
                            }
                            num8 += num12;
                            num9 += num13;
                            num6 += num8;
                            num7 += num9;
                            num13 = Math.Round(num13, 3);
                            num9  = Math.Round(num9, 3);
                            dataTable.Rows.Add(new object[]
                            {
                                name,
                                obj3,
                                obj4,
                                num12,
                                num13,
                                num8,
                                num9
                            });
                        }
                    }
                    num7 = Math.Round(num7, 3);
                    object[] array2 = new object[7];
                    array2.SetValue("合计", 1);
                    array2.SetValue(num6, 5);
                    array2.SetValue(num7, 6);
                    dataTable.Rows.Add(array2);
                }
                e.Result = dataTable;
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#12
0
        private void btnAnalysis_Click(object obj, EventArgs eventArgs)
        {
            if (cmbDepthType.SelectedIndex < 0)
            {
                MessageService.Current.Warn("请先选择埋深数据类型再进行分析!");
                return;
            }
            this.gridView1.Columns.Clear();
            //this.gridControl1.DataRowCount=0;//.Rows.Clear();
            IQueryFilter queryFilter = null;
            bool         isM         = cmbDepthType.SelectedIndex > 0 ? true : false;

            if (chkRegionAnalysis.Checked)
            {
                ISpatialFilter spatialFilter = new SpatialFilterClass();
                spatialFilter.Geometry   = _context.ActiveView.Extent;
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                queryFilter = spatialFilter as IQueryFilter;
            }
            _table = null;
            foreach (CheckListFeatureLayerItem pclass in this.checkedListBox1.CheckedItems)
            {
                IFeatureLayer ifeatureLayer = pclass.m_pFeatureLayer;
                this.progressBar1.Visible = true;
                this.progressBar1.Maximum = ifeatureLayer.FeatureClass.FeatureCount(queryFilter);
                this.progressBar1.Step    = 1;
                this.progressBar1.Value   = 0;
                this.Text = "覆土分析 - 正在处理:" + ifeatureLayer.Name + "...";
                IPipelineLayer  pipelineLayer = _config.GetPipelineLayer(ifeatureLayer.FeatureClass);
                IBasicLayerInfo pipeLine      = _config.GetBasicLayerInfo(ifeatureLayer.FeatureClass) as IBasicLayerInfo;


                string lineConfig_Kind = pipelineLayer.Code;

                string sDepthMethod = "";
                string sDepPosition = "";
                int    num          =
                    ifeatureLayer.FeatureClass.Fields.FindField(
                        pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.MSFS));
                //基本上没有使用,因为所在位置没有数据
                int num2 =
                    ifeatureLayer.FeatureClass.Fields.FindField(
                        pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.SZWZ));
                IFeatureCursor featureCursor = ifeatureLayer.Search(queryFilter, false);
                int            qdmsIdx       = featureCursor.FindField(pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.QDMS));
                int            zdmsIdx       = featureCursor.FindField(pipeLine.GetFieldName(PipeConfigWordHelper.LineWords.ZDMS));

                BuildTable(featureCursor);
                IFeature feature = featureCursor.NextFeature();
                while (feature != null)
                {
                    this.progressBar1.Value = this.progressBar1.Value + 1;
                    if (feature.Shape == null || feature.Shape.GeometryType != esriGeometryType.esriGeometryPolyline)
                    {
                        feature = featureCursor.NextFeature();
                    }
                    else
                    {
                        if (num != -1)
                        {
                            sDepthMethod = feature.get_Value(num).ToString();
                        }
                        if (num2 != -1)
                        {
                            sDepPosition = feature.get_Value(num2).ToString();
                        }
                        double ruleMS = this.m_RuleMs.GetRuleMS(lineConfig_Kind, sDepthMethod, sDepPosition);
                        if (isM)
                        {
                            IPoint point  = ((IPointCollection)feature.Shape).get_Point(0);
                            IPoint point2 = ((IPointCollection)feature.Shape).get_Point(1);
                            if (point.M < ruleMS || point2.M < ruleMS)
                            {
                                this.FillFeatureValue(pipeLine, lineConfig_Kind, feature, ruleMS, point.M, point2.M);
                            }
                        }
                        else
                        {
                            double qdms = qdmsIdx >= 0 ? Convert.ToDouble(feature.Value[qdmsIdx]) : 0;
                            double zdms = qdmsIdx >= 0 ? Convert.ToDouble(feature.Value[zdmsIdx]) : 0;
                            if (qdms < ruleMS || zdms < ruleMS)
                            {
                                this.FillFeatureValue(pipeLine, lineConfig_Kind, feature, ruleMS, qdms, zdms);
                            }
                        }
                        feature = featureCursor.NextFeature();
                    }
                }
                Marshal.ReleaseComObject(featureCursor);
                this.progressBar1.Visible    = false;
                this.gridControl1.DataSource = _table;
            }
            this.Text = "覆土分析--记录数:" + _table.Rows.Count.ToString();
        }
示例#13
0
        public void GetBaseLine()
        {
            string str;
            string str1;
            string str2;

            this.timer_0.Stop();
            this.dataGridView1.Rows.Clear();
            IMap         map = this.m_app.FocusMap;
            IEnumFeature featureSelection = (IEnumFeature)map.FeatureSelection;

            featureSelection.Reset();
            IFeature feature = featureSelection.Next();

            if ((feature == null ? false : feature.FeatureType == (esriFeatureType)8))
            {
                CommonUtils.GetSmpClassName(feature.Class.AliasName);
                if (_config.IsPipelineLayer(feature.Class.AliasName))
                {
                    IGeometry shape = feature.Shape;
                    if (shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                    {
                        this.ipolyline_0 = CommonUtils.GetPolylineDeepCopy((IPolyline)shape);
                        IBasicLayerInfo layerInfo = _config.GetBasicLayerInfo(feature.Class.AliasName);
                        this.m_commonDistAls.m_pFeature     = feature;
                        this.m_commonDistAls.m_pBaseLine    = this.ipolyline_0;
                        this.m_commonDistAls.m_strLayerName = feature.Class.AliasName;
                        int num = feature.Fields.FindField(layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.MSFS));
                        str = (num == -1 ? "" : this.method_0(feature.get_Value(num)));
                        this.m_commonDistAls.m_strBuryKind = str;
                        int num1 = feature.Fields.FindField(layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ));
                        str1 = (num1 == -1 ? "" : this.method_0(feature.get_Value(num1)));
                        num1 = feature.Fields.FindField(layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.DMCC));
                        str2 = (num1 == -1 ? "" : this.method_0(feature.get_Value(num1)));
                        string str3 = "";
                        if (str1 != "")
                        {
                            str3 = str1;
                        }
                        if (str2 != "")
                        {
                            str3 = str2;
                        }
                        this.m_commonDistAls.m_dDiameter = this.m_commonDistAls.GetDiameterFromString(str3.Trim());
                        IEdgeFeature edgeFeature = (IEdgeFeature)feature;
                        this.m_commonDistAls.m_nBaseLineFromID = edgeFeature.FromJunctionEID;
                        this.m_commonDistAls.m_nBaseLineToID   = edgeFeature.ToJunctionEID;
                        this.btAnalyse.Enabled             = this.m_commonDistAls.m_pBaseLine != null;
                        this.chitAnalyse_0.PipeLayer_Class = feature.Class as IFeatureClass;
                        this.chitAnalyse_0.BaseLine_OID    = feature.OID;
                    }
                    else
                    {
                        MessageBox.Show("所选择的管线多于一条,或者不是管线!");
                    }
                }
                else
                {
                    this.m_commonDistAls.m_pBaseLine = null;
                    this.btAnalyse.Enabled           = false;
                    this.m_app.FocusMap.ClearSelection();
                    this.m_app.ActiveView.Refresh();
                }
            }
            else
            {
                this.m_commonDistAls.m_pBaseLine = null;
                this.btAnalyse.Enabled           = false;
                this.m_app.FocusMap.ClearSelection();
                this.m_app.ActiveView.Refresh();
            }
        }
示例#14
0
        private void CalButton_Click(object sender, EventArgs e)
        {
            Splash.Show();
            int       count     = this.Layerbox.CheckedItems.Count;
            int       num       = -1;
            DataTable dataTable = new DataTable();

            dataTable.Columns.Clear();
            Splash.Status = "状态: 正在汇总,请稍候...";
            if (this.PointRadio.Checked)
            {
                if (!dataTable.Columns.Contains("层名"))
                {
                    dataTable.Columns.Add("层名", typeof(string));
                }
                if (!dataTable.Columns.Contains("点性"))
                {
                    dataTable.Columns.Add("点性", typeof(string));
                }
                if (!dataTable.Columns.Contains("个数"))
                {
                    dataTable.Columns.Add("个数", typeof(int));
                }
                if (!dataTable.Columns.Contains("总数"))
                {
                    dataTable.Columns.Add("总数", typeof(int));
                }
                int num2 = 0;
                for (int i = 0; i < count; i++)
                {
                    int num3 = 0;
                    Splash.Status = "状态: 正在汇总" + this.Layerbox.CheckedItems[i] + ",请稍候...";
                    IFeatureLayer pPipeLayer =
                        ((ClassCollectformsUI.LayerboxItem) this.Layerbox.CheckedItems[i]).m_pPipeLayer;
                    IFields  fields    = pPipeLayer.FeatureClass.Fields;
                    IYTField fieldInfo = pPipeCfg.GetSpecialField(pPipeLayer.FeatureClass.AliasName,
                                                                  PipeConfigWordHelper.PointWords.TZW);
                    string pointTableFieldName = fieldInfo.Name;
                    int    num4 = fields.FindField(pointTableFieldName);
                    if (num4 >= 0)
                    {
                        string         name          = pPipeLayer.Name;
                        ISpatialFilter spatialFilter = new SpatialFilter();
                        IFeatureClass  featureClass  = pPipeLayer.FeatureClass;
                        if (this.GeometrySet.Checked)
                        {
                            if (this.m_ipGeo != null)
                            {
                                spatialFilter.Geometry = (this.m_ipGeo);
                            }
                            spatialFilter.SpatialRel = (esriSpatialRelEnum)(1);
                        }
                        ISelectionSet selectionSet = featureClass.Select(spatialFilter, (esriSelectionType)3,
                                                                         (esriSelectionOption)1, null);
                        ITableSort tableSort = new TableSort();
                        tableSort.Fields       = (pointTableFieldName);
                        tableSort.SelectionSet = (selectionSet);
                        tableSort.Sort(null);
                        ICursor rows = tableSort.Rows;
                        object  obj  = null;
                        int     num5 = 1;
                        for (IRow row = rows.NextRow(); row != null; row = rows.NextRow())
                        {
                            object obj2 = row.Value[num4];
                            if (obj == null || !this.ColumnEqual(obj, obj2))
                            {
                                if (obj == null)
                                {
                                    obj = obj2;
                                }
                                else
                                {
                                    dataTable.Rows.Add(new object[]
                                    {
                                        name,
                                        obj,
                                        num5
                                    });
                                    num3 += num5;
                                    obj   = obj2;
                                    num5  = 1;
                                }
                            }
                            else
                            {
                                num5++;
                            }
                        }
                        num3 += num5;
                        num2 += num3;
                        dataTable.Rows.Add(new object[]
                        {
                            name,
                            obj,
                            num5,
                            num3
                        });
                    }
                }
                object[] array = new object[4];
                array.SetValue("合计", 1);
                array.SetValue(num2, 3);
                dataTable.Rows.Add(array);
            }
            else
            {
                if (!dataTable.Columns.Contains("层名"))
                {
                    dataTable.Columns.Add("层名", typeof(string));
                }
                if (!dataTable.Columns.Contains("规格"))
                {
                    dataTable.Columns.Add("规格", typeof(string));
                }
                if (!dataTable.Columns.Contains("材质"))
                {
                    dataTable.Columns.Add("材质", typeof(string));
                }
                if (!dataTable.Columns.Contains("条数"))
                {
                    dataTable.Columns.Add("条数", typeof(int));
                }
                if (!dataTable.Columns.Contains("长度"))
                {
                    dataTable.Columns.Add("长度", typeof(double));
                }
                if (!dataTable.Columns.Contains("总条数"))
                {
                    dataTable.Columns.Add("总条数", typeof(int));
                }
                if (!dataTable.Columns.Contains("总长度"))
                {
                    dataTable.Columns.Add("总长度", typeof(double));
                }
                int    num6 = 0;
                double num7 = 0.0;
                for (int j = 0; j < count; j++)
                {
                    int    num8 = 0;
                    double num9 = 0.0;
                    Splash.Status = "状态: 正在汇总" + this.Layerbox.CheckedItems[j] + ",请稍候...";
                    IFeatureLayer pPipeLayer =
                        ((ClassCollectformsUI.LayerboxItem) this.Layerbox.CheckedItems[j]).m_pPipeLayer;
                    IFields         fields2            = pPipeLayer.FeatureClass.Fields;
                    IBasicLayerInfo layerInfo          = pPipeCfg.GetBasicLayerInfo(pPipeLayer.FeatureClass);
                    string          lineTableFieldName = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ);

                    int    num4 = fields2.FindField(lineTableFieldName);
                    string lineTableFieldName2 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.DMCC);
                    // this.pPipeCfg.GetLineTableFieldName("断面尺寸");
                    int    num10 = fields2.FindField(lineTableFieldName2);
                    string lineTableFieldName3 = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GXCZ);
                    // this.pPipeCfg.GetLineTableFieldName("材质");
                    int num11 = fields2.FindField(lineTableFieldName3);
                    for (int k = 0; k < fields2.FieldCount; k++)
                    {
                        IField field = fields2.Field[k];
                        if (field.Type == (esriFieldType)7)
                        {
                            num = k;
                            break;
                        }
                    }
                    if (num4 >= 0 || num10 >= 0)
                    {
                        string         name           = pPipeLayer.Name;
                        ISpatialFilter spatialFilter2 = new SpatialFilter();
                        IFeatureClass  featureClass2  = pPipeLayer.FeatureClass;
                        if (this.GeometrySet.Checked)
                        {
                            if (this.m_ipGeo != null)
                            {
                                spatialFilter2.Geometry = (this.m_ipGeo);
                            }
                            spatialFilter2.SpatialRel = (esriSpatialRelEnum)(1);
                        }
                        ISelectionSet selectionSet2 = featureClass2.Select(spatialFilter2, (esriSelectionType)3,
                                                                           (esriSelectionOption)1, null);
                        ITableSort tableSort2 = new TableSort();
                        tableSort2.Fields = (string.Concat(new string[]
                        {
                            lineTableFieldName,
                            ",",
                            lineTableFieldName2,
                            ",",
                            lineTableFieldName3
                        }));
                        tableSort2.SelectionSet = (selectionSet2);
                        tableSort2.Sort(null);
                        ICursor rows2 = tableSort2.Rows;
                        object  obj3  = null;
                        object  obj4  = null;
                        int     num12 = 1;
                        IRow    row2  = rows2.NextRow();
                        double  num13 = 0.0;
                        while (row2 != null)
                        {
                            object obj5 = row2.Value[num4];
                            if (obj5 is DBNull || obj5.ToString() == "0")
                            {
                                obj5 = row2.Value[num10];
                            }
                            object obj6 = row2.Value[num11];
                            if (row2.Value[num] is DBNull)
                            {
                                row2 = rows2.NextRow();
                            }
                            else
                            {
                                IPolyline        polyline        = (IPolyline)row2.Value[num];
                                IPointCollection pointCollection = (IPointCollection)polyline;
                                double           num14           = 0.0;
                                for (int l = 0; l < pointCollection.PointCount - 1; l++)
                                {
                                    IPoint point  = pointCollection.Point[l];
                                    IPoint point2 = pointCollection.Point[l + 1];
                                    num14 +=
                                        Math.Sqrt(Math.Pow(point.X - point2.X, 2.0) + Math.Pow(point.Y - point2.Y, 2.0) +
                                                  Math.Pow(point.Z - point.M - point2.Z + point2.M, 2.0));
                                }
                                if (obj3 == null || !this.ColumnEqual(obj3, obj5))
                                {
                                    if (obj3 == null)
                                    {
                                        obj3   = obj5;
                                        num13 += num14;
                                    }
                                    else
                                    {
                                        num13 = Math.Round(num13, 3);
                                        dataTable.Rows.Add(new object[]
                                        {
                                            name,
                                            obj3,
                                            obj4,
                                            num12,
                                            num13
                                        });
                                        num8 += num12;
                                        num9 += num13;
                                        obj3  = obj5;
                                        obj4  = null;
                                        num13 = num14;
                                        num12 = 1;
                                    }
                                }
                                else if (obj4 == null || !this.ColumnEqual(obj4, obj6))
                                {
                                    if (obj4 == null)
                                    {
                                        obj4   = obj6;
                                        num13 += num14;
                                        num12++;
                                    }
                                    else
                                    {
                                        num13 = Math.Round(num13, 3);
                                        dataTable.Rows.Add(new object[]
                                        {
                                            name,
                                            obj3,
                                            obj4,
                                            num12,
                                            num13
                                        });
                                        num8 += num12;
                                        num9 += num13;
                                        num13 = num14;
                                        obj4  = obj6;
                                        num12 = 1;
                                    }
                                }
                                else
                                {
                                    num13 += num14;
                                    num12++;
                                }
                                row2 = rows2.NextRow();
                            }
                        }
                        num8 += num12;
                        num9 += num13;
                        num6 += num8;
                        num7 += num9;
                        num13 = Math.Round(num13, 3);
                        num9  = Math.Round(num9, 3);
                        dataTable.Rows.Add(new object[]
                        {
                            name,
                            obj3,
                            obj4,
                            num12,
                            num13,
                            num8,
                            num9
                        });
                    }
                }
                num7 = Math.Round(num7, 3);
                object[] array2 = new object[7];
                array2.SetValue("合计", 1);
                array2.SetValue(num6, 5);
                array2.SetValue(num7, 6);
                dataTable.Rows.Add(array2);
            }
            Splash.Close();
            ClassCollectResultForm classCollectResultForm = new ClassCollectResultForm();

            if (this.PointRadio.Checked)
            {
                classCollectResultForm.nType = 0;
            }
            else
            {
                classCollectResultForm.nType = 1;
            }
            classCollectResultForm.ResultTable = dataTable;
            classCollectResultForm.ShowDialog();
        }
示例#15
0
 private void method_0(ILayer layer)
 {
     if (layer is IFeatureLayer && layer.Visible)
     {
         IFeatureLayer   featureLayer = layer as IFeatureLayer;
         IFeatureClass   featureClass = featureLayer.FeatureClass;
         IFields         fields       = featureClass.Fields;
         IBasicLayerInfo layerInfo    = _config.GetBasicLayerInfo(featureClass);
         if (featureClass.ShapeType == esriGeometryType.esriGeometryPoint)
         {
             //this.m_strBuildDate = this.pPipeCfg.GetPointTableFieldName("爆管次数");
             this.m_strBuildDate = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.SGYHDJ);
         }
         else
         {
             this.m_strBuildDate = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.SGYHDJ);
             // this.m_strBuildDate = this.pPipeCfg.GetLineTableFieldName("爆管次数");
         }
         int num = fields.FindField(this.m_strBuildDate);
         if (num == -1)
         {
             MessageBox.Show("爆管次数字段不存在!返回");
         }
         else
         {
             IField field = fields.get_Field(num);
             if (layerInfo != null &&
                 (layerInfo.DataType == enumPipelineDataType.Point ||
                  layerInfo.DataType == enumPipelineDataType.Line))
             {
                 DateTime now = DateTime.Now;
                 now.ToShortDateString();
                 now.AddYears(-1 * this.m_nExpireTime).ToShortDateString();
                 string whereClause;
                 if (field.Type == (esriFieldType)4)
                 {
                     whereClause = this.m_strBuildDate + "> '" + this.m_nExpireTime.ToString() + "'";
                 }
                 else
                 {
                     whereClause = this.m_strBuildDate + "> " + this.m_nExpireTime.ToString();
                 }
                 IFeatureClass arg_162_0        = featureClass;
                 IQueryFilter  queryFilterClass = new QueryFilter();
                 queryFilterClass.WhereClause = (whereClause);
                 IFeatureCursor featureCursor = arg_162_0.Search(queryFilterClass, false);
                 ILayerFields   layerFields   = (ILayerFields)featureLayer;
                 int            fieldCount    = featureLayer.FeatureClass.Fields.FieldCount;
                 this.dataGridView3.Rows.Clear();
                 this.dataGridView3.Columns.Clear();
                 DataGridViewCellStyle columnHeadersDefaultCellStyle = new DataGridViewCellStyle();
                 this.dataGridView3.ColumnHeadersDefaultCellStyle           = columnHeadersDefaultCellStyle;
                 this.dataGridView3.ColumnHeadersDefaultCellStyle.BackColor = Color.FromName("Control");
                 this.dataGridView3.Columns.Clear();
                 this.dataGridView3.ColumnCount = fieldCount;
                 for (int i = 0; i < fieldCount; i++)
                 {
                     IField field2    = layerFields.get_Field(i);
                     string aliasName = field2.AliasName;
                     this.dataGridView3.Columns[i].Name     = aliasName;
                     this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                 }
                 IFeature feature = featureCursor.NextFeature();
                 int      num2    = 0;
                 while (feature != null)
                 {
                     if (!feature.HasOID || feature == null)
                     {
                         feature = featureCursor.NextFeature();
                     }
                     else
                     {
                         string text   = "esriGeometry";
                         int    length = text.Length;
                         int    num3   = layerFields.FindField(featureLayer.FeatureClass.ShapeFieldName);
                         string text2  = featureLayer.FeatureClass.ShapeType.ToString();
                         string value  = text2.Remove(0, length);
                         this.dataGridView3.Rows.Add(new object[]
                         {
                             ""
                         });
                         int num4 = 1;
                         for (int j = 0; j < fieldCount; j++)
                         {
                             if (num3 == j)
                             {
                                 this.dataGridView3[j, num2].Value = value;
                             }
                             else
                             {
                                 this.dataGridView3[j, num2].Value = feature.get_Value(j).ToString();
                             }
                             num4++;
                         }
                         num2++;
                         feature = featureCursor.NextFeature();
                     }
                 }
                 this.Text = "多次爆点列表: 记录条数--" + num2.ToString();
             }
         }
     }
 }
示例#16
0
        private bool ValidateField()
        {
            int  layerCount    = m_context.FocusMap.LayerCount;
            int  selectedIndex = this.LayerBox.SelectedIndex;
            bool result;

            if (selectedIndex < 0)
            {
                result = false;
            }
            else
            {
                this.SelectLayer = null;
                if (this.MapControl == null)
                {
                    result = false;
                }
                else
                {
                    string b = this.LayerBox.SelectedItem.ToString();
                    for (int i = 0; i < layerCount; i++)
                    {
                        ILayer layer = m_context.FocusMap.get_Layer(i);
                        if (layer is IFeatureLayer)
                        {
                            string a = layer.Name.ToString();
                            if (a == b)
                            {
                                this.SelectLayer = (IFeatureLayer)m_context.FocusMap.get_Layer(i);
                                break;
                            }
                        }
                        else if (layer is IGroupLayer)
                        {
                            ICompositeLayer compositeLayer = (ICompositeLayer)layer;
                            if (compositeLayer != null)
                            {
                                int count = compositeLayer.Count;
                                for (int j = 0; j < count; j++)
                                {
                                    ILayer layer2 = compositeLayer.get_Layer(j);
                                    string a      = layer2.Name.ToString();
                                    if (a == b)
                                    {
                                        this.SelectLayer = (IFeatureLayer)layer2;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (this.SelectLayer == null)
                    {
                        result = false;
                    }
                    else
                    {
                        this.myfields = this.SelectLayer.FeatureClass.Fields;
                        IBasicLayerInfo layerInfo = pPipeCfg.GetBasicLayerInfo(this.SelectLayer.FeatureClass);
                        if (this.radioButton1.Checked)
                        {
                            this.FieldBox.Text = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.QSDW);
                            // this.FieldBox.Text = this.pPipeCfg.GetPointTableFieldName("所属");
                        }
                        else
                        {
                            this.FieldBox.Text = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.SZDL);
                        }
                        if (this.myfields.FindField(this.FieldBox.Text) < 0)
                        {
                            this.QueryBut.Enabled = false;
                            result = false;
                        }
                        else
                        {
                            this.QueryBut.Enabled = true;
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#17
0
        private void CalButton_Click_1(object sender, EventArgs e)
        {
            var count = _layersCheckedListBox.CheckedItems.Count;

            if (count == 0)
            {
                MessageBox.Show(@"请选定需要统计的管线");
            }
            else
            {
                ValidateField();
                var rowCount = dataGridView1.RowCount;
                if (rowCount <= 0)
                {
                    MessageBox.Show(@"请确定上下限的值,其值不能为空");
                }
                else if ((dataGridView1[0, 0].Value == null) && (dataGridView1[1, 0].Value == null))
                {
                    MessageBox.Show(@"没有确定管径的范围");
                }
                else
                {
                    var num2      = -1;
                    var dataTable = new DataTable();
                    dataTable.Columns.Clear();
                    if (!dataTable.Columns.Contains("层名"))
                    {
                        dataTable.Columns.Add("层名", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("统计范围"))
                    {
                        dataTable.Columns.Add("统计范围", typeof(string));
                    }
                    if (!dataTable.Columns.Contains("条数"))
                    {
                        dataTable.Columns.Add("条数", typeof(int));
                    }
                    if (!dataTable.Columns.Contains("长度"))
                    {
                        dataTable.Columns.Add("长度", typeof(double));
                    }
                    var count2 = dataGridView1.Rows.Count;
                    for (var i = 0; i < count; i++)
                    {
                        for (var j = 0; j < count2; j++)
                        {
                            var text  = (string)dataGridView1[0, j].Value;
                            var text2 = (string)dataGridView1[1, j].Value;
                            if ((text == null) || (text2 == null))
                            {
                                MessageBox.Show(@"请确定上下限的值,其值不能为空");
                                return;
                            }
                            double num3;
                            double num4;
                            try
                            {
                                num3 = Convert.ToDouble(text);
                                num4 = Convert.ToDouble(text2);
                            }
                            catch (Exception)
                            {
                                MessageBox.Show(@"请确定上下限的值");
                                return;
                            }
                            var pPipeLayer =
                                ((LayerboxItem)_layersCheckedListBox.CheckedItems[i]).m_pPipeLayer;
                            var fields             = pPipeLayer.FeatureClass.Fields;
                            var layerInfo          = PPipeCfg.GetBasicLayerInfo(SelectLayer.FeatureClass);
                            var lineTableFieldName = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.GJ);
                            // this.pPipeCfg.GetLineTableFieldName("管径");
                            var num = fields.FindField(lineTableFieldName);
                            for (var k = 0; k < fields.FieldCount; k++)
                            {
                                var field = fields.Field[k];
                                if (field.Type == (esriFieldType)7)
                                {
                                    num2 = k;
                                    break;
                                }
                            }
                            if (num >= 0)
                            {
                                var            name          = pPipeLayer.Name;
                                ISpatialFilter spatialFilter = new SpatialFilter();
                                var            featureClass  = pPipeLayer.FeatureClass;
                                if (GeometrySet.Checked)
                                {
                                    if (MIpGeo != null)
                                    {
                                        spatialFilter.Geometry = MIpGeo;
                                    }
                                    spatialFilter.SpatialRel = (esriSpatialRelEnum)1;
                                }
                                var selectionSet = featureClass.Select(spatialFilter, (esriSelectionType)3,
                                                                       (esriSelectionOption)1, null);
                                ITableSort tableSort = new TableSort();
                                tableSort.Fields       = lineTableFieldName;
                                tableSort.SelectionSet = selectionSet;
                                tableSort.Sort(null);
                                var rows = tableSort.Rows;
                                var num5 = 0;
                                var row  = rows.NextRow();
                                var num6 = 0.0;
                                while (row != null)
                                {
                                    var obj  = row.Value[num];
                                    var num7 = 0.0;
                                    if (obj is DBNull)
                                    {
                                        row = rows.NextRow();
                                    }
                                    else
                                    {
                                        try
                                        {
                                            num7 = Convert.ToDouble(obj);
                                        }
                                        catch (Exception)
                                        {
                                            // ignored
                                        }
                                        if ((num7 >= num3) && (num7 < num4))
                                        {
                                            var polyline        = (IPolyline)row.Value[num2];
                                            var pointCollection = (IPointCollection)polyline;
                                            var num8            = 0.0;
                                            for (var l = 0; l < pointCollection.PointCount - 1; l++)
                                            {
                                                var point  = pointCollection.Point[l];
                                                var point2 = pointCollection.Point[l + 1];
                                                if (double.IsNaN(point.Z))
                                                {
                                                    num8 +=
                                                        Math.Sqrt(Math.Pow(point.X - point2.X, 2.0) +
                                                                  Math.Pow(point.Y - point2.Y, 2.0));
                                                }
                                                else
                                                {
                                                    num8 +=
                                                        Math.Sqrt(Math.Pow(point.X - point2.X, 2.0) +
                                                                  Math.Pow(point.Y - point2.Y, 2.0) +
                                                                  Math.Pow(point.Z - point2.Z, 2.0));
                                                }
                                            }
                                            num6 += num8;
                                            num5++;
                                        }
                                        row = rows.NextRow();
                                    }
                                }
                                object obj2 = text + "-" + text2;
                                num6 = Math.Round(num6, 3);
                                dataTable.Rows.Add(name, obj2, num5, num6);
                            }
                        }
                    }
                    new ClassCollectResultForm
                    {
                        nType       = 1,
                        ResultTable = dataTable
                    }.ShowDialog();
                }
            }
        }
示例#18
0
        private void method_0(ILayer layer)
        {
            if (!(layer is IFeatureLayer) || !layer.Visible)
            {
                return;
            }
            IFeatureLayer   featureLayer = layer as IFeatureLayer;
            IFeatureClass   featureClass = featureLayer.FeatureClass;
            IFields         fields       = featureClass.Fields;
            string          text         = "节点性质";
            IBasicLayerInfo layerInfo    = _config.GetBasicLayerInfo(featureClass);

            if (featureClass.ShapeType == esriGeometryType.esriGeometryPoint)
            {
                this.m_strBuildDate = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.MSRQ);
                // this.pPipeCfg.GetPointTableFieldName("建设年代");
                text = layerInfo.GetFieldName(PipeConfigWordHelper.PointWords.TZW);
            }
            else
            {
                this.m_strBuildDate = layerInfo.GetFieldName(PipeConfigWordHelper.LineWords.MSRQ);
                // this.pPipeCfg.GetLineTableFieldName("建设年代");
            }
            int num = fields.FindField(this.m_strBuildDate);

            if (num == -1)
            {
                MessageBox.Show("建设年代字段不存在!返回");
                return;
            }

            IField field = fields.get_Field(num);

            if (layerInfo == null ||
                (layerInfo.DataType != enumPipelineDataType.Point && layerInfo.DataType != enumPipelineDataType.Line))
            {
                return;
            }
            DateTime now = DateTime.Now;

            now.ToShortDateString();
            string text2       = now.AddYears(-1 * this.m_nExpireTime).ToShortDateString();
            string whereClause = "";

            if (field.Type == esriFieldType.esriFieldTypeDate)
            {
                if (featureLayer.DataSourceType == "Personal Geodatabase Feature Class")
                {
                    whereClause = this.m_strBuildDate + "< #" + text2 + "#";
                    if (this.m_pCurLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        whereClause = string.Concat(new string[]
                        {
                            this.m_strBuildDate,
                            " < #",
                            text2,
                            "# AND ",
                            text,
                            " <> '直线点' AND ",
                            text,
                            " <> '转折点'"
                        });
                    }
                }
                if (featureLayer.DataSourceType == "SDE Feature Class")
                {
                    whereClause = this.m_strBuildDate + "< TO_DATE('" + text2 + "','YYYY-MM-DD')";
                    if (this.m_pCurLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        whereClause = string.Concat(new string[]
                        {
                            this.m_strBuildDate,
                            " < TO_DATE('",
                            text2,
                            "','YYYY-MM-DD') AND ",
                            text,
                            " <> '直线点' AND ",
                            text,
                            " <> '转折点'"
                        });
                    }
                }
            }
            else if (field.Type == (esriFieldType)4)
            {
                whereClause = this.m_strBuildDate + "< '" + text2 + "'";
                if (this.m_pCurLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                {
                    whereClause = string.Concat(new string[]
                    {
                        this.m_strBuildDate,
                        " < '",
                        text2,
                        "' AND ",
                        text,
                        " <> '直线点' AND ",
                        text,
                        " <> '转折点'"
                    });
                }
            }
            if (field.Type == (esriFieldType)1 || field.Type == 0)
            {
                whereClause = this.m_strBuildDate + "< " + text2;
                if (this.m_pCurLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                {
                    whereClause = string.Concat(new string[]
                    {
                        this.m_strBuildDate,
                        " < ",
                        text2,
                        " AND ",
                        text,
                        " <> '直线点' AND ",
                        text,
                        " <> '转折点'"
                    });
                }
            }
            IFeatureClass arg_396_0        = featureClass;
            IQueryFilter  queryFilterClass = new QueryFilter();

            queryFilterClass.WhereClause = (whereClause);
            IFeatureCursor featureCursor = arg_396_0.Search(queryFilterClass, false);
            ILayerFields   layerFields   = (ILayerFields)featureLayer;
            int            fieldCount    = featureLayer.FeatureClass.Fields.FieldCount;

            this.dataGridView3.Rows.Clear();
            this.dataGridView3.Columns.Clear();
            DataGridViewCellStyle columnHeadersDefaultCellStyle = new DataGridViewCellStyle();

            this.dataGridView3.ColumnHeadersDefaultCellStyle           = columnHeadersDefaultCellStyle;
            this.dataGridView3.ColumnHeadersDefaultCellStyle.BackColor = Color.FromName("Control");
            this.dataGridView3.Columns.Clear();
            this.dataGridView3.ColumnCount = fieldCount;
            for (int i = 0; i < fieldCount; i++)
            {
                IField field2    = layerFields.get_Field(i);
                string aliasName = field2.AliasName;
                this.dataGridView3.Columns[i].Name     = aliasName;
                this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            IFeature feature = featureCursor.NextFeature();
            int      num2    = 0;

            while (feature != null)
            {
                if (!feature.HasOID || feature == null)
                {
                    feature = featureCursor.NextFeature();
                }
                else
                {
                    string text3  = "esriGeometry";
                    int    length = text3.Length;
                    int    num3   = layerFields.FindField(featureLayer.FeatureClass.ShapeFieldName);
                    string text4  = featureLayer.FeatureClass.ShapeType.ToString();
                    string value  = text4.Remove(0, length);
                    this.dataGridView3.Rows.Add(new object[]
                    {
                        ""
                    });
                    int num4 = 1;
                    for (int j = 0; j < fieldCount; j++)
                    {
                        if (num3 == j)
                        {
                            this.dataGridView3[j, num2].Value = value;
                        }
                        else
                        {
                            this.dataGridView3[j, num2].Value = feature.get_Value(j).ToString();
                        }
                        num4++;
                    }
                    num2++;
                    feature = featureCursor.NextFeature();
                }
            }
            this.Text = "预警分析明析: 记录条数--" + num2.ToString();
        }