CMS 3D CMS Logo

Ig3DPlaneControl.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/GLBrowsers/interface/Ig3DPlaneControl.h"
00004 #include "Iguana/GLBrowsers/interface/Ig3DUnitVec3fControl.h"
00005 #include "Iguana/GLBrowsers/interface/Ig3DFloatControl.h"
00006 #include "Iguana/GLBrowsers/interface/IgControlCategory.h"
00007 #include "Iguana/GLBrowsers/interface/IgQtRangeControl.h"
00008 #include <classlib/utils/DebugAids.h>
00009 #include <qlayout.h>
00010 #include <qlabel.h>
00011 
00012 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00013 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00014 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00015 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00016 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00017 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00018 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00019 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00020 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00021 
00022 Ig3DPlaneControl::Ig3DPlaneControl (IgControlCategory *pane, QString label)
00023     : Ig3DFieldControl (pane)
00024 {
00025     ASSERT (pane);
00026     ASSERT (pane->bodyArea ());
00027     ASSERT (pane->bodyLayout ());
00028         m_direction = new IgPlaneDirection();
00029 
00030     QWidget *area = pane->bodyArea ();
00031 
00032     // Add a new row to the grid: just the label for this category
00033     QWidget     *vlab = makeIndentedLabel (label, area);
00034     addGridWidget (vlab, gridRows (), 0);
00035 
00036     // Now add subitems for direction and distance
00037     pane->pushIndent ();
00038 
00039         // create a rotation control with 3 thumbwheels and 3 alignment buttons
00040         m_rotation = new Ig3DAxisRotationControl (pane, "Rotation", this);
00041     
00042     m_distance = new Ig3DFloatControl (pane, "Distance",
00043                                         IgQtRangeControl::StepperPart
00044                                         | IgQtRangeControl::ValuePart
00045                                         | IgQtRangeControl::SliderPart);    
00046     pane->popIndent ();
00047         
00048         m_distance->control()->setRange (-30., 30.);
00049 
00050     // Always reflect the state of the real value controls and vice versa.
00051     connect (m_direction, SIGNAL(dirty()), this, SLOT(setDirty()));
00052 
00053     connect (m_distance,  SIGNAL(dirty()), this, SLOT(setDirty()));
00054     connect (m_distance,  SIGNAL(settingsChanged (void)),
00055              this,        SLOT  (emitSettingsChanged (void)));
00056 
00057     connect (this, SIGNAL(clean()), m_distance,  SLOT(setClean()));
00058     connect (this, SIGNAL(editable(bool)),m_distance, SLOT(setEditable(bool)));
00059     connect (this, SIGNAL(editable(bool)),vlab,       SLOT(setEnabled(bool)));
00060 }
00061 
00063 SoSFPlane *
00064 Ig3DPlaneControl::field (void) const
00065 { return static_cast<SoSFPlane *> (Ig3DFieldControl::field ()); }
00066 
00067 void
00068 Ig3DPlaneControl::setField (SoSFPlane *field)
00069 { Ig3DFieldControl::setField (field); }
00070 
00071 SbPlane
00072 Ig3DPlaneControl::fieldValue (void) const
00073 { ASSERT (field ()); return field ()->getValue (); }
00074 
00076 SbPlane
00077 Ig3DPlaneControl::value (void) const
00078 { return SbPlane (direction (), distance ()); }
00079 
00080 SbVec3f
00081 Ig3DPlaneControl::direction (void) const
00082 { return m_direction->value (); }
00083 
00084 float
00085 Ig3DPlaneControl::distance (void) const
00086 { return m_distance->value (); }
00087 
00088 void
00089 Ig3DPlaneControl::setValue (const SbPlane &newval)
00090 {
00091     setDirection (newval.getNormal ());
00092     setDistance (newval.getDistanceFromOrigin ());
00093 }
00094 
00095 void
00096 Ig3DPlaneControl::setDirection (const SbVec3f &newval)
00097 { m_direction->setValue (newval); }
00098 
00099 void
00100 Ig3DPlaneControl::setDistance (float newval)
00101 { m_distance->setValue (newval); }
00102 
00103 void
00104 Ig3DPlaneControl::updateValue (void)
00105 { setValue (fieldValue ()); }
00106 
00107 void
00108 Ig3DPlaneControl::applyValue (void)
00109 { field ()->setValue (value ()); }
00110 
00112 void
00113 Ig3DPlaneControl::show (void)
00114 {
00115     Ig3DFieldControl::show ();
00116     m_distance->show ();
00117 }
00118 
00119 void
00120 Ig3DPlaneControl::hide (void)
00121 {
00122     Ig3DFieldControl::hide ();
00123     m_distance->hide ();
00124 }
00126 
00127 Ig3DAxisRotationControl*
00128 Ig3DPlaneControl::axisRotationControl (void) const
00129 { return m_rotation; }
00130 
00131 Ig3DFloatControl*
00132 Ig3DPlaneControl::distanceControl  (void) const
00133 { return m_distance; }
00134 
00135 QString
00136 Ig3DPlaneControl::getSettingString (void) const
00137 { 
00138   return m_distance->control ()->getSettingString ();
00139 }
00140     
00141 void
00142 Ig3DPlaneControl::setSettingString (QString &setting)
00143 {
00144   m_distance->control ()->setSettingString (setting);
00145 }
00146 
00147 void
00148 Ig3DPlaneControl::emitSettingsChanged (void)
00149 { fieldSettingsChanged (); }

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