爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5543|回复: 19

MeteoInfo脚本示例:手动绘制的图形创建图层

[复制链接]

新浪微博达人勋

发表于 2013-11-14 13:09:25 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
MeteoInfo里有比较丰富的手动绘制图形的功能,可以利用这些手动绘制的图形生成相应的图层。这里简单示例一个Polygon图形生成一个Polygon图层的例子:

先利用"New Polygon"工具手动绘制一个多边形。
Image00490.png

可以对已绘制的图形进行修改。用"Select Element“工具选中图形,会出现外接矩形框:
Image00487.png

然后点击"Edit Vertices"工具修改多边形的节点:
Image00489.png

修改完成的图形可以通过脚本程序创建一个Polygon图层:
Image00486.png

脚本程序:
  1. #--------------------------------------------------------        
  2. # Author: Yaqiang Wang                                          
  3. # Date: 2013-11-14                                                
  4. # Purpose: Create a polygon layer from a polygon plot  
  5. # Note: Sample                                                   
  6. #-----------------------------------------------------------  
  7. #---- Import clr and classes
  8. import clr
  9. clr.AddReference("MeteoInfoC.dll")
  10. from System import *
  11. from System.Collections.Generic import *
  12. from MeteoInfoC import *
  13. from MeteoInfoC.Layer import *
  14. from MeteoInfoC.Shape import *
  15. from MeteoInfoC.Legend import *

  16. #---- Create a polygon layer
  17. print 'Create a polygon layer...'
  18. pLayer = VectorLayer(ShapeTypes.Polygon)
  19. pLayer.LayerName = "Test_Polygon"
  20. pLayer.Visible = True
  21. pLayer.EditAddField("ID", Int32)

  22. #---- Get the polygon shape from plotted polygon
  23. pGraphic = mipy.MapDocument.ActiveMapFrame.MapView.GraphicCollection.GraphicList[0]
  24. pShape = pGraphic.Shape

  25. #--- Add polygon shape into the polygon layer
  26. shapeNum = pLayer.ShapeNum
  27. i = 1
  28. if pLayer.EditInsertShape(pShape, shapeNum):
  29.   pLayer.EditCellValue("ID", shapeNum, i)
  30.   i += 1

  31. pLayer.UpdateLegendScheme(LegendType.SingleSymbol, "ID")

  32. #---- Add the polygon layer
  33. mipy.MapDocument.ActiveMapFrame.AddLayer(pLayer)

  34. print 'Finished!'

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-11-14 13:36:24 | 显示全部楼层
谢谢王老师!方法、步骤很清楚。王老师有空的时候,多展示一些实际案例啊!其实前面已经有不少了!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-11-14 14:47:02 | 显示全部楼层
大赞!!!!!!!!!!!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-11-14 14:53:31 | 显示全部楼层
要是有那种photoshop里面类似的磁性套索工具就好玩多了.....

ps  中午又看到王老师了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-11-14 19:54:06 | 显示全部楼层

我昨天中午见了王老师~~~ 王老师真是神龙见首不见尾~~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-12-26 10:04:41 | 显示全部楼层
真是非常感谢王老师!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-5-30 16:14:39 | 显示全部楼层
王老师,如果手绘的两个区域图层出现交汇,交汇区只显示一个图层的颜色,让另一个屏蔽掉,或者避让掉,或者让原来就有的polyline的图层数据显示在手绘的polygon区域上面
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-5-30 16:14:43 | 显示全部楼层
王老师,如果手绘的两个区域图层出现交汇,交汇区只显示一个图层的颜色,让另一个屏蔽掉,或者避让掉,或者让原来就有的polyline的图层数据显示在手绘的polygon区域上面
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-5-30 16:14:47 | 显示全部楼层
王老师,如果手绘的两个区域图层出现交汇,交汇区只显示一个图层的颜色,让另一个屏蔽掉,或者避让掉,或者让原来就有的polyline的图层数据显示在手绘的polygon区域上面
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-5-30 16:14:50 | 显示全部楼层
王老师,如果手绘的两个区域图层出现交汇,交汇区只显示一个图层的颜色,让另一个屏蔽掉,或者避让掉,或者让原来就有的polyline的图层数据显示在手绘的polygon区域上面
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表