get/setAngle -> get/setRotation
This commit is contained in:
parent
ad01ba0feb
commit
a2795d089b
5 changed files with 19 additions and 19 deletions
|
@ -1050,21 +1050,21 @@ All overlay functions are callable via the global ``overlay`` object.
|
||||||
|
|
||||||
:param number scale: the scale to set
|
: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.
|
Gets the angle the specified overlay layer is rotated to.
|
||||||
|
|
||||||
:param number layer: the layer id. Defaults to ``0``
|
: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.
|
Sets the angle the specified overlay layer is rotated to.
|
||||||
|
|
||||||
:param number angle: the angle to set
|
:param number angle: the angle to set
|
||||||
:param number layer: the layer id
|
: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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ public:
|
||||||
Q_INVOKABLE void setHorizontalScale(qreal scale);
|
Q_INVOKABLE void setHorizontalScale(qreal scale);
|
||||||
Q_INVOKABLE void setVerticalScale(qreal scale, int layer);
|
Q_INVOKABLE void setVerticalScale(qreal scale, int layer);
|
||||||
Q_INVOKABLE void setVerticalScale(qreal scale);
|
Q_INVOKABLE void setVerticalScale(qreal scale);
|
||||||
Q_INVOKABLE int getAngle(int layer = 0);
|
Q_INVOKABLE int getRotation(int layer = 0);
|
||||||
Q_INVOKABLE void setAngle(int angle, int layer);
|
Q_INVOKABLE void setRotation(int angle, int layer);
|
||||||
Q_INVOKABLE void setAngle(int angle);
|
Q_INVOKABLE void setRotation(int angle);
|
||||||
Q_INVOKABLE void rotate(int degrees, int layer);
|
Q_INVOKABLE void rotate(int degrees, int layer);
|
||||||
Q_INVOKABLE void rotate(int degrees);
|
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);
|
Q_INVOKABLE void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12, int layer = 0);
|
||||||
|
|
|
@ -93,8 +93,8 @@ public:
|
||||||
qreal getVScale();
|
qreal getVScale();
|
||||||
void setHScale(qreal scale);
|
void setHScale(qreal scale);
|
||||||
void setVScale(qreal scale);
|
void setVScale(qreal scale);
|
||||||
int getAngle();
|
int getRotation();
|
||||||
void setAngle(int angle);
|
void setRotation(int angle);
|
||||||
void rotate(int degrees);
|
void rotate(int degrees);
|
||||||
void setClippingRect(QRectF rect);
|
void setClippingRect(QRectF rect);
|
||||||
void clearClippingRect();
|
void clearClippingRect();
|
||||||
|
|
|
@ -179,19 +179,19 @@ void MapView::setVerticalScale(qreal scale) {
|
||||||
this->scene()->update();
|
this->scene()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MapView::getAngle(int layer) {
|
int MapView::getRotation(int layer) {
|
||||||
return this->getOverlay(layer)->getAngle();
|
return this->getOverlay(layer)->getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setAngle(int angle, int layer) {
|
void MapView::setRotation(int angle, int layer) {
|
||||||
this->getOverlay(layer)->setAngle(angle);
|
this->getOverlay(layer)->setRotation(angle);
|
||||||
this->scene()->update();
|
this->scene()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload. No layer provided, set angle of all layers
|
// Overload. No layer provided, set rotation of all layers
|
||||||
void MapView::setAngle(int angle) {
|
void MapView::setRotation(int angle) {
|
||||||
foreach (Overlay * layer, this->overlayMap)
|
foreach (Overlay * layer, this->overlayMap)
|
||||||
layer->setAngle(angle);
|
layer->setRotation(angle);
|
||||||
this->scene()->update();
|
this->scene()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,11 +106,11 @@ void Overlay::setVScale(qreal scale) {
|
||||||
this->vScale = scale;
|
this->vScale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Overlay::getAngle() {
|
int Overlay::getRotation() {
|
||||||
return this->angle;
|
return this->angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlay::setAngle(int angle) {
|
void Overlay::setRotation(int angle) {
|
||||||
this->angle = angle;
|
this->angle = angle;
|
||||||
this->clampAngle();
|
this->clampAngle();
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ void Overlay::rotate(int degrees) {
|
||||||
|
|
||||||
void Overlay::clampAngle() {
|
void Overlay::clampAngle() {
|
||||||
// transform.rotate would handle this already, but we only
|
// 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;
|
this->angle %= 360;
|
||||||
if (this->angle < 0)
|
if (this->angle < 0)
|
||||||
this->angle += 360;
|
this->angle += 360;
|
||||||
|
|
Loading…
Reference in a new issue