MapItemBase visible API
MapItemEllipse::rebuild fix
This commit is contained in:
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
|||||||
cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
||||||
project(QAD)
|
project(QAD)
|
||||||
set(QAD_MAJOR 2)
|
set(QAD_MAJOR 2)
|
||||||
set(QAD_MINOR 29)
|
set(QAD_MINOR 30)
|
||||||
set(QAD_REVISION 0)
|
set(QAD_REVISION 0)
|
||||||
set(QAD_SUFFIX )
|
set(QAD_SUFFIX )
|
||||||
set(QAD_COMPANY SHS)
|
set(QAD_COMPANY SHS)
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ public:
|
|||||||
|
|
||||||
bool isVisible() const { return m_visible; }
|
bool isVisible() const { return m_visible; }
|
||||||
void setVisible(bool newVisible);
|
void setVisible(bool newVisible);
|
||||||
|
bool isHidden() const { return !isVisible(); }
|
||||||
|
void setHidden(bool newHidden) { setVisible(!newHidden); }
|
||||||
|
void show() { setVisible(true); }
|
||||||
|
void hide() { setVisible(false); }
|
||||||
|
|
||||||
double getRotation() const { return m_rotation; }
|
double getRotation() const { return m_rotation; }
|
||||||
void setRotation(double deg);
|
void setRotation(double deg);
|
||||||
|
|||||||
@@ -58,18 +58,19 @@ void MapItemEllipse::draw(QPainter * p) {
|
|||||||
void MapItemEllipse::rebuild() {
|
void MapItemEllipse::rebuild() {
|
||||||
pol.clear();
|
pol.clear();
|
||||||
QPointF c = rct.center();
|
QPointF c = rct.center();
|
||||||
bool full = sa == ea;
|
double starta = sa, enda = ea;
|
||||||
|
bool full = qFuzzyCompare(starta, enda);
|
||||||
if (!full) pol << c;
|
if (!full) pol << c;
|
||||||
double w = rct.width() / 2., h = rct.height() / 2.;
|
double w = rct.width() / 2., h = rct.height() / 2.;
|
||||||
static double deg2rad = M_PI / 180.;
|
static double deg2rad = M_PI / 180.;
|
||||||
if (full) {
|
if (full) {
|
||||||
sa = 0.;
|
starta = 0.;
|
||||||
ea = 360.;
|
enda = 360.;
|
||||||
} else {
|
} else {
|
||||||
if (ea < sa) qSwap(sa, ea);
|
if (enda < starta) qSwap(starta, enda);
|
||||||
}
|
}
|
||||||
for (double a = sa; a <= ea; a += 3.) {
|
for (double a = starta; a <= enda; a += 3.) {
|
||||||
if (a > ea) a = ea;
|
if (a > enda) a = enda;
|
||||||
QPointF p(sin(a * deg2rad) * w, cos(a * deg2rad) * h);
|
QPointF p(sin(a * deg2rad) * w, cos(a * deg2rad) * h);
|
||||||
pol << (c + p);
|
pol << (c + p);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user