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.HTTP when 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 state
string 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 fill
boolean optional Set to false if no fill is desired.
fillColor
string '#ee9900' optional Hex fill color.
fillOpacity
number 0.4 optional Fill opacity (0-1).
stroke
boolean optional Set to false if no stroke is desired.
strokeColor
string '#ee9900' optional Hex stroke color.
strokeOpacity
number 0.4 optional Stroke opacity (0-1).
strokeWidth
number 1 optional Pixel stroke width.
strokeLinecap
string 'round' optional Stroke line cap has three types of butt, round, square.
strokeDashstyle
string 'solid' optional Stroke dash style has types of dot,dash,dashdot,longdash,longdashdot,solid.
graphic
boolean optional Set to false if no graphic is desired.
pointRadius
number 6 optional Pixel point radius.
pointerEvents
string 'visiblePainted' optional pointerEvents。
cursor
string optional cursor.
allowRotate
boolean 'false' optional Whether the icon can rotate with the moving direction.
externalGraphic
string optional Url to an external graphic that will be used for rendering points.
graphicWidth
number optional Pixel width for sizing an external graphic.
graphicHeight
number optional Pixel height for sizing an external graphic.
graphicOpacity
number optional Opacity (0-1) for an external graphic.
graphicXOffset
number optional Pixel offset along the positive x axis for displacing an external graphic.
graphicYOffset
number optional Pixel offset along the positive y axis for displacing an external graphic.
rotation
number 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).
graphicZIndex
number optional The integer z-index value to use in rendering.
graphicName
string 'circle' optional Named graphic to use when rendering points. Supported values include "circle" , "square", "star", "x", "cross", "triangle".
graphicTitle
string optional Tooltip when hovering over a feature. deprecated, use title instead.
backgroundGraphic
string optional Url to a graphic to be used as the background under an externalGraphic.
backgroundGraphicZIndex
number optional The integer z-index value to use in rendering the background graphic.
backgroundXOffset
number optional The y offset (in pixels) for the background graphic.
backgroundYOffset
number optional The y offset (in pixels) for the background graphic.
backgroundHeight
number optional The height of the background width. If not provided, the graphicWidth will be used.
backgroundWidth
number optional The width of the background width. If not provided, the graphicWidth will be used.
isUnicode
boolean 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.
label
string optional The selectable label text.
labelAlign
string '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。
labelXOffset
number optional Offset value of label on x-axis.
labelYOffset
number optional Offset value of label on y-axis.
labelSelect
boolean false optional If set to true, labels will be selectable using SelectFeature or similar controls. Default is false.
fontColor
string '#000000' optional The font color for the label.
fontOpacity
number optional Opacity (0-1) for the label.
fontFamily
string optional The font family for the label.
fontSize
string optional The font size for the label.
fontStyle
string optional The font style for the label.
fontWeight
string optional The font weight for the label.
display
string 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]); }