登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
MeteoInfo里有比较丰富的手动绘制图形的功能,可以利用这些手动绘制的图形生成相应的图层。这里简单示例一个Polygon图形生成一个Polygon图层的例子:
先利用"New Polygon"工具手动绘制一个多边形。
可以对已绘制的图形进行修改。用"Select Element“工具选中图形,会出现外接矩形框:
然后点击"Edit Vertices"工具修改多边形的节点:
修改完成的图形可以通过脚本程序创建一个Polygon图层:
脚本程序:
 - #--------------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2013-11-14
- # Purpose: Create a polygon layer from a polygon plot
- # Note: Sample
- #-----------------------------------------------------------
- #---- Import clr and classes
- import clr
- clr.AddReference("MeteoInfoC.dll")
- from System import *
- from System.Collections.Generic import *
- from MeteoInfoC import *
- from MeteoInfoC.Layer import *
- from MeteoInfoC.Shape import *
- from MeteoInfoC.Legend import *
- #---- Create a polygon layer
- print 'Create a polygon layer...'
- pLayer = VectorLayer(ShapeTypes.Polygon)
- pLayer.LayerName = "Test_Polygon"
- pLayer.Visible = True
- pLayer.EditAddField("ID", Int32)
- #---- Get the polygon shape from plotted polygon
- pGraphic = mipy.MapDocument.ActiveMapFrame.MapView.GraphicCollection.GraphicList[0]
- pShape = pGraphic.Shape
- #--- Add polygon shape into the polygon layer
- shapeNum = pLayer.ShapeNum
- i = 1
- if pLayer.EditInsertShape(pShape, shapeNum):
- pLayer.EditCellValue("ID", shapeNum, i)
- i += 1
- pLayer.UpdateLegendScheme(LegendType.SingleSymbol, "ID")
- #---- Add the polygon layer
- mipy.MapDocument.ActiveMapFrame.AddLayer(pLayer)
- print 'Finished!'
|