sophia
路人甲
路人甲
  • 注册日期2007-10-25
  • 发帖数2
  • QQ
  • 铜币125枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1550回复:3

[求助]VB+AE中clip的问题

楼主#
更多 发布于:2008-03-28 10:11
<P><FONT style="BACKGROUND-COLOR: #cce8cf">用IBasicGeoprocessor接口做clip,照例子与intersect、union是一样的,可是intersect、union可以运行,clip就出错,VB关闭,提示“0x7c921010”指令引用的“0x069509b4”内存。该内存不能为“read”。</FONT></P>
<P><FONT style="BACKGROUND-COLOR: #cce8cf">哪位大侠指教下这是为什么呢?</FONT></P>
<P>    Dim pLayer As ILayer<BR>    Set pLayer = pLayer0<BR>    Dim pInputFeatLayer As IFeatureLayer<BR>    Set pInputFeatLayer = pLayer</P>
<P>    Dim pInputTable As ITable<BR>    Set pInputTable = pLayer<BR>    <BR>    Dim pInputFeatClass As IFeatureClass<BR>    Set pInputFeatClass = pInputFeatLayer.FeatureClass<BR>   <BR>   'Get the overlay layer<BR>    Set pLayer = pLayer1<BR>    Dim pOverlayTable As ITable<BR>    Set pOverlayTable = pLayer<BR>    <BR>    If pInputTable Is Nothing Then<BR>        MsgBox "Table QI failed"<BR>        Exit Function<BR>    End If<BR>    If pOverlayTable Is Nothing Then<BR>        MsgBox "Table QI failed"<BR>        Exit Function<BR>    End If</P>
<P>' Define the output feature class name and shape type<BR>    Dim pFeatClassName As IFeatureClassName<BR>    Set pFeatClassName = New FeatureClassName<BR>    With pFeatClassName<BR>        .FeatureType = esriFTSimple<BR>        .ShapeFieldName = "Shape"<BR>        .ShapeType = pInputFeatClass.ShapeType<BR>    End With</P>
<P>    '获取路径和文件名<BR>    Dim pNewWSName As IWorkspaceName<BR>    Set pNewWSName = New WorkspaceName<BR>    pNewWSName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapeFileWorkspaceFactory.1"<BR>    <BR>    pNewWSName.PathName = gOutPath<BR>    Dim pDatasetName As IDatasetName<BR>    Set pDatasetName = pFeatClassName<BR>    pDatasetName.Name = frmClip.Output.Text</P>
<P>    Set pDatasetName.WorkspaceName = pNewWSName</P>
<P>    Dim tol As Double<BR>    tol = 0#<BR>    Dim pBGP As IBasicGeoprocessor<BR>    Set pBGP = New BasicGeoprocessor<BR>    Dim pOutputFeatClass As IFeatureClass<BR>    Set pOutputFeatClass = pBGP.clip(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)</P>
<P>    Dim pOutputFeatLayer As IFeatureLayer<BR>    Set pOutputFeatLayer = New FeatureLayer<BR>    Set pOutputFeatLayer.FeatureClass = pOutputFeatClass<BR>    pOutputFeatLayer.Name = pOutputFeatClass.AliasName</P>
喜欢0 评分0
cjj1308
路人甲
路人甲
  • 注册日期2006-06-29
  • 发帖数28
  • QQ
  • 铜币201枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2008-06-27 09:55
<P>也碰到同样的问题了~顶一下</P>
举报 回复(0) 喜欢(0)     评分
cjj1308
路人甲
路人甲
  • 注册日期2006-06-29
  • 发帖数28
  • QQ
  • 铜币201枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2008-07-02 11:58
<P>在c#里做出来了</P>
<P>               ESRI.ArcGIS.Geoprocessing.IGeoProcessor pGP=new GeoProcessor();<BR>                    IVariantArray param = new VarArray();<BR>                    param.Add(Basetoolpfealyr2);<BR>                    param.Add(Basetoolpfealyr1);<BR>                    string filepathname = BasetoolPathName + "\\" + BasetoolFileName + ".shp";<BR>                    param.Add(filepathname);<BR>                    pGP.OverwriteOutput = true;<BR>                    pGP.Execute("Clip_analysis", param,null);<BR>                    IName pName = (IName)pFeatClassName;<BR>                    pOutputFeatClass = pName.Open() as IFeatureClass;</P>
举报 回复(0) 喜欢(0)     评分
hover
路人甲
路人甲
  • 注册日期2005-12-13
  • 发帖数69
  • QQ
  • 铜币279枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2008-07-15 17:56
<P>应该是你许可设置的问题,这个和你的代码没有什么关系的.</P>
<P>AE在关闭你的程序的时候,也会关闭许可的.</P>
<P>你查一下关闭程序的事件吧.</P>
承接、合作各种GIS项目开发 :ArcGIS平(基于AO、AE、ArcIMS、ArcServer开发) :MapInfo平台(基于MapXtreme 2004/2005、MapXtreme For Java开发) E-Mail:cmcrj0929@163.com QQ:31814576 有国土、市政、交通、电力等行业的成功应用项目经验。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部