From kstars-devel Wed Oct 08 13:35:43 2008 From: Akarsh Simha Date: Wed, 08 Oct 2008 13:35:43 +0000 To: kstars-devel Subject: [Kstars-devel] KDE/kdeedu/kstars/kstars/skycomponents Message-Id: <1223472943.591520.30920.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kstars-devel&m=122347295931715 SVN commit 869202 by asimha: Reverting my earlier commit (Revision 869148). What seemed to work does not actually work. This is probably because the StarBlock might get re-used by the LRU Cache while drawing and the star gets overwritten. CCMAIL: kstars-devel@kde.org M +0 -37 deepstarcomponent.cpp M +0 -2 deepstarcomponent.h M +7 -7 starcomponent.cpp --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepstarcomponent.cpp #869201:869202 @@ -409,43 +409,6 @@ return m_CatalogNumber.value( HDnum, NULL ); // TODO: Maybe, make this more general. } -SkyObject *DeepStarComponent::findByData( starData &stardata ) { - Trixel trixel; - StarObject m_starObject; - - m_starObject.init( &stardata ); - // Which trixel is this star in? - trixel = m_skyMesh->indexStar( &m_starObject ); - // Fill the required trixel - m_starBlockList.at( trixel )->fillToMag( m_starObject.mag() ); - for( int i = 0; i < m_starBlockList.at( trixel )->getBlockCount(); ++i ) { - StarBlock *block = m_starBlockList.at( trixel )->block( i ); - for( int j = 0; j < block->getStarCount(); ++j ) { - // int match = 0; - StarObject *star = block->star( j ); - if( !star ) - continue; - if( star->getHDIndex() == m_starObject.getHDIndex() && star->getHDIndex() != 0 ) { - // 100% match - return star; - } - /* - // Unused code - if( star->mag() == m_starObject.mag() ) - ++match; - if( abs( star->ra()->Degrees() - m_starObject.ra()->Degrees() ) < 0.05 ) - ++match; - if( abs( star->dec()->Degrees() - m_starObject.dec()->Degrees() ) < 0.05 ) - ++match; - - */ - } - } - return NULL; -} - - - // This uses the main star index for looking up nearby stars but then // filters out objects with the generic name "star". We could easily // build an index for just the named stars which would make this go --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepstarcomponent.h #869201:869202 @@ -97,8 +97,6 @@ SkyObject* findByHDIndex( int HDnum ); - SkyObject* findByData( starData &stardata ); - SkyObject* objectNearest(SkyPoint *p, double &maxrad ); inline bool fileOpen() { return fileOpened; } --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #869201:869202 @@ -539,23 +539,23 @@ FILE *hdidxFile = hdidxReader.openFile( "Henry-Draper.idx" ); if( !hdidxFile ) return 0; + FILE *dataFile; KDE_fseek( hdidxFile, (HDnum - 1) * 4, SEEK_SET ); fread( &offset, 4, 1, hdidxFile ); - hdidxReader.closeFile(); - if( offset <= 0 ) return 0; - // TODO: Implement byteswapping - FILE *dataFile; dataFile = m_DeepStarComponents.at( 1 )->getStarReader()->getFileHandle(); - KDE_fseek( dataFile, offset, SEEK_SET ); fread( &stardata, sizeof( starData ), 1, dataFile ); // TODO: Implement byteswapping // byteSwap( &stardata ); - - return m_DeepStarComponents.at( 1 )->findByData( stardata ); + m_starObject.init( &stardata ); + m_starObject.EquatorialToHorizontal( data()->lst(), data()->geo()->lat() ); + m_starObject.JITupdate( data() ); + hdidxReader.closeFile(); + // TODO: Lots of trouble since we are returning a copy. Can we fix that? + return &m_starObject; } return 0; _______________________________________________ Kstars-devel mailing list Kstars-devel@kde.org https://mail.kde.org/mailman/listinfo/kstars-devel