CMS 3D CMS Logo

IgRZWindow Class Reference

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

Inheritance diagram for IgRZWindow:

Ig3DBaseWindow IgView IgBrowser

List of all members.

Public Member Functions

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

Static Public Attributes

static const int MENU_RZ_MANIP = 119

Private Slots

void showLights (void)
void showRZViewProperties (void)

Private Member Functions

void repMenu (IgQtObjectMenuMessage message)

Private Attributes

Ig3DLightsCategorym_lightsCategory
IgRZViewPropertiesCategorym_rzViewPropertiesCategory


Detailed Description

Definition at line 22 of file IgRZWindow.h.


Constructor & Destructor Documentation

IgRZWindow::IgRZWindow ( IgPage page  ) 

Definition at line 45 of file IgRZWindow.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().

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

IgRZWindow::~IgRZWindow ( void   ) 

Definition at line 77 of file IgRZWindow.cc.

00078 {
00079 }


Member Function Documentation

void IgRZWindow::focusIn ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 145 of file IgRZWindow.cc.

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

00146 {
00147     Ig3DBaseWindow::focusIn ();
00148     
00149     ASSERT (IgQtObjectMenuService::get (state ()));
00150     IgQtObjectMenuService::get (state ())
00151         ->add (lat::CreateCallback (this, &IgRZWindow::repMenu));
00152 }

void IgRZWindow::focusOut ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 155 of file IgRZWindow.cc.

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

00156 {
00157     Ig3DBaseWindow::focusOut ();
00158 
00159     ASSERT (IgQtObjectMenuService::get (state ()));
00160     IgQtObjectMenuService::get (state ())
00161         ->remove (lat::CreateCallback (this, &IgRZWindow::repMenu));
00162 }

void IgRZWindow::initCategories ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 82 of file IgRZWindow.cc.

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

Referenced by IgRZWindow().

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

void IgRZWindow::initMenu ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 116 of file IgRZWindow.cc.

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

Referenced by IgRZWindow().

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

void IgRZWindow::initToolBar ( void   )  [virtual]

Reimplemented from Ig3DBaseWindow.

Definition at line 192 of file IgRZWindow.cc.

References IgQtAppContextService::addOnFocusIn(), IgQtAppContextService::addOnFocusOut(), ASSERT, Ig3DBaseWindow::browser(), lat::CreateCallback(), feedbackButtonCallback(), DBSPlugin::get(), IgImageIDs::IMAGE_ID_INVERSE, IgImageIDs::IMAGE_ID_ORTHO, IgImageIDs::IMAGE_ID_PERSPECTIVE, IgImageIDs::IMAGE_ID_YX_SMALL_COL, Ig3DBaseWindow::initToolBar(), edm::Normal, orthogonalButtonCallback(), IgQtAppImageService::pixmapById(), qtSetOff(), Ig3DBaseWindow::state(), Ig3DBaseWindow::TOOLBAR_ID_3D2D, Ig3DBaseWindow::TOOLBAR_ID_3D2D_INVERT, Ig3DBaseWindow::TOOLBAR_ID_3D2D_ORTHO, Ig3DBaseWindow::TOOLBAR_ID_3D2D_SHOW_AXIS, and IgQtAppToolBarService::toolBarButton().

Referenced by IgRZWindow().

00193 {
00194     Ig3DBaseWindow::initToolBar ();    
00195 
00196     // This creates a toolbar with the general widgets.
00197     IgQtAppToolBarService *toolBarService = IgQtAppToolBarService::get (state ());
00198     IgQtAppImageService *is = IgQtAppImageService::get (state ());
00199     IgQtAppContextService *cs = IgQtAppContextService::get (state ());
00200 
00201     ASSERT (is);
00202 
00203     QToolButton *button = 0;
00204     button = toolBarService->toolBarButton (state (),
00205                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D,
00206                                             Ig3DBaseWindow::TOOLBAR_ID_3D2D_SHOW_AXIS,
00207                                             *is->pixmapById (IgImageIDs::IMAGE_ID_YX_SMALL_COL), 
00208                                             "Show Axis",
00209                                             browser (),
00210                                             SLOT (setFeedbackVisibility (bool)),
00211                                             SIGNAL (toggled (bool)));
00212     button->setToggleButton (true);    
00213 
00214     toolBarService->toolBarButton (state (),
00215                                    Ig3DBaseWindow::TOOLBAR_ID_3D2D,
00216                                    Ig3DBaseWindow::TOOLBAR_ID_3D2D_INVERT, 
00217                                    *is->pixmapById (IgImageIDs::IMAGE_ID_INVERSE),
00218                                    "Invert normals",
00219                                    browser (),
00220                                    SLOT (invertCamera ()));
00221 
00222     // FIXME: this needs to be a togglable button. Create a service
00223     // for doing so.
00224     QIconSet iconSet(*is->pixmapById (IgImageIDs::IMAGE_ID_PERSPECTIVE));
00225     iconSet.setPixmap (*is->pixmapById (IgImageIDs::IMAGE_ID_ORTHO), QIconSet::Automatic,
00226                        QIconSet::Normal, QIconSet::On);
00227     QToolButton *cpButton 
00228         = toolBarService->toolBarButton (state (),
00229                                          Ig3DBaseWindow::TOOLBAR_ID_3D2D,
00230                                          Ig3DBaseWindow::TOOLBAR_ID_3D2D_ORTHO, 
00231                                          //*is->pixmapById (IgImageIDs::IMAGE_ID_ORTHO),
00232                                          iconSet,
00233                                          "Change projection",
00234                                          browser (),
00235                                          SLOT (toggleCameraType ()));
00236 
00237     cpButton->setToggleButton (true);
00238     
00239     cs->addOnFocusIn (lat::CreateCallback (&feedbackButtonCallback, 
00240                                            browser (), 
00241                                            button));    
00242     cs->addOnFocusOut (lat::CreateCallback (&qtSetOff,
00243                                             button));
00244 
00245     cs->addOnFocusIn (lat::CreateCallback (&orthogonalButtonCallback, 
00246                                            browser (), 
00247                                            cpButton));
00248     cs->addOnFocusOut (lat::CreateCallback (&qtSetOff,
00249                                             cpButton));    
00250 }

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

Definition at line 268 of file IgRZWindow.cc.

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

Referenced by focusIn(), and focusOut().

00269 {
00270     static const IgQtObjectMenu::ItemDef defs [] = {
00271         { -1, Ig3DBaseBrowser::MENU_3D_OPS, 0, 0, -1 }
00272         //      { -1, IgRZWindow::MENU_RZ_MANIP, "Manipulate", SLOT(repNode ()), -1 },
00273     };
00274     static const int    ndefs = sizeof (defs)/sizeof (defs [0]);
00275 
00276     IgRepresentable     *object = message.object ();
00277 
00278     IgRep *m_menuRep = dynamic_cast<IgRep *>
00279                 (IgRepSet::lookup (object, model (), false));
00280 
00281     // An irrelevant object or already added item, remove our items.
00282     message.menu ()->removeFromDefs (defs, ndefs);
00283     if (m_menuRep)
00284         // Add our items if they aren't there yet.
00285         message.menu ()->insertFromDefs (this, defs, ndefs);
00286 }

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

Definition at line 260 of file IgRZWindow.cc.

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

Referenced by initMenu().

00261 {
00262     centre ()->selectCategory (m_lightsCategory);
00263     centre ()->show ();
00264 }

void IgRZWindow::showRZViewProperties ( void   )  [private, slot]

Definition at line 253 of file IgRZWindow.cc.

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

Referenced by initMenu().

00254 {
00255     centre ()->selectCategory (m_rzViewPropertiesCategory);
00256     centre ()->show ();
00257 }


Member Data Documentation

Ig3DLightsCategory* IgRZWindow::m_lightsCategory [private]

Definition at line 48 of file IgRZWindow.h.

Referenced by initCategories(), and showLights().

IgRZViewPropertiesCategory* IgRZWindow::m_rzViewPropertiesCategory [private]

Definition at line 47 of file IgRZWindow.h.

Referenced by initCategories(), and showRZViewProperties().

const int IgRZWindow::MENU_RZ_MANIP = 119 [static]

Definition at line 31 of file IgRZWindow.h.


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