CMS 3D CMS Logo

Ig3DFieldControl.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/GLBrowsers/interface/Ig3DFieldControl.h"
00004 #include <Inventor/sensors/SoFieldSensor.h>
00005 #include <Inventor/fields/SoField.h>
00006 #include <classlib/utils/DebugAids.h>
00007 
00008 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00009 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00010 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00011 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00012 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00013 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00014 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00015 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00016 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00017 
00018 Ig3DFieldControl::Ig3DFieldControl (IgControlCategory *pane)
00019     : IgControlBase (pane),
00020       m_field (0),
00021       m_sensor (new SoFieldSensor (&fieldChanged, this))
00022 {}
00023 
00024 Ig3DFieldControl::~Ig3DFieldControl (void)
00025 { delete m_sensor; }
00026 
00027 void
00028 Ig3DFieldControl::setField (SoField *field)
00029 {
00030     detach ();
00031     m_field = field;
00032     attach ();
00033 }
00034 
00035 void
00036 Ig3DFieldControl::clearField (void)
00037 { setField (0); }
00038 
00039 SoField *
00040 Ig3DFieldControl::field (void) const
00041 { return m_field; }
00042 
00043 void
00044 Ig3DFieldControl::attach (void)
00045 {
00046     IgControlBase::attach ();
00047     if (m_field)
00048         m_sensor->attach (m_field);
00049 }
00050 
00051 void
00052 Ig3DFieldControl::detach (void)
00053 {
00054     IgControlBase::detach ();
00055     if (m_field)
00056         m_sensor->detach ();
00057 }
00058 
00059 bool
00060 Ig3DFieldControl::hasValue (void) const
00061 { return IgControlBase::hasValue () && m_field; }
00062 
00063 void
00064 Ig3DFieldControl::fieldChanged (void *data, SoSensor * /*sensor*/)
00065 { ASSERT (data); static_cast<Ig3DFieldControl *> (data)->update (); }
00066 
00067 void
00068 Ig3DFieldControl::fieldSettingsChanged(void)
00069 {
00070     emit settingsChanged (m_field);
00071     emit settingsChanged ();
00072 }

Generated on Tue Jun 9 17:38:36 2009 for CMSSW by  doxygen 1.5.4