ArcGIS Explorer Component Help |
Layer..::.MaximumScale Property |
Layer Class Example See Also |
Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public virtual double MaximumScale { get; set; } |
Visual Basic (Declaration) |
---|
Public Overridable Property MaximumScale As Double |
Field Value
A double containing the maximum scale: the lower bound of the scale range for the Layer.Remarks
Normally, if a Layer.Visible is trueTruetruetrue (True in Visual Basic) and the Layer is contained by the map, ArcGIS Explorer will draw it. However, as you zoom out, it may become difficult to see the more detailed information, or as you zoom in, information may become too coarse. While you can turn off a Layer, this may be inconvenient, especially if the map contains several layers or if you change the scale frequently as you work.
Layers can be set to automatically display only within an appropriate visible scale range. You can set a layers visible scale range using the Layer.MinumumScale and Layer.MaximumScale properties. The ability to set the scale range for a Layer's visibility is useful because you can progressively display more detailed layers as you zoom in on an area.
The maximum scale represents the lower bound of the scale range e.g. if the scale range between 1:100 and 1:15,000 the maximum scale is 100. This may seem unusual, but the terms maximum and minimum relate to the scale expressions as fractions: 1/100 is larger than 1/15,000, therefore 1/100 is the maximum scale. If you zoom in beyond this scale, the Layer will not be visible even if the Layer.Visible property is trueTruetruetrue (True in Visual Basic).
Examples
//Retrieve the map from the application Map map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map; MapDisplay mapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; //Create a DataSourceProperties object that holds the connection information to the feature class DataSourceProperties featureLayerDataSourceProps = new DataSourceProperties(@"C:\Data\Forestry.gdb", "road_hazards"); //Create a feature layer FeatureLayer featureLayer = new FeatureLayer(featureLayerDataSourceProps); //Set scale thresholds for the layer so that it is only visible between 1:5,000 and 1:15,000 //Maximum scale is 1:5,000 - Layer will not draw if you zoom in beyond this scale featureLayer.MaximumScale = 5000; //Minimum scale is 1:15,000 - Layer will not draw if you zoom out beyond this scale featureLayer.MinimumScale = 15000; //Set layer visibility - this is overridden by the scale threshold featureLayer.Visible = true; //Connect the layer to the feature class bool isConnected = featureLayer.Connect(); if (isConnected) //Add the layer to the map map.ChildItems.Add(featureLayer); //Get current map scale System.Diagnostics.Debug.Print(mapDisplay.MapScale.ToString()); //1:100,000 -> featureLayer is not visible at this scale even when the visible property is set to True //Zoom to a scale and extent where features are visible mapDisplay.ZoomToMapScale(10000, featureLayer.Extent);
'Retrieve the map from the application Dim map As Map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map Dim mapDisplay As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay 'Create a DataSourceProperties object that holds the connection information to the feature class Dim featureLayerDataSourceProps As New DataSourceProperties("C:\Data\Forestry.gdb", "road_hazards") 'Create a feature layer Dim featureLayer As New FeatureLayer(featureLayerDataSourceProps) 'Set scale thresholds for the layer so that it is only visible between 1:5,000 and 1:15,000 'Maximum scale is 1:5,000 - Layer will not draw if you zoom in beyond this scale featureLayer.MaximumScale = 5000 'Minimum scale is 1:15,000 - Layer will not draw if you zoom out beyond this scale featureLayer.MinimumScale = 15000 'Set layer visibility - this is overridden by the scale threshold featureLayer.Visible = True 'Connect the layer to the feature class Dim isConnected As Boolean = featureLayer.Connect() If isConnected Then map.ChildItems.Add(featureLayer) 'Add the layer to the map End If 'Get current map scale System.Diagnostics.Debug.Print(mapDisplay.MapScale.ToString()) '1:100,000 -> featureLayer is not visible at this scale even when the visible property is set to True 'Zoom to a scale and extent where features are visible mapDisplay.ZoomToMapScale(10000, featureLayer.Extent)