Map 3D 2013中的AcMapMap.GroupModified 和AcMapMap.LayerModified 事件的参数变化

简介:


By Daniel Du

在Map 3D Geospatial Platform API中,AcMapMap.GroupModified 和AcMapMap.LayerModified 事件的参数类型由AcMapMappingEventArgs 变成了AcMapMapObjectModifiedEventArgs. 这个变化主要是在参数中增加了一个Modification 属性。通过这个属性我们可以判断是什么东西发生了变化。Modification 可能的取值是:

      /// <summary>

      /// Name property changed during the event.

      ///</summary>

      static const INT32 Name               = 1;

      /// <summary>

      /// Visibility changed during the event.

      ///</summary>

      static const INT32 Visibility         = 2;

      /// <summary>

      /// Layer selectability during the event.

      ///</summary>

      static const INT32 LayerSelectability = 4;

      /// <summary>

      /// Parent changed during the event.

      ///</summary>

      static const INT32 ParentChanged      = 8;

 

下面是如何使用的示例代码:

 

[CommandMethod("ListenToLayerChange")]

public void ListenToLayerChange()

{

  AcMapMap currentMap = AcMapMap.GetCurrentMap();

  currentMap.GroupModified +=

    new GroupModifiedHandler(currentMap_GroupModified);

  currentMap.LayerModified +=

    new LayerModifiedHandler(currentMap_LayerModified);

 

}

 

void currentMap_LayerModified(object sender,

                              AcMapMapObjectModifiedEventArgs args)

{

  OutputChanges(args.Modification);

}

void currentMap_GroupModified(object sender,

                              AcMapMapObjectModifiedEventArgs args)

{

  OutputChanges(args.Modification);

}

 

private static void OutputChanges(int modification)

{

  Editor ed = Autodesk.AutoCAD.ApplicationServices.Application

    .DocumentManager.MdiActiveDocument.Editor;

 

  ///// <summary>

  ///// Name property changed during the event.

  /////</summary>

  //static const INT32 Name               = 1;

  ///// <summary>

  ///// Visibility changed during the event.

  /////</summary>

  //static const INT32 Visibility         = 2;

  ///// <summary>

  ///// Layer selectability during the event.

  /////</summary>

  //static const INT32 LayerSelectability = 4;

  ///// <summary>

  ///// Parent changed during the event.

  /////</summary>

  //static const INT32 ParentChanged      = 8;

  switch (modification)

  {

    case 1:

      ed.WriteMessage("\n Layer or LayerGroup name is changed.");

      break;

 

    case 2:

      ed.WriteMessage(" \nLayer or LayerGroup Visibility  is changed.");

      break;

 

    case 4:

      ed.WriteMessage(" \nLayer or LayerGroup LayerSelectability is changed.");

      break;

 

    case 8:

      ed.WriteMessage(" \nLayer or LayerGroup Parent is changed.");

      break;

    default:

      break;

  }

}

 

当我在任务面板里对图层或者图层组进行更改时,就可以收到哪些发生变化的提示信息。

when I change the name of layer in task pane of Map 3D, the LayerModified event is trigger, with “args.Modification”, I know that it is the layer’s name is changed. Similarly, when I turn on/off a layer, I get a notification of the changes of visibility of layer. And when I drag one layer from one layer group to another, I get a notification saying that the parent of layer is changed.

 

The result output is as below:

-------------------------------------

Command: 
Command: netload 
Command: LISTENTOLAYERCHANGE 
Layer or LayerGroup name is changed. 
Layer or LayerGroup Visibility  is changed 
Layer or LayerGroup Parent is changed. 
Command: 

-------------------------------------

Hope this helps.

作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。



本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/archive/2012/07/18/2598002.html ,如需转载请自行联系原作者
相关文章
|
1月前
|
存储 前端开发 JavaScript
node中循环异步的问题[‘解决方案‘]_源于map循环和for循环对异步事件配合async、await的支持
本文探讨了在Node.js中处理循环异步操作的问题,比较了使用map和for循环结合async/await处理异步事件的差异,并提供了解决方案。
29 0
|
2月前
|
JavaScript 前端开发
Vue中传递自定义参数到后端、后端获取数据(使用Map接收参数)
这篇文章讲述了如何在Vue中通过Axios二次封装传递自定义参数到后端,并展示了后端如何使用Map接收这些参数,以及如何避免参数转换错误和统一接口设计的方法。
|
前端开发 JavaScript API
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(五)
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(五)
|
5月前
|
前端开发 数据库
返回参数不用实体类,用map返。resultType=“Map“,以及使用map不返回空的值解决办法,
返回参数不用实体类,用map返。resultType=“Map“,以及使用map不返回空的值解决办法,
131 1
|
5月前
|
Java
Java【代码分享 11】yaml配置List和Map参数对象的配置信息及类文件实例分享(效仿GatewayDynamic+DynamicDataSource的注入方法)
Java【代码分享 11】yaml配置List和Map参数对象的配置信息及类文件实例分享(效仿GatewayDynamic+DynamicDataSource的注入方法)
231 0
|
5月前
|
Java
【Java代码】反射机制处理传递给mapper文件的非Map类型参数对象(指定属性为空则设置默认值)
【Java代码】反射机制处理传递给mapper文件的非Map类型参数对象(指定属性为空则设置默认值)
51 0
|
5月前
|
JavaScript
封装echarts china map geo实现dispatch触发geoSelect事件高亮显示某个省份和城市,并定义复杂样式
封装echarts china map geo实现dispatch触发geoSelect事件高亮显示某个省份和城市,并定义复杂样式
|
前端开发 API 网络架构
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(六)
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(六)
|
前端开发 网络架构
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(四)
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(四)
|
前端开发 JavaScript 网络架构
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(三)
ES6-ES11-第一部分-let、const、解构赋值、模板字符串、简化对象写法、箭头函数、函数参数默认值、rest 参数、扩展运算符、Symbol、迭代器、生成器、Promise、Set、Map(三)