CMS 3D CMS Logo

IgSpareWindow Class Reference

Implements a generic 3DBaseWindow modeled after IgRPhiWindow. More...

#include <Iguana/GLBrowsers/interface/IgSpareWindow.h>

Inheritance diagram for IgSpareWindow:

Ig3DBaseWindow IgView IgBrowser

List of all members.

Public Member Functions

virtual void focusIn (void)
virtual void focusOut (void)
 IgSpareWindow (IgPage *page)
virtual void initCategories (void)
virtual void initMenu (void)
virtual void initToolBar (void)
 ~IgSpareWindow (void)

Static Public Attributes

static const int MENU_SPARE_MANIP = 118

Private Slots

void showLights (void)
void showSpareViewProperties (void)

Private Member Functions

void repMenu (IgQtObjectMenuMessage message)

Private Attributes

Ig3DLightsCategorym_lightsCategory
IgSpareViewPropertiesCategorym_spareViewPropertiesCategory


Detailed Description

Implements a generic 3DBaseWindow modeled after IgRPhiWindow.

This is intended to be used for specialist displays that need the utility of a IgRPhiWindow, but which would interfere with its normal use.

Definition at line 32 of file IgSpareWindow.h.


Constructor & Destructor Documentation

IgSpareWindow::IgSpareWindow ( IgPage page  ) 

Definition at line 46 of file IgSpareWindow.cc.

References IgModelManager::add(), DBSPlugin::get(), IgQtSiteStack::hostWithName(), initCategories(), initMenu(), initToolBar(), IgDocumentDataManager::lookup(), IgModelManager::lookup(), IgView::setTitle(), Ig3DBaseWindow::show(), IgPage::state(), Ig3DBaseWindow::state(), t, Ig3DBaseWindow::watchBrowser(), and IgPage::workspace().

00047     : Ig3DBaseWindow (page),
00048       m_spareViewPropertiesCategory (0),
00049       m_lightsCategory (0)
00050 {   
00051     static int lastWindowNumber = 0;    
00052     IgSpareModel *spareModel = 0;
00053     IgModelManager *manager = IgModelManager::get (page->state ());
00054     if (!manager)
00055         manager = new IgModelManager (page->state ());
00056     manager->lookup (&spareModel);
00057     if (!spareModel)
00058     {
00059       IgDocumentDataManager* dm = IgDocumentDataManager::get(page->state ());
00060       spareModel = new  IgSpareModel (dm->lookup(0));
00061       manager->add (dm->lookup(0), spareModel);
00062     }
00063     
00064     QString t = "Spare Window #" + QString::number (lastWindowNumber++);
00065     IgView::setTitle (t.ascii ());   
00066     
00067     watchBrowser (new IgSpareBrowser (state (), 
00068                                    page->workspace ()->hostWithName (t), 
00069                                    spareModel));
00070 
00071     initCategories ();
00072     initMenu ();
00073     initToolBar ();    
00074 
00075     show ();
00076 }

IgSpareWindow::~IgSpareWindow ( void   ) 

Definition at line 78 of file IgSpareWindow.cc.

00079 {
00080 }


Member Function Documentation

void IgSpareWindow::focusIn ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 140 of file IgSpareWindow.cc.

References ASSERT, lat::CreateCallback(), Ig3DBaseWindow::focusIn(), DBSPlugin::get(), repMenu(), and Ig3DBaseWindow::state().

00141 {
00142     Ig3DBaseWindow::focusIn ();
00143     
00144     ASSERT (IgQtObjectMenuService::get (state ()));
00145     IgQtObjectMenuService::get (state ())
00146         ->add (lat::CreateCallback (this, &IgSpareWindow::repMenu));
00147 }

void IgSpareWindow::focusOut ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 150 of file IgSpareWindow.cc.

References ASSERT, lat::CreateCallback(), Ig3DBaseWindow::focusOut(), DBSPlugin::get(), repMenu(), and Ig3DBaseWindow::state().

00151 {
00152     Ig3DBaseWindow::focusOut ();
00153 
00154     ASSERT (IgQtObjectMenuService::get (state ()));
00155     IgQtObjectMenuService::get (state ())
00156         ->remove (lat::CreateCallback (this, &IgSpareWindow::repMenu));
00157 }

void IgSpareWindow::initCategories ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 83 of file IgSpareWindow.cc.

References Ig3DBaseWindow::browser(), DBSPlugin::get(), Ig3DBaseWindow::initCategories(), m_lightsCategory, m_spareViewPropertiesCategory, IgView::page(), IgSpareViewPropertiesCategory::registerBrowser(), Ig3DLightsCategory::registerBrowser(), and Ig3DBaseWindow::state().

Referenced by IgSpareWindow().

00084 {
00085     Ig3DBaseWindow::initCategories ();
00086     
00087     //Create a Lights Category and add it in control centre
00088     m_lightsCategory = Ig3DLightsCategory::get (page ()->state ());
00089     if (!m_lightsCategory)
00090     {
00091         m_lightsCategory = new Ig3DLightsCategory (page ()->state ());
00092     }    
00093     m_lightsCategory->registerBrowser (state (), browser ());
00094 
00095     // Create a Spare Window Properties Category and add it in control
00096     // centre
00097     m_spareViewPropertiesCategory = IgSpareViewPropertiesCategory::get (page ()->state ());
00098     
00099     if (!m_spareViewPropertiesCategory)
00100     {
00101         m_spareViewPropertiesCategory = new IgSpareViewPropertiesCategory (
00102             page ()->state (),
00103             dynamic_cast <IgSpareBrowser *> (browser ()));
00104     }
00105 
00106     m_spareViewPropertiesCategory->registerBrowser (state (),
00107           dynamic_cast <IgSpareBrowser *> (browser ()));    
00108 }

void IgSpareWindow::initMenu ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 111 of file IgSpareWindow.cc.

References ASSERT, DBSPlugin::get(), IgQtAppMenuService::index(), Ig3DBaseWindow::initMenu(), IgQtAppMenuService::isIdThere(), Ig3DBaseBrowser::MENU_ID_3D, Ig3DBaseBrowser::MENU_ID_3D_LIGHTS, Ig3DBaseBrowser::MENU_ID_3D_SPARE_VIEW_PROPERTIES, Ig3DBaseBrowser::MENU_ID_3D_Z_SLICE, showLights(), showSpareViewProperties(), and Ig3DBaseWindow::state().

Referenced by IgSpareWindow().

00112 {
00113     Ig3DBaseWindow::initMenu ();    
00114 
00115     ASSERT (IgQtAppMenuService::get (state ()));
00116     
00117     // Get the menu as it has already been initialised in the
00118     // baseClass.
00119     QPopupMenu *menu = IgQtAppMenuService::get (state ())->subMenu
00120                        (Ig3DBaseBrowser::MENU_ID_3D);
00121 
00122     // Submenus
00123     if (IgQtAppMenuService::isIdThere (menu, Ig3DBaseBrowser::MENU_ID_3D_SPARE_VIEW_PROPERTIES) == -1)
00124     {
00125         menu->insertItem
00126             ("Spare View properties...", this, SLOT (showSpareViewProperties ()), 0,
00127              Ig3DBaseBrowser::MENU_ID_3D_SPARE_VIEW_PROPERTIES, IgQtAppMenuService::index
00128              (menu, Ig3DBaseBrowser::MENU_ID_3D_SPARE_VIEW_PROPERTIES));
00129     }
00130     if (IgQtAppMenuService::isIdThere (menu, Ig3DBaseBrowser::MENU_ID_3D_Z_SLICE) == -1)
00131     {
00132         menu->insertItem
00133             ("&Lights...", this, SLOT (showLights ()), 0,
00134              Ig3DBaseBrowser::MENU_ID_3D_LIGHTS, IgQtAppMenuService::index
00135              (menu, Ig3DBaseBrowser::MENU_ID_3D_LIGHTS));
00136     }    
00137 }

void IgSpareWindow::initToolBar ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 180 of file IgSpareWindow.cc.

References reco::fitHelper::add(), IgQtAppContextService::addOnFocusIn(), IgQtAppContextService::addOnFocusOut(), ASSERT, Ig3DBaseWindow::browser(), lat::CreateCallback(), feedbackButtonCallback(), DBSPlugin::get(), gridButtonCallback(), IgImageIDs::IMAGE_ID_GRID, IgImageIDs::IMAGE_ID_YX_SMALL_COL, Ig3DBaseWindow::initToolBar(), IgQtAppImageService::pixmapById(), qtSetOff(), Ig3DBaseWindow::state(), Ig3DBaseWindow::TOOLBAR_ID_3D2D, Ig3DBaseWindow::TOOLBAR_ID_3D2D_GRID, Ig3DBaseWindow::TOOLBAR_ID_3D2D_SHOW_AXIS, and IgQtAppToolBarService::toolBarButton().

Referenced by IgSpareWindow().

00181 {
00182     Ig3DBaseWindow::initToolBar ();    
00183 
00184     // This creates a toolbar with the general widgets.
00185     IgQtAppToolBarService *toolBarService = IgQtAppToolBarService::get (state ());
00186     IgQtAppImageService *is = IgQtAppImageService::get (state ());
00187     IgQtAppContextService *cs = IgQtAppContextService::get (state ());
00188     
00189     ASSERT (is);
00190 
00191     QToolButton *button = 0;
00192 
00193     button = toolBarService->toolBarButton (state (),
00194                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D,
00195                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D_GRID, 
00196                                             *is->pixmapById (IgImageIDs::IMAGE_ID_GRID),
00197                                             "Show/Hide Grid",
00198                                             browser (),
00199                                             SLOT (setGridVisibility (bool)),
00200                                             SIGNAL (toggled (bool)));
00201     button->setToggleButton (true); 
00202     QWhatsThis::add (button, "Enable/disable the grid ont he scene graph.");
00203     cs->addOnFocusIn (lat::CreateCallback (&gridButtonCallback, 
00204                                            browser (),
00205                                            button));
00206     cs->addOnFocusOut (lat::CreateCallback (&qtSetOff,
00207                                             button));    
00208 
00209     button = toolBarService->toolBarButton (state (),
00210                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D,
00211                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D_SHOW_AXIS,
00212                                             *is->pixmapById (IgImageIDs::IMAGE_ID_YX_SMALL_COL), 
00213                                             "Show Axis",
00214                                             browser (),
00215                                             SLOT (setFeedbackVisibility (bool)),
00216                                             SIGNAL (toggled (bool)));
00217     button->setToggleButton (true);    
00218     QWhatsThis::add (button, "Show/Hide the axis on the 3D scene.");
00219     cs->addOnFocusIn (lat::CreateCallback (&feedbackButtonCallback, 
00220                                            browser (), 
00221                                            button));    
00222     cs->addOnFocusOut (lat::CreateCallback (&qtSetOff,
00223                                             button));
00224 }

void IgSpareWindow::repMenu ( IgQtObjectMenuMessage  message  )  [private]

Definition at line 242 of file IgSpareWindow.cc.

References IgQtObjectMenu::insertFromDefs(), IgRepSet::lookup(), IgQtObjectMenuMessage::menu(), Ig3DBaseBrowser::MENU_3D_OPS, Ig3DBaseWindow::model(), IgQtObjectMenuMessage::object(), and IgQtObjectMenu::removeFromDefs().

Referenced by focusIn(), and focusOut().

00243 {
00244     static const IgQtObjectMenu::ItemDef defs [] = {
00245         { -1, Ig3DBaseBrowser::MENU_3D_OPS, 0, 0, -1 }
00246     };
00247     static const int    ndefs = sizeof (defs) / sizeof (defs [0]);
00248 
00249     IgRepresentable     *object = message.object ();
00250 
00251     IgRep *m_menuRep = dynamic_cast<IgRep *>
00252                 (IgRepSet::lookup (object, model (), false));
00253 
00254     // An irrelevant object or already added item, remove our items.
00255     message.menu ()->removeFromDefs (defs, ndefs);
00256     if (m_menuRep)
00257         // Add our items if they aren't there yet.
00258         message.menu ()->insertFromDefs (this, defs, ndefs);
00259 }

void IgSpareWindow::showLights ( void   )  [private, slot]

Definition at line 234 of file IgSpareWindow.cc.

References Ig3DBaseWindow::centre(), m_lightsCategory, IgControlCentre::selectCategory(), and IgControlCentre::show().

Referenced by initMenu().

00235 {
00236     centre ()->selectCategory (m_lightsCategory);
00237     centre ()->show ();
00238 }

void IgSpareWindow::showSpareViewProperties ( void   )  [private, slot]

Definition at line 227 of file IgSpareWindow.cc.

References Ig3DBaseWindow::centre(), m_spareViewPropertiesCategory, IgControlCentre::selectCategory(), and IgControlCentre::show().

Referenced by initMenu().

00228 {
00229     centre ()->selectCategory (m_spareViewPropertiesCategory);
00230     centre ()->show ();
00231 }


Member Data Documentation

Ig3DLightsCategory* IgSpareWindow::m_lightsCategory [private]

Definition at line 58 of file IgSpareWindow.h.

Referenced by initCategories(), and showLights().

IgSpareViewPropertiesCategory* IgSpareWindow::m_spareViewPropertiesCategory [private]

Definition at line 57 of file IgSpareWindow.h.

Referenced by initCategories(), and showSpareViewProperties().

const int IgSpareWindow::MENU_SPARE_MANIP = 118 [static]

Definition at line 41 of file IgSpareWindow.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:44 2009 for CMSSW by  doxygen 1.5.4