hugin: use command and panoramaChanged() [Re: hugin::Images]

Pablo d'Angelo pablo at mathematik.uni-ulm.de
Thu Jun 12 01:49:57 BST 2003


On Wed, 11 Jun 2003, Kai-Uwe Behrmann wrote:

> Hi Pablo,
> I like to add and erase images as in the dialog and ended with an function
>     void panoramaChanged(PT::Panorama &pano);
>     void panoramaChanged(PT::Panorama &pano, int added);
>     void panoramaChanged(PT::Panorama &pano, int removed[512]);
> in CPEditorPanel:: with it special usefullnes for one of three purposes:
> add, delete and check all.
> I think this is not the best way. I will rename each of the three
> overloaded functions.

A word on how the Panorama class and the GUI are supposed to work
together (also read something about the command and observer patterns):

1. never change the Panorama directly (for example with
   pano->AddImage()). Use the Commands from
   PanoCommand.h to make changes to the panorama.
   If one is missing, feel free to create a new one.

2. execute the command using the GlobalCmdHistory singleton.
   This will ensure proper undo/redo.

3. never change the GUI view of the panorama (listviews, Control point
   display...) directly from the function that issues the command.
   You will not know what needs to be updated. Even if you know
   everything, some other part of the program will issue the command
   and that part will not (and does not want to) know exactly which
   control depend on that change.
   
4. update the GUI inside the panoramaChanged() and
   friends. This way the sender of the command is completely
   relieved from the responsibility of updating the GUI.
   Panorama is resposible for calling these functions, since
   it knows best what changed.

This separation might look like overkill, but it makes everything
flexible and easy to change even if one does not know every dark corner
of the program. Think about adding some scripting etc. The scripting
engine should never know which GUI elements need to be changed when
an image is added.

I'm going to change some of your stuff to make it fit into that scheme.
but I do not have a lot of time right now, so it might be an incomplete
change. But I will leave FIXME notes wherever something needs to be
done.

btw. I thougt about creating a class for every Tab, so that we do
not end up with a monster 200 kB MainFrame.cpp

> What would You suggest to connect next to the gui?

hmm, the lens settings would be interesting, as I have
no idea how a good interface from the should look like.
(sharing lens settings for multiple images and diplaying that to the
user in an intuive way.). The Panorama class should already support
this, but I have never really tried it.

Hmm, maybe there should be a list of images, that shows
wich lens it uses, and a combo box and some fields for that
lens. the combo box can then be used to select the active lens.

With the qt version of hugin I tried to integrate that with the Image
list. A separate window is then used to change the lens settings.

ciao
  Pablo
--
http://wurm.wohnheim.uni-ulm.de/~redman/
Please use PGP


More information about the ptX mailing list