【发布时间】:2015-09-14 09:58:49
【问题描述】:
我的代码使用 MapWingis.ocx
我使用 MapWingis.Shapefile 来声明一个“Shapefile”对象
我只想剪辑两个 shapefile。有一个API函数格式:
Shapefile.Clip (bool SelectedOnlySubject, Shapefile sfOverlay, bool SelectedOnlyOverlay)
我开始写这个。
Dim sfOverlay As New MapWinGIS.Shapefile
Dim sfinput As New MapWinGIS.Shapefile
Dim sfClip As New MapWinGIS.Shapefile
Dim index1 As Integer
Dim index2 As Integer
index1 = CbBInputLayer.SelectedIndex
index2 = CbBOverlayClipLayer.SelectedIndex
sfinput = FormMain.AxMapMain.get_Shapefile(index1)
sfOverlay = FormMain.AxMapMain.get_Shapefile(index2)
sfClip = sfinput.Clip(False, sfOverlay, False)
If sfClip Is Nothing Then
MessageBox.Show("Failed to calculate Clip :" + sfinput.ErrorMsg(sfinput.LastErrorCode))
MessageBox.Show("Failed to calculate Clip :" + sfOverlay.ErrorMsg(sfOverlay.LastErrorCode))
MessageBox.Show("Failed to calculate Clip :" + sfClip.ErrorMsg(sfClip.LastErrorCode))
Else
shape2.Add(sfClip)
End If
结果is Nothingand
sfInput give 生成的 shapefile 没有形状
sfOverlay给出没有错误
sfClip 将空引用设置为对象的实例
我该如何解决这个问题?有错吗?
【问题讨论】:
-
你试过
Catfood从CodePlex吗? -
我会试试的,是不是要从 Mapwingis.shapefile 中更改
sfInput、sfOverlay和sfClip的声明? @OneFineDay -
这是一个
SDK,用于打开和访问形状文件元素。我用它来读取多边形,然后将它们绘制在地图上。它做得更多......
标签: vb.net visual-studio-2012 dictionary shapes shapefile