ArcGlobe移动图层顺序
来源:互联网 发布:如何和程序员谈恋爱 编辑:程序博客网 时间:2024/04/30 03:09
原文地址:http://www.gisall.com/html/63/151663-6305.html
要在TOC控件中移动顺序,其实就是这二个操作,选择要移动的图层;拖动要放置的位置,但是这两个操作牵扯到三个函数,分别是mousedown,mounsemove,mounseup。而在这三个操作里面牵扯一个重要的方法HitTest这里只做了对图层的移动,其它的没有考虑,现在直接上代码:
//保存选择的图层
public ILayer pSeletLayer = null;
public IBasicMap pBasicMap = null;
System.Object pOther = new object();
System.Object pIndex = new object();
private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)
{
ILayer pLayer = null;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//鼠标左击操作,对层的选择
if (e.button == 1)
{
this.axTOCControl1.HitTest(e.x, e.y, ref pItem, ref pBasicMap, ref pLayer, ref pOther, ref pIndex);
if (pItem == esriTOCControlItem.esriTOCControlItemLayer)
{
pSeletLayer = pLayer;
this.axTOCControl1.SelectItem(pLayer, null);
}
//刷新SelectLayer控件
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//鼠标右击操作
if (e.button == 2)
{
this.axTOCControl1.HitTest(e.x, e.y, ref pItem, ref pBasicMap, ref pLayer, ref pOther, ref pIndex);
/////////////////////////////////////////////////////////////////////////////
//显示右击事件窗口
if (pItem == esriTOCControlItem.esriTOCControlItemLayer)
{
pSeletLayer = pLayer;
this.axTOCControl1.SelectItem(pLayer, null);
if (pLayer is IFeatureLayer)
{
this.pContextMenuStrip.Show(this.axTOCControl1, new System.Drawing.Point(e.x, e.y));
}
}
else if (pItem == esriTOCControlItem.esriTOCControlItemMap)
{
this.pMapMenu.Show(this.axTOCControl1, new System.Drawing.Point(e.x, e.y));
}
}
}
private void axTOCControl1_OnMouseMove(object sender, ITOCControlEvents_OnMouseMoveEvent e)
{
IBasicMap pTemBasicMap = null;
System.Object pTemOther = new object();
System.Object pTemIndex = new object();
esriTOCControlItem pTemItem = new esriTOCControlItem(); //选择的TOC的项目名
ILayer pLayer = null;
if (e.button == 1)
{
this.axTOCControl1.HitTest(e.x, e.y, ref pTemItem, ref pTemBasicMap, ref pLayer, ref pTemOther, ref pTemIndex);
if (pTemItem != esriTOCControlItem.esriTOCControlItemNone)
{
axTOCControl1.MousePointer = esriControlsMousePointer.esriPointerCustom;
}
//刷新SelectLayer控件
}
}
private void axTOCControl1_OnMouseUp(object sender, ITOCControlEvents_OnMouseUpEvent e)
{
IBasicMap pTemBasicMap = null;
System.Object pTemOther = new object();
System.Object pTemIndex = new object();
esriTOCControlItem pTemItem = new esriTOCControlItem(); //选择的TOC的项目名
ILayer pLayer = null;
//鼠标左击操作,对层的选择
if (e.button == 1)
{
this.axTOCControl1.HitTest(e.x, e.y, ref pTemItem, ref pTemBasicMap, ref pLayer, ref pTemOther, ref pTemIndex);
if (pItem == esriTOCControlItem.esriTOCControlItemLayer)
{
if (pSeletLayer != pLayer && pLayer!=null)
{
this.axTOCControl1.SelectItem(pLayer, null);
this.globe.Globe.GlobeDisplay.Scene.MoveLayer(pSeletLayer, CommonHelper.GetIndexByLayer(this.globe.Globe, pLayer));
this.globe.Globe.GlobeDisplay.RefreshViewers();
this.axTOCControl1.Refresh();
this.axTOCControl1.SelectItem(pSeletLayer, null);
}
}
}
}
其中GetIndexByLayer 方法是用来获取图层对象的索引值,代码如下:
public static int GetIndexByLayer(IGlobe _pGlobe,ILayer _pLayer)
{
IScene pScene = _pGlobe.GlobeDisplay.Scene;
int pIndex = 0;
for (int i = 0; i < pScene.LayerCount; i++)
{
if (pScene.get_Layer(i).Name == _pLayer.Name)
{
pIndex = i;
return pIndex;
}
}
return pIndex;
}
- ArcGlobe移动图层顺序
- Arcglobe删除图层
- ArcGlobe图层高程拉伸
- ArcGIS Engine移动图层顺序
- GlobeControl中设置图层基本高程--ArcGlobe+C#
- ArcGlobe三维开发之一——图层及常用接口
- ArcGlobe三维开发之四——设置globe图层的缓存属性)
- ArcGlobe三维开发之五——获取并设置Globe图层的叠加次序
- 移动图层
- 移动photoshop图层
- TOCControl图层顺序调整
- 页面图层显示顺序
- ps如何移动图层
- 图层跟随精灵移动
- 移动层
- 层移动
- Photoshop脚本 > 复制图层并改变图层顺序
- 百度地图 Android SDK - 图层顺序
- Image is Everuthing LA2995
- [转]数据库操作-程序-java--oracle
- 如何学习编程?
- windows核心编程---StringCbCopy和StringCchCopy 函数
- Ari Zilka谈Ehcache的进程内堆外缓存BigMemory
- ArcGlobe移动图层顺序
- C++实现桥接模式
- hdu 1395 数论
- Android系统的无广告软件
- 超过存储量, 数据如何处理
- lucene学习第二篇
- 黑马程序员_交通灯管理系统
- 一缕阳光,照亮世界——ArcGlobe中光照功能介绍
- 2011级-csdn-java-张侃—自定义JSP标签(一)