Class GSMapFeature
GSMapFeature is an abstract base class for all feature types rendered onto the map.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GSMapFeature(options)
This class is abstract and should not be used directly.
|
| Method Attributes | Method Name and Description |
|---|---|
|
addContextMenuItem(menuItem)
Adds a context menu item for this component.
|
|
|
addEventHandler(eventType, func)
Calls the handler function provided when the given event is triggered on this feature.
|
|
|
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element.
|
|
|
addListener(obj)
Adds the specified object as a listener on this object.
|
|
|
deleteProperty(name)
Deletes the named property for this feature
|
|
|
deselect()
Abstract method that should be overriden by subclasses
|
|
|
Disables this component's context menu
|
|
|
Enables this component's context menu if it has been set
|
|
|
Returns the context menu for this component
|
|
|
Returns all user-defined properties for this feature
|
|
|
getProperty(name)
Gets the named property for this feature
|
|
|
Returns a boolean value indicating whether the map feature is selectable
|
|
|
Returns a boolean value indicating the visibility of this map feature
|
|
|
Removes this component's context menu
|
|
|
removeContextMenuItem(menuItem)
Removes the passed in context menu item from the list of menu items dynamically
added by this component to its context menu
|
|
|
removeEventHandler(token)
Removes the event handler function represented by the
token parameter
from this feature |
|
|
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature |
|
|
Removes all registered event listeners from the component's target element
|
|
|
removeListener(obj)
Removes the specified object as a listener from this object
|
|
|
select()
Abstract method that should be overriden by subclasses
|
|
|
setContextMenu(contextMenu)
Sets the context menu for this component
|
|
|
setProperty(name, value)
Sets a new property for this feature
|
|
|
setTip(text, options)
Sets a tool tip for this map feature
|
|
|
setVisible(value)
Sets the visibility of this map feature
|
|
|
setZIndex(zIndex)
Sets the z-index property of this feature
|
|
|
showInfoWindow(html, options)
Displays the specified HTML markup in the info window above this feature
|
|
|
toJson()
Outputs a JSON representation of this map feature
|
| Event Attributes | Event Name and Description |
|---|---|
|
featureClicked(feature)
|
|
|
featureRemoved(feature)
|
Class Detail
GSMapFeature(options)
This class is abstract and should not be used directly.
- Parameters:
- {Object} options Optional
- options to set on the map feature
- {Array} options.contextMenuItems
- if specified a context menu will be set on the feature with the provided context menu items
Method Detail
addContextMenuItem(menuItem)
Adds a context menu item for this component. The menu item will be dynamically
added to the context menu set on the component when it is displayed.
When the context menu is closed the menu item will be automatically removed.
Requires that a context menu has first been set for this component.
- Parameters:
- {GSMenuItem} menuItem
- the menu item to set
- Throws:
- {Error}
- if an attempt is made to add a context menu item before a context menu has been set
{Object}
addEventHandler(eventType, func)
Calls the handler function provided when the given event is triggered on this feature.
Any DOM Level 2 mouse event type may be specified for the
eventType
argument:
- click - the click event occurs when the mouse button is clicked over the feature.
- mousedown - the mousedown event occurs when the mouse button is pressed over the feature
- mouseup - the mouseup event occurs when the mouse button is released over the feature
- mouseover - the mouseover event occurs when the mouse is moved onto the feature
- mousemove - the mousemove event occurs when the mouse is moved while it is over the feature
- mouseout - the mouseout event occurs when the mouse is moved away from the feature
- Parameters:
- {String} eventType
- the event that should trigger the handler function
- {Function} func
- the function to be invoked when the event is triggered
- Deprecated:
- use GSMapFeature#addEventListener instead
- Returns:
- {Object} a token that can be passed to the
GSMapFeature.removeEventHandler()method to remove the event handler
{Object}
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element. This function returns a token
that can be passed to the #removeEventListener to remove the event
listener. If the
scope argument is not passed the function will execute in the context
of this object
- Parameters:
- {String} eventType
- the event type to add the listener for. Can be one of:
click, mousedown, mouseup, mouseover, mouseout - {Function} func
- The function to invoke when the event is triggered
- {Object} scope Optional
- the scope (
thisreference) in which the function is executed
- Throws:
- {Error}
- if this component does not define a reference to its DOM element
- Returns:
- {Object} a token that can be passed to the GSEventManager#removeEventListener to remove the event listener.
{boolean}
addListener(obj)
Adds the specified object as a listener on this object. The listener
object should provide callback methods for any events it wishes to
support
- Parameters:
- {Object} obj
- the object that should be added as a listener
- Returns:
- {boolean}
trueif the object was successfully added as a listener
deleteProperty(name)
Deletes the named property for this feature
- Parameters:
- {String} name
- the name of the property to delete
deselect()
Abstract method that should be overriden by subclasses
disableContextMenu()
Disables this component's context menu
{GSContextMenu}
enableContextMenu()
Enables this component's context menu if it has been set
- Returns:
- {GSContextMenu} the context menu belonging to this component
{GSContextMenu}
getContextMenu()
Returns the context menu for this component
- Returns:
- {GSContextMenu} the compoonents's context menu
{Object}
getProperties()
Returns all user-defined properties for this feature
- Returns:
- {Object} user-defined properties
getProperty(name)
Gets the named property for this feature
- Parameters:
- {String} name
- the name of the property to get
{boolean}
isSelectable()
Returns a boolean value indicating whether the map feature is selectable
- Returns:
- {boolean}
trueif this map feature is selectable
{boolean}
isVisible()
Returns a boolean value indicating the visibility of this map feature
- Returns:
- {boolean}
trueif this map feature is currently visible on the map
{GSContextMenu}
removeContextMenu()
Removes this component's context menu
- Returns:
- {GSContextMenu} the context menu that was removed, or
nullif no context menu was set
{boolean}
removeContextMenuItem(menuItem)
Removes the passed in context menu item from the list of menu items dynamically
added by this component to its context menu
- Parameters:
- {GSMenuItem} menuItem
- the menu item to remove
- Returns:
- {boolean}
trueif the menu item was removed from the component's list of menu items,falseif the menu item was not contained in the list
removeEventHandler(token)
Removes the event handler function represented by the
token parameter
from this feature
- Parameters:
- {Object} token
- a token identifying the event handler to be removed
- Deprecated:
- use GSMapFeature#removeEventListener instead
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature
- Parameters:
- {Object} token
- a token identifying the event handler to be removed
removeEventListeners()
Removes all registered event listeners from the component's target element
{boolean}
removeListener(obj)
Removes the specified object as a listener from this object
- Parameters:
- {Object} obj
- the object that should be removed as a listener
- Returns:
- {boolean}
trueif the specified listener object was removed successfully
select()
Abstract method that should be overriden by subclasses
setContextMenu(contextMenu)
Sets the context menu for this component
- Parameters:
- {GSContextMenu} contextMenu
- the context menu to display in response to right-click events on this component
setProperty(name, value)
Sets a new property for this feature
- Parameters:
- {String} name
- the name of the property to set
- {Mixed} value
- the value to set
setTip(text, options)
Sets a tool tip for this map feature
- Parameters:
- {String} text
- the text to display in the tool tip
- {Object} options Optional
- an object literal specifying optional configuration properties
- {boolean} options.fixed
- if
truethe tip is statically positioned relative to its owning element. If not fixed the tip will follow the mouse while its within the boundaries of the owning element (defaults tofalse) - {int} options.showDelay
- the delay the onShow method is called, defaults to 100ms
- {int} options.hideDelay
- the delay the onHide method is called, defaults to 100ms
- {int} options.maxDisplayChars
- the maximum number of characters that will be displayed in the tool tip
- {String} options.className
- the CSS class name to apply to the tip element, if not provided the tip will use a default style
- {GSPoint} options.offset
- the pixel offset for the tip. If the
fixedoption istruethe tip is positioned relative to the top-left corner of the owning element, otherwise it is positioned relative to the mouse position
setVisible(value)
Sets the visibility of this map feature
- Parameters:
- {boolean} value
trueif this feature should be visible on the map
setZIndex(zIndex)
Sets the z-index property of this feature
- Parameters:
- {int} zIndex
- the zIndex to use for this feature
showInfoWindow(html, options)
Displays the specified HTML markup in the info window above this feature
- Parameters:
- {String} html
- the HTML markup to display in the info window.
- {Object} options Optional
- optional parameters for configuring the map's info window
- {String} options.title
- the text to be displayed in the info window title bar
- {boolean} options.maximizable
- if
truea maximize button will be provided for maximizing the info window - {Mixed} options.maxContent
- a DOM node or HTML string to be displayed when the info window is maximized
- {GSDimension} options.maxSize
- the size the info window body should be maximized to. If not specified will resize to relative to the map window up to the internal maximum size (1000 x 800px)
- {Function} options.onopen
- a function to be called when the info window is opened
- {Function} options.onclose
- a function to be called when the info window is closed
- {boolean} options.showCloseButton
- if
truea close button will be displayed on the info window, defaults totrue
- Throws:
- {Error}
- if
htmlis undefined
{String}
toJson()
Outputs a JSON representation of this map feature
- Returns:
- {String} a JSON string
Event Detail
featureClicked(feature)
- Parameters:
- {GSMapFeature} feature
- the feature that was clicked
featureRemoved(feature)
- Parameters:
- {GSMapFeature} feature
- the feature that was removed