szgeoinfo.Polyline

Class: szgeoinfo.Polyline


new Polyline(points, style)

线对象,仅在二维模式中

Parameters:
Name Type Description
points array

点对象数组

style szgeoinfo.style.Style

显示样式

Example
var ps=[];
ps.push(new szgeoinfo.Point(114.0900388 ,22.54558073));
ps.push(new szgeoinfo.Point(114.0906407 ,22.54578336));

var fill=new szgeoinfo.style.Fill("rgba(253,206,4,1)");//填充颜色
var stroke=new szgeoinfo.style.Stroke("rgba(253,206,4,1)",8);//边框颜色宽度
var style=new szgeoinfo.style.Style(fill,stroke);
var polyline=new szgeoinfo.Polyline(ps,style);
map.addMarker(polyline);

polyline.hide();//隐藏

var distance = polyline.getDistance();//计算折线的距离

Methods


getDistance() → {double}

获取线长度

Returns:

单位米


hide()

线对象隐藏


setStyle(style)

设置线对象的Style

Parameters:
Name Type Description
style szgeoinfo.style.Style

显示样式

Example
var stroke=new szgeoinfo.style.Stroke("#fff",8);
var style=new szgeoinfo.style.Style('',stroke);
polyline.setStyle(style);

show()

线对象显示