[Kstars-devel] KDE/kdeedu/kstars/kstars
James Bowlin
bowlin at mindspring.com
Wed Aug 15 23:43:42 CEST 2007
SVN commit 700573 by jbowlin:
Experimental: Am now drawing a filled rectangle the color of the sky
background behind transient star labels. I'm not doing it for non-stars
ATM so you can compare and contrast the two different ways. If the object
is surrounded by empty space, there is no visual difference. I noticed
the biggest difference when the object was in the Milky Way because then
you see the rectangle clearly.
It would be easy and fast to first check to see if the transient label
would overlap an existing label and then only draw the background
rectangle in the case of an overlap. PLMK if you would like to see
this. It would be very easy to implement. IMO it is best to always
draw the rectangle and thus ensure the transient label is always
legible.
Also cleaned up SkyMap::drawTransientLabel() a little bit.
BTW: I don't know why the asteroid transient labels don't exactly
overlap the normal labels.
CCMAIL: kstars-devel at kde.org
M +6 -8 skymapdraw.cpp
M +7 -7 starobject.cpp
--- trunk/KDE/kdeedu/kstars/kstars/skymapdraw.cpp #700572:700573
@@ -357,15 +357,13 @@
}
void SkyMap::drawTransientLabel( QPainter &p ) {
- if ( transientObject() ) {
- p.setPen( TransientColor );
+ if ( ! transientObject() || ! checkVisibility( transientObject() ) ) return;
- if ( checkVisibility( transientObject() ) ) {
- QPointF o = toScreen( transientObject() );
- if ( o.x() >= 0. && o.x() <= width() && o.y() >= 0. && o.y() <= height() )
- transientObject()->drawNameLabel( p, o.x(), o.y(), 1.0 );
- }
- }
+ QPointF o = toScreen( transientObject() );
+ if ( ! onScreen( o ) ) return;
+
+ p.setPen( TransientColor );
+ transientObject()->drawNameLabel( p, o.x(), o.y(), 1.0 );
}
void SkyMap::drawBoxes( QPainter &p ) {
--- trunk/KDE/kdeedu/kstars/kstars/starobject.cpp #700572:700573
@@ -395,10 +395,11 @@
QString sName = customLabel( Options::showStarNames(), Options::showStarMagnitudes() );
float offset = scale * (6. + 0.5*( 5.0 - mag() ) + 0.01*( zoom/500. ) );
- //QFontMetricsF fm = SkyLabeler::Instance()->fontMetrics();
- //qreal width = fm.width( sName );
- //qreal height = fm.height();
- //psky.fillRect( x+offset, y+offset - height * 0.8 , width, height, QBrush("darkBlue") );
+ QFontMetricsF fm = SkyLabeler::Instance()->fontMetrics();
+ qreal width = fm.width( sName );
+ qreal height = fm.height();
+ QColor color( KStarsData::Instance()->colorScheme()->colorNamed( "SkyColor" ) );
+ psky.fillRect( QRectF( x+offset, y+offset - height * 0.7, width, height ), QBrush( color ) );
if ( Options::useAntialias() )
psky.drawText( QPointF( x+offset, y+offset ), sName );
@@ -408,8 +409,7 @@
void StarObject::drawNameLabel( QPainter &psky, double x, double y, double scale ) {
//set the zoom-dependent font
- QFont stdFont( psky.font() );
- SkyLabeler::SetZoomFont( psky );
+ SkyLabeler::Instance()->resetFont( psky );
drawLabel( psky, x, y, Options::zoomFactor(), scale );
- psky.setFont( stdFont );
+ SkyLabeler::Instance()->useStdFont( psky );
}
More information about the Kstars-devel
mailing list