Hallo
Ich muss den untenstehenden VB-Code in Delphi übersetzen. Doch leider hab ich keinen Schimmer von VB. Kann mir da jemand helfen?
<PRE>
Private Sub TestIAC()
Dim doc As IDocument
Dim app As IApplication
Dim pMxDoc As IMxDocument
Dim pobjectFactory As IObjectFactory
Dim rot As AppROT
Dim strName As String
Set rot = New esriCore.AppROT
Set app = rot.Item(0)
Set pobjectFactory = app
Set pMxDoc = app.Document
Dim pActiveView As IActiveView
Set pActiveView = pMxDoc.ActiveView
MsgBox app.Name
Dim pMap As IMap
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter
Set pMxDoc = app.Document
Set pMap = pMxDoc.FocusMap
'Set pActiveView = pMap
'For simplicity sake let's use the first layer in the map
If Not TypeOf pMap.Layer(0) Is IFeatureLayer Then Exit Sub
Set pFeatureLayer = pMap.Layer(0)
Set pFeatureSelection = pFeatureLayer 'QI
'Create the query filter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "Id = 2"
'Invalidate only the selection cache
'Flag the original selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'Perform the selection
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False
'Flag the new selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
End Sub
</PRE>
Besten Dank
Gruss
Ich muss den untenstehenden VB-Code in Delphi übersetzen. Doch leider hab ich keinen Schimmer von VB. Kann mir da jemand helfen?
<PRE>
Private Sub TestIAC()
Dim doc As IDocument
Dim app As IApplication
Dim pMxDoc As IMxDocument
Dim pobjectFactory As IObjectFactory
Dim rot As AppROT
Dim strName As String
Set rot = New esriCore.AppROT
Set app = rot.Item(0)
Set pobjectFactory = app
Set pMxDoc = app.Document
Dim pActiveView As IActiveView
Set pActiveView = pMxDoc.ActiveView
MsgBox app.Name
Dim pMap As IMap
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter
Set pMxDoc = app.Document
Set pMap = pMxDoc.FocusMap
'Set pActiveView = pMap
'For simplicity sake let's use the first layer in the map
If Not TypeOf pMap.Layer(0) Is IFeatureLayer Then Exit Sub
Set pFeatureLayer = pMap.Layer(0)
Set pFeatureSelection = pFeatureLayer 'QI
'Create the query filter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "Id = 2"
'Invalidate only the selection cache
'Flag the original selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'Perform the selection
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False
'Flag the new selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
End Sub
</PRE>
Besten Dank
Gruss
Comment