Example #1
0
        private void UpdateView()
        {
            int layerCount = this.m_MapControl.LayerCount;

            for (int i = 0; i < layerCount; i++)
            {
                ILayer ipLay = this.m_MapControl.Layer[i];
                this.AddLayer(ipLay);
            }
            if (this.m_pFtLayer == null)
            {
                MessageBox.Show(@"没有加载道路中心线图层!");
                base.Close();
            }
            else
            {
                IFeatureClass  featureClass  = this.m_pFtLayer.FeatureClass;
                IFunctionLayer layer         = m_pPipeCfg.GetFunctionLayer(featureClass);
                IFeatureCursor featureCursor = featureClass.Search(null, false);
                IFeature       feature       = featureCursor.NextFeature();
                int            num           = feature.Fields.FindField(layer.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.DLMC));
                if (num >= 0)
                {
                    List <string> values = new List <string>();
                    CommonHelper.GetUniqueValues((ITable)featureClass,
                                                 layer.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.DLMC), values);
                    this.comboRoad1.Items.AddRange(values.ToArray());
                    this.comboRoad2.Items.AddRange(values.ToArray());
                }
            }
        }
Example #2
0
 private void FillValueBox()
 {
     if (this.SelectLayer == null)
     {
         MessageBox.Show(@"此图层不存在");
     }
     else
     {
         IFeatureClass  featureClass  = this.SelectLayer.FeatureClass;
         IFunctionLayer functionLayer = pPipeCfg.GetFunctionLayer(featureClass);
         IQueryFilter   queryFilter   = new QueryFilter();
         IFeatureCursor featureCursor = featureClass.Search(queryFilter, false);
         IFeature       feature       = featureCursor.NextFeature();
         this.comboBox1.Items.Clear();
         string text = functionLayer.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.JMDMC);
         int    num  = featureClass.Fields.FindField(text);
         if (num == -1)
         {
             this.button1.Enabled = false;
             MessageBox.Show(@"没有找到字段!");
         }
         else
         {
             this.button1.Enabled = true;
             this.comboBox1.Items.Clear();
             while (feature != null)
             {
                 object obj = feature.Value[num];
                 string text2;
                 if (obj == null || Convert.IsDBNull(obj))
                 {
                     text2 = "";
                 }
                 else
                 {
                     text2 = obj.ToString();
                 }
                 if (!this.comboBox1.Items.Contains(text2) && text2 != "")
                 {
                     this.comboBox1.Items.Add(text2);
                 }
                 feature = featureCursor.NextFeature();
             }
             if (this.comboBox1.Items.Count > 0)
             {
                 this.comboBox1.SelectedIndex = 0;
             }
         }
     }
 }
Example #3
0
 private void FillLayerBox()
 {
     if (this.SelectLayer == null)
     {
         MessageBox.Show(@"此图层不存在");
     }
     else
     {
         IFeatureClass  featureClass = this.SelectLayer.FeatureClass;
         IFunctionLayer layerInfo    = pPipeCfg.GetFunctionLayer(featureClass);
         this.comboBox1.Items.Clear();
         string text;
         if (this.radioButton1.Checked)
         {
             text = layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMMC);
         }
         else
         {
             text = layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMDW);
         }
         int num = featureClass.Fields.FindField(text);
         if (num == -1)
         {
             MessageBox.Show(@"没有找到字段!");
         }
         else
         {
             List <string> values = new List <string>();
             CommonHelper.GetUniqueValues((ITable)featureClass, text, values);
             this.comboBox1.Items.AddRange(values.ToArray());
             if (this.comboBox1.Items.Count > 0)
             {
                 this.comboBox1.SelectedIndex = 0;
             }
         }
     }
 }
Example #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.SelectLayer == null)
     {
         MessageBox.Show(@"项目地界层不存在!");
     }
     else
     {
         IFeatureClass  featureClass  = this.SelectLayer.FeatureClass;
         IFunctionLayer layerInfo     = pPipeCfg.GetFunctionLayer(featureClass);
         ISpatialFilter spatialFilter = new SpatialFilter();
         string         text          = this.comboBox1.Text;
         string         text2;
         if (!this.checkBox1.Checked)
         {
             if (this.radioButton1.Checked)
             {
                 text2 = $"{layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMMC)} = ";
             }
             else
             {
                 text2 = $"{layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMDW)} = ";
             }
             text2 += " '";
             text2 += text;
             text2 += "'";
         }
         else
         {
             if (this.radioButton1.Checked)
             {
                 text2 = $"{layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMMC)} LIKE ";
             }
             else
             {
                 text2 = $"{layerInfo.GetFieldName(PipeConfigWordHelper.FunctionLayerWorkds.XMDW)} LIKE ";
             }
             IDataset dataset = this.SelectLayer.FeatureClass as IDataset;
             if (dataset.Workspace.Type == (esriWorkspaceType)2)
             {
                 text2 += " '%";
                 text2 += text;
                 text2 += "%'";
             }
             else
             {
                 text2 += " '*";
                 text2 += text;
                 text2 += "*'";
             }
         }
         if (this.comboBox1.Text == "")
         {
             text2 = "";
         }
         spatialFilter.WhereClause = text2;
         IFeatureCursor pCursor = featureClass.Search(spatialFilter, false);
         //修改为插件事件,因为结果显示窗体为插件拥有。
         _plugin.FireQueryResultChanged(new QueryResultArgs(pCursor, (IFeatureSelection)this.SelectLayer));
     }
 }