Class GSControl
A control that belongs to a map. This class is abstract and should not be used directly.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GSControl(name)
Creates a new
GSControl |
| Property Attributes | Property Name and Description |
|---|---|
| <static> |
GSControl.ANCHOR_BOTTOM_CENTER
Constant for specifying that a map control should be anchored in the bottom center
of the map viewport
|
| <static> |
GSControl.ANCHOR_BOTTOM_LEFT
Constant for specifying that a map control should be anchored in the bottom left
corner of the map viewport
|
| <static> |
GSControl.ANCHOR_BOTTOM_RIGHT
Constant for specifying that a map control should be anchored in the bottom right
corner of the map viewport
|
| <static> |
GSControl.ANCHOR_CENTER
Constant for specifying that a map control should be anchored in the center
of the map viewport
|
| <static> |
GSControl.ANCHOR_TOP_CENTER
Constant for specifying that a map control should be anchored in the top center
of the map viewport
|
| <static> |
GSControl.ANCHOR_TOP_LEFT
Constant for specifying that a map control should be anchored in the top left
corner of the map viewport
|
| <static> |
GSControl.ANCHOR_TOP_RIGHT
Constant for specifying that a map control should be anchored in the top right
corner of the map viewport
|
true if the map control is positioned by its parent |
| Method Attributes | Method Name and Description |
|---|---|
|
Used by the map to determine the position in the map viewport where the control should appear.
|
|
|
Returns the height of the control in pixels.
|
|
|
Returns the orientation of the control,
horizontal or vertical. |
|
|
Returns the positioning information for this control.
|
|
|
getWidth()
Returns the width of the control in pixels.
|
|
|
hide()
Hides the map control
|
|
|
remove(map)
Called by the map when this control is removed so that it can do
any clean up necessary.
|
|
|
render(map)
Called by the map instance the control is added to, this method creates the DOM elements for this control.
|
|
|
show()
Shows the map control
|
Class Detail
GSControl(name)
Creates a new
GSControl
- Parameters:
- name
- a unique identifier for the map control
Property Detail
<static>
{int}
GSControl.ANCHOR_BOTTOM_CENTER
Constant for specifying that a map control should be anchored in the bottom center
of the map viewport
<static>
{int}
GSControl.ANCHOR_BOTTOM_LEFT
Constant for specifying that a map control should be anchored in the bottom left
corner of the map viewport
<static>
{int}
GSControl.ANCHOR_BOTTOM_RIGHT
Constant for specifying that a map control should be anchored in the bottom right
corner of the map viewport
<static>
{int}
GSControl.ANCHOR_CENTER
Constant for specifying that a map control should be anchored in the center
of the map viewport
<static>
{int}
GSControl.ANCHOR_TOP_CENTER
Constant for specifying that a map control should be anchored in the top center
of the map viewport
<static>
{int}
GSControl.ANCHOR_TOP_LEFT
Constant for specifying that a map control should be anchored in the top left
corner of the map viewport
<static>
{int}
GSControl.ANCHOR_TOP_RIGHT
Constant for specifying that a map control should be anchored in the top right
corner of the map viewport
{boolean}
parentPositioned
true if the map control is positioned by its parent
Method Detail
{Object}
getDefaultPosition()
Used by the map to determine the position in the map viewport where the control should appear.
The control positioning information is specified using an object literal with an
anchor
property that specifies the corner of the map viewport in which the control should be positioned and
an offset property which is a GSPoint instance describing the x and y offset
from the anchor position. The anchor property should reference one of the static GSControl
positioning constants.
This positioning information can be overriden at the time the control is added to the map by passing a position object as the second argument to GSMap#addControl
- Returns:
- {Object} a position object specifying where the control should be anchored and the offset of the control from the edge of the map viewport
- See:
- GSControl.ANCHOR_TOP_LEFT
- GSControl.ANCHOR_TOP_CENTER
- GSControl.ANCHOR_TOP_RIGHT
- GSControl.ANCHOR_BOTTOM_LEFT
- GSControl.ANCHOR_BOTTOM_CENTER
- GSControl.ANCHOR_BOTTOM_RIGHT
- GSControl.ANCHOR_CENTER
{int}
getHeight()
Returns the height of the control in pixels. This method must be overriden
by control subclasses if they wish to be taken into account when positioning
the map's info window
- Returns:
- {int} the height of the control
{String}
getOrientation()
Returns the orientation of the control,
horizontal or vertical. This method should be overriden
by control subclasses
- Returns:
- {String} the orientation of the control
{Object}
getPosition()
Returns the positioning information for this control.
- Returns:
- {Object} a position object specifying where the control is anchored and the offset of the control from the edge of the map viewport
{int}
getWidth()
Returns the width of the control in pixels. This method must be overriden
by control subclasses if they wish to be taken into account when positioning
the map's info window
- Returns:
- {int} the width of the control
hide()
Hides the map control
remove(map)
Called by the map when this control is removed so that it can do
any clean up necessary. This method should not be called directly, to remove
a map control use GSMap#removeControl instead.
- Parameters:
- {GSMap} map
- the map instance this control has been added to
{HTMLElement}
render(map)
Called by the map instance the control is added to, this method creates the DOM elements for this control.
Within
render() the control class is required to return a reference to the control's outermost
DOM element to the map
- Parameters:
- {GSMap} map
- the map instance the control belongs to
- Returns:
- {HTMLElement} a reference to the control's outermost DOM element
show()
Shows the map control