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(); } }
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()); } } }
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; } } } }