Hello.
I try to identify the shapeindex and layerhandle with the tool identify but dosn’t work and with the ShapeHighlighted works correctly. any idea?
Thanks.
i use sf.identificable = true
Hello @Luis
I’m guessing that there shapes identified from more than 1 layer. This occurs if the following IdentifierMode is set
AxMap1.Identifier.IdentifierMode = tkIdentifierMode.imAllLayers ' all identifiable layers
rather than
AxMap1.Identifier.IdentifierMode = tkIdentifierMode.imSingleLayer ' shapefile defined by Identifier.ActiveLayer
So you probably want to set IdentifierMode equal to imSingleLayer, and set the specific LayerHandle (in your case, 3) into the Identifier.ActiveLayer property.
When multiple shapes are identified, you instead need to do something like the following (code is in VB.NET)
Private Sub AxMap1_ShapeIdentified(sender As Object, e As AxMapWinGIS._DMapEvents_ShapeIdentifiedEvent)
Dim shapes As SelectionList = AxMap1.IdentifiedShapes()
If shapes.Count > 0 Then
Dim sf As Shapefile = AxMap1.get_Shapefile(e.layerHandle)
Dim shp As Shape = sf.Shape(e.shapeIndex)
...
' do something with each shape
...
End If
End Sub
See if that’s what is going on.
Regards,
Jerry.
Thanks @jerryfaust
I’m sorry, i only have these options in AxMap1.Identifier
Thanks for your time, regards.
Interesting. It looks like the documentation is out-of-date. I should make a note of that.
Looking at the source code, it looks like if you set
AxMap1.Identifier.IdentifierMode = tkIdentifierMode.imSingleLayer
then it will select features from the single layer that you specify in the AxMap.ChooseLayer event.
And if you set
AxMap1.Identifier.IdentifierMode = tkIdentifierMode.imAllLayersStopOnFirst
then the selection will consider all “Identifiable” layers, and stop on the first layer for which shapes are identified.
EIther way, you may get more than 1 shape returned. If only 1 shape is returned, then you can use e.layerHandle
and e.shapeIndex
to fetch the shape. However, if more than 1 shape is identified, even if all from one layer, then you will need to iterate the shapes as I outlined in the previous response.
Hope that helps.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.