ALKMaps.Control.ScaleLine

The ScaleLine displays a small line indicator representing the current map scale on the map.  By default it is drawn in the lower left corner of the map.

Inherits from

Is a very close copy of

Summary
ALKMaps.Control.ScaleLineThe ScaleLine displays a small line indicator representing the current map scale on the map.
Properties
maxWidth{Integer} Maximum width of the scale line in pixels.
topOutUnits{String} Units for zoomed out on top bar.
topInUnits{String} Units for zoomed in on top bar.
bottomOutUnits{String} Units for zoomed out on bottom bar.
bottomInUnits{String} Units for zoomed in on bottom bar.
eTop{DOMElement}
eBottom{DOMElement}
geodesic{Boolean} Use geodesic measurement.
Constructor
ALKMaps.Control.ScaleLineCreate a new scale line control.
Functions
draw{DOMElement}
getBarLenGiven a number, round it down to the nearest 1,2,5 times a power of 10.
updateUpdate the size of the bars, and the labels they contain.

Properties

maxWidth

{Integer} Maximum width of the scale line in pixels.  Default is 100.

topOutUnits

{String} Units for zoomed out on top bar.  Default is km.

topInUnits

{String} Units for zoomed in on top bar.  Default is m.

bottomOutUnits

{String} Units for zoomed out on bottom bar.  Default is mi.

bottomInUnits

{String} Units for zoomed in on bottom bar.  Default is ft.

eTop

{DOMElement}

eBottom

{DOMElement}

geodesic

{Boolean} Use geodesic measurement.  Default is true.  The recommended setting for maps in EPSG:4326 is false, and true EPSG:900913.  If set to true, the scale will be calculated based on the horizontal size of the pixel in the center of the map viewport.

Constructor

ALKMaps.Control.ScaleLine

Create a new scale line control.

Parameters

options{Object} An optional object whose properties will be used to extend the control.

Functions

draw

draw: function()

Returns

{DOMElement}

getBarLen

getBarLen: function(maxLen)

Given a number, round it down to the nearest 1,2,5 times a power of 10.  That seems a fairly useful set of number groups to use.

Parameters

maxLen{float} the number we’re rounding down from

Returns

{Float} the rounded number (less than or equal to maxLen)

update

update: function()

Update the size of the bars, and the labels they contain.

draw: function()
{DOMElement}
getBarLen: function(maxLen)
Given a number, round it down to the nearest 1,2,5 times a power of 10.
update: function()
Update the size of the bars, and the labels they contain.
Controls affect the display or behavior of the map.
The Scale control displays the current map scale as a ratio (e.g.
Close