阅读:1550回复:3
[求助]VB+AE中clip的问题
<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> |
|
1楼#
发布于:2008-06-27 09:55
<P>也碰到同样的问题了~顶一下</P>
|
|
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> |
|
3楼#
发布于:2008-07-15 17:56
<P>应该是你许可设置的问题,这个和你的代码没有什么关系的.</P>
<P>AE在关闭你的程序的时候,也会关闭许可的.</P> <P>你查一下关闭程序的事件吧.</P> |
|
|