コード例 #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());
                }
            }
        }
コード例 #2
0
        public void AutoFlash()
        {
            int layerCount = m_context.FocusMap.LayerCount;

            for (int i = 0; i < layerCount; i++)
            {
                ILayer         ipLay         = m_context.FocusMap.Layer[i];
                IFunctionLayer functionLayer = pPipeCfg.GetFunctionLayer(enumFunctionLayerType.Item);
                if (functionLayer == null)
                {
                    break;
                }
                if (this.GetLayer(functionLayer.AutoNames, ipLay))
                {
                    break;
                }
            }
            if (this.SelectLayer == null)
            {
                base.Close();
            }
            else
            {
                this.FillLayerBox();
            }
        }
コード例 #3
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;
             }
         }
     }
 }
コード例 #4
0
ファイル: FunctionLayer.cs プロジェクト: secondii/Yutai
 public FunctionLayer(IFunctionLayer layer, bool keepClass)
 {
     _name         = layer.Name;
     _aliasName    = layer.AliasName;
     _visible      = layer.Visible;
     _autoNames    = layer.AutoNames;
     _functionType = layer.FunctionType;
     _fields       = new List <IYTField>();
     foreach (IYTField layerField in layer.Fields)
     {
         _fields.Add(layerField.Clone(keepClass));
     }
     if (keepClass)
     {
         _featureClass  = layer.FeatureClass;
         _esriClassName = layer.EsriClassName;
     }
 }
コード例 #5
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;
             }
         }
     }
 }
コード例 #6
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));
     }
 }
コード例 #7
0
ファイル: PipelineConfig.cs プロジェクト: secondii/Yutai
        public bool IsFunctionLayer(string classAliasName, enumFunctionLayerType type)
        {
            IFunctionLayer layer = _functionLayers.FirstOrDefault(c => c.AliasName == classAliasName);

            return(layer != null && layer.FunctionType == type);
        }
コード例 #8
0
ファイル: PipelineConfig.cs プロジェクト: secondii/Yutai
        public bool IsFunctionLayer(IFeatureClass featureClass)
        {
            IFunctionLayer layer = _functionLayers.FirstOrDefault(c => c.AliasName == featureClass.AliasName);

            return(layer != null);
        }
コード例 #9
0
ファイル: PipelineConfig.cs プロジェクト: secondii/Yutai
        public bool IsFunctionLayer(string classAliasName)
        {
            IFunctionLayer layer = _functionLayers.FirstOrDefault(c => c.AliasName == classAliasName);

            return(layer != null);
        }