private void btnOK_Click(object sender, EventArgs e) { m_uctrGeneral.SaveChangeResult(); if (m_uctrDefQuery != null) { m_uctrDefQuery.GetQueryResult(); } if (m_uctrFields != null) { m_uctrFields.SaveFieldChange(); } //空间索引 if (m_ucSpatialIndex != null) { m_ucSpatialIndex.SetGridSize(); //空间索引 m_ucSpatialIndex.SetRasterNoDataColor(); //影像无效值设置 } this.Close(); //改掉刷新方式 xisheng 20111117*********************************************** if (m_MapControl != null) { m_MapControl.Refresh(esriViewDrawPhase.esriViewBackground, m_pLayer, null); } //改掉刷新方式 xisheng 20111117*********************************************end }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; if (Button == 1) { IGeometry Geo = m_MapControl.TrackLine(); m_MapControl.Map.ClearSelection(); m_MapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); m_MapControl.Map.SelectByShape(Geo, null, false); m_MapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); } }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { m_mapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; if (Button == 1) { IGeometry pGeo; pGeo = m_mapControl.TrackRectangle(); m_mapControl.Map.ClearSelection(); m_mapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); m_mapControl.Map.SelectByShape(pGeo, null, false); m_mapControl.CustomProperty = m_mapControl.Map.FeatureSelection; m_mapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); } }
public override void OnClick() { IMapControlDefault pMapControl = m_hookHelper.Hook as IMapControlDefault; IGeoFeatureLayer pGeoFeatLyr = pMapControl.CustomProperty as IGeoFeatureLayer; if (pGeoFeatLyr == null) { return; } SymbolForm symbolForm = new SymbolForm(); IStyleGalleryItem styleGalleryItem = null; switch (pGeoFeatLyr.FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPoint: styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols); break; case esriGeometryType.esriGeometryPolyline: styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols); break; case esriGeometryType.esriGeometryPolygon: styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols); break; } symbolForm.Dispose(); m_App.MainPlatfrom.Activate(); if (styleGalleryItem == null) { return; } ISimpleRenderer simpleRenderer = new SimpleRendererClass(); simpleRenderer.Symbol = (ISymbol)styleGalleryItem.Item; pGeoFeatLyr.Renderer = simpleRenderer as IFeatureRenderer; pMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null); }
/// <summary> /// 显示符号选择器 /// </summary> private void ShowSymbolSelectForm() { ISimpleRenderer currentSimpleRender; IMapControlDefault pMapControl = m_hookHelper.Hook as IMapControlDefault; IGeoFeatureLayer pGeoFeatureLayer = pMapControl.CustomProperty as IGeoFeatureLayer; if (pGeoFeatureLayer == null) { return; } currentSimpleRender = pGeoFeatureLayer.Renderer as ISimpleRenderer; SymbolForm symbolForm = new SymbolForm(currentSimpleRender); IStyleGalleryItem styleGallryItem = null; switch (pGeoFeatureLayer.FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPoint: styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols); break; case esriGeometryType.esriGeometryPolyline: styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols); break; case esriGeometryType.esriGeometryPolygon: styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols); break; } symbolForm.Dispose(); if (styleGallryItem == null) { return; } ISimpleRenderer simpleRender = new SimpleRendererClass(); simpleRender.Symbol = styleGallryItem.Item as ISymbol; pGeoFeatureLayer.Renderer = simpleRender as IFeatureRenderer; pMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null); SymbolChanged(); }
private void btnOK_Click(object sender, EventArgs e) { //刷新地图 if (m_MapControl != null) { ILayer m_layer = GetLayerByName(m_MapControl, m_pCurrentLayer.Name); if (m_layer == null) { MessageBox.Show("在地图中未找到选择图层,请重新选择查看图层!", "提示"); return; } IFeatureLayer pFeatureLayer = (IFeatureLayer)m_layer; m_pFeatureLayerDefinition = (IFeatureLayerDefinition)pFeatureLayer; m_pFeatureLayerDefinition.DefinitionExpression = RichTxtCondition.Text.Trim(); m_MapControl.Refresh(esriViewDrawPhase.esriViewBackground, m_layer, null); } this.Close(); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { ILayer pLayer = (ILayer)m_MapControl.CustomProperty; if (m_SubType == 1) { pLayer.MaximumScale = m_MapControl.MapScale; } if (m_SubType == 2) { pLayer.MinimumScale = m_MapControl.MapScale; } if (m_SubType == 3) { pLayer.MaximumScale = 0; pLayer.MinimumScale = 0; } m_MapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null); }
private void btn_OK_Click(object sender, EventArgs e) { IGeoFeatureLayer pGeoFeatureLayer = (IGeoFeatureLayer)m_FeatureLayer; //清除原有注记 pGeoFeatureLayer.DisplayAnnotation = false; m_MapControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); //得到图层的标注属性集合对象 IAnnotateLayerPropertiesCollection pAnnoProps = pGeoFeatureLayer.AnnotationProperties; //清空这个集合内的对象 pAnnoProps.Clear(); IAnnotateLayerProperties pAnnoLayerProps; ILineLabelPlacementPriorities pPlacement; ILineLabelPosition pPosition; IBasicOverposterLayerProperties pBasic; ILabelEngineLayerProperties pLabelEngine; //设置文本属性 stdole.IFontDisp pFont; pFont = new stdole.StdFontClass() as stdole.IFontDisp; pFont.Name = lbl_PreviewFont.Font.Name; pFont.Italic = lbl_PreviewFont.Font.Italic; pFont.Underline = lbl_PreviewFont.Font.Underline; pFont.Bold = lbl_PreviewFont.Font.Bold; pFont.Size = (decimal)lbl_PreviewFont.Font.Size; pFont.Strikethrough = lbl_PreviewFont.Font.Strikeout; IRgbColor pRGB = new RgbColorClass(); pRGB.Red = (int)lbl_PreviewFont.ForeColor.R; pRGB.Green = (int)lbl_PreviewFont.ForeColor.G; pRGB.Blue = (int)lbl_PreviewFont.ForeColor.B; ITextSymbol pTextSymbol = new TextSymbolClass(); pTextSymbol.Size = lbl_PreviewFont.Font.Size; pTextSymbol.Font = pFont; pTextSymbol.Color = pRGB; //设置注记文本的位置 pPosition = new LineLabelPositionClass(); pPosition.Parallel = false; pPosition.Perpendicular = true; pPlacement = new LineLabelPlacementPrioritiesClass(); pBasic = new BasicOverposterLayerPropertiesClass(); pBasic.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolyline; pBasic.LineLabelPosition = pPosition; //新建一个图层注记引擎对象,并设置它的属性 pLabelEngine = new LabelEngineLayerPropertiesClass(); pLabelEngine.Symbol = pTextSymbol; pLabelEngine.BasicOverposterLayerProperties = pBasic; //设置注记字段 pLabelEngine.Expression = "[" + cbx_Field.SelectedItem.ToString() + "]"; pAnnoLayerProps = (IAnnotateLayerProperties)pLabelEngine; pAnnoProps.Add(pAnnoLayerProps); pGeoFeatureLayer.DisplayAnnotation = true; m_MapControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); }