From a2795d089b95c46f5f51d63b0d130fa1e9ec073c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 15 Oct 2022 13:12:40 -0400 Subject: [PATCH] get/setAngle -> get/setRotation --- docsrc/manual/scripting-capabilities.rst | 8 ++++---- include/ui/mapview.h | 6 +++--- include/ui/overlay.h | 4 ++-- src/scriptapi/apioverlay.cpp | 14 +++++++------- src/ui/overlay.cpp | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docsrc/manual/scripting-capabilities.rst b/docsrc/manual/scripting-capabilities.rst index f5acd7f3..e6608248 100644 --- a/docsrc/manual/scripting-capabilities.rst +++ b/docsrc/manual/scripting-capabilities.rst @@ -1050,21 +1050,21 @@ All overlay functions are callable via the global ``overlay`` object. :param number scale: the scale to set -.. js:function:: overlay.getAngle(layer = 0) +.. js:function:: overlay.getRotation(layer = 0) Gets the angle the specified overlay layer is rotated to. :param number layer: the layer id. Defaults to ``0`` - :returns number: the angle + :returns number: the angle the layer is rotated to -.. js:function:: overlay.setAngle(angle, layer) +.. js:function:: overlay.setRotation(angle, layer) Sets the angle the specified overlay layer is rotated to. :param number angle: the angle to set :param number layer: the layer id -.. js:function:: overlay.setAngle(angle) +.. js:function:: overlay.setRotation(angle) This is an overloaded function. Sets the angle that all active overlay layers are rotated to. Layers that have not been used yet will not have their angle changed. diff --git a/include/ui/mapview.h b/include/ui/mapview.h index 5838c4ae..0d727b2a 100644 --- a/include/ui/mapview.h +++ b/include/ui/mapview.h @@ -50,9 +50,9 @@ public: Q_INVOKABLE void setHorizontalScale(qreal scale); Q_INVOKABLE void setVerticalScale(qreal scale, int layer); Q_INVOKABLE void setVerticalScale(qreal scale); - Q_INVOKABLE int getAngle(int layer = 0); - Q_INVOKABLE void setAngle(int angle, int layer); - Q_INVOKABLE void setAngle(int angle); + Q_INVOKABLE int getRotation(int layer = 0); + Q_INVOKABLE void setRotation(int angle, int layer); + Q_INVOKABLE void setRotation(int angle); Q_INVOKABLE void rotate(int degrees, int layer); Q_INVOKABLE void rotate(int degrees); Q_INVOKABLE void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12, int layer = 0); diff --git a/include/ui/overlay.h b/include/ui/overlay.h index f951360d..60c5f904 100644 --- a/include/ui/overlay.h +++ b/include/ui/overlay.h @@ -93,8 +93,8 @@ public: qreal getVScale(); void setHScale(qreal scale); void setVScale(qreal scale); - int getAngle(); - void setAngle(int angle); + int getRotation(); + void setRotation(int angle); void rotate(int degrees); void setClippingRect(QRectF rect); void clearClippingRect(); diff --git a/src/scriptapi/apioverlay.cpp b/src/scriptapi/apioverlay.cpp index 2c7b55ee..79c5e4aa 100644 --- a/src/scriptapi/apioverlay.cpp +++ b/src/scriptapi/apioverlay.cpp @@ -179,19 +179,19 @@ void MapView::setVerticalScale(qreal scale) { this->scene()->update(); } -int MapView::getAngle(int layer) { - return this->getOverlay(layer)->getAngle(); +int MapView::getRotation(int layer) { + return this->getOverlay(layer)->getRotation(); } -void MapView::setAngle(int angle, int layer) { - this->getOverlay(layer)->setAngle(angle); +void MapView::setRotation(int angle, int layer) { + this->getOverlay(layer)->setRotation(angle); this->scene()->update(); } -// Overload. No layer provided, set angle of all layers -void MapView::setAngle(int angle) { +// Overload. No layer provided, set rotation of all layers +void MapView::setRotation(int angle) { foreach (Overlay * layer, this->overlayMap) - layer->setAngle(angle); + layer->setRotation(angle); this->scene()->update(); } diff --git a/src/ui/overlay.cpp b/src/ui/overlay.cpp index 2713ce2e..5de4ce37 100644 --- a/src/ui/overlay.cpp +++ b/src/ui/overlay.cpp @@ -106,11 +106,11 @@ void Overlay::setVScale(qreal scale) { this->vScale = scale; } -int Overlay::getAngle() { +int Overlay::getRotation() { return this->angle; } -void Overlay::setAngle(int angle) { +void Overlay::setRotation(int angle) { this->angle = angle; this->clampAngle(); } @@ -122,7 +122,7 @@ void Overlay::rotate(int degrees) { void Overlay::clampAngle() { // transform.rotate would handle this already, but we only - // want to report angles 0-359 for Overlay::getAngle + // want to report angles 0-359 for Overlay::getRotation this->angle %= 360; if (this->angle < 0) this->angle += 360;