[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Mon Jul 14 02:11:10 CEST 2008


SVN commit 832057 by asimha:

+ General code quality improvements: Fixing a few compiler warnings

+ Added missing code in StarComponent::draw()

CCMAIL: kstars-devel at kde.org



 M  +1 -1      binfilehelper.cpp  
 M  +5 -6      binfilehelper.h  
 M  +1 -2      finddialog.cpp  
 M  +0 -2      fovdialog.cpp  
 M  +2 -2      skycomponents/customcatalogcomponent.cpp  
 M  +3 -3      skycomponents/highpmstarlist.cpp  
 M  +4 -5      skycomponents/starblocklist.cpp  
 M  +9 -18     skycomponents/starcomponent.cpp  
 M  +1 -1      tools/conjunctions.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/binfilehelper.cpp #832056:832057
@@ -183,7 +183,7 @@
     return false;
 }
 
-bool BinFileHelper::closeFile() {
+void BinFileHelper::closeFile() {
     fclose(fileHandle);
     fileHandle = NULL;
 }
--- trunk/KDE/kdeedu/kstars/kstars/binfilehelper.h #832056:832057
@@ -83,10 +83,9 @@
 
     /**
      *@short  Close the binary data file
-     *@return true if successful, false if no file was opened
      */
 
-    bool closeFile();
+    void closeFile();
 
     /**
      *@short   Get error number
@@ -139,13 +138,13 @@
      *@param  id  ID of the index entry
      *@return The number of records under index that index ID, or 0 if the index has not been read
      */
-    inline long getRecordCount(int id) { return (indexUpdated ? indexCount.at( id ) : 0); }
+    inline unsigned int getRecordCount(int id) { return (indexUpdated ? indexCount.at( id ) : 0); }
 
     /**
      *@short  Returns the total number of records in the file
      *@return The number of records in the file, or 0 if the index has not been read
      */
-    inline long getRecordCount() { return (indexUpdated ? recordCount : 0); }
+    inline unsigned long getRecordCount() { return (indexUpdated ? recordCount : 0); }
 
     /**
      *@short  Should we do byte swapping?
@@ -246,7 +245,7 @@
 
     FILE *fileHandle;                     // Handle to the file.
     QVector<unsigned long> indexOffset;   // Stores offsets corresponding to each index table entry
-    QVector<int> indexCount;              // Stores number of records under each index table entry
+    QVector<unsigned int> indexCount;     // Stores number of records under each index table entry
     bool indexUpdated;                    // True if the data from the index, and associated properties have been updated
     bool FDUpdated;                       // True if the data from the Field Descriptor, and associated properties have been updated
     bool RSUpdated;                       // True if the recordSize parameter is set correctly, either manually or bye reading the FD
@@ -261,7 +260,7 @@
     long itableOffset;                    // Stores the offset position of the first index table entry
     long dataOffset;                      // Stores the offset position of the start of data
     QString errorMessage;                 // Stores the most recent 'unread' error message
-    unsigned int recordCount;             // Stores the total number of records in the file
+    unsigned long recordCount;            // Stores the total number of records in the file
 };
 
 #endif
--- trunk/KDE/kdeedu/kstars/kstars/finddialog.cpp #832056:832057
@@ -252,8 +252,7 @@
     QRegExp re;
     QString searchtext = ui->SearchBox->text();
 
-    // NOTE: The following function has been DEPRECATED. What should I use instead?
-    re.setCaseSensitive( false ); 
+    re.setCaseSensitivity( Qt::CaseInsensitive ); 
 
     // If it is an NGC/IC/M catalog number, as in "M 76" or "NGC 5139", check for absence of the space
     re.setPattern("^(m|ngc|ic)\\s*\\d*$");
--- trunk/KDE/kdeedu/kstars/kstars/fovdialog.cpp #832056:832057
@@ -222,8 +222,6 @@
 }
 
 void NewFOV::slotComputeFOV() {
-    KStars *ks = (KStars*)(parent()->parent());
-
     if ( sender() == ui->ComputeEyeFOV && ui->TLength1->value() > 0.0 )
         ui->FOVEdit->setText( KGlobal::locale()->formatNumber( ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value() ) );
     else if ( sender() == ui->ComputeCameraFOV && ui->TLength2->value() > 0.0 )
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/customcatalogcomponent.cpp #832056:832057
@@ -142,8 +142,8 @@
     if ( ! visible() ) return;
 
     SkyMap *map = SkyMap::Instance();
-    float Width  = map->scale() * map->width();
-    float Height = map->scale() * map->height();
+    //    float Width  = map->scale() * map->width();
+    //    float Height = map->scale() * map->height();
 
     psky.setBrush( Qt::NoBrush );
     psky.setPen( QColor( m_catColor ) );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/highpmstarlist.cpp #832056:832057
@@ -47,7 +47,7 @@
 {
     if ( pm < m_threshold ) return false;
 
-    if( trixel >= m_skyMesh->size() || trixel < 0 )
+    if( trixel >= m_skyMesh->size() )
         kDebug() << "### Trixel ID out of range for the Mesh currently in use!" << trixel;
 
     m_stars.append( new HighPMStar( trixel, star ) );
@@ -82,7 +82,7 @@
         StarObject* star = HPStar->star;
 
         // out with the old ...
-        if( HPStar->trixel < 0 || HPStar->trixel >= m_skyMesh->size() ) {
+        if( HPStar->trixel >= m_skyMesh->size() ) {
             kDebug() << "### Expect an Index out-of-range error. star->trixel =" << HPStar->trixel;
         }
             
@@ -94,7 +94,7 @@
 
         // in with the new ...
         HPStar->trixel = trixel;
-        if( trixel < 0 || trixel >= m_skyMesh->size() )
+        if( trixel >= m_skyMesh->size() )
             kDebug() << "### Expect an Index out-of-range error. trixel =" << trixel;
                 
         StarList *list = starIndex->at( trixel );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starblocklist.cpp #832056:832057
@@ -97,8 +97,7 @@
     if( readOffset <= 0 )
         readOffset = dSReader->getOffset( trixelId );
 
-    if( nBlocks != blocks.size() )
-        kDebug() << "nBlocks =" << nBlocks << "and blocks.size() =" << blocks.size() << "!!!!!!!!!!!!!!!!!!!!!!!!";
+    Q_ASSERT( nBlocks == blocks.size() );
 
     fseek( dataFile, readOffset, SEEK_SET );
     
@@ -113,7 +112,7 @@
             StarBlock *newBlock;
             newBlock = SBFactory->getBlock();
             if( !newBlock ) {
-                kDebug() << "ERROR: Could not get a new block from StarBlockFactory::getBlock() in trixel " 
+                kWarning() << "ERROR: Could not get a new block from StarBlockFactory::getBlock() in trixel " 
                          << trixel << ", while trying to create block #" << nBlocks + 1 << endl;
                 return false;
             }
@@ -121,7 +120,7 @@
             blocks[nBlocks]->parent = this;
             
             if( !SBFactory->markNext( blocks[nBlocks - 1], blocks[nBlocks] ) )
-                kDebug() << "ERROR: markNext() failed on block #" << nBlocks + 1 << "in trixel" << trixel;
+                kWarning() << "ERROR: markNext() failed on block #" << nBlocks + 1 << "in trixel" << trixel;
             
             ++nBlocks;
         }
@@ -132,7 +131,7 @@
         star.init( &stardata );
         blocks[nBlocks - 1]->addStar( &star );
         if( faintMag > -5.0 && fabs(faintMag - blocks[nBlocks - 1]->getFaintMag()) > 0.2 ) {
-            kDebug() << "WARNING: Encountered a jump from mag" << faintMag << "to mag"
+            kDebug() << "Encountered a jump from mag" << faintMag << "to mag"
                      << blocks[nBlocks - 1]->getFaintMag() << "in trixel" << trixel;
         }
         faintMag = blocks[nBlocks - 1]->getFaintMag();
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #832056:832057
@@ -107,19 +107,6 @@
 
     loadShallowStarData();
 
-    //adjust maglimit for ZoomLevel
-    //    float maglim = Options::magLimitDrawStar();
-    double lgmin = log10(MINZOOM);
-    double lgmax = log10(MAXZOOM);
-    double lgz = log10(Options::zoomFactor());
-    /*
-    if ( lgz <= 0.75*lgmax )
-        maglim -= (Options::magLimitDrawStar() -
-                   Options::magLimitDrawStarZoomOut() ) *
-                  (0.75*lgmax - lgz)/(0.75*lgmax - lgmin);
-
-    m_zoomMagLimit = maglim;
-    */
     StarObject::initImages();
 }
 
@@ -326,6 +313,7 @@
 
             float size = ( sizeFactor*( sizeMagLim - mag ) / sizeMagLim ) + 1.;
             if ( size <= 1.0 ) size = 1.0;
+            if( size > maxSize ) size = maxSize;
 
             curStar->draw( psky, o.x(), o.y(), size, (starColorMode()==0),
                            starColorIntensity(), true );
@@ -376,8 +364,11 @@
                 QPointF o = map->toScreen( curStar );
 
                 if ( ! map->onScreen( o ) ) continue;
+                
                 float size = ( sizeFactor*( sizeMagLim - mag ) / sizeMagLim ) + 1.;
-                if ( size <= 0. ) continue;
+                if ( size <= 1.0 ) size = 1.0;
+                if( size > maxSize ) size = maxSize;
+
                 curStar->draw( psky, o.x(), o.y(), size, (starColorMode()==0),
                                starColorIntensity(), true );
                 visibleStarCount++;
@@ -754,11 +745,11 @@
     printf( "Number of visible stars (named + unnamed)    = %8ld\n", visibleStarCount );
     printf( "Magnitude of the faintest star in memory     = %8.2f\n", faintMag );
     printf( "Target magnitude limit                       = %8.2f\n", magLim );
-    printf( "Size of each StarBlock                       = %8ld bytes\n", sizeof( StarBlock ) );
-    printf( "Size of each StarObject                      = %8ld bytes\n", sizeof( StarObject ) );
+    printf( "Size of each StarBlock                       = %8d bytes\n", sizeof( StarBlock ) );
+    printf( "Size of each StarObject                      = %8d bytes\n", sizeof( StarObject ) );
     printf( "Memory use due to visible unnamed stars      = %8.2f MB\n", ( sizeof( StarObject ) * nStars / 1048576.0 ) );
-    printf( "Memory use due to visible StarBlocks         = %8ld bytes\n", sizeof( StarBlock ) * nBlocks );
-    printf( "Memory use due to StarBlocks in SBF          = %8ld bytes\n", sizeof( StarBlock ) * m_StarBlockFactory.getBlockCount() );
+    printf( "Memory use due to visible StarBlocks         = %8d bytes\n", sizeof( StarBlock ) * nBlocks );
+    printf( "Memory use due to StarBlocks in SBF          = %8d bytes\n", sizeof( StarBlock ) * m_StarBlockFactory.getBlockCount() );
     printf( "=============== STAR DRAW LOOP TIMING INFORMATION ==============\n" );
     printf( "Time taken for drawing named stars           = %8ld ms\n", t_drawNamed );
     printf( "Time taken for dynamic load of data          = %8ld ms\n", t_dynamicLoad );
--- trunk/KDE/kdeedu/kstars/kstars/tools/conjunctions.cpp #832056:832057
@@ -210,7 +210,7 @@
 
   for(it = conjunctionlist.begin(); it != conjunctionlist.end(); ++it) {
     dt.setDJD( it.key() );
-    OutputView -> addItem( i18n("Conjunction on %1 UT: Separation is %2", dt.toString("%a, %d %b %Y %H:%M"), it.data().toDMSString()) );
+    OutputView -> addItem( i18n("Conjunction on %1 UT: Separation is %2", dt.toString("%a, %d %b %Y %H:%M"), it.value().toDMSString()) );
     outputJDList.insert( i, it.key() );
     ++i;
   }


More information about the Kstars-devel mailing list