本来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)
- Can't be used in Microsoft Access, VB6.0 or other pre-.Net systems. (Yet)
参考
到此,通过简单拖放控件,一个功能比较齐全的基于MapWindow 6的软件便做出来了。
增加 与 删除图层
继续升入代码 ,也可以这样
相关类图参考参考
1.可以通过按钮实现
2.代码实现
FunctionMode 枚举类型:
None
Pan 手形
Select 标记选择的区域
ZoomIn 放大
ZoomOut 缩小
Measure 测量
通过IFeatureLayer 属性 Symbolizer复制,给以不同的主题色彩。点线 也一样 类似
效果图:
相关类图参考
效果图:
MapWindow.Geometries.Coordinate start;
Coordinate 相当于点。
效果图:
FeatureSet fs ;
调用 fs.SaveAS(路径str,bool 是否覆盖)
显示效果
接收到经纬度,然后 通过SetExtents设置需要定位的区域。
1.通过FeatureLayer的 DataSet属性 DataTable.Select获取某行数据。
2.然后获取该行的index
3.通过index 获取该形状的区域
4.将该区域信息赋值给地图的Extents属性。