arcgis用箭头标注距离

arcgis用箭头标注距离,第1张

arcgis用箭头标注距离方式如下:

1、打开arcgis,加入线数据。

2、开始编辑数据。

3、点击创建要素工具。

4、点击模板中的线。

5、打开数据下的线型,选择箭头,再点确定。

ArcGIS是计算机制图应用,包含全球范围内底图地图数据、应用程序以及可配置应用模板和开发人员使用GIS工具和API,用于创建Web地图发布GIS服务,共享地图数据和应用程序,以及管理组织内容和多个用户。

ArcGISengine中⽓泡标注的添加、修改!

ArcGIS engine中⽓泡标注,是我们在编辑图形中⼀个重要的⼯具,能提供注释功能,下⾯的介绍怎么来编程实现callout的添加,以及怎么去修改它们!

// 在Mapcontrol的mouseDown中添加下列内容,来添加⽓泡注释功能:callout.

privatevoid axMapControl1_OnMouseDown(object sender,IMapControlEvents2_OnMouseDownEvent e)

{

axMapControl1.CurrentTool = null

IPoint pPoint

pPoint = new PointClass()

pPoint.PutCoords(e.mapX, e.mapY)

IFormattedTextSymbol pTextSymbol = newTextSymbolClass()

pTextSymbol.Background =CreateBalloonCallout(e.mapX, e.mapY) asITextBackground

pTextSymbol.Direction =esriTextDirection.esriTDAngle

pTextSymbol.Angle = 15

ITextElement pTextElement = newTextElementClass()

pTextElement.Symbol = pTextSymbol asITextSymbol

pTextElement.Text = "MaDeSheng"

IElement ptexte = pTextElement asIElement

pPoint = new PointClass()

pPoint.PutCoords(e.mapX * 0.90, e.mapY*1.1)

ptexte.Geometry = pPoint as IGeometry

IMap pMap = axMapControl1.Map

IGraphicsContainer pGraphicsContainer = pMap asIGraphicsContainer

pGraphicsContainer.AddElement(pTextElement asIElement, 0)

this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null, null)

}

红颜⾊的部分是产⽣⽓泡背景,具体程序如下:

public IBalloonCalloutCreateBalloonCallout(double x, double y)

{

IRgbColor pRgbClr = newRgbColorClass()

pRgbClr.Red =225

pRgbClr.Blue =225

pRgbClr.Green =225

ISimpleFillSymbol pSmplFill =new SimpleFillSymbolClass()

pSmplFill.Color =pRgbClr

pSmplFill.Style =esriSimpleFillStyle.esriSFSSolid

IBalloonCallout pBllnCallout= new BalloonCalloutClass()

//pBllnCallout.Style =esriBalloonCalloutStyle.esriBCSRectangle

pBllnCallout.Style =esriBalloonCalloutStyle.esriBCSRoundedRectangle

pBllnCallout.Symbol =pSmplFill

pBllnCallout.LeaderTolerance= 5

IPoint pPoint = newESRI.ArcGIS.Geometry.PointClass()

pPoint.X =x

pPoint.Y =y

pBllnCallout.AnchorPoint =pPoint

returnpBllnCallout

}

那么添加了之后如何修改呢?

双击事件!

private void axMapControl1_OnDoubleClick(objectsender, IMapControlEvents2_OnDoubleClickEvent e)

{

if(e.button ==1)

{

//标注的修改

if(((axMapControl1.CurrentTool) as ICommand).Name =="ControlToolsGraphicEleme nt_SelectTool")//这⼀句的判断很⽜B,我当时考虑了半天才搞出来。难点呀!toolbarControl中要加载esriControls.ControlsSelectTool⼯具

{

IPoint pPoint = new PointClass()

pPoint.PutCoords(e.mapX, e.mapY)

IMap pMap = axMapControl1.Map

IGraphicsContainer pGraphicsContainer = pMap asIGraphicsContainer

IEnumElement pEnumElement =pGraphicsContainer.LocateElements(pPoint, 10)

if (pEnumElement != null)

{

IElementpElement = pEnumElement.Next()

if(pElement is ITextElement)

{

ITextElement ptextElement =pElement as ITextElement

labelEditCallout pLabelEditCallout = newlabelEditCallout(ptextElement.Text,ptextElement.Symbol)

pLabelEditCallout.ShowDialog()

ptextElement.Text =pLabelEditCallout.inputText

ptextElement.Symbol =pLabelEditCallout.textSymbol

pGraphicsContainer.DeleteElement(pElement)

pGraphicsContainer.AddElement(pElement,0)

//这两句可以⽤pGraphicsContainer.UpdataElement(pElement);来代替

this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null, null)

}

}

}

}

}

labelEditCallout是我⾃⼰弄的⼀个修改样式,其实很简单的⼀个页⾯,截图如下:

具体,代码如下:

usingSystem

usingSystem.Collections.Generic

usingSystem.ComponentModel

usingSystem.Data

usingSystem.Drawing

usingSystem.Linq

usingSystem.Text

usingSystem.Windows.Forms

usingESRI.ArcGIS.Display

usingESRI.ArcGIS.Geometry

namespaceEdit

{

public partial class labelEditCallout :Form

{

publicstring inputText = ""

publicITextSymbol textSymbol

privatebool ModifFillColor = false

publiclabelEditCallout(string s,ITextSymbol texSy)

{

inputText =s

textSymbol =texSy

InitializeComponent()

}

privatevoid labelEditCallout_Load(object sender, EventArgse)

{

textBox1.Text =inputText

comboBox1.Items.Add("矩形框")

comboBox1.Items.Add("圆⾓矩形")

//comboBox1.Items.Add("Oval")

comboBox1.SelectedIndex = 1

}

publicIColor ConvertColorToIColor(Color color)

{

IColor pColor = newRgbColorClass()

pColor.RGB = color.B * 65536+ color.G * 256 + color.R

returnpColor

}

privatevoid button2_Click(object sender, EventArgs e)

{

IBalloonCallout textBack =(((IFormattedTextSymbol)textSymbol).Background) asIBalloonCalloutIFillSymbol pOldFill =textBack.Symbol

IPoint pPoint =textBack.AnchorPoint

ISimpleFillSymbol pSmplFill =new SimpleFillSymbolClass()

pSmplFill.Style =esriSimpleFillStyle.esriSFSSolid

if(ModifFillColor)

{

pSmplFill.Color =ConvertColorToIColor(this.button1.BackColor)

}

else

pSmplFill.Color =pOldFill.Color

IBalloonCallout pBllnCallout= new BalloonCalloutClass()

switch(comboBox1.Text)

{

case"矩形框":

pBllnCallout.Style =esriBalloonCalloutStyle.esriBCSRectangle

break

case"圆⾓矩形":

pBllnCallout.Style =esriBalloonCalloutStyle.esriBCSRoundedRectangle

break

//case"Oval":

// pBllnCallout.Style =esriBalloonCalloutStyle.esriBCSOval

// break

}

pBllnCallout.Symbol =pSmplFill

pBllnCallout.LeaderTolerance= 5

pBllnCallout.AnchorPoint =pPoint

IFormattedTextSymbolpTextSymbol = new

1.在ArcGIS中,打开要编辑的图层。

2.在“编辑”工具栏中,单击“编辑”按钮。

3.在地图上选择要更改的黑箭头。

4.在“编辑”工具栏中,单击“属性”按钮。

5.在“属性”窗口中,单击“符号”标签。

6.在“符号”窗口中,单击“符号类型”下拉菜单,并选择“十字架”。

7.单击“确定”按钮,将黑箭头更改为十字架。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11479328.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存