Featurelayer InScaleRange not working anymore

406
2
04-27-2011 09:10 AM
Wolf
by Esri Regular Contributor
Esri Regular Contributor
I ported some 9.3 Mobile code to 10.0 and found that the following code sequence is not working anymore:

private Map m_theMap = ...;
FeatureLayer featLyr = ...
MapLayer lyrFeat = clsMapUtil.FindMapLayer(featLyr.Name, m_theMap);
if (featLyr.InScaleRange (m_theMap.Scale)) ...

featLyr.InScaleRange used to return true for the following value:

the values are as follows:
lyrFeat.MinScale = 10063.854373775863
lyrFeat.MaxScale = 0.0

m_theMap.Scale = 9086.4508347532319

Any ideas on this problem?
0 Kudos
2 Replies
StephenDickinson
Esri Contributor
My experience mirrors your own.

Have you tried manually calculating whether the layer is within the scale range?

e.g.

            MapLayer associatedMapLayer = map.MapLayers[associatedFeatureLayer.Name];

            //InScaleRange method doesn't seem to work, MapLayer.MinScale and MapLayer.MaxScale
            //values seem to be wrong way around, so calculate our own

            bool inScaleRange = (map.Scale <= associatedMapLayer.MinScale) && (map.Scale >= associatedMapLayer.MaxScale);


            //if (associatedMapLayer.Visible /*&& associatedMapLayer.InScaleRange(map.Scale)*/)
            if (associatedMapLayer.Visible && inScaleRange)
            {...}
0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor
Stephen,
I implemented that code as a work around and this seems to work.

Thanks
0 Kudos