summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-17 02:03:04 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-17 02:03:04 (GMT)
commitd7c9f8dae0772d118b4980db4536315262bd3b14 (patch)
tree0cc922b463e12e1373e17e323649006950092389
parent99ee92c70ed4d6a35976dcde249be5879f5d3ccf (diff)
Draw objects of unknown type as a circle with a "?" symbol
This is better than not drawing objects of unknown type at all! FIXME: I'm only introducing this in the QPainter backend. I believe that we should deprecate the GL Backends since they are unmaintained.
-rw-r--r--kstars/skyqpainter.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/kstars/skyqpainter.cpp b/kstars/skyqpainter.cpp
index 707ac12..a4aaaea 100644
--- a/kstars/skyqpainter.cpp
+++ b/kstars/skyqpainter.cpp
@@ -762,7 +762,36 @@ color = pen().color().name();
}
setBrush( tempBrush );
break;
+ default: // Unknown object or something we don't know how to draw. Just draw an ellipse with a ?-mark
+ color = pen().color().name();
+ if ( size <1. && zoom > 20*MINZOOM ) size = 3.; //force ellipse above zoomFactor 20
+ if ( size <1. && zoom > 5*MINZOOM ) size = 1.; //force points above zoomFactor 5
+ if ( size>2. ) {
+ save();
+ QFont f = font();
+ const QString qMark = " ? ";
+ double scaleFactor = 0.8 * size / fontMetrics().width( qMark );
+ f.setPointSizeF( f.pointSizeF() * scaleFactor );
+ setFont( f );
+ translate( x, y );
+ rotate( positionAngle ); //rotate the coordinate system
+
+ if ( Options::useAntialias() ) {
+ drawEllipse( QRectF(dx1, dy1, size, e*size) );
+ drawText( QRectF(dx1, dy1, size, e*size), Qt::AlignCenter, qMark );
+ } else {
+ int idx1 = int(dx1); int idy1 = int(dy1);
+ drawEllipse( QRect(idx1, idy1, isize, int(e*size)) );
+ drawText( QRectF(idx1, idy1, isize, int(e*size)), Qt::AlignCenter, qMark );
+ }
+
+ restore(); //reset coordinate system (and font?)
+
+ } else if ( size>0. ) {
+ drawPoint( QPointF(x, y) );
+ }
}
+
}
void SkyQPainter::drawObservingList(const QList< SkyObject* >& obs)