CMS 3D CMS Logo

Ig3DNodeCategory Class Reference

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

Inheritance diagram for Ig3DNodeCategory:

IgControlCategory IgStateElement IgControlItem

List of all members.

Public Slots

virtual void focusIn (void)
virtual void hide (void)
virtual void saveNode (void)
virtual void saveSettings (SoField *field)
virtual void show (void)

Public Member Functions

virtual void apply (void)
virtual void attach (void)
void browserFocusIn (Ig3DBaseBrowser *browser)
virtual void clearBodyArea (void)
virtual void clearCategory (void)
virtual void detach (void)
 Ig3DNodeCategory (IgState *state, Ig3DBaseBrowser *source)
virtual void manipulate (SoNode *node)
virtual void registerBrowser (IgState *state, Ig3DBaseBrowser *browser)
virtual void update (void)
 ~Ig3DNodeCategory (void)

Protected Slots

virtual void manipulateItem (QListViewItem *item)

Protected Member Functions

virtual void addFields (SoNode *node, const char *name=0)
virtual bool addNode (SoNode *node, QListViewItem *parent=0)
virtual void fieldMBool (SoField *, FieldOptions)
virtual void fieldMColor (SoField *, FieldOptions)
virtual void fieldMFloat (SoField *, FieldOptions)
virtual void fieldMInt32 (SoField *, FieldOptions)
virtual void fieldMShort (SoField *, FieldOptions)
virtual void fieldMString (SoField *, FieldOptions)
virtual void fieldMUInt32 (SoField *, FieldOptions)
virtual void fieldMUShort (SoField *, FieldOptions)
virtual void fieldSBool (SoField *, FieldOptions)
virtual void fieldSColor (SoField *, FieldOptions)
virtual void fieldSFloat (SoField *, FieldOptions)
virtual void fieldSInt32 (SoField *, FieldOptions)
virtual void fieldSPlane (SoField *, FieldOptions)
virtual void fieldSRotation (SoField *, FieldOptions)
virtual void fieldSShort (SoField *, FieldOptions)
virtual void fieldSString (SoField *, FieldOptions)
virtual void fieldSUInt32 (SoField *, FieldOptions)
virtual void fieldSUShort (SoField *, FieldOptions)
virtual void fieldSVec2f (SoField *, FieldOptions)
virtual void fieldSVec3f (SoField *, FieldOptions)
virtual void fieldSVec4f (SoField *, FieldOptions)
virtual void itrateOverFields (FieldOptions type)
virtual void itrateOverFields (SoNode *node, FieldOptions type)
 itrate over all the controllable fields in order i.e.

Private Types

typedef std::map< SoField *,
Ig3DFieldControl * > 
fieldControlMap
typedef std::map< QString,
QString > 
fieldLimitsMap
enum  FieldOptions { CREATE, DELETE, SET, SAVE_LIMITS }
typedef std::map
< QListViewItem *, SoNode * > 
nodeMap

Private Member Functions

bool hasControllableFields (SoNode *)
 Ig3DNodeCategory (const Ig3DNodeCategory &)
 IG_DECLARE_STATE_ELEMENT (Ig3DNodeCategory)
Ig3DNodeCategoryoperator= (const Ig3DNodeCategory &)

Private Attributes

SoNode * m_currentNode
fieldLimitsMap m_fieldLimitsMap
fieldControlMap m_fields
nodeMap m_nodeMap
QListView * m_nodeTree
Ig3DBaseBrowserm_source


Detailed Description

Definition at line 31 of file Ig3DNodeCategory.h.


Member Typedef Documentation

typedef std::map<SoField*, Ig3DFieldControl*> Ig3DNodeCategory::fieldControlMap [private]

Definition at line 41 of file Ig3DNodeCategory.h.

typedef std::map<QString, QString> Ig3DNodeCategory::fieldLimitsMap [private]

Definition at line 43 of file Ig3DNodeCategory.h.

typedef std::map<QListViewItem *, SoNode*> Ig3DNodeCategory::nodeMap [private]

Definition at line 39 of file Ig3DNodeCategory.h.


Member Enumeration Documentation

enum Ig3DNodeCategory::FieldOptions [private]

Enumerator:
CREATE 
DELETE 
SET 
SAVE_LIMITS 

Definition at line 45 of file Ig3DNodeCategory.h.

00045                       {
00046       CREATE,
00047       DELETE,
00048       SET,
00049       SAVE_LIMITS
00050     };


Constructor & Destructor Documentation

Ig3DNodeCategory::Ig3DNodeCategory ( IgState state,
Ig3DBaseBrowser source 
)

Definition at line 188 of file Ig3DNodeCategory.cc.

References controllableFields, lat::CreateCallback(), fieldMBool(), fieldMColor(), fieldMFloat(), fieldMInt32(), fieldMShort(), fieldMString(), fieldMUInt32(), fieldMUShort(), fieldSBool(), fieldSColor(), fieldSFloat(), fieldSInt32(), fieldSPlane(), fieldSRotation(), fieldSShort(), fieldSString(), fieldSUInt32(), fieldSUShort(), fieldSVec2f(), fieldSVec3f(), fieldSVec4f(), python::multivaluedict::map(), and IgState::put().

00190     : IgControlCategory (state, "Node Manipulator", MonitorChanges | SplitterArea),
00191       m_source (source),
00192       m_currentNode (0),
00193       m_nodeTree(0)
00194 {
00195   state->put (s_key, this);
00196   if (controllableFields.size () == 0){
00197     std::map<SoType, lat::Callback2<SoField*,
00198                      Ig3DNodeCategory::FieldOptions> > types;
00199     types [SoSFVec2f::getClassTypeId ()] =
00200         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSVec2f);
00201     types [SoSFVec3f::getClassTypeId ()] =
00202         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSVec3f);
00203     types [SoSFVec4f::getClassTypeId ()] =
00204         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSVec4f);
00205     types [SoSFRotation::getClassTypeId ()] =
00206         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSRotation);
00207     types [SoSFPlane::getClassTypeId ()] =
00208         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSPlane);
00209     controllableFields.push_back (types);
00210     types.clear ();
00211     
00212     types [SoMFFloat::getClassTypeId ()] =
00213         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMFloat);
00214     types [SoMFInt32::getClassTypeId ()] =
00215         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMInt32);
00216     types [SoMFUInt32::getClassTypeId ()] =
00217         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMUInt32);
00218     types [SoMFShort::getClassTypeId ()] =
00219         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMShort);
00220     types [SoMFUShort::getClassTypeId ()] =
00221         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMUShort);
00222     types [SoSFFloat::getClassTypeId ()] =
00223         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSFloat);
00224     types [SoSFInt32::getClassTypeId ()] =
00225         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSInt32);
00226     types [SoSFUInt32::getClassTypeId ()] =
00227         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSUInt32);
00228     types [SoSFShort::getClassTypeId ()] =
00229         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSShort);
00230     types [SoSFUShort::getClassTypeId ()] =
00231         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSUShort);
00232     controllableFields.push_back (types);
00233     types.clear ();
00234 
00235     types [SoMFString::getClassTypeId ()] =
00236         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMString);
00237     types [SoSFString::getClassTypeId ()] =
00238         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSString);
00239     types [SoMFColor::getClassTypeId ()] =
00240         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMColor);
00241     types [SoSFColor::getClassTypeId ()] =
00242         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSColor);
00243     controllableFields.push_back (types);
00244     types.clear ();
00245 
00246     types [SoMFBool::getClassTypeId ()] =
00247         lat::CreateCallback (this, &Ig3DNodeCategory::fieldMBool);
00248     types [SoSFBool::getClassTypeId ()] =
00249         lat::CreateCallback (this, &Ig3DNodeCategory::fieldSBool);
00250     controllableFields.push_back (types);
00251     types.clear ();
00252   }
00253 }

Ig3DNodeCategory::~Ig3DNodeCategory ( void   ) 

Definition at line 255 of file Ig3DNodeCategory.cc.

References clearCategory().

00256 { clearCategory (); }

Ig3DNodeCategory::Ig3DNodeCategory ( const Ig3DNodeCategory  )  [private]


Member Function Documentation

void Ig3DNodeCategory::addFields ( SoNode *  node,
const char *  name = 0 
) [protected, virtual]

Definition at line 613 of file Ig3DNodeCategory.cc.

References IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), CREATE, Ig3DBaseModel::decode(), itrateOverFields(), m_currentNode, IgControlCategory::makeIndentedLabel(), IgControlCategory::popIndent(), IgControlCategory::pushIndent(), and row.

Referenced by manipulateItem().

00614 {
00615     if (node){
00616       m_currentNode = node;
00617       QWidget   *area = bodyArea ();
00618       int       row   = bodyLayout ()->numRows ();
00619       
00620       std::string name1 ("");
00621       if (name == 0){
00622         if (node->getName ().getLength ())
00623           name1 = Ig3DBaseModel::decode(node->getName ());
00624         else
00625           name1 = Ig3DBaseModel::decode(node->getTypeId ().getName ());
00626       }
00627       else
00628         name1 = name;
00629       
00630       //alignment widget
00631       if (!name1.empty ()){
00632         QWidget         *vlab = makeIndentedLabel (name1.c_str (),area);
00633         bodyLayout ()->addWidget (vlab, row, 0);
00634         pushIndent ();
00635       }
00636       
00637       itrateOverFields (m_currentNode, CREATE);
00638       
00639       if (!name1.empty ())
00640         popIndent ();
00641     }
00642 }

bool Ig3DNodeCategory::addNode ( SoNode *  node,
QListViewItem *  parent = 0 
) [protected, virtual]

Definition at line 458 of file Ig3DNodeCategory.cc.

References Ig3DBaseModel::decode(), group, hasControllableFields(), i, m_nodeMap, m_nodeTree, and name.

Referenced by manipulate().

00459 {
00460     std::string name("");
00461     QListViewItem *item = 0;
00462     
00463     //Check for the already existance of the node in map    
00464     for(nodeMap::iterator itr = m_nodeMap.begin ();
00465         itr != m_nodeMap.end (); itr++)
00466       if (itr->second == node)
00467         return false;
00468 
00469     bool isGroup = node->isOfType(SoGroup::getClassTypeId ());
00470     
00471     if (!(isGroup || hasControllableFields(node)))
00472       return false;
00473     
00474     if (node->getName ().getLength ())
00475       name = Ig3DBaseModel::decode(node->getName ());
00476     else
00477       name = Ig3DBaseModel::decode(node->getTypeId ().getName ());
00478 
00479     if (parent == 0)
00480       item = new QListViewItem (m_nodeTree, name.c_str ());
00481     else
00482       item = new QListViewItem (parent, name.c_str ());
00483     
00484     if (isGroup)
00485     {
00486       SoGroup *group = dynamic_cast<SoGroup*>(node);
00487       int added = 0;
00488       for(int i = 0; i < group->getNumChildren (); i++)
00489         if (addNode (group->getChild (i), item))
00490           added++;
00491       if(!added)
00492       {
00493         delete item;
00494         return false;
00495       }
00496     }
00497     
00498     m_nodeMap [item] = node;
00499     return true;
00500 }

void Ig3DNodeCategory::apply ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 341 of file Ig3DNodeCategory.cc.

References m_fields.

00342 {
00343     fieldControlMap::iterator item;
00344     for (item = m_fields.begin() ; item != m_fields.end() ; item++) 
00345       (*item).second->apply ();
00346 }

void Ig3DNodeCategory::attach ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 321 of file Ig3DNodeCategory.cc.

References itrateOverFields(), and SET.

00322 { itrateOverFields (SET); }

void Ig3DNodeCategory::browserFocusIn ( Ig3DBaseBrowser browser  ) 

Definition at line 658 of file Ig3DNodeCategory.cc.

References m_source.

Referenced by registerBrowser().

00659 { m_source = browser; }

void Ig3DNodeCategory::clearBodyArea ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 515 of file Ig3DNodeCategory.cc.

References IgControlCategory::clearBodyArea(), detach(), m_fields, and saveSettings().

Referenced by hide(), manipulate(), and manipulateItem().

00516 {
00517     IgControlCategory::clearBodyArea ();
00518     detach ();
00519     fieldControlMap::iterator item;
00520     for(item = m_fields.begin (); item != m_fields.end (); item++)
00521       disconnect (item->second, SIGNAL (settingsChanged (SoField*)),
00522                   this,         SLOT (saveSettings (SoField*)));
00523     m_fields.clear ();
00524 }

void Ig3DNodeCategory::clearCategory ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 503 of file Ig3DNodeCategory.cc.

References IgControlCategory::clearCategory(), detach(), m_fields, and saveSettings().

Referenced by ~Ig3DNodeCategory().

00504 {
00505     IgControlCategory::clearCategory ();
00506     detach ();
00507     fieldControlMap::iterator item;
00508     for(item = m_fields.begin (); item != m_fields.end (); item++)
00509       disconnect (item->second, SIGNAL (settingsChanged (SoField*)),
00510                   this,         SLOT (saveSettings (SoField*)));
00511     m_fields.clear ();
00512 }

void Ig3DNodeCategory::detach ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 325 of file Ig3DNodeCategory.cc.

References m_fields.

Referenced by clearBodyArea(), and clearCategory().

00326 {
00327     fieldControlMap::iterator item;
00328     for (item = m_fields.begin(); item != m_fields.end(); item++) 
00329       (*item).second->clearField ();
00330 }

void Ig3DNodeCategory::fieldMBool ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 741 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00742 {
00743       FIELD_OPERATIONS(Ig3DMBoolControl, SoMFBool);
00744 }

void Ig3DNodeCategory::fieldMColor ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 729 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00730 {
00731       FIELD_OPERATIONS(Ig3DMColorControl, SoMFColor);
00732 }

void Ig3DNodeCategory::fieldMFloat ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 663 of file Ig3DNodeCategory.cc.

References MRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00664 {
00665       MRANGE_FIELD_OPERATIONS(Ig3DMFloatControl, SoMFFloat);
00666 }

void Ig3DNodeCategory::fieldMInt32 ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 669 of file Ig3DNodeCategory.cc.

References MRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00670 {
00671       MRANGE_FIELD_OPERATIONS(Ig3DMInt32Control, SoMFInt32);
00672 }

void Ig3DNodeCategory::fieldMShort ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 681 of file Ig3DNodeCategory.cc.

References MRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00682 {
00683       MRANGE_FIELD_OPERATIONS(Ig3DMShortControl, SoMFShort);
00684 }

void Ig3DNodeCategory::fieldMString ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 783 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00784 {
00785       FIELD_OPERATIONS(Ig3DMStringControl, SoMFString);
00786 }

void Ig3DNodeCategory::fieldMUInt32 ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 675 of file Ig3DNodeCategory.cc.

References MRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00676 {
00677       MRANGE_FIELD_OPERATIONS(Ig3DMUInt32Control, SoMFUInt32);
00678 }

void Ig3DNodeCategory::fieldMUShort ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 687 of file Ig3DNodeCategory.cc.

References MRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00688 {
00689       MRANGE_FIELD_OPERATIONS(Ig3DMUShortControl, SoMFUShort);
00690 }

void Ig3DNodeCategory::fieldSBool ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 735 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00736 {
00737       FIELD_OPERATIONS(Ig3DBoolControl, SoSFBool);
00738 }

void Ig3DNodeCategory::fieldSColor ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 723 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00724 {
00725       FIELD_OPERATIONS(Ig3DColorControl, SoSFColor);
00726 }

void Ig3DNodeCategory::fieldSFloat ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 693 of file Ig3DNodeCategory.cc.

References SRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00694 {
00695       SRANGE_FIELD_OPERATIONS(Ig3DFloatControl, SoSFFloat);
00696 }

void Ig3DNodeCategory::fieldSInt32 ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 699 of file Ig3DNodeCategory.cc.

References SRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00700 {
00701       SRANGE_FIELD_OPERATIONS(Ig3DInt32Control, SoSFInt32);
00702 }

void Ig3DNodeCategory::fieldSPlane ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 771 of file Ig3DNodeCategory.cc.

References SVEC_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00772 {
00773       SVEC_FIELD_OPERATIONS(Ig3DPlaneControl, SoSFPlane);
00774 }

void Ig3DNodeCategory::fieldSRotation ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 765 of file Ig3DNodeCategory.cc.

References SVEC_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00766 {
00767       SVEC_FIELD_OPERATIONS(Ig3DRotationFControl, SoSFRotation);
00768 }

void Ig3DNodeCategory::fieldSShort ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 711 of file Ig3DNodeCategory.cc.

References SRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00712 {
00713       SRANGE_FIELD_OPERATIONS(Ig3DShortControl, SoSFShort);
00714 }

void Ig3DNodeCategory::fieldSString ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 777 of file Ig3DNodeCategory.cc.

References FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00778 {
00779       FIELD_OPERATIONS(Ig3DStringControl, SoSFString);
00780 }

void Ig3DNodeCategory::fieldSUInt32 ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 705 of file Ig3DNodeCategory.cc.

References SRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00706 {
00707       SRANGE_FIELD_OPERATIONS(Ig3DUInt32Control, SoSFUInt32);
00708 }

void Ig3DNodeCategory::fieldSUShort ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 717 of file Ig3DNodeCategory.cc.

References SRANGE_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00718 {
00719       SRANGE_FIELD_OPERATIONS(Ig3DUShortControl, SoSFUShort);
00720 }

void Ig3DNodeCategory::fieldSVec2f ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 747 of file Ig3DNodeCategory.cc.

References SVEC_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00748 {
00749       SVEC_FIELD_OPERATIONS(Ig3DVec2fControl, SoSFVec2f);
00750 }

void Ig3DNodeCategory::fieldSVec3f ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 753 of file Ig3DNodeCategory.cc.

References SVEC_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00754 {
00755       SVEC_FIELD_OPERATIONS(Ig3DVec3fControl, SoSFVec3f);
00756 }

void Ig3DNodeCategory::fieldSVec4f ( SoField *  field,
FieldOptions  type 
) [protected, virtual]

Definition at line 759 of file Ig3DNodeCategory.cc.

References SVEC_FIELD_OPERATIONS.

Referenced by Ig3DNodeCategory().

00760 {
00761       SVEC_FIELD_OPERATIONS(Ig3DVec4fControl, SoSFVec4f);
00762 }

void Ig3DNodeCategory::focusIn ( void   )  [virtual, slot]

Reimplemented from IgControlCategory.

Definition at line 273 of file Ig3DNodeCategory.cc.

References Ig3DBaseBrowser::getSelection(), m_currentNode, m_nodeMap, m_nodeTree, m_source, manipulate(), and Ig3DBaseRep::node().

Referenced by show().

00274 {
00275     SoNode *oldnode=m_currentNode;
00276     if (m_source && m_source->getSelection ())
00277       manipulate (m_source->getSelection ()->node ());
00278     else
00279       manipulate (0);
00280       
00281     for(nodeMap::iterator itr = m_nodeMap.begin ();
00282         itr != m_nodeMap.end (); itr++)
00283     {
00284       if (itr->second == oldnode)
00285       {
00286         QListViewItem *top = itr->first->parent ();
00287         while (top)
00288         {
00289           top->setOpen (true);
00290           top = top->parent ();
00291         }
00292         m_nodeTree->setSelected (itr->first, true);
00293         break;
00294       }
00295     }
00296 }

bool Ig3DNodeCategory::hasControllableFields ( SoNode *  node  )  [private]

Definition at line 527 of file Ig3DNodeCategory.cc.

References begin, controllableFields, i, j, python::multivaluedict::map(), and funct::num().

Referenced by addNode().

00528 {
00529   SoFieldList fields;
00530   SoField *field = 0;
00531   int num = node->getFields (fields);
00532   std::map<SoType, lat::Callback2<SoField*,
00533     Ig3DNodeCategory::FieldOptions> >::iterator item;
00534 
00535   for (int i = 0; i < num; i++ )
00536   {
00537     field = fields[i];
00538     for(unsigned int j=0; j < controllableFields.size (); j++)
00539     {
00540       for(item = controllableFields[j].begin ();
00541           item != controllableFields[j].end (); item++)
00542       {
00543         if (field->isOfType (item->first))
00544           return true;
00545       }
00546     }
00547   }
00548   return false;
00549 }

void Ig3DNodeCategory::hide ( void   )  [virtual, slot]

Reimplemented from IgControlCategory.

Definition at line 266 of file Ig3DNodeCategory.cc.

References clearBodyArea(), and IgControlCategory::hide().

00267 {
00268     IgControlCategory::hide ();
00269     clearBodyArea ();
00270 }

Ig3DNodeCategory::IG_DECLARE_STATE_ELEMENT ( Ig3DNodeCategory   )  [private]

void Ig3DNodeCategory::itrateOverFields ( FieldOptions  type  )  [protected, virtual]

Definition at line 587 of file Ig3DNodeCategory.cc.

References begin, controllableFields, i, m_fields, and python::multivaluedict::map().

00588 {
00589     SoField *field = 0;
00590     fieldControlMap::iterator item;
00591     std::map<SoType, lat::Callback2<SoField*,
00592       Ig3DNodeCategory::FieldOptions> >::iterator itr;
00593     
00594     for(item = m_fields.begin (); item != m_fields.end (); item++)
00595     {
00596       field = item->first;
00597       for (unsigned int i=0; i < controllableFields.size (); i++)
00598       {
00599         for(itr = controllableFields[i].begin ();
00600           itr != controllableFields[i].end (); itr++)
00601         {
00602           if (field->isOfType (itr->first))
00603           {
00604             (itr->second)(field, type);
00605             break;
00606           }
00607         }
00608       }
00609     }
00610 }

void Ig3DNodeCategory::itrateOverFields ( SoNode *  node,
FieldOptions  type 
) [protected, virtual]

itrate over all the controllable fields in order i.e.

So*F(Float/Int32/Long...) first and then So*FColor and then So*FBool etc.

Definition at line 556 of file Ig3DNodeCategory.cc.

References begin, controllableFields, i, j, python::multivaluedict::map(), and funct::num().

Referenced by addFields(), and attach().

00557 {
00558     SoFieldList fields;
00559     SoField *field = 0;
00560     int num = node->getFields (fields);
00561     
00562     int done = 0;
00563     std::map<SoType, lat::Callback2<SoField*,
00564       Ig3DNodeCategory::FieldOptions> >::iterator item;
00565     for (unsigned int i=0; i < controllableFields.size (); i++)
00566     {
00567       for (int j = 0; j < num; j++)
00568       {
00569         field = fields[j];
00570         for(item = controllableFields[i].begin ();
00571           item != controllableFields[i].end (); item++)
00572         {
00573           if (field->isOfType (item->first))
00574           {
00575             (item->second)(field, type);
00576             done++;
00577             if (done == num)
00578               return;
00579             break;
00580           }
00581         }
00582       }
00583     }
00584 }

void Ig3DNodeCategory::manipulate ( SoNode *  node  )  [virtual]

Definition at line 409 of file Ig3DNodeCategory.cc.

References addNode(), IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), clearBodyArea(), HLT_VtxMuL3::connect, IgControlCategory::leftArea(), IgControlCategory::leftLayout(), m_nodeMap, m_nodeTree, IgControlCategory::makeIndentedLabel(), manipulateItem(), row, IgControlCategory::show(), and reco::Single.

Referenced by focusIn().

00410 {      
00411     clearBodyArea ();
00412     if (!node)
00413     { 
00414       if (m_nodeTree)
00415       {
00416         m_nodeTree->clear ();
00417         m_nodeMap.clear ();
00418         m_nodeTree->hide ();
00419       }
00420       QWidget   *area = bodyArea ();
00421       int       row   = bodyLayout ()->numRows ();
00422       
00423       QWidget *vlab = makeIndentedLabel (
00424                        "No selected node on the scenegraph.\n"
00425                        "If you want to manipulate a node then please\n"
00426                        "change to the pick mode and then click on\n"
00427                        "the node to manipuate in the 3D browser.\n\n",
00428                        area);
00429       bodyLayout ()->addWidget (vlab, row, 0);
00430       IgControlCategory::show ();
00431       return;
00432     }
00433     
00434     if (!m_nodeTree)
00435     {
00436       m_nodeTree = new QListView (leftArea (), "Node Manipulator List");
00437       m_nodeTree->addColumn ("Node Type/Name");
00438       m_nodeTree->setSelectionMode (QListView::Single);
00439       leftLayout ()->addWidget (m_nodeTree);
00440       connect (m_nodeTree, SIGNAL ( selectionChanged (QListViewItem *)),
00441                this,       SLOT   ( manipulateItem (QListViewItem *)));
00442     }
00443     m_nodeTree->clear ();
00444     m_nodeMap.clear ();
00445     m_nodeTree->show ();
00446     
00447     QListViewItem *topItem = new QListViewItem (m_nodeTree, "Nodes List");
00448     topItem->setSelectable (false);
00449     addNode (node, topItem);
00450     topItem->setOpen (true);
00451     if (topItem->childCount () == 0)
00452       manipulate (0);
00453     else if (topItem->firstChild ())
00454       m_nodeTree->setSelected (topItem->firstChild (), true);
00455 }

void Ig3DNodeCategory::manipulateItem ( QListViewItem *  item  )  [protected, virtual, slot]

Definition at line 357 of file Ig3DNodeCategory.cc.

References reco::fitHelper::add(), addFields(), ASSERT, IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), IgControlCategory::bottomLayout(), clearBodyArea(), HLT_VtxMuL3::connect, IgControlCategory::isTracking(), m_fields, m_nodeMap, IgControlCategory::makeIndentedLabel(), row, saveNode(), IgControlCategory::setTracking(), and IgControlCategory::show().

Referenced by manipulate().

00358 {
00359     if(!item) return;
00360     if (m_nodeMap.find (item) != m_nodeMap.end ())
00361     {
00362       bool oldTracking = isTracking ();
00363       clearBodyArea ();
00364       addFields (m_nodeMap [item], item->text (0));
00365       
00366       QWidget   *area = bodyArea ();
00367       if (m_fields.size () == 0)
00368       {
00369         int     row   = bodyLayout ()->numRows ();
00370       
00371         QWidget *vlab = makeIndentedLabel (
00372                         "This node either has no fields to manilupate\n"
00373                         "or the implementation is not yet ready.\n\n",
00374                         area);
00375         bodyLayout ()->addWidget (vlab, row, 0);
00376       }
00377       
00378       QHBoxLayout *layout1 = new QHBoxLayout (bottomLayout ());
00379     
00380       layout1->addItem (new QSpacerItem (20, 20, 
00381         QSizePolicy::Expanding, QSizePolicy::Minimum));
00382       
00383       QPushButton *saveme = new QPushButton ("Save Node", area);
00384       layout1->addWidget (saveme);
00385       layout1->addItem (new QSpacerItem (20, 20, 
00386         QSizePolicy::Expanding, QSizePolicy::Minimum));
00387       
00388       bottomLayout ()->addItem (new QSpacerItem (20, 20, 
00389         QSizePolicy::Minimum, QSizePolicy::Expanding));
00390 
00391       QWhatsThis::add (saveme, "To Save the currently selected node/sub-node in iv file.");
00392 
00393       connect (saveme,          SIGNAL (clicked ()),
00394                this,            SLOT   (saveNode ()));
00395 
00396       bodyArea()->show ();      
00397       IgControlCategory::show ();
00398       setTracking (oldTracking);
00399 
00400       // Space it up 
00401       bottomLayout ()->addItem (new QSpacerItem (20, 20, 
00402         QSizePolicy::Minimum, QSizePolicy::Expanding));
00403     }
00404     else
00405       ASSERT (0);
00406 }

Ig3DNodeCategory& Ig3DNodeCategory::operator= ( const Ig3DNodeCategory  )  [private]

void Ig3DNodeCategory::registerBrowser ( IgState state,
Ig3DBaseBrowser browser 
) [virtual]

Definition at line 646 of file Ig3DNodeCategory.cc.

References IgQtAppContextService::addOnFocusIn(), ASSERT, browserFocusIn(), lat::CreateCallback(), DBSPlugin::get(), m_source, and IgControlCategory::registerMe().

Referenced by Ig3DWindow::initCategories().

00647 {
00648     IgQtAppContextService *cs = IgQtAppContextService::get (state);
00649     ASSERT (cs);
00650     cs->addOnFocusIn (lat::CreateCallback (this,
00651                                            &Ig3DNodeCategory::browserFocusIn,
00652                                            browser));    
00653     IgControlCategory::registerMe (state);
00654     m_source = browser;
00655 }

void Ig3DNodeCategory::saveNode ( void   )  [virtual, slot]

Definition at line 348 of file Ig3DNodeCategory.cc.

References ASSERT, m_currentNode, m_source, IgControlCategory::panel(), and Ig3DBaseBrowser::saveNode().

Referenced by manipulateItem().

00349 {
00350     ASSERT (m_source);
00351     m_source->saveNode(m_currentNode,"Save Selected Node As...",panel ());
00352 }

void Ig3DNodeCategory::saveSettings ( SoField *  field  )  [virtual, slot]

Definition at line 299 of file Ig3DNodeCategory.cc.

References ASSERT, begin, controllableFields, i, m_fields, python::multivaluedict::map(), and SAVE_LIMITS.

Referenced by clearBodyArea(), and clearCategory().

00300 {
00301     ASSERT (m_fields.find (field) != m_fields.end ());
00302 
00303     std::map<SoType, lat::Callback2<SoField*,
00304       Ig3DNodeCategory::FieldOptions> >::iterator itr;
00305     
00306     for (unsigned int i=0; i < controllableFields.size (); i++)
00307     {
00308       for(itr = controllableFields[i].begin ();
00309           itr != controllableFields[i].end (); itr++)
00310       {
00311         if (field->isOfType (itr->first))
00312         {
00313           (itr->second)(field, SAVE_LIMITS);
00314           return;
00315         }
00316       }
00317     }
00318 }

void Ig3DNodeCategory::show ( void   )  [virtual, slot]

Reimplemented from IgControlCategory.

Definition at line 259 of file Ig3DNodeCategory.cc.

References focusIn(), and IgControlCategory::show().

00260 {
00261     IgControlCategory::show ();
00262     focusIn ();
00263 }

void Ig3DNodeCategory::update ( void   )  [virtual]

Reimplemented from IgControlCategory.

Definition at line 333 of file Ig3DNodeCategory.cc.

References m_fields.

00334 {
00335     fieldControlMap::iterator item;
00336     for (item = m_fields.begin(); item != m_fields.end(); item++) 
00337       (*item).second->update ();
00338 }


Member Data Documentation

SoNode* Ig3DNodeCategory::m_currentNode [private]

Definition at line 112 of file Ig3DNodeCategory.h.

Referenced by addFields(), focusIn(), and saveNode().

fieldLimitsMap Ig3DNodeCategory::m_fieldLimitsMap [private]

Definition at line 115 of file Ig3DNodeCategory.h.

fieldControlMap Ig3DNodeCategory::m_fields [private]

Definition at line 110 of file Ig3DNodeCategory.h.

Referenced by apply(), clearBodyArea(), clearCategory(), detach(), itrateOverFields(), manipulateItem(), saveSettings(), and update().

nodeMap Ig3DNodeCategory::m_nodeMap [private]

Definition at line 114 of file Ig3DNodeCategory.h.

Referenced by addNode(), focusIn(), manipulate(), and manipulateItem().

QListView* Ig3DNodeCategory::m_nodeTree [private]

Definition at line 113 of file Ig3DNodeCategory.h.

Referenced by addNode(), focusIn(), and manipulate().

Ig3DBaseBrowser* Ig3DNodeCategory::m_source [private]

Definition at line 111 of file Ig3DNodeCategory.h.

Referenced by browserFocusIn(), focusIn(), registerBrowser(), and saveNode().


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