Class MapScaleIndicatorElement
Represents a scale indicator element that displays distance measurements on a map, showing both metric and imperial units with visual scale bars.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.RadMap.dll
Syntax
public class MapScaleIndicatorElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Constructors
MapScaleIndicatorElement(RadMapElement)
Initializes a new instance of the MapScaleIndicatorElement class and associates it with the specified map element for scale calculations.
Declaration
public MapScaleIndicatorElement(RadMapElement mapElement)
Parameters
|
RadMapElement
mapElement
The RadMapElement that this scale indicator will monitor for zoom level and position changes. |
Properties
BarHeight
Gets or sets the height of the scale indicator bars in pixels that represent the distance measurements.
Declaration
public int BarHeight { get; set; }
Property Value
|
System.Int32
|
FeetText
Gets or sets the localized text displayed for feet measurements, with automatic fallback to the localization provider if not specified.
Declaration
public string FeetText { get; set; }
Property Value
|
System.String
|
ImperialBarColor
Gets or sets the color used for drawing the imperial distance measurement bar (feet or miles).
Declaration
public Color ImperialBarColor { get; set; }
Property Value
|
System.Drawing.Color
|
KilometersText
Gets or sets the localized text displayed for kilometer measurements, with automatic fallback to the localization provider if not specified.
Declaration
public string KilometersText { get; set; }
Property Value
|
System.String
|
MapElement
Gets the map element that this scale indicator is associated with for monitoring zoom levels and calculating scale measurements.
Declaration
public RadMapElement MapElement { get; }
Property Value
|
RadMapElement
|
MetersText
Gets or sets the localized text displayed for meter measurements, with automatic fallback to the localization provider if not specified.
Declaration
public string MetersText { get; set; }
Property Value
|
System.String
|
MetricBarColor
Gets or sets the color used for drawing the metric distance measurement bar (meters or kilometers).
Declaration
public Color MetricBarColor { get; set; }
Property Value
|
System.Drawing.Color
|
MilesText
Gets or sets the localized text displayed for mile measurements, with automatic fallback to the localization provider if not specified.
Declaration
public string MilesText { get; set; }
Property Value
|
System.String
|
Methods
CalculateDistanceAndText()
Calculates the appropriate distance measurements and display text based on the current map zoom level and position.
Declaration
protected virtual MapScaleIndicatorElement.SizeAndText CalculateDistanceAndText()
Returns
|
MapScaleIndicatorElement.SizeAndText
A MapScaleIndicatorElement.SizeAndText object containing the calculated metric and imperial measurements for display. |
CalculateDistanceAndTextInKilometersAndMiles(Int32)
Calculates broader distance measurements and display text using kilometer and mile units for lower zoom levels where larger scale measurements are appropriate.
Declaration
protected virtual MapScaleIndicatorElement.SizeAndText CalculateDistanceAndTextInKilometersAndMiles(int maxPixels)
Parameters
|
System.Int32
maxPixels
The maximum width in pixels available for the scale indicator display. |
Returns
|
MapScaleIndicatorElement.SizeAndText
A MapScaleIndicatorElement.SizeAndText object containing the calculated kilometer and mile measurements for display. |
CalculateDistanceAndTextInMetersAndFeet(Int32)
Calculates precise distance measurements and display text using meter and feet units for high zoom levels where detailed measurements are needed.
Declaration
protected virtual MapScaleIndicatorElement.SizeAndText CalculateDistanceAndTextInMetersAndFeet(int maxPixels)
Parameters
|
System.Int32
maxPixels
The maximum width in pixels available for the scale indicator display. |
Returns
|
MapScaleIndicatorElement.SizeAndText
A MapScaleIndicatorElement.SizeAndText object containing the calculated meter and feet measurements for display. |
GetDisplayScaleDistance(Double)
Calculates an appropriate display scale distance using predefined digit values to ensure readable and meaningful scale measurements.
Declaration
protected virtual int GetDisplayScaleDistance(double distance)
Parameters
|
System.Double
distance
The raw distance value to be converted to a display-friendly scale measurement. |
Returns
|
System.Int32
An integer representing the optimized distance value for scale indicator display. |
InitializeFields()
Initializes the default field values and visual properties for the scale indicator element, including colors, padding, and measurement settings.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the required size for the scale indicator element based on the calculated distance text and bar dimensions.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
|
System.Drawing.SizeF
availableSize
The System.Drawing.SizeF representing the available space for measurement. |
Returns
|
System.Drawing.SizeF
A System.Drawing.SizeF representing the required size for the scale indicator display. |
Overrides
PaintElement(IGraphics, Single, SizeF)
Paints the scale indicator element, including both metric and imperial distance bars with their corresponding text labels.
Declaration
protected override void PaintElement(IGraphics graphics, float angle, SizeF scale)
Parameters
|
IGraphics
graphics
The IGraphics object used for drawing the scale indicator. |
|
System.Single
angle
The rotation angle for the element. |
|
System.Drawing.SizeF
scale
The scaling factor for the element. |