[Kstars-devel] SkyComponents: SkyObject or SkyPoint ?

Jason Harris kstars at 30doradus.org
Tue Oct 25 03:01:45 CEST 2005


Hello,

As a reminder, the various SkyComponents are going to inherit from either 
ListComponent or SingleComponent, depending on whether they contain a single 
object (e.g., SunComponent), or a list of objects (e.g., CometsComponent).

However, there's really a third class of SkyComponent: those which contain a 
list of *SkyPoints*, not SkyObjects (e.g., EquatorComponent).

Do we want to have three of these base-classes (SingleComponent, 
ListComponent, and PointListComponent), or keep the two base-class layout?  
The latter choice will require that we use a QList<SkyPoint*> to store the 
list of objects/points, and rely on recasting when we need to retrieve an 
actual SkyObject from skyComponents() (reminder: SkyObject inherits 
SkyPoint).  

From a code-cleanliness and maintenance standpoint, I'd rather not have to 
recast as SkyObject* every time we retrieve something from skyComponents().
Also, many internal operations will require SkyObject recasting in the 
internal methods of the SkyComponent classes.  From this perspective, I'd 
rather add a PointsListComponent base class to be used specifically for those 
components that contain points, not objects.

In addition, I think it would make sense to add a PointsComposite child of 
SkyComposite that manages these points-components.  This would be similar to 
SolarSystemComposite: a container that contains components that need to be 
handled a bit differently.  This would allow SkyComposite to easily skip over 
these components when it needs to deal with SkyObjects (e.g., 
SkyComposite::objectNamed(QString) ).

Any opinions?  

Summary of proposed hierarchy:

SkyComposite:
- StarComponent [ListComponent]
- DeepSkyComponent [ListComponent]
+ SolarSystemComposite
  - SunComponent [SingleComponent]
  - MoonComponent [SingleComponent]
  - PlanetComponent (one each for Merc, Ven, Mar, Jup, Sat, Ura, Nep) 
    [SingleComponent]
  - PlutoComponent [SingleComponent]
  - AsteroidsComponent [ListComponent]
  - CometsComponent [ListComponent]
+ PointsComposite 
  - EquatorComponent [PointListComponent]
  - HorizonComponent [PointListComponent]
  - EclipticComponent [PointListComponent]
  - MilkyWayComponent [PointListComponent]
  - ConstellationLinesComponent [PointListComponent]
  - ConstellationNamesComponent [PointListComponent]
  - ConstellationBoundaryComponent [PointListComponent]
  - CoordinateGridComponent [PointListComponent]

-- 
-------------------------------
KStars: KDE Desktop Planetarium
http://edu.kde.org/kstars


More information about the Kstars-devel mailing list