Class GSMapFeature

GSMapFeature is an abstract base class for all feature types rendered onto the map.

Class Summary
Constructor Attributes Constructor Name and Description
 
GSMapFeature(options)
This class is abstract and should not be used directly.
Method Summary
Method Attributes Method Name and Description
 
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.
 
Adds the specified object as a listener on this object.
 
Deletes the named property for this feature
 
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
 
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
 
Removes the passed in context menu item from the list of menu items dynamically added by this component to its context menu
 
Removes the event handler function represented by the token parameter from this feature
 
Removes the event listener function represented by the token parameter from this feature
 
Removes all registered event listeners from the component's target element
 
Removes the specified object as a listener from this object
 
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
 
Outputs a JSON representation of this map feature
Event Summary
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:
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 (this reference) 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} true if 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} true if this map feature is selectable

{boolean} isVisible()
Returns a boolean value indicating the visibility of this map feature
Returns:
{boolean} true if 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 null if 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} true if the menu item was removed from the component's list of menu items, false if 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} true if 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 true the 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 to false)
{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 fixed option is true the 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
true if 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 true a 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 true a close button will be displayed on the info window, defaults to true
Throws:
{Error}
if html is 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

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Mar 07 2012 11:47:29 GMT+1300 (NZDT)