阅读:1611回复:2
请教delphi+ArcEngine老鸟,急呀!:(
<P>Open the workspace<BR> Dim pFact As IWorkspaceFactory<BR> Set pFact = New AccessWorkspaceFactory<BR> <BR> Dim pWorkspace As IWorkspace<BR> 'Change this path to point to the USA geodatabase in the developer sample directory<BR> Set pWorkspace = pFact.OpenFromFile("C:\Program Files\ArcGIS\DeveloperKit\samples\data\usa\usa.mdb", 0)<BR> <BR> Dim pFeatws As IFeatureWorkspace<BR> Set pFeatws = pWorkspace<BR> <BR> ' QI for the IWorkspaceDomains interface<BR> Dim pWorkspaceDomains2 As IWorkspaceDomains<BR> Set pWorkspaceDomains2 = pWorkspace<BR> <BR> ' get the coded value domain<BR> Dim pDomain As IDomain<BR> Set pDomain = GetDomain(pWorkspaceDomains2)<BR> <BR> 'Get the States FeatureClass<BR> Dim pFeatcls As IFeatureClass<BR> Set pFeatcls = pFeatws.OpenFeatureClass("States")<BR> <BR> 'QI for the ISubtypes interface<BR> Dim pSubType As ISubtypes<BR> Dim lSubT As Long<BR> Set pSubType = pFeatcls</P>
<P> Set pSubType.Domain(pSubType.DefaultSubtypeCode, "SUB_REGION") = pDomain<BR> <BR> MsgBox "Done"<BR> Exit Sub</P> <P>上面这段代码翻译成DELPHI,怎么写呢,请高手指教!</P> |
|
1楼#
发布于:2005-07-16 18:50
<P>var<BR> pFact: IWorkspaceFactory;<BR> pWorkspace: IWorkspace;<BR> pFeatws: IFeatureWorkspace;<BR> pWorkspaceDomains2: IWorkspaceDomains;<BR> pDomain: IDomain;<BR> pFeatcls: IFeatureClass;<BR> pSubType: ISubtypes;<BR> lSubT: Integer;<BR> Subtypecode: Integer;<BR>begin<BR> pFact := coAccessWorkspaceFactory.Create As IWorkspaceFactory;</P>
<P> //'Change this path to point to the USA geodatabase in the developer sample directory<BR> pFact.OpenFromFile('C:\Program Files\ArcGIS\DeveloperKit\samples\data\usa\usa.mdb',<BR> 0,pWorkspace);</P> <P> pFeatws := pWorkspace As IFeatureWorkspace;</P> <P> //' QI for the IWorkspaceDomains interface<BR> pWorkspaceDomains2 := pWorkspace As IWorkspaceDomains;</P> <P> //' get the coded value domain<BR> //Set pDomain = GetDomain(pWorkspaceDomains2)</P> <P> //'Get the States FeatureClass<BR> pFeatws.OpenFeatureClass('States',pFeatcls);</P> <P> //'QI for the ISubtypes interface<BR> pSubType := pFeatcls As ISubtypes;</P> <P> pSubType.Get_DefaultSubtypeCode(Subtypecode);<BR> pSubType.Get_Domain(Subtypecode,'SUB_REGION',pDomain);</P> <P>end;</P> |
|
2楼#
发布于:2005-07-20 19:06
<P>谢谢大哥,能帮我解决如下问题吗〉</P>
<P> 为什么我这段代码得不到ShapeFieldName呢?</P> <P>pGeom:IGeometry;<BR> pType:TOleEnum;<BR> mapcontrol1.Map.Get_Layers(nil,true,pLayers);<BR> pLayers.Reset;<BR> pLayers.Next(pLayer);<BR> pGeoLayer:=pLayer as IGeoFeatureLayer;<BR> pGeoLayer.Get_FeatureClass(pFeaClass);<BR> pFeaClass.Get_ShapeFieldName(pName); <BR> pGeom.Get_GeometryType(pType);</P> <P>我怀疑是DELPHI对这些借口支持的不好,请delphi开发高手指点</P> <P>并给出解决的办法!谢谢!</P> |
|