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
|
||||
project(QAD)
|
||||
set(QAD_MAJOR 2)
|
||||
set(QAD_MINOR 29)
|
||||
set(QAD_MINOR 30)
|
||||
set(QAD_REVISION 0)
|
||||
set(QAD_SUFFIX )
|
||||
set(QAD_COMPANY SHS)
|
||||
|
||||
@@ -44,6 +44,10 @@ public:
|
||||
|
||||
bool isVisible() const { return m_visible; }
|
||||
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; }
|
||||
void setRotation(double deg);
|
||||
|
||||
@@ -57,19 +57,20 @@ void MapItemEllipse::draw(QPainter * p) {
|
||||
|
||||
void MapItemEllipse::rebuild() {
|
||||
pol.clear();
|
||||
QPointF c = rct.center();
|
||||
bool full = sa == ea;
|
||||
QPointF c = rct.center();
|
||||
double starta = sa, enda = ea;
|
||||
bool full = qFuzzyCompare(starta, enda);
|
||||
if (!full) pol << c;
|
||||
double w = rct.width() / 2., h = rct.height() / 2.;
|
||||
static double deg2rad = M_PI / 180.;
|
||||
if (full) {
|
||||
sa = 0.;
|
||||
ea = 360.;
|
||||
starta = 0.;
|
||||
enda = 360.;
|
||||
} else {
|
||||
if (ea < sa) qSwap(sa, ea);
|
||||
if (enda < starta) qSwap(starta, enda);
|
||||
}
|
||||
for (double a = sa; a <= ea; a += 3.) {
|
||||
if (a > ea) a = ea;
|
||||
for (double a = starta; a <= enda; a += 3.) {
|
||||
if (a > enda) a = enda;
|
||||
QPointF p(sin(a * deg2rad) * w, cos(a * deg2rad) * h);
|
||||
pol << (c + p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user