Implement rotate function for circle geometry

This commit is contained in:
Frederic Junod
2019-04-09 16:58:36 +02:00
parent 9883b7d3d9
commit 319a905ec0
2 changed files with 32 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import {createOrUpdate, forEachCorner, intersects} from '../extent.js';
import GeometryType from './GeometryType.js';
import SimpleGeometry from './SimpleGeometry.js';
import {deflateCoordinate} from './flat/deflate.js';
import {rotate} from './flat/transform.js';
/**
* @classdesc
@@ -212,6 +214,18 @@ class Circle extends SimpleGeometry {
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
this.changed();
}
/**
* @inheritDoc
* @api
*/
rotate(angle, anchor) {
const center = this.getCenter();
const stride = this.getStride();
this.setCenter(rotate(center, 0, center.length, stride, angle, anchor, center));
this.changed();
}
}