[Kstars-devel] branches/kstars/summer/kdeedu/kstars/kstars/skycomponents
Akarsh Simha
akarshsimha at gmail.com
Wed Jul 9 02:38:45 CEST 2008
SVN commit 829749 by asimha:
Making the deep star catalog optional.
CCMAIL: kstars-devel at kde.org
M +32 -28 starcomponent.cpp
M +3 -1 starcomponent.h
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #829748:829749
@@ -71,11 +71,11 @@
if( !deepStarReader.getFileHandle() ) {
deepStarReader.openFile( "deepstars.dat" );
-
+ deepStars = false;
if( !deepStarReader.getFileHandle() )
- kDebug() << "WARNING: Failed to open deep star catalog!!" << endl;
+ kDebug() << "WARNING: Failed to open deep star catalog!! Disabling it!" << endl;
else if( !deepStarReader.readHeader() )
- kDebug() << "WARNING: Header read error for deep star catalog!!" << endl;
+ kDebug() << "WARNING: Header read error for deep star catalog!! Disabling it!" << endl;
else {
qint16 faintmag;
quint8 htm_level;
@@ -85,6 +85,7 @@
if( htm_level != m_skyMesh->level() )
kDebug() << "WARNING: Trixel level in program != that in file. EXPECT TROUBLE!" << endl;
fread( &MSpT, 2, 1, deepStarReader.getFileHandle() );
+ deepStars = true;
}
}
@@ -268,31 +269,33 @@
if( sizeMagLim > m_FaintMagnitude * ( 1 - 1.5/16 ) )
sizeMagLim = m_FaintMagnitude * ( 1 - 1.5/16 );
- if( veryFrugalMem )
+ if( deepStars && veryFrugalMem )
m_StarBlockFactory.freeAll();
- while( region.hasNext() ) {
- Trixel currentRegion = region.next();
- for( int i = 1; i < m_starBlockList[ currentRegion ]->getBlockCount(); ++i ) {
- StarBlock *prevBlock = m_starBlockList[ currentRegion ]->block( i - 1 );
- StarBlock *block = m_starBlockList[ currentRegion ]->block( i );
+ if( deepStars ) {
+ while( region.hasNext() ) {
+ Trixel currentRegion = region.next();
+ for( int i = 1; i < m_starBlockList[ currentRegion ]->getBlockCount(); ++i ) {
+ StarBlock *prevBlock = m_starBlockList[ currentRegion ]->block( i - 1 );
+ StarBlock *block = m_starBlockList[ currentRegion ]->block( i );
+
+ if( i == 1 )
+ if( !m_StarBlockFactory.markFirst( block ) )
+ kDebug() << "markFirst failed in trixel" << currentRegion;
+ if( i > 1 )
+ if( !m_StarBlockFactory.markNext( prevBlock, block ) )
+ kDebug() << "markNext failed in trixel" << currentRegion << "while marking block" << i;
+ if( i + 1 < m_starBlockList[ currentRegion ]->getBlockCount()
+ && m_starBlockList[ currentRegion ]->block( i + 1 )->getFaintMag() < maglim )
+ break;
+ }
+ }
- if( i == 1 )
- if( !m_StarBlockFactory.markFirst( block ) )
- kDebug() << "markFirst failed in trixel" << currentRegion;
- if( i > 1 )
- if( !m_StarBlockFactory.markNext( prevBlock, block ) )
- kDebug() << "markNext failed in trixel" << currentRegion << "while marking block" << i;
- if( i + 1 < m_starBlockList[ currentRegion ]->getBlockCount()
- && m_starBlockList[ currentRegion ]->block( i + 1 )->getFaintMag() < maglim )
- break;
- }
+ t_updateCache = t.restart();
+
+ region.reset();
}
- t_updateCache = t.restart();
-
- region.reset();
-
while ( region.hasNext() ) {
++nTrixels;
Trixel currentRegion = region.next();
@@ -336,7 +339,7 @@
// NOTE: We are guessing that the last 1.5/16 magnitudes in the catalog are just additions and the star catalog
// is actually supposed to reach out continuously enough only to mag m_FaintMagnitude * ( 1 - 1.5/16 )
// TODO: Is there a better way? We may have to change the magnitude tolerance if the catalog changes
- if( !m_starBlockList[ currentRegion ]->fillToMag( maglim ) && maglim <= m_FaintMagnitude * ( 1 - 1.5/16 ) ) {
+ if( deepStars && !m_starBlockList[ currentRegion ]->fillToMag( maglim ) && maglim <= m_FaintMagnitude * ( 1 - 1.5/16 ) ) {
kDebug() << "SBL::fillToMag( " << maglim << " ) failed for trixel "
<< currentRegion << " !"<< endl;
}
@@ -383,7 +386,7 @@
t_drawUnnamed += t.restart();
}
- if( frugalMem )
+ if( deepStars && frugalMem )
m_StarBlockFactory.freeUnused();
@@ -454,7 +457,6 @@
kDebug() << "Error reading starnames.dat header : " << nameReader.getErrorNumber() << " : " << nameReader.getError() << endl;
return;
}
-
fseek(nameFile, nameReader.getDataOffset(), SEEK_SET);
swapBytes = dataReader.getByteSwap();
@@ -469,14 +471,16 @@
qint16 faintmag;
quint8 htm_level;
quint16 t_MSpT;
+
fread( &faintmag, 2, 1, dataFile );
fread( &htm_level, 1, 1, dataFile );
fread( &t_MSpT, 2, 1, dataFile ); // Unused
+
if( faintmag / 100.0 > m_FaintMagnitude )
m_FaintMagnitude = faintmag / 100.0;
- if( htm_level != m_skyMesh->level() ) {
+
+ if( htm_level != m_skyMesh->level() )
kDebug() << "WARNING: HTM Level in shallow star data file and HTM Level in m_skyMesh do not match. EXPECT TROUBLE" << endl;
- }
for(int i = 0; i < m_skyMesh -> size(); ++i) {
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.h #829748:829749
@@ -166,12 +166,14 @@
bool m_hideLabels;
KStarsData* m_Data;
+ float m_zoomMagLimit;
+
float m_FaintMagnitude; // Limiting magnitude of the catalog currently loaded
bool starsLoaded;
- float m_zoomMagLimit;
float magLim; // Current limiting magnitude for visible stars
unsigned long visibleStarCount;
quint16 MSpT; // Maximum number of stars in any given trixel
+ bool deepStars; // Indicates whether deepstars are loaded
KStarsSplash* m_reloadSplash;
KStarsSplash* m_reindexSplash;
More information about the Kstars-devel
mailing list