[Kstars-devel] KDE/kdeedu/kstars/kstars/skycomponents
James Bowlin
bowlin at mindspring.com
Thu Aug 16 01:25:41 CEST 2007
SVN commit 700596 by jbowlin:
Fixed objectNearest() so only objects that have been drawn will get a
transient label. Had to account for the mag limit for stars and
asteroids. If a transient label appears (away for the edges of the
skymap) for an object that wasn't drawn, it is a bug and should be
reported.
Also, no longer update objects that are of types that aren't drawn.
Fixed a bug where I was updating stars with both JITupdate and
the standard update routine. I made an empty StarComponent::update()
so only the JITupdate's should be performed now.
CCMAIL: kstars-devel at kde.org
M +25 -5 asteroidscomponent.cpp
M +5 -0 asteroidscomponent.h
M +2 -0 constellationnamescomponent.cpp
M +3 -0 deepskycomponent.cpp
M +7 -5 listcomponent.cpp
M +5 -5 pointlistcomponent.cpp
M +3 -0 skycomposite.cpp
M +10 -14 skymapcomposite.cpp
M +9 -3 starcomponent.cpp
M +3 -0 starcomponent.h
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.cpp #700595:700596
@@ -101,7 +101,8 @@
if ( ! selected() ) return;
SkyMap *map = ks->map();
- bool hideLabels = ! Options::showAsteroidNames() || (map->isSlewing() && Options::hideLabels() );
+ bool hideLabels = ! Options::showAsteroidNames() ||
+ ( map->isSlewing() && Options::hideLabels() );
double lgmin = log10(MINZOOM);
double lgmax = log10(MAXZOOM);
@@ -111,6 +112,8 @@
if ( labelMagLimit > 10.0 ) labelMagLimit = 10.0;
//printf("labelMagLim = %.1f\n", labelMagLimit );
+ float sizeFactor = scale * dms::PI * Options::zoomFactor()/10800.0;
+
psky.setBrush( QBrush( QColor( "gray" ) ) );
foreach ( SkyObject *o, objectList() ) {
@@ -122,10 +125,10 @@
QPointF o = map->toScreen( ast, scale );
if ( ! map->onScreen( o ) ) continue;
- float size = ast->angSize() * scale * dms::PI * Options::zoomFactor()/10800.0;
- if ( size < 1 ) size = 1.;
- float x1 = o.x() - 0.5*size;
- float y1 = o.y() - 0.5*size;
+ float size = ast->angSize() * sizeFactor;
+ if ( size < 1.0 ) size = 1.0;
+ float x1 = o.x() - 0.5 * size;
+ float y1 = o.y() - 0.5 * size;
if ( Options::useAntialias() )
psky.drawEllipse( QRectF( x1, y1, size, size ) );
@@ -137,4 +140,21 @@
}
}
+SkyObject* AsteroidsComponent::objectNearest( SkyPoint *p, double &maxrad ) {
+ SkyObject *oBest = 0;
+ if ( ! selected() ) return 0;
+
+ foreach ( SkyObject *o, objectList() ) {
+ if ( o->mag() > Options::magLimitAsteroid() ) continue;
+
+ double r = o->angularDistanceTo( p ).Degrees();
+ if ( r < maxrad ) {
+ oBest = o;
+ maxrad = r;
+ }
+ }
+
+ return oBest;
+}
+
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.h #700595:700596
@@ -86,6 +86,11 @@
void update( KStarsData *data, KSNumbers *num );
+ /* @short we need to overide objectNearest to bail on asteroids dimmer
+ * than the draw threshold.
+ */
+ SkyObject* objectNearest( SkyPoint *p, double &maxrad );
+
private:
AsterIndex m_asterIndex;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationnamescomponent.cpp #700595:700596
@@ -85,6 +85,8 @@
// Don't precess the location of the names
void ConstellationNamesComponent::update( KStarsData *data, KSNumbers *num )
{
+ if ( ! selected() ) return;
+
for ( int i = 0; i < objectList().size(); i++ ) {
objectList().at( i )->EquatorialToHorizontal( data->lst(),
data->geo()->lat() );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepskycomponent.cpp #700595:700596
@@ -379,6 +379,9 @@
// "other" catalog = 0.4
// Messier object = 0.25
SkyObject* DeepSkyComponent::objectNearest( SkyPoint *p, double &maxrad ) {
+
+ if ( ! selected() ) return 0;
+
SkyObject *oTry = 0;
SkyObject *oBest = 0;
double rTry = maxrad;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/listcomponent.cpp #700595:700596
@@ -51,11 +51,11 @@
void ListComponent::update( KStarsData *data, KSNumbers *num )
{
- if ( visible() ) {
- foreach ( SkyObject *o, objectList() ) {
- if ( num ) o->updateCoords( num );
- o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
- }
+ if ( ! selected() ) return;
+
+ foreach ( SkyObject *o, objectList() ) {
+ if ( num ) o->updateCoords( num );
+ o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
}
@@ -71,6 +71,8 @@
SkyObject* ListComponent::objectNearest( SkyPoint *p, double &maxrad ) {
SkyObject *oBest = 0;
+ if ( ! selected() ) return 0;
+
foreach ( SkyObject *o, objectList() ) {
double r = o->angularDistanceTo( p ).Degrees();
if ( r < maxrad ) {
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/pointlistcomponent.cpp #700595:700596
@@ -32,10 +32,10 @@
void PointListComponent::update( KStarsData *data, KSNumbers *num )
{
- if ( visible() ) {
- foreach ( SkyPoint *p, pointList() ) {
- if ( num ) p->updateCoords( num );
- p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
- }
+ if ( ! selected() ) return;
+
+ foreach ( SkyPoint *p, pointList() ) {
+ if ( num ) p->updateCoords( num );
+ p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skycomposite.cpp #700595:700596
@@ -88,6 +88,9 @@
}
SkyObject* SkyComposite::objectNearest( SkyPoint *p, double &maxrad ) {
+
+ if ( ! selected() ) return 0;
+
SkyObject *oTry = 0;
SkyObject *oBest = 0;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #700595:700596
@@ -306,21 +306,17 @@
m_skyMesh->aperture( p, maxrad + 1.0, OBJ_NEAREST_BUF);
//kDebug() << QString("Nearest trixels: %1\n").arg( m_skyMesh->intersectSize());
- if ( Options::showStars() ) {
- oBest = m_Stars->objectNearest( p, rBest );
- //reduce rBest by 0.75 for stars brighter than 4th mag
- if ( oBest && oBest->mag() < 4.0 ) rBest *= 0.75;
- }
+ oBest = m_Stars->objectNearest( p, rBest );
+ //reduce rBest by 0.75 for stars brighter than 4th mag
+ if ( oBest && oBest->mag() < 4.0 ) rBest *= 0.75;
- if ( Options::showDeepSky() ) {
- //m_DeepSky internally discriminates among deepsky catalogs
- //and renormalizes rTry
- oTry = m_DeepSky->objectNearest( p, rTry );
- if ( rTry < rBest ) {
- rBest = rTry;
- oBest = oTry;
- }
- }
+ //m_DeepSky internally discriminates among deepsky catalogs
+ //and renormalizes rTry
+ oTry = m_DeepSky->objectNearest( p, rTry );
+ if ( rTry < rBest ) {
+ rBest = rTry;
+ oBest = oTry;
+ }
rTry = maxrad;
oTry = m_CustomCatalogs->objectNearest( p, rTry );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #700595:700596
@@ -50,6 +50,7 @@
m_reindexInterval = StarObject::reindexInterval( 304.0 );
lastFilePos = 0;
+ m_zoomMagLimit = 0.0;
}
StarComponent::~StarComponent()
@@ -60,6 +61,9 @@
return Options::showStars();
}
+void StarComponent::update( KStarsData *data, KSNumbers *num )
+{}
+
// We use the update hook to re-index all the stars when the date has changed by
// more than 150 years.
@@ -138,7 +142,7 @@
//shortcuts to inform whether to draw different objects
bool hideFaintStars( checkSlewing && Options::hideStars() );
- double maglim = Options::magLimitDrawStar();
+ float maglim = Options::magLimitDrawStar();
if ( ! hideFaintStars && ( m_FaintMagnitude < maglim ) ) { // -jbb
setFaintMagnitude( maglim );
@@ -154,6 +158,8 @@
Options::magLimitDrawStarZoomOut() ) *
(0.75*lgmax - lgz)/(0.75*lgmax - lgmin);
+ m_zoomMagLimit = maglim;
+
float sizeFactor = 6.0 + (lgz - lgmin);
double labelMagLim = Options::magLimitDrawStarInfo();
@@ -391,8 +397,8 @@
StarList* starList = m_starIndex->at( region.next() );
for (int i=0; i < starList->size(); ++i) {
StarObject* star = starList->at( i );
- //if ( star->name() == i18n("star") ) continue; // prevents "star" popups --jbb
- //kDebug() << QString("found: %1\n").arg(star->name());
+ if ( star->mag() > m_zoomMagLimit ) continue;
+
double r = star->angularDistanceTo( p ).Degrees();
if ( r < maxrad ) {
oBest = star;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.h #700595:700596
@@ -54,6 +54,8 @@
virtual ~StarComponent();
+ void update( KStarsData *data, KSNumbers *num );
+
void reindex( KSNumbers *num );
virtual void draw(KStars *ks, QPainter& psky, double scale);
@@ -149,6 +151,7 @@
KStarsData *m_Data;
float m_FaintMagnitude;
+ float m_zoomMagLimit;
int m_ColorMode, m_ColorIntensity;
};
More information about the Kstars-devel
mailing list