ArcGIS Engine代码共享-不同格式数据打开,对象创建,导入导出http://blog.csdn.net/linghe301/article/details/7204928ArcGIS Engine代码共享-颜色(Color)对象函数http://blog.csdn.net/linghe301/article/details/7204954ArcGIS Engine代码共享-要素(Feature)操作http://blog.csdn.net/linghe301/article/details/7204959ArcGIS Engine代码共享-字段(Field)操作http://blog.csdn.net/linghe301/article/details/7204963ArcGIS Engine代码共享-图层(Layer)操作http://blog.csdn.net/linghe301/article/details/7204969ArcGIS Engine代码共享-投影(SpatialReference)对象操作http://blog.csdn.net/linghe301/article/details/7204975ArcGIS Engine代码共享-符号(Symbol)对象操作http://blog.csdn.net/linghe301/article/details/7204979ArcGIS Engine代码共享-工作空间(workspace)对象操作http://blog.csdn.net/linghe301/article/details/7204985
IFeatureClass.Search(IQuery Filter,bool Recycling)参数说明
用户自定义动态电力符号(C#)
图形操作函数
将symbologycontrol中选中的symbol或对象转化为图像(VB.Net)
空间运算
Geometry相关函数(VB.NET)
修改图层的symbol(C#)
ArcGIS Engine开发系列:将地图导出为图片的两种方法
ArcGIS Engine自定义工具类,实现添加图名,比例尺,指北针等。 自定义工具类,实现添加图名,比例尺,指北针
-------------------------添加图名------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.ADF.BaseClasses;
using stdole;
//自定义工具类,实现添加图名功能
namespace WindowsApplication1
{
class addPageLayoutName:BaseTool
{
public Form1 formTemp;
TextBox textbox;
AxPageLayoutControl axLayoutControl;
IPoint pPoint;
//double xMap, yMap;
public static double xMap;
public static double yMap;
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
if (Button==1)
{
pPoint = formTemp.returnPageLayoutControl().ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
xMap = pPoint.X;
yMap = pPoint.Y;
formTemp.returnTextbox1().Location = new System.Drawing.Point(X,Y);
formTemp.returnTextbox1().Visible = true;
formTemp.returnTextbox1().Focus();
formTemp.returnTextbox1().Text = "请在此输入图名";
}
}
public override void OnCreate(object hook)
{
axLayoutControl = hook as AxPageLayoutControl;
}
public void AddTextElement(AxPageLayoutControl PageLayoutControl,double x,double y,string textName)
{
IPageLayout pPageLayout;
IActiveView pAV;
IGraphicsContainer pGraphicsContainer;
IPoint pPoint;
ITextElement pTextElement;
IElement pElement;
ITextSymbol pTextSymbol;
IRgbColor pColor;
pPageLayout = PageLayoutControl.PageLayout;
pAV = (IActiveView)pPageLayout;
pGraphicsContainer = (IGraphicsContainer)pPageLayout;
pTextElement = new TextElementClass();
IFontDisp pFont = new StdFontClass() as IFontDisp;
pFont.Bold = true;
pFont.Name = "宋体";
pFont.Size = 13;
pColor = new RgbColorClass();
pColor.Red = 255;
pTextSymbol = new TextSymbolClass();
pTextSymbol.Color = (IColor)pColor;
pTextSymbol.Font = pFont;
pTextElement.Text = textName;
pTextElement.Symbol = pTextSymbol;
pPoint = new PointClass();
pPoint.X = x;
pPoint.Y = y;
pElement = (IElement)pTextElement;
pElement.Geometry = (IGeometry)pPoint;
pGraphicsContainer.AddElement(pElement, 0);
pAV.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
}
}
另外附加其它(添加比例尺,指北针的代码,,,也是通过自定义工具类实现的,,,,下列只给出自定义工具类的代码!)
---------------------------------------添加指北针-------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.ADF.BaseClasses;
namespace WindowsApplication1
{
sealed class addNorthArrow : BaseTool
{
AxPageLayoutControl axPageLayout=null;
IPoint pPoint;
bool bInuse;
INewEnvelopeFeedback pNewEnvelopeFeedback = null;
public addNorthArrow()
{
base.m_caption= "添加指北针";
base.m_toolTip = "添加指北针";
base.m_category = "customCommands";
base.m_message = "添加指北针";
base.m_deactivate = true;
}
public override void OnCreate(object hook)
{
axPageLayout = (AxPageLayoutControl)hook;
}
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
pPoint = axPageLayout.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
bInuse = true;
}
public override void OnMouseMove(int Button, int Shift, int X, int Y)
{
if (bInuse==false)
{
return;
}
if (pNewEnvelopeFeedback==null)
{
pNewEnvelopeFeedback = new NewEnvelopeFeedbackClass();
pNewEnvelopeFeedback.Display = axPageLayout.ActiveView.ScreenDisplay;
pNewEnvelopeFeedback.Start(pPoint);
}
pNewEnvelopeFeedback.MoveTo(axPageLayout.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
}
public override void OnMouseUp(int Button, int Shift, int X, int Y)
{
if (bInuse==false)
{
return;
}
if (pNewEnvelopeFeedback==null)
{
pNewEnvelopeFeedback = null;
bInuse = false;
return;
}
IEnvelope pEnvelope=pNewEnvelopeFeedback.Stop();
if((pEnvelope.IsEmpty)||(pEnvelope.Width==0)||(pEnvelope.Height==0))
{
pNewEnvelopeFeedback = null;
bInuse = false;
return;
}
addNorthArrowForm northArrow = new addNorthArrowForm();
IStyleGalleryItem pStyleGalleryItemTemp = Form1.pStyleGalleryItem;
if (pStyleGalleryItemTemp==null)
{
return;
}
IMapFrame pMapframe = axPageLayout.ActiveView.GraphicsContainer.FindFrame(axPageLayout.ActiveView.FocusMap)as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = new MapSurroundFrameClass();
pMapSurroundFrame.MapFrame = pMapframe;
pMapSurroundFrame.MapSurround = (IMapSurround)pStyleGalleryItemTemp.Item;
//在pageLayout中根据名称查要Element,找到之后删除已经存在的指北针
IElement pElement = axPageLayout.FindElementByName("NorthArrows");
if (pElement!=null)
{
axPageLayout.ActiveView.GraphicsContainer.DeleteElement(pElement); //删除已经存在的指北针
}
pElement = (IElement)pMapSurroundFrame;
pElement.Geometry = (IGeometry)pEnvelope;
axPageLayout.ActiveView.GraphicsContainer.AddElement(pElement, 0);
axPageLayout.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
pNewEnvelopeFeedback = null;
bInuse = false;
}
}
}
----------------------------------------添加比例尺(Scale Bars)-----------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.ADF.BaseClasses;
namespace WindowsApplication1
{
sealed class addScaleBar:BaseTool
{
//----------------------------------------------------------
//发现的重大问题,如果用IHookHelper,就会出现问题,用AxPageLayoutControl则不会出现问题,以后注意
//private IHookHelper pHookHelper=null;
private AxPageLayoutControl axPagelayoutControl = null;
private IPoint pPoint;
private INewEnvelopeFeedback pNewEnvelopeFeedback;
private bool bInuse;
public addScaleBar()
{
base.m_caption = "ScaleBar";
base.m_category = "myCustomCommands(C#)";
base.m_message = "Add a scale bar map surround";
base.m_name = "myCustomCommands(C#)_ScaleBar";
base.m_toolTip = "Add a scale bar";
base.m_deactivate = true;
}
public override void OnCreate(object hook)
{
//pHookHelper.Hook = hook;
axPagelayoutControl = hook as AxPageLayoutControl;
}
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
pPoint = axPagelayoutControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
bInuse = true;
}
public override void OnMouseMove(int Button, int Shift, int X, int Y)
{
if (bInuse==false)
{
return;
}
if (pNewEnvelopeFeedback==null)
{
pNewEnvelopeFeedback = new NewEnvelopeFeedbackClass();
pNewEnvelopeFeedback.Display = axPagelayoutControl.ActiveView.ScreenDisplay;
pNewEnvelopeFeedback.Start(pPoint);
}
pNewEnvelopeFeedback.MoveTo(axPagelayoutControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
}
public override void OnMouseUp(int Button, int Shift, int X, int Y)
{
if (bInuse==false)
{
return;
}
if (pNewEnvelopeFeedback==null)
{
pNewEnvelopeFeedback = null;
bInuse = false;
return;
}
IEnvelope pEnvelope = pNewEnvelopeFeedback.Stop();
if ((pEnvelope.IsEmpty)||(pEnvelope.Width==0)||(pEnvelope.Height==0))
{
pNewEnvelopeFeedback = null;
bInuse = false;
return;
}
AddScaleBarForm scaleBarForm = new AddScaleBarForm();
//scaleBarForm.Show();
IStyleGalleryItem pStyleItem = Form1.pStyleGalleryItem;
if (pStyleItem == null)
{
return;
}
IMapFrame pMapframe = axPagelayoutControl.ActiveView.GraphicsContainer.FindFrame(axPagelayoutControl.ActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pSurroundFrame = new MapSurroundFrameClass();
pSurroundFrame.MapFrame = pMapframe;
pSurroundFrame.MapSurround = (IMapSurround)pStyleItem.Item;
//在pageLayout中根据名称查要Element,找到之后删除已经存在的比例尺
IElement pelement = axPagelayoutControl.FindElementByName("ScaleBars");
if (pelement != null)
{
axPagelayoutControl.ActiveView.GraphicsContainer.DeleteElement(pelement); //删除已经存在的指北针
}
pelement = (IElement)pSurroundFrame;
pelement.Geometry = (IGeometry)pEnvelope;
axPagelayoutControl.ActiveView.GraphicsContainer.AddElement(pelement, 0);
axPagelayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
pNewEnvelopeFeedback = null;
bInuse = false;
}
}
}
分享到:
相关推荐
ArcGIS Engine代码共享-不同格式数据
资料包含: ArcGIS_Engine_zh_105 ArcGIS_Engine_DevKit_105
能够让初学者使用C#结合arcgis engine实现arcmap功能的二次开发,实现界面的搭建、属性表的构建、符号设计器的设计、鹰眼的实现、右键菜单栏的创建等功能。
Arcgis engine 9.3 中文环境 新鲜出炉 用AE9.3开发的程序,由于客户要求中文,我用了许多AE 中的很多bean(比如toolbarbean),发布后是英文的。 于是百度,Google,搜AE9.3 中文环境,找了一下午都没有找到。 ...
ArcGIS Engine 开发技术ESRI官方代码
ArcGIS Engine开发课程设计源码下载 ArcGIS Engine 开发 源码
Qt结合ArcGIS Engine 开发
arcgis engine开发详解,全面介绍arcgis engine模块功能
ArcGIS Engine 10 Runtime,是运行基于ArcGIS Engine 10开发的程序必须的库文件,通常我们把这个Runtime整合在安装包中。总共有6个压缩包,请依次下载。
本压缩包包含了初学ArcGIS Engine(语言工具:C#)的基本学习课件,具体包括以下文件: 1.ArcGIS全套及下载地址.doc——简要介绍了ArcGIS所用到的软件,并给出了具体的下载地址; 2.ArcGIS Engine开发入门介绍.pdf...
这是与ArcGIS 10.3配套的ArcGIS Engine 10.3,由于之前自己一直很难找到,特此分享出来,给需要的人下载。
本压缩包包含了初学ArcGIS Engine(语言工具:C#)的基本学习课件,具体包括以下文件: 1.ArcGIS全套及下载地址.doc——简要介绍了ArcGIS所用到的软件,并给出了具体的下载地址; 2.ArcGIS Engine开发入门介绍.pdf...
ArcGIS Engine runtime 10 安装包及授权文件。内容包括百度网盘的下载链接。
发布ArcGIS Engine应用程序(ESRI官方文档,pdf格式)。简要介绍了开发和发布的过程等内容。
《ArcGIS Engine开发从入门到精通》共4篇分18章,第一篇基础篇(第1~9章)集中介绍了 ArcGIS Engine基础知识,包括开发基础组件对象模型、ArcGIS Engine介绍、基于.NET的ArcGIS Engine的开发,ArcGIS Engine中的...
针对于目前没有ArcGIS Engine Runtime 10 sp中文升级补丁需要中文版才能升级所以安装后骗过SP补丁包,让中文版SP补丁能够正常更新英文版的Engine,这样英文版的Engine就变成官方中文版的了。 安装方法 1,安装ArcGIS...
详细介绍了如何在ArcGIS Engine开发中加载MDB中的数据, 带有C#开发的代码
开发实例,有助于arcgis engine初学者学习。
ArcGIS Engine SDK 是用来开发和部署 GIS 及地图方面应用程序的组件化软件开发产 品。ArcGIS Engine SDK 不是终端产品而是共应用开发者使用的软件包。它能构建基本的 地图浏览或者全面的、动态的 GIS 编辑工具。使用...