From: Chris Laurel <claurel@ww...> - 2003-06-25 22:21:07
I modified the Selection class so that it has just a single pointer and a
type field. Quite a number of files in src/celengine and src/celestia
were changed as a result. I modified both the Windows and KDE versions,
but haven't had time to touch the Mac, Gtk, or GLUT code, so there may
still be compilation errors lurking there.
Where you once wrote selection.body or selection.star, you'll now need to
call the accessor functions selection.star(), selection.body(), etc. If
the selection is not of the correct type, the accessor functions will
return NULL. I suppose that I could overload the cast operators so you
could write (Star*) selection instead of selection.star(). It would make
the selection class feel more like a common base class, but personally I
don't feel that the C++ casting syntax has that much to recommend it.
The type of a selection can be queried with the new getType() method.
Switching on getType() should be favored over if/else tests of the various
accessor functions. I've tried to rewrite code like this:
if (sel.body() != NULL)
else if (sel.star() != NULL)
to look like this:
I'm going to revisit most of this code to see if more of the
type-switching stuff really belongs inside of the selection class.
On Wednesday, June 25, 2003, at 04:05 PM, Chris Laurel wrote:
> I modified the Selection class so that it has just a single pointer
> and a
> type field. Quite a number of files in src/celengine and src/celestia
> were changed as a result. I modified both the Windows and KDE
> but haven't had time to touch the Mac, Gtk, or GLUT code, so there may
> still be compilation errors lurking there.
I've made the (very minor) changes required in the Mac OS X code.
Get latest updates about Open Source Projects, Conferences and News.