Appearance
KBE3D / KBCore / turf / transformRotate
函数: transformRotate()
transformRotate<
T>(geojson:T,angle:number,options?: {pivot?:Coord;mutate?:boolean; }):T
Function
Rotates any geojson Feature or Geometry of a specified angle, around its centroid or a given pivot point.
类型参数
T
T extends GeometryCollection<Geometry> | GeoJSON
参数
geojson
T
object to be rotated
angle
number
of rotation in decimal degrees, positive clockwise
options?
Optional parameters
pivot?
point around which the rotation will be performed
mutate?
boolean
allows GeoJSON input to be mutated (significant performance increase if true)
返回
T
the rotated GeoJSON feature
示例
ts
const poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
const options = {pivot: [0, 25]};
const rotatedPoly = turf.transformRotate(poly, 10, options);
//addToMap
const addToMap = [poly, rotatedPoly];
rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};