This project is read-only.

Vb.Net: get selected Elements

Jun 6, 2012 at 9:20 AM

Hello everybody,

I'm stuck again:

After I entered The selection mode via:

Me.mapMain.FunctionMode = DotSpatial.Controls.FunctionMode.Select

I need to retrive the selected Element(s). This should be somthing like:

- get the slected Layer

     Dim objLayer As ????
     objLayer = mapMain.Layers.SelectedLayer

  I'm not sure about that.

- Then I need to get the selected Elements on the active Layer ...?


Can anybody help?

Thanks an regards

Jun 6, 2012 at 3:13 PM

Hello again,

it seems like I answer most of my questions myself. Ok, I found the following solution which I put into the MouseUp-event:

Dim objLayer As DotSpatial.Controls.IMapFeatureLayer
Dim objSelection As DotSpatial.Symbology.ISelection

' Objekt zum Zugriff auf den aktuellen Layer
 objLayer = CType(mapMain.Layers.SelectedLayer, DotSpatial.Controls.IMapFeatureLayer)
' Selectierte Objekte ermitteln
objSelection = objLayer.Selection()
' In Schleife über die Selektion iterieren
For Each objItem In objSelection.ToFeatureList
    ' Erstes Attribut ausgeben