new FeatureVector(geometry, attributes, style)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
  new ol.supermap.Feature.Vector(geometry, attributes, style);
  
  // 弃用的写法
  new SuperMap.Feature.Vector(geometry, attributes, style);
</script>
// ES6 Import
import { FeatureVector } from '@supermap/iclient-ol';
new FeatureVector(geometry, attributes, style);
        
        
        | Name | Type | Description | 
|---|---|---|
| geometry | Geometry | 要素的几何信息。 | 
| attributes | Object | 可选 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。 | 
| style | Object | 可选 样式对象。 | 
Example
var geometry = new GeometryPoint(-115,10);
 var style = {
     strokeColor:"#339933",
     strokeOpacity:1,
     strokeWidth:3,
     pointRadius:6
 }
 var pointFeature = new FeatureVector(geometry,null,style);
 vectorLayer.addFeatures(pointFeature);Extends
Members
- 
    attributesObject
- 
    
    描述要素的任意的可序列化属性。 
- 
    boundsBounds
- 
    
    限制要素几何的边界。 
- 
    dataObject
- 
    
    数据对象。 
- 
    fidstring
- 
    
    fid。 
- 
    geometryGeometry
- 
    
    存放几何信息。 
- 
    idstring
- 
    
    要素 ID。 
- 
    deprecated layerSuperMap.Layer
- 
    
    图层。 
- 
    lonlatLonLat
- 
    
    经纬度。 
- 
    statestring
- 
    
    state。 
- 
    styleObject
- 
    
    要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。 
- 
    urlstring
- 
    
    如果设置了这个属性,在更新或者删除要素时需要考虑 HTTP 。 
Methods
- 
    clone(){FeatureVector}common/commontypes/Vector.js, line 187
- 
    
    复制矢量要素,并返回复制后的新对象。 Returns:Type Description FeatureVector 相同要素的新的矢量要素。 
- 
    destroy()common/commontypes/Vector.js, line 173
- 
    
    释放资源,将引用资源的属性置空。 
- 
    toState(state)common/commontypes/Vector.js, line 199
- 
    
    设置新状态。 Name Type Description statestring 状态。 
Type Definitions
- 
    styleObject
- 
    
    Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式, 大部分样式通过 SVG 标准定义属性。 - fill properties 资料介绍:http://www.w3.org/TR/SVG/painting.html#FillProperties
- stroke properties 资料介绍:http://www.w3.org/TR/SVG/painting.html#StrokeProperties
 Properties:Name Type Default Description fillboolean 可选 不需要填充则设置为 false。 fillColorstring '#ee9900' 可选 十六进制填充颜色。 fillOpacitynumber 0.4 可选 填充不透明度。 strokeboolean 可选 不需要描边则设为 false。 strokeColorstring '#ee9900' 可选 十六进制描边颜色。 strokeOpacitynumber 0.4 可选 描边的不透明度(0-1)。 strokeWidthnumber 1 可选 像素描边宽度。 strokeLinecapstring 'round' 可选 strokeLinecap 有三种类型 butt,round,square。 strokeDashstylestring 'solid' 可选 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。 graphicboolean 可选 不需要则设置为 false。 pointRadiusnumber 6 可选 像素点半径。 pointerEventsstring 'visiblePainted' 可选 pointerEvents。 cursorstring 可选 cursor。 allowRotateboolean 'false' 可选 是否允许图标随着运行方向旋转。用于时空数据图层。 externalGraphicstring 可选 连接到用来渲染点的外部的图形。 graphicWidthnumber 可选 外部图表的像素宽度。 graphicHeightnumber 可选 外部图表的像素高度。 graphicOpacitynumber 可选 外部图表的不透明度(0-1)。 graphicXOffsetnumber 可选 外部图表沿着x方向的偏移量。 graphicYOffsetnumber 可选 外部图表沿着y方向的偏移量。 rotationnumber 可选 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。 graphicZIndexnumber 可选 渲染时使用的索引值。 graphicNamestring 'circle' 可选 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。 graphicTitlestring 可选 外部图表的提示框。 backgroundGraphicstring 可选 外部图表的背景。 backgroundGraphicZIndexnumber 可选 背景图渲染时使用的索引值。 backgroundXOffsetnumber 可选 背景图在 x 轴的偏移量。 backgroundYOffsetnumber 可选 背景图在 y 轴的偏移量。 backgroundHeightnumber 可选 背景图的高度。如果没有设置,将用 graphicHeight。 backgroundWidthnumber 可选 背景图的宽度。如果没有设置,将用 graphicWidth。 isUnicodeboolean false 可选 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码, 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "a",其中 "&#" 为前缀,标志这个为 unicode 编码, "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出, 比如,label 为 "a",这时页面显示的也是 "a"。 labelstring 可选 可选的标签文本。 labelAlignstring 'cm' 可选 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb", 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right; 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。 labelXOffsetnumber 可选 标签在 x 轴方向的偏移量。 labelYOffsetnumber 可选 标签在 y 轴方向的偏移量。 labelSelectboolean false 可选 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。 fontColorstring '#000000' 可选 标签字体颜色。 fontOpacitynumber 可选 标签透明度 (0-1)。 fontFamilystring 可选 标签的字体类型。 fontSizestring 可选 标签的字体大小。 fontStylestring 可选 标签的字体样式。 fontWeightstring 可选 标签的字体粗细。 displaystring 可选 如果 display 属性设置为 “none”,符号将没有任何效果。 Example// label的用法如下: function addGeoTest(){ var geometry = new GeometryPoint(105, 35); var pointFeature = new FeatureVector(geometry); var styleTest = { label:"supermap", fontColor:"#0000ff", fontOpacity:"0.5", fontFamily:"隶书", fontSize:"8em", fontWeight:"bold", fontStyle:"italic", labelSelect:"true", } pointFeature.style = styleTest; vectorLayer.addFeatures([pointFeature]); }