OpenLayers.Feature.Vector - OpenLayers

# OpenLayers. Feature. Vector

Vector features use the OpenLayers.Geometry classes as geometry description. They have an ‘attributes’ property, which is the data object, and a ‘style’ property, the default values of which are defined in the OpenLayers.Feature.Vector.style objects.

#### Inherits from

- OpenLayers.Feature

Summary

OpenLayers. Feature. Vector | Vector features use the OpenLayers.Geometry classes as geometry description.
Properties |
fid | {String}
geometry | {OpenLayers.Geometry}
attributes | {Object} This object holds arbitrary properties that describe the feature.
state | {String}
style | {Object}
renderIntent | {String} rendering intent currently being used
Constructor |
OpenLayers. Feature. Vector | Create a vector feature.
Functions |
destroy | nullify references to prevent circular references and memory leaks
clone | Create a clone of this vector feature.
onScreen | Determine whether the feature is within the map viewport.
createMarker |
destroyMarker |
createPopup |
atPoint | Determins whether the feature intersects with the specified location.
destroyPopup |
move | Moves the feature and redraws it at its new location
toState | Sets the new state
Constants |
OpenLayers. Feature. Vector. style | OpenLayers features can have a number of style attributes.

### Properties

### fid

{String}

### geometry

{OpenLayers.Geometry}

### attributes

{Object} This object holds arbitrary properties that describe the feature.

### state

{String}

### style

{Object}

### renderIntent

{String} rendering intent currently being used

### Constructor

### OpenLayers. Feature. Vector

Create a vector feature.

#### Parameters

geometry | {OpenLayers.Geometry} The geometry that this feature represents.
attributes | {Object} An optional object that will be mapped to the attributes property.
style | {Object} An optional style object.

### Functions

### destroy

> destroy: function()

nullify references to prevent circular references and memory leaks

### clone

> clone: function ()

Create a clone of this vector feature. Does not set any non-standard properties.

#### Returns

{OpenLayers.Feature.Vector} An exact clone of this vector feature.

### onScreen

> onScreen:function( | boundsOnly | )

Determine whether the feature is within the map viewport. This method tests for an intersection between the geometry and the viewport bounds. If a more effecient but less precise geometry bounds intersection is desired, call the method with the boundsOnly parameter true.

#### Parameters

boundsOnly | {Boolean} Only test whether a feature’s bounds intersects the viewport bounds. Default is false. If false, the feature’s geometry must intersect the viewport for onScreen to return true.

#### Returns

{Boolean} The feature is currently visible on screen (optionally based on its bounds if boundsOnly is true).

### createMarker

> createMarker: function()

HACK | we need to decide if all vector features should be able to create markers

#### Returns

{OpenLayers.Marker} For now just returns null

### destroyMarker

> destroyMarker: function()

HACK | we need to decide if all vector features should be able to delete markers

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

### createPopup

> createPopup: function()

HACK | we need to decide if all vector features should be able to create popups

#### Returns

{OpenLayers.Popup} For now just returns null

### atPoint

> atPoint: function( | lonlat,
> | toleranceLon,
> | toleranceLat | )

Determins whether the feature intersects with the specified location.

#### Parameters

lonlat | {OpenLayers.LonLat}
toleranceLon | {float} Optional tolerance in Geometric Coords
toleranceLat | {float} Optional tolerance in Geographic Coords

#### Returns

{Boolean} Whether or not the feature is at the specified location

### destroyPopup

> destroyPopup: function()

HACK | we need to decide if all vector features should be able to delete popups

### move

> move: function( | location | )

Moves the feature and redraws it at its new location

#### Parameters

state | {OpenLayers.LonLat or OpenLayers.Pixel} the location to which to move the feature.

### toState

> toState: function( | state | )

Sets the new state

#### Parameters

state | {String}

### Constants

### OpenLayers. Feature. Vector. style

OpenLayers features can have a number of style attributes. The ‘default’ style will typically be used if no other style is specified.

#### Default style properties

- fillColor: “#ee9900”,
- fillOpacity: 0.4,
- hoverFillColor: “white”,
- hoverFillOpacity: 0.8,
- strokeColor: “#ee9900”,
- strokeOpacity: 1,
- strokeWidth: 1,
- strokeLinecap: “round”, [butt | round | square]
- strokeDashstyle: “solid”, [dot | dash | dashdot | longdash | longdashdot | solid]
- hoverStrokeColor: “red”,
- hoverStrokeOpacity: 1,
- hoverStrokeWidth: 0.2,
- pointRadius: 6,
- hoverPointRadius: 1,
- hoverPointUnit: “%”,
- pointerEvents: “visiblePainted”
- cursor: “”

#### Other style properties that have no default values

- externalGraphic,
- graphicWidth,
- graphicHeight,
- graphicOpacity,
- graphicXOffset,
- graphicYOffset,
- graphicName,
- display

A Geometry is a description of a geographic object.

> destroy: function()

nullify references to prevent circular references and memory leaks

> clone: function ()

Create a clone of this vector feature.

> onScreen:function( | boundsOnly | )

Determine whether the feature is within the map viewport.

> createMarker: function()

> destroyMarker: function()

> createPopup: function()

> atPoint: function( | lonlat,
> | toleranceLon,
> | toleranceLat | )

Determins whether the feature intersects with the specified location.

> destroyPopup: function()

> move: function( | location | )

Moves the feature and redraws it at its new location

> toState: function( | state | )

Sets the new state
OpenLayers features can have a number of style attributes.
Features are combinations of geography and attributes.
{Object} This object holds arbitrary properties that describe the feature.
Create a vector feature.
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.
This class represents a longitude and latitude pair
Close