SVN commit 869221 by asimha: + Introducing a StarObject pointer called focusStar in StarComponent that always gets drawn if it is on the screen. + Whenever a search by HD number is made, the resulting "copy" StarObject is put into the draw loop by making focusStar point to it. Although this method is ugly, it works and the requested star doesn't drift away. CCMAIL: kstars-devel@kde.org M +27 -2 starcomponent.cpp M +1 -0 starcomponent.h --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #869220:869221 @@ -42,7 +42,8 @@ #include StarComponent::StarComponent(SkyComponent *parent ) - : ListComponent(parent), m_reindexNum(J2000), m_FaintMagnitude(-5.0), starsLoaded(false) + : ListComponent(parent), m_reindexNum(J2000), m_FaintMagnitude(-5.0), + starsLoaded(false), focusStar(NULL) { m_skyMesh = SkyMesh::Instance(); m_StarBlockFactory = StarBlockFactory::Instance(); @@ -336,6 +337,29 @@ // t_drawNamed += t.restart(); } + // Draw focusStar if not null + if( focusStar ) { + if ( focusStar->updateID != updateID ) + focusStar->JITupdate( data ); + + float mag = focusStar->mag(); + + if ( map->checkVisibility( focusStar ) ) { + QPointF o = map->toScreen( focusStar ); + + if ( map->onScreen( o ) ) { + + float size = ( sizeFactor*( sizeMagLim - mag ) / sizeMagLim ) + 1.; + if ( size <= 1.0 ) size = 1.0; + if( size > maxSize ) size = maxSize; + + focusStar->draw( psky, o.x(), o.y(), size, (starColorMode()==0), + starColorIntensity(), true ); + visibleStarCount++; + } + } + } + // Now draw each of our DeepStarComponents for( int i =0; i < m_DeepStarComponents.size(); ++i ) { m_DeepStarComponents.at( i )->draw( psky ); @@ -553,9 +577,10 @@ m_starObject.init( &stardata ); m_starObject.EquatorialToHorizontal( data()->lst(), data()->geo()->lat() ); m_starObject.JITupdate( data() ); + focusStar = &m_starObject; hdidxReader.closeFile(); // TODO: Lots of trouble since we are returning a copy. Can we fix that? - return &m_starObject; + return focusStar; } return 0; --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.h #869220:869221 @@ -161,6 +161,7 @@ quint16 MSpT; // Maximum number of stars in any given trixel StarObject m_starObject; + StarObject *focusStar; // This object is always drawn KStarsSplash* m_reloadSplash; KStarsSplash* m_reindexSplash; _______________________________________________ Kstars-devel mailing list Kstars-devel@kde.org https://mail.kde.org/mailman/listinfo/kstars-devel