OpenLayers.Feature

Features are combinations of geography and attributes.  The OpenLayers.Feature class specifically combines a marker and a lonlat.

Summary
OpenLayers.FeatureFeatures are combinations of geography and attributes.
Properties
layer{OpenLayers.Layer}
id{String}
lonlat{OpenLayers.LonLat}
data{Object}
marker{OpenLayers.Marker}
popupClass{OpenLayers.Class} The class which will be used to instantiate a new Popup.
popup{OpenLayers.Popup}
Constructor
OpenLayers.FeatureConstructor for features.
Functions
destroynullify references to prevent circular references and memory leaks
onScreen{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)
createMarkerBased on the data associated with the Feature, create and return a marker object.
destroyMarkerDestroys marker.
createPopupCreates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.
destroyPopupDestroys the popup created via createPopup.

Properties

id

{String}

data

{Object}

popupClass

{OpenLayers.Class} The class which will be used to instantiate a new Popup.  Default is OpenLayers.Popup.Anchored.

Constructor

OpenLayers.Feature

Constructor for features.

Parameters

layer{OpenLayers.Layer}
lonlat{OpenLayers.LonLat}
data{Object}

Returns

{OpenLayers.Feature}

Functions

destroy

destroy: function()

nullify references to prevent circular references and memory leaks

onScreen

onScreen:function()

Returns

{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)

createMarker

createMarker: function()

Based on the data associated with the Feature, create and return a marker object.

Returns

{OpenLayers.Marker} A Marker Object created from the ‘lonlat’ and ‘icon’ properties set in this.data.  If no ‘lonlat’ is set, returns null.  If no ‘icon’ is set, OpenLayers.Marker() will load the default image.

Notethis.marker is set to return value

destroyMarker

destroyMarker: function()

Destroys marker.  If user overrides the createMarker() function, s/he should be able to also specify an alternative function for destroying it

createPopup

createPopup: function(closeBox)

Creates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.  It uses this.marker.icon as default anchor.

If no ‘lonlat’ is set, returns null.  If no this.marker has been created, no anchor is sent.

Notethe returned popup object is ‘owned’ by the feature, so you cannot use the popup’s destroy method to discard the popup.  Instead, you must use the feature’s destroyPopup
Notethis.popup is set to return value

Parameters

closeBox{Boolean} create popup with closebox or not

Returns

{OpenLayers.Popup} Returns the created popup, which is also set as ‘popup’ property of this feature.  Will be of whatever type specified by this feature’s ‘popupClass’ property, but must be of type OpenLayers.Popup.

destroyPopup

destroyPopup: function()

Destroys the popup created via createPopup.

As with the marker, if user overrides the createPopup() function, s/he should also be able to override the destruction

This class represents a longitude and latitude pair
Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.
A popup is a small div that can opened and closed on the map.
destroy: function()
nullify references to prevent circular references and memory leaks
onScreen:function()
{Boolean} Whether or not the feature is currently visible on screen (based on its ‘lonlat’ property)
createMarker: function()
Based on the data associated with the Feature, create and return a marker object.
destroyMarker: function()
Destroys marker.
createPopup: function(closeBox)
Creates a popup object created from the ‘lonlat’, ‘popupSize’, and ‘popupContentHTML’ properties set in this.data.
destroyPopup: function()
Destroys the popup created via createPopup.
Constructor for features.
Close