Layer.MaxScale Property
Gets or sets the highest inverted nominal scale in a 2D view, or the furthest distance in a 3D globe view, at which objects from this Layer should be drawn.
Syntax
public System.Double MaxScale { get; set; }
Property Value
Default: max
The highest inverted nominal scale in a 2D view, or the furthest distance in a 3D globe view, at which objects from this Layer should be drawn.
Remarks
The highest inverted nominal scale this layer should be drawn at. If, for instance, MinScale is 10000 and MaxScale is 50000, then the layer will be drawn in the scale range 1:10 000 to 1:50 000. For the layer to be drawn, the Enabled property must also be True and the Condition must evaluate to True (or be null).
The property has a slightly different behavior for layers in a GlobeView. Instead of turning the layer off at the specified scale, the scale value is converted to a corresponding distance in meters. This distance is then used to limit the area around the camera position where features in the layer are loaded and displayed. The conversion from scale to distance is only approximative, but the distance roughly corresponds to the height above ground the camera need to be when looking straight down to see the map at the same scale.
When checking the distance to a feature in 3D, the feature is first extended indefinitely in Z, to handle the case when the feature position is actually on ground or sea level, but the visualization is offset in Z. Therefore, when looking at a feature from above, it will be visible at a much greater distance than expected.
Similarly, in a PlotLayer in 3D, the scale value is converted to a corresponding distance in meters, and plots beyond that distance are not rendered.
Using this property in a globe view will limit the amount of data loaded and displayed, but the limit will not be very exact, since data is typically loaded in rectangles. If you need finer control of how far from the camera that objects should be visible, you can also add a condition to your visualizers based on the #distance3D update attribute.
In 2D, the actual test performed is minScale <= inverted nominal scale < maxScale. If the maxScale of one layer is identical to the minScale of another, exactly one of the layers will be active at any given scale. However, the view scale calculation may introduce some floating point inaccuracy, so even if you set the nominal scale to the exact same value as the minScale or maxScale of a layer, you can't be sure whether the layer will be visible or not. To get around this, add or subtract a small amount to either the scale or the minScale or maxScale properties.
Example
// Set MaxScale of the Layer to 1 : 1 000 000
public static void SetMaxScaleTo1Mio(Layer layer)
{
// This property is a member of a type that might be referred to by a View
// or a GlobeView, either directly or indirectly through other objects, which means
// that you must use the Guard class to take the global configuration lock when it
// is modified to synchronize access with any running Carmenta Engine threads.
using (Guard guard = new Guard())
{
// Set the MaxScale of the Layer to 1 : 1 000 000
layer.MaxScale = 1000000.0;
}
}
Platforms
Windows, Linux, Android