老舅程序猿

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

本来mapwindow4 已经能够实现基本的功能了。

可是加载中国地图,一个300多M的shp文件,绘制效率很低,很慢。 最大的一个shp文件800多M。

MapWindow4  很不给力。 于是便看了最新的MapWindow6,效率很高,也更容易。打开800多M的shp文件也显示也比较快

MW6对比4的优缺点 

  • Advantages over MapWindow 4.x
    • Fully .Net (no COM registration or dll hell)
    • Works on Mac or Linux (using Mono)
    • Vastly extended symbology set
      • Stacks of Symbols
      • Schemes based on attributes
      • Point decorations
      • Symbols from scalable system fonts
    • Object Oriented Code
      • Perform overlays, intersections, directly with features.
      • FeatureSet.DataTable is a System.Data.DataTable.
      • OGC Geometries
    • Comprehensive Plug-in Model
      • Plug-in interfaces have events like normal objects
      • Interfaces are complete, so if you can do it with a class, you can do it with an interface.
      • Control virtually everything directly through the plug-in interface
    • Components
      • All components provided through the MapWindow.dll
      • Custom GIS can be built from components in the designer (No code necessary)
      • Even the Plug-in capability is in the ApplicationManager
  • About the same
    • Drawing performance
    • Loading performance
  • Disadvantages
    • Can't be used in Microsoft Access, VB6.0 or other pre-.Net systems. (Yet)
      • (requires a COM wrapper to be created, which we can do later.)
    • OGR/FDO not supported (Yet)
      • (requires a data provider plugin to be written to translate)
    • Big rasters/grids (> 8000x8000) fail to load or use unconventional native formats
      • (requires finishing img(HFA) support for native, pyramidal img files)
    • Rudimentary feature editing
      • (requires some extra editing tools to be added to the shape editor)
    • Still in beta (MW4 is probably more stable and fixed and with fewer bugs)

 

一.简单Demo搭建        

 参考

 

MapWindow6 Developer Corner

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

到此,通过简单拖放控件,一个功能比较齐全的基于MapWindow 6的软件便做出来了。 

 

 

二.增加图层

1.可以点击 + 增加图层 省界_region,增加后效果

 

 

 

2.二次开发 代码演示

 增加 删除图层

 

继续升入代码 ,也可以这样

 

相关类图参考参考 

 

.地图缩放,选择,手形状。

 1.可以通过按钮实现

 

 2.代码实现

 

FunctionMode 枚举类型:

 None

Pan 手形

Select 标记选择的区域

ZoomIn 放大

ZoomOut 缩小

          Measure 测量 

 

 

改变背景颜色,线颜色,设置

 

 

 

 通过IFeatureLayer 属性 Symbolizer复制,给以不同的主题色彩。点线 也一样 类似

 效果图:

 

 相关类图参考

 

 

.绘制点,线。

 

1.画点

 

效果图: 

 

2.画线

 MapWindow.Geometries.Coordinate start;

MapWindow.Geometries.Coordinate end;

 Coordinate 相当于点。

 

 效果图:

 

 

 

3.点线的保存

 FeatureSet fs ;

调用 fs.SaveAS(路径str,bool 是否覆盖)

 

六.显示标签

 

 

显示效果 

 

七.定位

1.经纬度定位

 

 接收到经纬度,然后 通过SetExtents设置需要定位的区域。

2.地名定位

 

 

1.通过FeatureLayer DataSet属性 DataTable.Select获取某行数据。

2.然后获取该行的index

3.通过index 获取该形状的区域

          4.将该区域信息赋值给地图的Extents属性。 

 

8.总结

该控件公能强大,源码可以定制自己想要的功能,去掉一些不需要的东西,二次开发为自己的gis软件。

 

 转载保留作者wallini 

 

posted on 2010-12-04 23:08  老舅程序猿  阅读(6059)  评论(7编辑  收藏  举报