Select to view content in your preferred language

FeatureLayer and its visibility.

2116
1
12-15-2011 06:33 AM
SanajyJadhav
Deactivated User
Hi,

I am having feature layers (come from FeatureServer)in my application and they have scale dependent visibility set in mxd that works fine ( I am using version2.3).I have Legend control (TOC) through which these feature layers can be turned on/off.

Now, I want to know if any feature layer is on or off and is within scale range.That is, feature layer may be on but due to scale range it is not showing up in the map.

I check FeatureLayer::Visible and every time it gives me True even if it is off ( thru TOC ).If it is out of scale range and not showing up, then also, this ::Visibility property gives me True.

So how can I get the exact visibility status of the FeatureLayer? If it is out of scale range, then also, I should know that it is off.

To do this, I have gone long way as below.
1. Hook to UpdateCompleted event of the FeatureLayer
2. In this event, I cast it to GraphicsLayer and get its graphics count.
3. Depending on this count, I decide whether this layer is on or off.I am not sure whether this is giving ,correct result.

I am sure I am missing something here because to get the visibility status of a FeatureLayer should not be a big deal.Can anybody help me on this issue please? I would appreciate it.
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
The current visibility of a layer is depending on:
     1) Its Visible status (that is not depending on the resolution)
     2) The map resolution

something like :
    bool isInScaleRange = map.Resolution >= layer.MinimumResolution && map.Resolution <= layer.MaximumResolution;
    bool isCurrentlyVisible = layer.Visible && isInScaleRange;
0 Kudos