ArcEngine开发鹰眼实现问题
在网上百度一下有关AE鹰眼实现的代码,基本是一样的,可问题是好多代码自己运行起来鹰眼却总是加不进地图。住视图axMapControl1.OnMapReplaced(),axMapControl1.OnExtentUpdated(),axMapControl2.OnMouseDown(),axMapControl2.OnMouseMove()在这几个事件绑定的委托方法里写代码,能够实现鹰眼所必须的功能。问题看似简单,代码也不难理解,可往往别人的代码到我们这里却总是会出现很多bug,问题是什么,我现在也不知道,为什么鹰眼地图总是加不进去,按理说代码改来改去都觉得问题不大应该可以实现,可就是无法显示,蛋疼的很。这也就是我们看别人代码思路感觉都对着,可往往在我们实际去做,总是会出现各种各样的不如人意。哎,不说了,把那经典的代码贴下来,那天返回来再看吧。现在我只有用比较笨的硬拷贝方法来实现鹰眼的显示联动问题了。
private void axMapControl2_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
if (axMapControl2.Map.LayerCount > )
{
if (e.button == )
{
IPoint pPt = new PointClass();
pPt.X = e.mapX;
pPt.Y = e.mapY;
IEnvelope pEnvelope = axMapControl1.Extent as IEnvelope;
pEnvelope.CenterAt(pPt);
axMapControl1.Extent = pEnvelope;
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
else if (e.button == )
{
IEnvelope pEnvelope = axMapControl2.TrackRectangle();
axMapControl1.Extent = pEnvelope;
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
}
} private void axMapControl2_OnMouseMove(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e)
{
if (e.button != )
return;
IPoint pPt = new PointClass();
pPt.X = e.mapX;
pPt.Y = e.mapY;
axMapControl1.CenterAt(pPt);
axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
} private void axMapControl1_OnMapReplaced(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e)
{
if (axMapControl1.LayerCount > )
{
//IMap pMap = axMapControl1.Map;
axMapControl2.Map = new MapClass(); for (int i = ; i <= axMapControl1.Map.LayerCount - ; i++)
{
//axMapControl2.Map.AddLayer(pMap.get_Layer(i));
axMapControl2.AddLayer(axMapControl1.get_Layer(i));
}
}
axMapControl2.Extent = axMapControl1.FullExtent;
axMapControl2.Refresh();
} private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
{
IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;
IActiveView pAV = pGraphicsContainer as IActiveView;
pGraphicsContainer.DeleteAllElements();
IRectangleElement pRecElement = new RectangleElementClass();
IElement pEle = pRecElement as IElement;
IEnvelope pEnv;
pEnv = e.newEnvelope as IEnvelope;
IRgbColor pColor = new RgbColorClass();
pColor.Red = ;
pColor.Green = ;
pColor.Blue = ;
pColor.Transparency = ;
//产生一个线符号对象
ILineSymbol pLineSymbol = new SimpleLineSymbolClass();
pLineSymbol.Width = ;
pLineSymbol.Color = pColor;
//设置填充符号属性
IFillSymbol pFillSymbol = new SimpleFillSymbolClass();
//设置透明颜色
pColor.Transparency = ;
pFillSymbol.Color = pColor;
pFillSymbol.Outline = pLineSymbol;
IFillShapeElement pFillShapeElement = pRecElement as IFillShapeElement;
pFillShapeElement.Symbol = pFillSymbol;
pGraphicsContainer.AddElement(pEle, ); axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
why it doesn't run ?
ArcEngine开发鹰眼实现问题的更多相关文章
- arcengine 开发经典帖 【强烈推荐仔细研读】
转自原文 arcengine 开发经典帖 使用ArcGIS Engine 开发自定义GIS应用: 第一部分:使用ArcGIS Engine 发布自定义GIS应用软件-全面了解ArcGIS Engine ...
- Arcengine 开发,FeatureClass新增feature时“The Geometry has no z-value”或"The Geometry has null z-value"的解决方案
Arcengine 开发,当图层含有Z值时,新增的feature没有Z值就会 出现“The Geometry has no z-value”的错误.意思很明显,新增的geometry没有Z值. 此时按 ...
- ArcEngine开发中“错误类型"****"未定义构造函数”
from:http://blog.csdn.net/mengdong_zy/article/details/8990593 问题 在ArcEngine开发的时候,在编译时,发现出现这样的错误,出错的地 ...
- ArcEngine开发遇到的问题(转)
ArcEngine开发遇到的问题 https://blog.csdn.net/u013751758/article/category/6971559 转载 2018年02月11日 17:28:11 1 ...
- ArcGIS Engine开发鹰眼图的功能(代码优化篇)
在上一篇,ArcGIS Engine开发鹰眼图的功能(基础篇) 上一篇的实现效果图如下, 如果仔细观察,会发现一个问题,即在“鹰眼”的区域,只要在红色线框内的注记会被覆盖. 如果红色框包括整张图的话, ...
- ArcGIS Engine开发鹰眼图的功能(基础篇)
鹰眼是用于调节全视域范围内主地图显示范围情况的副地图.它体现了地图整体与详细局部的关系. 用户可以通过鼠标单击或者画框等动作实现鹰眼与主地图的交互情况. 鹰眼功能的原理是通过主地图窗口的地图控件和鹰眼 ...
- 利用ArcEngine开发地图发布服务,将mxd文档一键发布成wmts,并根据需要对地图进行空间查询,返回客户端geojson
一直想开发一个软件取代ArcGIS Server,该软件使用ArcEngine开发,以Windows Service形式发布,部署在服务端上,解决wmts地图服务发布和空间查询的问题,经过不断的研究. ...
- arcengine 开发经典帖
http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=25575&page=1&extra= 使用ArcGIS Engine 开发自定义 ...
- ArcEngine开发中StartEditing和StartEditOperation的区别
背景: 最近在开发一个管道数据维护系统的新增模块,牵涉到将这个模块的数据编辑统一到整个系统的编辑处理框架内的问题:即这个系统的所有对数据产生的编辑都需要处在整个系统唯一的开始.保存.回滚编辑的入口内. ...
随机推荐
- 20165224 陆艺杰 Exp4 恶意代码分析
Exp4 恶意代码分析 1实验后回答问题 (1)如果在工作中怀疑一台主机上有恶意代码,但只是猜想,所有想监控下系统一天天的到底在干些什么.请设计下你想监控的操作有哪些,用什么方法来监控. 计划任务每段 ...
- python学习之路---day04
一:元组 元组案例:tuple=("张三","李四","王五","小六","大七",["1 ...
- 012 Android Palette颜色选择器的使用
1.页面总体使用线性布局(LinearLayout) 2.将Toolbar(顶部菜单栏)拖入design模式下的设计界面中 3.颜色选择器需要在build.gradle中手动的添加 compile ' ...
- 静态区间第K小(整体二分、主席树)
题目链接 题解 主席树入门题 但是这里给出整体二分解法 整体二分顾名思义是把所有操作放在一起二分 想想,如果求\([1-n]\)的第\(k\)小怎么二分求得? 我们可以二分答案\(k\), \(O(n ...
- A. Little C Loves 3 I Codeforces Round #511 (Div. 2) 【数学】
题目: Little C loves number «3» very much. He loves all things about it. Now he has a positive integer ...
- A Simple Problem with Integers(线段树区间更新复习,lazy数组的应用)-------------------蓝桥备战系列
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of op ...
- Bubble Sort Graph CodeForces - 340D || 最长不下降/上升子序列
Bubble Sort Graph CodeForces - 340D 题意: 给出一个n个数的数列,建一个只有n个结点没有边的无向图,对数列进行冒泡排序,每交换一对位置在(i,j)的数在点i和点j间 ...
- 关于jstl taglib的错误 Can not find the tag library descriptor for “http://java.sun.com/jstl/core”
在查了N个帖子之后,决定记录一下关于jstl taglib的配置方法. 首先我遇到的错误是: Can not find the tag library descriptor for "htt ...
- maven项目在eclipse中debug时看不到源码?
就像图中一样,看不到源码,但是能step over,也可查看变量值,点击edit source lookup path,选定项目的一瞬间源码会出来,但马上又变回原样了,求大神指教~ 我也遇到这个问题了 ...
- 数据插入INSERT
一.INSERT SELECT :将查询的数据直接插入 特点: 1.一次性插入所有查询出来的数据. 2.数据原子性,有一个失败全部失败. 3.没有指定的列加默认值或NULL,都没有就报错. 二.INS ...