Class MVScaleBar
MVScaleBar defines a scale bar object that is to be displayed inside
a map decoration(MVMapDecoration) object.
The visibility and positioning of the scale bar is determined by the
map decoration that holds the scale bar.
An existing scale bar can be removed by removing the correspondind map
decoration object from the map.
Typical usage of this class is illustrated below.
var md=new MVMapDecoration(new MVScaleBar(),0,1,null,null,4,-45); mapview.addMapDecoration(md);
Constructor Attributes | Constructor Name and Description |
---|---|
MVScaleBar(options)
|
Method Attributes | Method Name and Description |
---|---|
setStyle(style)
This methods sets the visual style of the scale bar object.
|
Class Detail
MVScaleBar(options)
- Parameters:
- {object} options
- optional, an object that specifies the rendering options of the scale bar.
It can have the following three attributes.
- transformToGeodetic: A boolean that tells the map client whether to convert projected coordinates to geodetic coordinates and calculate the scale bar using sphere surface distances. It should be used only for map images rendered in projected systems.
- maxWidth: A number that specifies the maximum pixel width of the scale bar.
- format: A string that specifies the scale bar format, which can be one of the following, "METRIC", "IMPERIAL" and "BOTH".
Method Detail
{void}
setStyle(style)
This methods sets the visual style of the scale bar object.
The style parameter is an object that specifies aspects such as scale bar style, height and text style. The object has the following attributes:
- barStyle : The CSS style string that specifies the color and border of the scale bar.
- barHeight: The height of the scale bar in screen pixels,
- textStyle : The CSS style string that specifies the font style of the scale measurement text.
Here is an example.
var style = { barStyle:"border-top:1px solid #0a6ff9;background-color:#0066FF;border-bottom:1px solid #2c3847", barHeight:1, textStyle: "font-family: Tahoma;font-size:11px;font-weight:bold" } ;
- Parameters:
- {Obect} style
- the style object
- Returns:
- None