① I can’t use ActiveLayer property to get the handle of active layer.
int layer = axMap1.Identifier.ActiveLayer;
② There is no introduction to tkIdentifierMode.imAllLayersStopOnFirst mode in the document.
axMap1.Identifier.IdentifierMode = tkIdentifierMode.imAllLayersStopOnFirst;
(2) IdentifierMode includes three types: imAllLayers, imSingleLayer, imAllLayersStopOnFirst.
I added 10 layers to the mapControl, and I don’t want to select only one layer or all layers. I just want to identify the geometric primitives on 5 of these layers. That is to say, the geometric primitives that I want to identify are located not on one layer, not on all layers, but on 5 of them.
If the geometric primitives I want to identify are on a layer, I can use imSingleLayer mode. If the primitives I want to identify are on all layers, I can use imAllLayers mode. Now, I don’t want to identify primitives on some layers. What should I do in this situation?
First of all, I can agree that this feature is not well documented. Not all of the documentation has been kept up-to-date as features have been added, but we’re trying to fill it in as we can (or when we realize that it is lacking).
On initial review, it looks like the ActiveLayer is not being set during the identification process. Presumably, it would only be valid when the mode is imSingleLayer, but even so, I’m not sure what value it adds since you are given the layer in your ShapeIdentified event handler.
Regarding multiple identifiable layers, the Identifiable layers are those you specify as Identifiable, so only 5 of your 10 layers will be Identifiable. And as it turns out (and this is not documented at all), you still receive the ShapeIdentified event, but when multiple layers have been identified, the e.layerHandle value will be -1 instead of a valid layer handle.
If you are given a layerHandle of -1, then multiple layers have been identified, and you use the AxMap1.IdentifiedShapes method (may be get_IdentifiedShapes in c#). This method (which is not in the documentation) returns an ISelectionList, which you can use to get the layer handles and shapes within those layers that were identified.
I hope this gets you going. I’ll see what I can do about updating the documentation.
" Regarding multiple identifiable layers, the Identifiable layers are those you specify as Identifiable, so only 5 of your 10 layers will be Identifiable."
It sounds that I can specify some layers as identifiable and some layers as unidentifiable. But How to set a layer to be identifiable? How to set a layer unidentifiable?
I gave a link to the documentation. Identifiable is a Boolean property of a Shapefile. The default is False. So you can choose which layers you would like to be identifiable by setting the property to True, and you can even change them over time.