new SuperMap.Feature.Vector(geometry, attributes, style)
| Name | Type | Description |
|---|---|---|
geometry |
SuperMap.Geometry |
geometry shape of features. |
attributes |
Object |
optional
This object holds arbitrary, serializable properties that describe the feature. |
style |
Object |
optional
A selectable style object. |
Example
var geometry = new SuperMap.Geometry.Point(-115,10);
var style = {
strokeColor:"#339933",
strokeOpacity:1,
strokeWidth:3,
pointRadius:6
}
var pointFeature = new SuperMap.Feature.Vector(geometry,null,style);
vectorLayer.addFeatures(pointFeature);
Extends
Members
-
attributesObject
-
This object holds arbitrary, serializable properties that describe the feature.
-
boundsSuperMap.Bounds
-
The box bounding that feature's geometry, that property can be set by an <SuperMap.Format> object when deserializing the feature, so in most cases it represents an information set by the server.
-
dataObject
-
The data object.
-
fidstring
-
fid
-
geometrySuperMap.Geometry
-
A Geometry is a description of a geographic object.
-
idstring
-
The feature id.
-
layerSuperMap.Layer
-
The layer.
- Deprecated
- Yes
-
lonlatSuperMap.LonLat
-
The longitude and latitude.
-
statestring
-
state
-
styleObject
-
The style attribute of features. The style of feature returned by map query. In 8C it has changed to null.
-
urlstring
-
If this property is set it will be taken into account by
SuperMap.HTTPwhen updating or deleting the feature.
Methods
-
clone(){SuperMap.Feature.Vector}
Vector.js, line 187 -
Create a clone of this vector feature. Does not set any non-standard properties.
Returns:
Type Description SuperMap.Feature.Vector An exact clone of this vector feature. -
destroy()
Vector.js, line 173 -
nullify references to prevent circular references and memory leaks
-
toState(state)
Vector.js, line 200 -
Sets the new state.
Name Type Description statestring state.
Type Definitions
-
SuperMap.Feature.Vector.styleObject
-
SuperMap.features can have a number of style attributes. If it isn't specified, most of the styles are defined by SVG standard.
- fill properties Information introduction: href="http://www.w3.org/TR/SVG/painting.html#FillProperties">www.w3.org/TR/SVG/painting.html#FillProperties}
- stroke properties Information introduction: href="http://www.w3.org/TR/SVG/painting.html#StrokeProperties">www.w3.org/TR/SVG/painting.html#StrokeProperties}
Properties:
Name Type Default Description fillboolean optional Set to false if no fill is desired.
fillColorstring '#ee9900' optional Hex fill color.
fillOpacitynumber 0.4 optional Fill opacity (0-1).
strokeboolean optional Set to false if no stroke is desired.
strokeColorstring '#ee9900' optional Hex stroke color.
strokeOpacitynumber 0.4 optional Stroke opacity (0-1).
strokeWidthnumber 1 optional Pixel stroke width.
strokeLinecapstring 'round' optional Stroke line cap has three types of butt, round, square.
strokeDashstylestring 'solid' optional Stroke dash style has types of dot,dash,dashdot,longdash,longdashdot,solid.
graphicboolean optional Set to false if no graphic is desired.
pointRadiusnumber 6 optional Pixel point radius.
pointerEventsstring 'visiblePainted' optional pointerEvents。
cursorstring optional cursor.
allowRotateboolean 'false' optional Whether the icon can rotate with the moving direction.
externalGraphicstring optional Url to an external graphic that will be used for rendering points.
graphicWidthnumber optional Pixel width for sizing an external graphic.
graphicHeightnumber optional Pixel height for sizing an external graphic.
graphicOpacitynumber optional Opacity (0-1) for an external graphic.
graphicXOffsetnumber optional Pixel offset along the positive x axis for displacing an external graphic.
graphicYOffsetnumber optional Pixel offset along the positive y axis for displacing an external graphic.
rotationnumber optional 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).
graphicZIndexnumber optional The integer z-index value to use in rendering.
graphicNamestring 'circle' optional Named graphic to use when rendering points. Supported values include "circle" , "square", "star", "x", "cross", "triangle".
graphicTitlestring optional Tooltip when hovering over a feature. deprecated, use title instead.
backgroundGraphicstring optional Url to a graphic to be used as the background under an externalGraphic.
backgroundGraphicZIndexnumber optional The integer z-index value to use in rendering the background graphic.
backgroundXOffsetnumber optional The y offset (in pixels) for the background graphic.
backgroundYOffsetnumber optional The y offset (in pixels) for the background graphic.
backgroundHeightnumber optional The height of the background width. If not provided, the graphicWidth will be used.
backgroundWidthnumber optional The width of the background width. If not provided, the graphicWidth will be used.
isUnicodeboolean false optional This property should combine with lable property. If it is true, label can use unicode. e.g., the unicode of "a" is 61, so the label property can be a, where &# is prefix, x is hexadecimal; if it is false, the label will output a, the display a. The default is false.
labelstring optional The selectable label text.
labelAlignstring 'cm' optional Label alignment. This specifies the insertion point relative to the text. It is a string composed of two characters. :"lt", "cm", "rb", 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。
labelXOffsetnumber optional Offset value of label on x-axis.
labelYOffsetnumber optional Offset value of label on y-axis.
labelSelectboolean false optional If set to true, labels will be selectable using SelectFeature or similar controls. Default is false.
fontColorstring '#000000' optional The font color for the label.
fontOpacitynumber optional Opacity (0-1) for the label.
fontFamilystring optional The font family for the label.
fontSizestring optional The font size for the label.
fontStylestring optional The font style for the label.
fontWeightstring optional The font weight for the label.
displaystring optional Symbolizers will have no effect if display is set to “none”. All other values have no effect.
Example
// The usage of label is as following: function addGeoTest(){ var geometry = new SuperMap.Geometry.Point(105, 35); var pointFeature = new SuperMap.Feature.Vector(geometry); var styleTest = { label:"supermap", fontColor:"#0000ff", fontOpacity:"0.5", fontFamily:"Microsoft YaHei", fontSize:"8em", fontWeight:"bold", fontStyle:"italic", labelSelect:"true", } pointFeature.style = styleTest; vectorLayer.addFeatures([pointFeature]); }