ALKMaps.Feature.Vector

Vector features use the ALKMaps.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 ALKMaps.Feature.Vector.style objects.

Inherits from

Summary
ALKMaps.Feature.VectorVector features use the ALKMaps.Geometry classes as geometry description.
Properties
fid{String}
geometry{ALKMaps.Geometry}
attributes{Object} This object holds arbitrary, serializable properties that describe the feature.
bounds{ALKMaps.Bounds} The box bounding that feature’s geometry, that property can be set by an ALKMaps.Format object when deserializing the feature, so in most cases it represents an information set by the server.
state{String}
style{Object}
url{String} If this property is set it will be taken into account by {<ALKMaps.HTTP>} when updating or deleting the feature.
renderIntent{String} rendering intent currently being used
modified{Object} An object with the originals of the geometry and attributes of the feature, if they were changed.
Constructor
ALKMaps.Feature.VectorCreate a vector feature.
Functions
destroynullify references to prevent circular references and memory leaks
cloneCreate a clone of this vector feature.
onScreenDetermine whether the feature is within the map viewport.
getVisibilityDetermine whether the feature is displayed or not.
createMarker
destroyMarker
createPopupCreate popup and attach it to the feature.
atPointDetermines whether the feature intersects with the specified location.
moveMoves the feature and redraws it at its new location
toStateSets the new state
Constants
ALKMaps.Feature.Vector.styleALKMaps features can have a number of style attributes.

Properties

fid

{String}

attributes

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

bounds

{ALKMaps.Bounds} The box bounding that feature’s geometry, that property can be set by an ALKMaps.Format object when deserializing the feature, so in most cases it represents an information set by the server.

state

{String}

style

{Object}

url

{String} If this property is set it will be taken into account by {<ALKMaps.HTTP>} when updating or deleting the feature.

renderIntent

{String} rendering intent currently being used

modified

{Object} An object with the originals of the geometry and attributes of the feature, if they were changed.  Currently this property is only read by <ALKMaps.Format.WFST.v1>, and written by ALKMaps.Control.ModifyFeature, which sets the geometry property.  Applications can set the originals of modified attributes in the attributes property.  Note that applications have to check if this object and the attributes property is already created before using it.  After a change made with ModifyFeature, this object could look like

{
    geometry: >Object
}

When an application has made changes to feature attributes, it could have set the attributes to something like this:

{
    attributes: {
        myAttribute: "original"
    }
}

Note that <ALKMaps.Format.WFST.v1> only checks for truthy values in modified.geometry and the attribute names in modified.attributes, but it is recommended to set the original values (and not just true) as attribute value, so applications could use this information to undo changes.

Constructor

ALKMaps.Feature.Vector

Create a vector feature.

Parameters

geometry{ALKMaps.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

{ALKMaps.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 efficient 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).

getVisibility

getVisibility: function()

Determine whether the feature is displayed or not.  It may not displayed because:

  • its style display property is set to ‘none’,
  • it doesn’t belong to any layer,
  • the styleMap creates a symbolizer with display property set to ‘none’ for it,
  • the layer which it belongs to is not visible.

Returns

{Boolean} The feature is currently displayed.

createMarker

createMarker: function()
HACKwe need to decide if all vector features should be able to create markers

Returns

{ALKMaps.Marker} For now just returns null

destroyMarker

destroyMarker: function()
HACKwe 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(closeBox)

Create popup and attach it to the feature.  The popup is created from the feature ‘lonLat’ and ‘popupClass’.  ‘popupSize’, ‘anchor’, ‘popupContentHTML’, and ‘overflow’ properties in this.data can be used to override default popup properties.

If no ‘lonlat’ is set, returns null.

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

{ALKMaps.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 ALKMaps.Popup.

atPoint

atPoint: function(lonlat,
toleranceLon,
toleranceLat)

Determines whether the feature intersects with the specified location.

Parameters

lonlat{<ALKMaps.LonLat>|Object} ALKMaps.LonLat or an object with a ‘lon’ and ‘lat’ properties.
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

move

move: function(location)

Moves the feature and redraws it at its new location

Parameters

location{ALKMaps.LonLat or ALKMaps.Pixel} the location to which to move the feature.

toState

toState: function(state)

Sets the new state

Parameters

state{String}

Constants

ALKMaps.Feature.Vector.style

ALKMaps features can have a number of style attributes.  The ‘default’ style will typically be used if no other style is specified.  These styles correspond for the most part, to the styling properties defined by the SVG standard.  Information on fill properties: https://www.w3.org/TR/SVG/painting.html#FillProperties Information on stroke properties: https://www.w3.org/TR/SVG/painting.html#StrokeProperties

Symbolizer properties

fill{Boolean} Set to false if no fill is desired.
fillColor{String} Hex fill color.  Default is “#ee9900”.
fillOpacity{Number} Fill opacity (0-1).  Default is 0.4
stroke{Boolean} Set to false if no stroke is desired.
strokeColor{String} Hex stroke color.  Default is “#ee9900”.
strokeOpacity{Number} Stroke opacity (0-1).  Default is 1.
strokeWidth{Number} Pixel stroke width.  Default is 1.
strokeLinecap{String} Stroke cap type.  Default is “round”.  [butt | round | square]
strokeDashstyle{String} Stroke dash style.  Default is “solid”.  [dot | dash | dashdot | longdash | longdashdot | solid]
graphic{Boolean} Set to false if no graphic is desired.
pointRadius{Number} Pixel point radius.  Default is 6.
pointerEvents{String} Default is “visiblePainted”.
cursor{String} Default is “”.
externalGraphic{String} Url to an external graphic that will be used for rendering points.
graphicWidth{Number} Pixel width for sizing an external graphic.
graphicHeight{Number} Pixel height for sizing an external graphic.
graphicOpacity{Number} Opacity (0-1) for an external graphic.
graphicXOffset{Number} Pixel offset along the positive x axis for displacing an external graphic.
graphicYOffset{Number} Pixel offset along the positive y axis for displacing an external graphic.
rotation{Number} For point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point (or any point off center as specified by graphicXOffset and graphicYOffset).
graphicZIndex{Number} The integer z-index value to use in rendering.
graphicName{String} Named graphic to use when rendering points.  Supported values include “circle” (default), “square”, “star”, “x”, “cross”, “triangle”.
graphicTitle{String} Tooltip for an external graphic.
backgroundGraphic{String} Url to a graphic to be used as the background under an externalGraphic.
backgroundGraphicZIndex{Number} The integer z-index value to use in rendering the background graphic.
backgroundXOffset{Number} The x offset (in pixels) for the background graphic.
backgroundYOffset{Number} The y offset (in pixels) for the background graphic.
backgroundHeight{Number} The height of the background graphic.  If not provided, the graphicHeight will be used.
backgroundWidth{Number} The width of the background width.  If not provided, the graphicWidth will be used.
label{String} The text for an optional label.  For browsers that use the canvas renderer, this requires either fillText or mozDrawText to be available.
labelAlign{String} Label alignment.  This specifies the insertion point relative to the text.  It is a string composed of two characters.  The first character is for the horizontal alignment, the second for the vertical alignment.  Valid values for horizontal alignment: “l”=left, “c”=center, “r”=right.  Valid values for vertical alignment: “t”=top, “m”=middle, “b”=bottom.  Example values: “lt”, “cm”, “rb”.  Default is “cm”.
labelXOffset{Number} Pixel offset along the positive x axis for displacing the label.  Not supported by the canvas renderer.
labelYOffset{Number} Pixel offset along the positive y axis for displacing the label.  Not supported by the canvas renderer.
labelSelect{Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.  Default is false.
labelOutlineColor{String} The color of the label outline.  Default is ‘white’.  Only supported by the canvas & SVG renderers.
labelOutlineWidth{Number} The width of the label outline.  Default is 3, set to 0 or null to disable.  Only supported by the canvas & SVG renderers.
fontColor{String} The font color for the label, to be provided like CSS.
fontOpacity{Number} Opacity (0-1) for the label
fontFamily{String} The font family for the label, to be provided like in CSS.
fontSize{String} The font size for the label, to be provided like in CSS.
fontStyle{String} The font style for the label, to be provided like in CSS.
fontWeight{String} The font weight for the label, to be provided like in CSS.
display{String} Symbolizers will have no effect if display is set to “none”.  All other values have no effect.
arrows{String} “end” indicates an arrow at end of the line, “line” indicates arrows along the line.  Default is null (no arrows).
arrowSize{String/Number} Either a number representing the point radius of the arrow.  Or a string indicating the size of the arrow as a percentage of the route line’s stroke width.  Default is “100%”.
arrowSpacing{Number} Distance in pixels between arrows along a line.  Default is 100.
arrowFillColor{String} Hex fill color.  Used as the color for the inside of arrows along a line.  Default is “white”.
arrowFillOpacity{Number} Fill opacity (0-1).  Used as the opacity for the inside of arrows along a line.  Default is 1.
arrowStrokeColor{String} Hex stroke color.  Used as the color for the outline of arrows along a line.  Default is “black”.
arrowStrokeOpacity{Number} Stroke opacity (0-1).  Used as the opacity for the outline of arrows along a line.  Default is 1.
arrowStrokeWidth{Number} Pixel stroke width.  Used as the thickness for the outline of arrows along a line.  Default is 1.
arrowGraphicName{String} Name of symbol to use when rendering arrows.  Supported values are keys in ALKMaps.Renderer.symbol object.  Default is “chevron”.
arrowRotation{Number} For arrow point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point.  Default is 0.
A Geometry is a description of a geographic object.
Instances of this class represent bounding boxes.
Base class for format reading/writing a variety of formats.
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.
getVisibility: function()
Determine whether the feature is displayed or not.
createMarker: function()
destroyMarker: function()
createPopup: function(closeBox)
Create popup and attach it to the feature.
atPoint: function(lonlat,
toleranceLon,
toleranceLat)
Determines whether the feature intersects with the specified location.
move: function(location)
Moves the feature and redraws it at its new location
toState: function(state)
Sets the new state
ALKMaps features can have a number of style attributes.
Features are combinations of geography and attributes.
Control to modify features.
{Object} This object holds arbitrary, serializable properties that describe the feature.
Create a vector feature.
Deprecated.
A popup is a small div that can opened and closed on the map.
This class represents a longitude and latitude pair
This class represents a screen coordinate, in x and y coordinates
Close