获得Coverage的featureclass
Public Function getCoverageFC(pFilePath As String, pFeatureClassType As Integer) As IFeatureClass
Set getCoverageFC = Nothing
Dim pWSfact As IWorkspaceFactory
Set pWSfact = New ArcInfoWorkspaceFactory
Dim pPropertyset As IPropertySet
Set pPropertyset = New PropertySet
pPropertyset.SetProperty "DATABASE", pFilePath
Dim pWS As IArcInfoWorkspace
Set pWS = pWSfact.Open(pPropertyset, 0)
Dim pQuerySyntax As ISQLSyntax
Set pQuerySyntax = pWS
Dim pdataset As IDataset
Set pdataset = pWS
Dim penumdata As IEnumDataset
Set penumdata = pdataset.Subsets
penumdata.Reset
'get datasets from enumerator
Dim pdataset2 As IDataset
Set pdataset2 = penumdata.Next
Dim pCovFeatClass As ICoverageFeatureClass
Dim pFeatDS As IFeatureDataset
'loop through the datasets
Do Until pdataset2 Is Nothing
'if dataset is coverage continue
If TypeOf pdataset2 Is ICoverage Then
'-------------------------------
Dim penumdataset2 As IEnumDataset
Dim pdat2 As IDataset
Dim test As Variant
'open coverage for feature classes
Set penumdataset2 = pdataset2.Subsets
penumdataset2.Reset
Set pdat2 = penumdataset2.Next
Do Until pdat2 Is Nothing
'make sure you have a feature class
If TypeOf pdat2 Is ICoverageFeatureClass Then
'test = pdat2.Name 'name of featureclass
Set pCovFeatClass = pdat2
If pCovFeatClass.FeatureClassType = pFeatureClassType Then
'if found,set return value
Set getCoverageFC = pCovFeatClass
End If
End If
Set pdat2 = penumdataset2.Next
Loop
End If
Set pdataset2 = penumdata.Next
Loop
Set pWSfact = Nothing
Set pWS = Nothing
Set pPropertyset = Nothing
Set pFeatDS = Nothing
End Function
Set getCoverageFC = Nothing
Dim pWSfact As IWorkspaceFactory
Set pWSfact = New ArcInfoWorkspaceFactory
Dim pPropertyset As IPropertySet
Set pPropertyset = New PropertySet
pPropertyset.SetProperty "DATABASE", pFilePath
Dim pWS As IArcInfoWorkspace
Set pWS = pWSfact.Open(pPropertyset, 0)
Dim pQuerySyntax As ISQLSyntax
Set pQuerySyntax = pWS
Dim pdataset As IDataset
Set pdataset = pWS
Dim penumdata As IEnumDataset
Set penumdata = pdataset.Subsets
penumdata.Reset
'get datasets from enumerator
Dim pdataset2 As IDataset
Set pdataset2 = penumdata.Next
Dim pCovFeatClass As ICoverageFeatureClass
Dim pFeatDS As IFeatureDataset
'loop through the datasets
Do Until pdataset2 Is Nothing
'if dataset is coverage continue
If TypeOf pdataset2 Is ICoverage Then
'-------------------------------
Dim penumdataset2 As IEnumDataset
Dim pdat2 As IDataset
Dim test As Variant
'open coverage for feature classes
Set penumdataset2 = pdataset2.Subsets
penumdataset2.Reset
Set pdat2 = penumdataset2.Next
Do Until pdat2 Is Nothing
'make sure you have a feature class
If TypeOf pdat2 Is ICoverageFeatureClass Then
'test = pdat2.Name 'name of featureclass
Set pCovFeatClass = pdat2
If pCovFeatClass.FeatureClassType = pFeatureClassType Then
'if found,set return value
Set getCoverageFC = pCovFeatClass
End If
End If
Set pdat2 = penumdataset2.Next
Loop
End If
Set pdataset2 = penumdata.Next
Loop
Set pWSfact = Nothing
Set pWS = Nothing
Set pPropertyset = Nothing
Set pFeatDS = Nothing
End Function
-----------------------------------------------------------
佛对我说:你心里有尘。我用力的拭擦。