Class: FMCalculator

FMCalculator

计算类, 属于fengmap.map.min.js

Methods

staticfengmap.FMCalculator.area(polygon){number}

面积

Name Type Description
polygon Array

多边形顶点数组

Name Type Description
point Array

多边形顶点

Name Type Description
x Object

多边形顶点x坐标

y Object

多边形顶点y坐标

Returns:
Type Description
number 面积
Example
fengmap.FMCalculator.area([{x:12619620,y:2621864},{x:12619623,y:2621866},{x:12619633,y:2621868}])

staticfengmap.FMCalculator.bound(polygon){Object}

计算界限

Name Type Description
polygon Array
Name Type Description
point Object

多边形顶点

Name Type Description
x Object

多边形顶点x坐标

y Object

多边形顶点y坐标

Returns:
Name Type Description
bound Object 界限
Name Type Description
max Object 最大坐标
Name Type Description
x Object 最大x坐标
y Object 最大y坐标
min Object 最小坐标
Name Type Description
x Object 最小x坐标
y Object 最小y坐标
center Object 中心坐标
Name Type Description
x Object 中心x坐标
y Object 中心y坐标
size Object 尺寸
Name Type Description
x Object x方向尺寸
y Object y方向尺寸

staticfengmap.FMCalculator.circleBuilder(radius, center, segments){Array}

生成圆形

Name Type Description
radius number

圆形半径

center Object

圆形中心点坐标

Name Type Description
x number

圆形中心点x坐标

y number

圆形中心点y坐标

segments int

圆形边的段数

Returns:
Type Description
Array 圆形

staticfengmap.FMCalculator.distance(start, end){number}

计算两点间距离

Name Type Description
start Object

起点

Name Type Description
x number
y number
end Object

终点

Name Type Description
x number
y number
Returns:
Type Description
number 两点间距离

staticfengmap.FMCalculator.fanBuilder(radius, center, segments, angles){Array}

生成扇形

Name Type Description
radius number

扇形半径

center Object

扇形中心点坐标

Name Type Description
x number

扇形中心点x坐标

y number

扇形中心点y坐标

segments int

扇形边的段数

angles Array

扇形角度范围 [0]-最小值 [1]-最大值

Returns:
Type Description
Array 扇形

staticfengmap.FMCalculator.isContain(polygon, point){boolean}

计算多边形是否包含点

Name Type Description
polygon Array

多边形顶点数组

Name Type Description
point Object

多边形顶点

Name Type Description
x Object

多边形顶点x坐标

y Object

多边形顶点y坐标

point Object

Name Type Description
x Object

点x坐标

y Object

点y坐标

Returns:
Type Description
boolean true:包含;false:不包含
Example
fengmap.FMCalculator.isContain([{x:12619620,y:2621865},{x:12619622,y:2621865},{x:12619621,y:2621866}], { x:12619620,y:2621864 })

staticfengmap.FMCalculator.latlngToMapCoordinate(latlng){Object}

经纬度坐标转地图坐标

Name Type Description
latlng Object

经纬度坐标

Returns:
Type Description
Object 地图坐标
Example
FMCalculator.latlngToMapCoordinate({x:100,y:12})

staticfengmap.FMCalculator.mapCoordinateToLatlng(map){Object}

地图坐标转经纬度坐标

Name Type Description
map Object

地图坐标

Returns:
Type Description
Object 经纬度坐标
Example
fengmap.FMCalculator.mapCoordinateToLatlng({x:12619620,y:2621864})

staticfengmap.FMCalculator.rectangleBuilder(w, h, center){Array}

生成矩形

Name Type Description
w number

矩形宽度

h number

矩形高度

center Object

矩形中心点坐标

Name Type Description
x number

矩形中心点x坐标

y number

矩形中心点y坐标

Returns:
Type Description
Array 矩形