new Polygon(points, style)
面对象,仅在二维模式中
Parameters:
Name | Type | Description |
---|---|---|
points |
array | 点对象数组 |
style |
szgeoinfo.style.Style | 显示样式 |
Example
var ps = []; ps.push(new szgeoinfo.Point(114.06145720500,22.523970131470)); ps.push(new szgeoinfo.Point(114.062202858793,22.5235241619530)); ps.push(new szgeoinfo.Point(114.062283325385,22.5232714446730)); var fill=new szgeoinfo.style.Fill("rgba(247, 227, 167, 0.7)");//填充颜色 var stroke=new szgeoinfo.style.Stroke("rgba(253,206,4,1)",1); var style=new szgeoinfo.style.Style(fill,stroke); var polygon=new szgeoinfo.Polygon(ps,style); map.addMarker(polygon); polygon.hide();//隐藏 var area = polygon.getArea();//计算距离
Methods
-
getArea() → {double}
-
获取面的面积
Returns:
单位平方米
-
hide()
-
多边形对象隐藏
-
setStyle(style)
-
设置多边形对象的样式
Parameters:
Name Type Description style
szgeoinfo.style.Style 显示样式
Example
polygon.setStyle(new szgeoinfo.style.Style(fill));
-
show()
-
多边形对象显示