[Kstars-devel] Need help with the angular ruler

Akarsh Simha akarshsimha at gmail.com
Sat Jan 8 09:59:50 CET 2011


Hi

TL;DR -- skip to 3rd heading.

Another regression in 4.6:
--------------------------

I just discovered another regression caused by my recent changes
(i.e. separation of SkyMap) and this involves the angular ruler. The
angular ruler does not redraw when the mouse is moved, but instead
updates only when the SkyMap is redrawn. So if you are at 1 sec time
step (default), the angular ruler takes an entire second to move to
your mouse location. Of course, the functionality should remain
unaffected (sorry; haven't tested that in trunk) -- it's a draw cycle
thing.

1. We need a short term fix for this, to go into KDE 4.6. (Any
   volunteers to do this?)

2. We need a long term fix for this and a bigger problem. (The subject
   of this thread.)

Some generic context:
---------------------

Now, I'm also adding a feature that lets you find star-hop routes
between two points in the sky. So for instance, if you are planning to
go from Gamma Comae Berenices to NGC 4565, it will find you a route
with bright stars as landmarks (or should we say skymarks) within 1
FOV.

Both these features -- computing angular distance and starhopping --
require two points as an input, and that's what the Angular Ruler
does. So I want to generalize the angular ruler for that.

What I want to do:
------------------

Now, the angular ruler is tightly tied to SkyMap. (c.f. methods
SkyMap::updateAngularRuler(), SkyMapDrawAbstract::drawAngularRuler(),
SkyMap::slotBeginAngularDistance() etc)

I don't like this, because I feel that the angular ruler would be
better separated from SkyMap. I tried the following approach -- make
the angular ruler a QWidget, so it draws itself and handles
itself. I've not been very successful, because in my design the SkyMap
still handles mouse clicks, and so there's some event handling crap --
mouse events are captured by the ruler.

Now one of the solutions to this is to make the angular ruler
modal. So we send a disable to the SkyMap the moment Angular Mode
starts (where should this be handled? SkyMap or AngRuler?) and do all
the stuff in angruler, and emit a signal once the angular ruler is
done, and whatever subscribes to that signal does all the computations
and displays the results.

I have a number of software-development questions that I don't know
how to answer:

0. Should everything be handled by SkyMap and we don't bother forking?

1. Should AngRuler be a QWidget?

2. Should we do the computations (distance / star-hop route) within
   the AngRuler class? If so, which class will read the result and
   display it? How?

3. Should AngRuler be a base class with two subclasses --
   DistanceRuler and StarHopRuler?

4. Should angular ruler be a small QWidget that stretches the length
   of the ruler, or a sky-map-sized QWidget that "captures" an image
   of the sky map from behind it, repaints it, and draws a ruler over
   that?

I'm right now tending in favor of making the angular ruler a modal
QWidget, that just handles:

1. drawing the ruler,

2. determining the end point (it's supplied with the start point. or
   may be we should just find the screen-point and the conversion into
   a SkyPoint should be done in SkyMap, because it requires to find
   the objectNearest)

3. handling the moving mouse -- updating itself.

Also, 

1. freeze the skymap (but not time if we are running at x1, otherwise
   time too)

2. make the ruler modal.

I invite suggestions on this matter.

Regards
Akarsh


More information about the Kstars-devel mailing list