* @function Label.prototype.rotationBounds * @description 旋转 bounds。 * @param {Bounds} bounds - 要旋转的 bounds。 * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性 x(横坐标),属性 y(纵坐标)。 * @param {number} angle - 旋转角度(顺时针)。 * @returns {Array. } bounds 旋转后形成的多边形节点数组。是一个四边形,形
(bounds, rotationCenterPoi, angle)
| 731 | * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。 |
| 732 | */ |
| 733 | rotationBounds(bounds, rotationCenterPoi, angle) { |
| 734 | var ltPoi = new Point([bounds.left, bounds.top]); |
| 735 | var rtPoi = new Point([bounds.right, bounds.top]); |
| 736 | var rbPoi = new Point([bounds.right, bounds.bottom]); |
| 737 | var lbPoi = new Point([bounds.left, bounds.bottom]); |
| 738 | |
| 739 | var ver = []; |
| 740 | ver.push(this.getRotatedLocation(ltPoi.getCoordinates()[0], ltPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle)); |
| 741 | ver.push(this.getRotatedLocation(rtPoi.getCoordinates()[0], rtPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle)); |
| 742 | ver.push(this.getRotatedLocation(rbPoi.getCoordinates()[0], rbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle)); |
| 743 | ver.push(this.getRotatedLocation(lbPoi.getCoordinates()[0], lbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle)); |
| 744 | |
| 745 | //bounds旋转后形成的多边形节点数组 |
| 746 | var quad = []; |
| 747 | |
| 748 | for (var i = 0; i < ver.length; i++) { |
| 749 | quad.push({ |
| 750 | "x": ver[i].x, |
| 751 | "y": ver[i].y |
| 752 | }); |
| 753 | } |
| 754 | quad.push({ |
| 755 | "x": ver[0].x, |
| 756 | "y": ver[0].y |
| 757 | }); |
| 758 | return quad; |
| 759 | } |
| 760 | |
| 761 | /** |
| 762 | * @function Label.prototype.getRotatedLocation |
no test coverage detected