[Kstars-devel] branches/work/kdeedu_kstars_htm/kstars/kstars

James Bowlin bowlin at mindspring.com
Fri Aug 10 03:00:50 CEST 2007


SVN commit 698387 by jbowlin:

Everything outside the Solar System is now being indexed. 

The Horizon is not indexed but it is not really outside of the Solar
System and it certainly doesn't have fixed (RA, Dec).

Created LabeledListIndex (subclass of NoPrecessIndex) and created two
subclasses: Equator and Ecliptic which lets the equator and the
ecliptic make use of the HTM index.  

I still make 4 candidate label positions: left-most, right-most,
top-most, and bottom-most, but since I am making use of the SkyLabeler
to prevent overlap, I use the same priority for both the ecliptic and
equator:

  right, left, bottom, top

It would be trivial for me to give the ecliptic and the equator
different candidate priorities if that is preferred but I think it is
easier for the user if we try to consistently put those labels on the
same side of the screen. I'm totally open to changing this around if
anyone expresses a preference.  It would be easy to give the users
the option of which side to first try drawing the labels.

I reduced the number of points used to display both the ecliptic and
the equator.  The lines themselves look fine to me but when skewing,
the labels appeared to jump a little.  I then bumped up the number of
points in the equator by a factor of four and its label appears to
move much smoother.  I left the ecliptic as-is so you can compare the
jumpiness of the two.  I have no idea which way is better and am open
to suggestions.  I think the smoothly scrolling label looks better
when skewing.

The classes: EquatorComponent, EclipticComponent, and LineListComponent
are no longer being used but I haven't deleted them yet.

CCMAIL: kstars-devel at kde.org


 M  +3 -2      CMakeLists.txt  
 M  +15 -5     skycomponents/README.indexing  
 A             skycomponents/equator.cpp   skycomponents/ecliptic.cpp#698354 [License: GPL (v2+)]
 A             skycomponents/equator.h   skycomponents/ecliptic.h#698354 [License: GPL (v2+)]
 A             skycomponents/labeledlistindex.cpp   skycomponents/noprecessindex.cpp#697450 [License: GPL (v2+)]
 A             skycomponents/labeledlistindex.h   skycomponents/linelistcomponent.h#698075 [License: GPL (v2+)]
 M  +2 -1      skycomponents/linelist.h  
 M  +11 -0     skycomponents/linelistindex.cpp  
 M  +5 -0      skycomponents/linelistindex.h  
 M  +2 -0      skycomponents/noprecessindex.cpp  
 M  +6 -6      skycomponents/skymapcomposite.cpp  
 M  +15 -15    skycomponents/skymapcomposite.h  


--- branches/work/kdeedu_kstars_htm/kstars/kstars/CMakeLists.txt #698386:698387
@@ -128,6 +128,7 @@
    skycomponents/skymapcomposite.cpp 
    skycomponents/skymesh.cpp
    skycomponents/linelistindex.cpp
+   skycomponents/labeledlistindex.cpp
    skycomponents/noprecessindex.cpp
    skycomponents/skiplistindex.cpp
    skycomponents/polylistindex.cpp
@@ -151,8 +152,8 @@
    skycomponents/constellationlines.cpp 
    skycomponents/constellationnamescomponent.cpp 
    skycomponents/coordinategrid.cpp 
-   skycomponents/eclipticcomponent.cpp 
-   skycomponents/equatorcomponent.cpp 
+   skycomponents/ecliptic.cpp 
+   skycomponents/equator.cpp 
    skycomponents/horizoncomponent.cpp 
    skycomponents/milkyway.cpp 
    skycomponents/skycomponent.cpp 
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/README.indexing #698386:698387
@@ -256,16 +256,19 @@
 
 Class Structure:
 
-Index classes
+Index Classes
 -------------
 
   + LineListIndex
     - ConstellationLines
+    + SkipListIndex
+      - MilkWay
     + NoPrecessIndex
       - CoordinateGrid
       - ConsellationBoundary
-    + SkipListIndex
-      - MilkWay
+      + LabeledListIndex
+	    - Ecliptic
+		- Equator
 
   + PolyListIndex
     - ConstellationBoundaryPoly
@@ -285,7 +288,12 @@
         ||               ||                  ||
      LineList         SkipList            PolyList
 
-NoPrecessIndex uses the plain LineList data container.
+NoPrecessIndex and LabeledListIndex uses the plain LineList data
+container. NoPrecessIndex does not precess the data in the containers
+and LabeledListIndex additionally allows a single label to be added to a
+curved line (equator, ecliptic).  The LabeledListIndex code could easily
+be combined into NoPrecessIndex but I think it is more clear as a
+separate subclass at the expense of almost repeated code.
 
 The LineList/LineListIndex (which we will call LineList[Index] for
 brevity) provide the base for all the other classes.  They can be used
@@ -380,13 +388,15 @@
 
 The End Use Classes
 
-There are currently (as of 2007/07/12) five different end use classes:
+There are currently (as of 2007/08/09) seven different end use classes:
 
     - CoordinateGrid
     - ConstellationLines
     - ConsellationBoundary
     - MilkWay
     - ConstellationBoundaryPoly
+	- Ecliptic
+	- Equator
 
 These classes are typically small and simple, with just an init()
 routine to populate and append a bunch of LineList's (or their
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/linelist.h #698386:698387
@@ -54,7 +54,8 @@
          * (or whatever).
          */
         SkyList* points() { return &pointList; }
-
+        SkyPoint* at( int i ) { return pointList.at( i ); }
+		void append( SkyPoint* p ) { pointList.append( p ); }
     private:
         SkyList pointList;
         
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/linelistindex.cpp #698386:698387
@@ -174,6 +174,13 @@
 }                                      // -jbb
 
 
+// Yet another 2 callbacks.  These are used in LabeledListIndex
+void LineListIndex::updateLabelCandidates( const QPointF& o, LineList* lineList, int i )
+{}
+
+void LineListIndex::updateLabelCandidates( const QPoint& o, LineList* lineList, int i )
+{}
+
 //-----------------------------------------------------------------------------
 // The four^H^H six drawing routines below are very, very similar.  I think any
 // further compactification of the code will move more decisions into the inner
@@ -221,6 +228,7 @@
 
                     if ( isVisible && isVisibleLast ) {
                         psky.drawLine( oLast.x(), oLast.y(), oThis.x(), oThis.y() );
+						updateLabelCandidates( oThis, lineList, i );
                     }
                     else if ( isVisibleLast ) {
                         oMid = map->clipLineI( pLast, pThis, scale );
@@ -282,6 +290,7 @@
 
                     if ( isVisible && isVisibleLast ) {
                         psky.drawLine( oLast, oThis );
+						updateLabelCandidates( oThis, lineList, i );
                     }
                     else if ( isVisibleLast ) {
                         oMid = map->clipLineI( pLast, pThis, scale );
@@ -339,6 +348,7 @@
 
                     if ( isVisible && isVisibleLast ) {
                         psky.drawLine( oLast.x(), oLast.y(), oThis.x(), oThis.y() );
+						updateLabelCandidates( oThis, lineList, i );
                     }
                     else if ( isVisibleLast ) {
                         oMid = map->clipLineI( pLast, pThis, scale );
@@ -396,6 +406,7 @@
 
                     if ( isVisible && isVisibleLast ) {
                         psky.drawLine( oLast, oThis );
+						updateLabelCandidates( oThis, lineList, i );
                     }
                     else if ( isVisibleLast ) {
                         oMid = map->clipLineI( pLast, pThis, scale );
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/linelistindex.h #698386:698387
@@ -129,6 +129,11 @@
          */
         virtual bool skipAt( LineList* lineList, int i );
 
+		
+		virtual void updateLabelCandidates( const QPointF& o, LineList* lineList, int i );
+
+		virtual void updateLabelCandidates( const QPoint& o, LineList* lineList, int i );
+
         /* @short a callback overridden by NoPrecessIndex so it can use the
          * drawing code with the non-reverse-precessed mesh buffer.
          */
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/noprecessindex.cpp #698386:698387
@@ -42,6 +42,7 @@
 
     preDraw( kstars, psky );
    
+	/**
     if ( lastZoom ^ skyMesh()->isZoomedIn() ) {
         lastZoom = skyMesh()->isZoomedIn();
         if ( lastZoom ) 
@@ -49,6 +50,7 @@
         else
             printf("Zoomed out.\n");
     }
+	**/
     
     if ( skyMesh()->isZoomedIn() ) {
         if ( Options::useAntialias() )
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/skymapcomposite.cpp #698386:698387
@@ -34,8 +34,8 @@
 #include "coordinategrid.h"
 #include "customcatalogcomponent.h"
 #include "deepskycomponent.h"
-#include "equatorcomponent.h"
-#include "eclipticcomponent.h"
+#include "equator.h"
+#include "ecliptic.h"
 #include "horizoncomponent.h"
 #include "jupitermoonscomponent.h"
 #include "milkyway.h"
@@ -81,10 +81,10 @@
 	m_CNames = new ConstellationNamesComponent( this );
 	addComponent( m_CNames );
 
-	m_Equator = new EquatorComponent( this );
+	m_Equator = new Equator( this );
 	addComponent( m_Equator );
 
-	m_Ecliptic = new EclipticComponent( this );
+	m_Ecliptic = new Ecliptic( this );
 	addComponent( m_Ecliptic );
 
 	m_Horizon = new HorizonComponent( this );
@@ -133,9 +133,9 @@
 	//5. Constellation names
 	m_CNames->update( data, num );
 	//6. Equator
-	m_Equator->update( data, num );
+	//m_Equator->update( data, num );
 	//7. Ecliptic
-	m_Ecliptic->update( data, num );
+	//m_Ecliptic->update( data, num );
 	//8. Deep sky
 	//m_DeepSky->update( data, num );
 	//9. Custom catalogs
--- branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents/skymapcomposite.h #698386:698387
@@ -36,8 +36,8 @@
 class ConstellationNamesComponent;
 class CoordinateGrid;
 class DeepSkyComponent;
-class EclipticComponent;
-class EquatorComponent;
+class Ecliptic;
+class Equator;
 class HorizonComponent;
 class MilkyWay;
 class SolarSystemComposite;
@@ -188,20 +188,20 @@
 		void progressText( const QString &message );
 
 	private:
-		ConstellationBoundary *m_CBounds;
-		ConstellationBoundaryPoly *m_CBoundsBoundary;
+		ConstellationBoundary       *m_CBounds;
+		ConstellationBoundaryPoly   *m_CBoundsBoundary;
 		ConstellationNamesComponent *m_CNames;
-		ConstellationLines *m_CLines;
-		CoordinateGrid *m_CoordinateGrid;
-		DeepSkyComponent *m_DeepSky;
-		EquatorComponent *m_Equator;
-		EclipticComponent *m_Ecliptic;
-		HorizonComponent *m_Horizon;
-		MilkyWay *m_MilkyWay;
-		SolarSystemComposite *m_SolarSystem;
-		SkyComposite *m_CustomCatalogs;
-		StarComponent *m_Stars;
-		SatelliteComposite *m_Satellites;
+		ConstellationLines          *m_CLines;
+		CoordinateGrid              *m_CoordinateGrid;
+		DeepSkyComponent            *m_DeepSky;
+		Equator                     *m_Equator;
+		Ecliptic                    *m_Ecliptic;
+		HorizonComponent            *m_Horizon;
+		MilkyWay                    *m_MilkyWay;
+		SolarSystemComposite        *m_SolarSystem;
+		SkyComposite                *m_CustomCatalogs;
+		StarComponent               *m_Stars;
+		SatelliteComposite          *m_Satellites;
 
         SkyMesh*                m_skyMesh;
         SkyLabeler*             m_skyLabeler;


More information about the Kstars-devel mailing list