Revision b0d111e...

Go back to digest for 16th June 2013

Other in Educational

Henry de Valence committed changes in [kstars/hdevalence-gsoc2013] /:

Move the coordinate conversion functions out of SkyPoint.

This commit is rather more monstrous than anticipated, since in
order to do this, we have to touch every part of the KStars code that
uses the conversion functions of SkyPoint. This illustrates just
how screwed up this class is.

The main problem that the SkyPoint has is that it's really three
points bundled together into one, with no synchronization between the
coordinates. The three coordinates (catalog, equatorial, horizontal)
are supposed to represent the same point in some cases, but not in others.
We can't just add synchronization, for example, because it would break
all of the things that rely on being able to update things independently.
But not having synchronization causes all kinds of position bugs, and
makes the code incredibly difficult to reason about as well.

I suspect that there are, amongst the various parts of the codebase,
incompatible expectations about how the class should behave (i.e., there
is no correct behaviour).

The other problem with the SkyPoint, of course, is that it confuses the
relationship between "has a coordinate" and "is a coordinate". This may
be related to the problems above.

When we reimplement the functions now in the KSEngine::Old* namespaces,
we will not repeat these mistakes. I intend to keep the coordinates to
just a POD quaternion, with one type for each system, and have all of the
functions be *functions*, not methods, whose output depends only on their
input and are side-effect free. This also means that we can actually
unit test them, since they will both a) have "correct" behaviour
and b) not require the entire rest of KStars to be running to operate.

File Changes

Added 2 files
  • /engine
  •   kstars/oldconversions.cpp
  •   kstars/oldconversions.h
Modified 55 files
  •   kstars/CMakeLists.txt
  •   kstars/kstarsactions.cpp
  •   kstars/kstarsdata.cpp
  •   kstars/kstarsdcop.cpp
  •   kstars/kstarsinit.cpp
  •   kstars/main.cpp
  •   kstars/skyglpainter.cpp
  •   kstars/skymap.cpp
  •   kstars/skymapdrawabstract.cpp
  •   kstars/skymapevents.cpp
  •   kstars/skyqpainter.cpp
  •   kstars/dialogs/focusdialog.cpp
  •   kstars/engine/oldpointfunctions.cpp
  •   kstars/oal/execute.cpp
  •   kstars/projections/equirectangularprojector.cpp
  •   kstars/projections/projector.cpp
  •   kstars/skycomponents/catalogcomponent.cpp
  •   kstars/skycomponents/constellationboundarylines.cpp
  •   kstars/skycomponents/constellationnamescomponent.cpp
  •   kstars/skycomponents/deepskycomponent.cpp
  •   kstars/skycomponents/deepstarcomponent.cpp
  •   kstars/skycomponents/ecliptic.cpp
  •   kstars/skycomponents/equator.cpp
  •   kstars/skycomponents/equatorialcoordinategrid.cpp
  •   kstars/skycomponents/horizoncomponent.cpp
  •   kstars/skycomponents/horizontalcoordinategrid.cpp
  •   kstars/skycomponents/linelistindex.cpp
  •   kstars/skycomponents/listcomponent.cpp
  •   kstars/skycomponents/noprecessindex.cpp
  •   kstars/skycomponents/pointlistcomponent.cpp
  •   kstars/skycomponents/skymesh.cpp
  •   kstars/skycomponents/solarsystemcomposite.cpp
  •   kstars/skycomponents/solarsystemlistcomponent.cpp
  •   kstars/skycomponents/solarsystemsinglecomponent.cpp
  •   kstars/skycomponents/starcomponent.cpp
  •   kstars/skycomponents/supernovaecomponent.cpp
  •   kstars/skyobjects/ksplanetbase.cpp
  •   kstars/skyobjects/planetmoons.cpp
  •   kstars/skyobjects/satellite.cpp
  •   kstars/skyobjects/skyline.cpp
  •   kstars/skyobjects/skyobject.cpp
  •   kstars/skyobjects/skypoint.cpp
  •   kstars/skyobjects/skypoint.h
  •   kstars/skyobjects/starobject.cpp
  •   kstars/skyobjects/trailobject.cpp
  •   kstars/tools/altvstime.cpp
  •   kstars/tools/modcalcaltaz.cpp
  •   kstars/tools/modcalceclipticcoords.cpp
  •   kstars/tools/modcalcgalcoord.cpp
  •   kstars/tools/modcalcplanets.cpp
  •   kstars/tools/observinglist.cpp
  •   kstars/tools/obslistwizard.cpp
  •   kstars/tools/wutdialog.cpp
  •   kstars/tools/whatsinteresting/obsconditions.cpp
  •   kstars/tools/whatsinteresting/skyobjitem.cpp
57 files changed in total