#include <Iguana/GLBrowsers/interface/Ig3DGridCategory.h>
Public Member Functions | |
virtual void | apply (void) |
virtual void | attach (void) |
void | browserChanged (Ig3DBaseBrowser *browser) |
virtual void | detach (void) |
Ig3DGridCategory (IgState *state, Ig3DBaseBrowser *source) | |
bool | makeOne (Ig3DBaseRep *rep) |
void | reconstruct (SoSwitch *from) |
void | reconstruct (void) |
virtual void | registerBrowser (IgState *state, Ig3DBaseBrowser *browser) |
virtual void | update (void) |
Protected Member Functions | |
virtual void | createNewItem (void) |
virtual void | deleteItem (void) |
virtual void | renameItem (const QString &newName) |
Private Slots | |
virtual void | deleteOne (void) |
virtual bool | makeOne (void) |
virtual void | openIVFile (void) |
virtual void | openXMLFile (const char *def=0) |
virtual void | openXMLFileDef (void) |
virtual void | saveIVFile (void) |
virtual void | saveXMLFile (const char *def=0) |
virtual void | saveXMLFileDef (void) |
Private Member Functions | |
void | addButtons (void) |
DOMNode * | addTextNodeWithValue (DOMNode *parent, const char *tagname, const XMLCh *stringValue) |
void | addTips (void) |
void | buildDefaults (void) |
void | buildGridPlaneTree (DOMNode *gridPlane) |
void | buildGridTree (DOMNode *node, unsigned gridID) |
SoNode * | findFather (SoNode *node, SoNode *father, const char *name, int &child) |
DOMNode * | getGridPlaneReady (DOMNode *root, DOMImplementation *impl) |
SoGroup * | getParent (SoNode *node, SoNode *root) |
DOMNode * | getRootOfXMLDoc (QString fileName) |
Ig3DGridCategory (const Ig3DGridCategory &) | |
IG_DECLARE_STATE_ELEMENT (Ig3DGridCategory) | |
bool | makeCustomGrids (std::vector< std::string > &textList) |
bool | makeCustomOne (std::vector< std::string > &textList) |
IgSoGridPlane * | makeGrid (QString name, SbPlane plane, float xOrig, float zOrig, float xLen, float zLen, float spacing, bool on, SbVec3f color, SbVec3f labColor) |
IgSoGridPlane * | makeGrid (QString name, bool on, SbVec3f center) |
Ig3DGridCategory & | operator= (const Ig3DGridCategory &) |
void | reconstruct (SoGroup *from) |
void | removeAllChildren (DOMNode *node) |
void | removeGrids (void) |
SoGroup * | repActiveGrids (Ig3DBaseRep *rep, bool make) |
SoGroup * | repAllGrids (Ig3DBaseRep *rep, bool make) |
SoSwitch * | repGrids (SoGroup *magic, bool make, SoGroup **objects, SoGroup **active) |
QString | savingXMLFileDialog (const QString &title, QWidget *parent=0) |
template<typename T> | |
const XMLCh * | toChar (const T &thing) |
void | writeStringToFile (QString fileName, DOMImplementation *impl) |
Private Attributes | |
Ig3DColorControl * | m_color |
QPushButton * | m_defaultLoad |
QPushButton * | m_defaultSave |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | m_doc |
Ig3DColorControl * | m_labelColor |
Ig3DBoolControl * | m_manip |
Ig3DBoolControl * | m_on |
QPushButton * | m_open |
Ig3DPlaneControl * | m_plane |
QPushButton * | m_saveAs |
Ig3DBaseBrowser * | m_source |
Ig3DFloatControl * | m_spacing |
Ig3DFloatControl * | m_xLen |
Ig3DFloatControl * | m_xOrigin |
Ig3DFloatControl * | m_zLen |
Ig3DFloatControl * | m_zOrigin |
Static Private Attributes | |
static const char * | s_active = "Active" |
static const char * | s_all = "All" |
static const char * | s_group = "Grid Planes" |
Definition at line 39 of file Ig3DGridCategory.h.
Ig3DGridCategory::Ig3DGridCategory | ( | IgState * | state, | |
Ig3DBaseBrowser * | source | |||
) |
Definition at line 82 of file Ig3DGridCategory.cc.
References addButtons(), addTips(), IgControlCategory::bottomLayout(), Ig3DRangeControl< C1, C2, C3 >::control(), f, m_spacing, m_xLen, m_xOrigin, m_zLen, m_zOrigin, IgState::put(), and IgQtRangeControlFloat::setRange().
00084 : Ig3DObjectCategory<IgSoGridPlane> (state, "Grid Planes"), 00085 m_source (source), 00086 m_plane (new Ig3DPlaneControl (this, "Plane")), 00087 m_xOrigin (new Ig3DFloatControl (this, "Origin X (in m)", 00088 IgQtRangeControl::StepperPart 00089 | IgQtRangeControl::ValuePart 00090 | IgQtRangeControl::SliderPart)), 00091 m_zOrigin (new Ig3DFloatControl (this, "Origin Z (in m)", 00092 IgQtRangeControl::StepperPart 00093 | IgQtRangeControl::ValuePart 00094 | IgQtRangeControl::SliderPart)), 00095 m_xLen (new Ig3DFloatControl (this, "Width (in m)", 00096 IgQtRangeControl::StepperPart 00097 | IgQtRangeControl::ValuePart 00098 | IgQtRangeControl::SliderPart)), 00099 m_zLen (new Ig3DFloatControl (this, "Height (in m)", 00100 IgQtRangeControl::StepperPart 00101 | IgQtRangeControl::ValuePart 00102 | IgQtRangeControl::SliderPart)), 00103 m_spacing (new Ig3DFloatControl (this, "Spacing (in mm)", 00104 IgQtRangeControl::StepperPart 00105 | IgQtRangeControl::ValuePart 00106 | IgQtRangeControl::SliderPart)), 00107 m_on (new Ig3DBoolControl (this, "Active")), 00108 m_color (new Ig3DColorControl (this, "Color")), 00109 m_labelColor (new Ig3DColorControl (this, "Label Color")), 00110 m_manip (new Ig3DBoolControl (this, "Manipulator")), 00111 m_doc (0) 00112 { 00113 // add 'what's this' tips 00114 addTips (); 00115 00116 m_xOrigin->control()->setRange (-35.0f, 35.0f); 00117 m_zOrigin->control()->setRange (-35.0f, 35.0f); 00118 m_xLen->control()->setRange (0.01f, 35.0f); 00119 m_zLen->control()->setRange (0.01f, 35.0f); 00120 m_spacing->control()->setRange (1.0f, 35000.0f); 00121 00122 // add load and save buttons 00123 addButtons (); 00124 00125 // Space it up 00126 bottomLayout ()->addItem (new QSpacerItem (20, 20, 00127 QSizePolicy::Minimum, QSizePolicy::Expanding)); 00128 00129 state->put (s_key, this); 00130 }
Ig3DGridCategory::Ig3DGridCategory | ( | const Ig3DGridCategory & | ) | [private] |
Definition at line 133 of file Ig3DGridCategory.cc.
References reco::fitHelper::add(), IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), HLT_VtxMuL3::connect, m_defaultLoad, m_defaultSave, m_open, m_saveAs, openXMLFile(), openXMLFileDef(), saveXMLFile(), and saveXMLFileDef().
Referenced by Ig3DGridCategory().
00134 { 00135 m_saveAs = new QPushButton (bodyArea (), "m_saveAs"); 00136 m_open = new QPushButton (bodyArea (), "m_open"); 00137 00138 m_defaultSave = new QPushButton (bodyArea (), "m_defaultSave"); 00139 m_defaultLoad = new QPushButton (bodyArea (), "m_defaultLoad"); 00140 00141 const unsigned numRows = bodyLayout ()->numRows (); 00142 00143 bodyLayout()->addWidget (m_saveAs, numRows, 0); 00144 m_saveAs->setFixedSize (QSize (100, 30)); 00145 m_saveAs->setText ("Save Grids"); 00146 00147 bodyLayout()->addWidget (m_open, numRows, 1); 00148 m_open->setFixedSize (QSize (100, 30)); 00149 m_open->setText ("Load Grids"); 00150 00151 bodyLayout()->addWidget (m_defaultSave, numRows + 1 , 0); 00152 m_defaultSave->setFixedSize (QSize (150, 30)); 00153 m_defaultSave->setText ("Save as default"); 00154 00155 bodyLayout()->addWidget (m_defaultLoad, numRows + 1, 1); 00156 m_defaultLoad->setFixedSize (QSize (150, 30)); 00157 m_defaultLoad->setText ("Load default"); 00158 00159 connect (m_saveAs, SIGNAL (clicked ()), this, SLOT (saveXMLFile ())); 00160 connect (m_open, SIGNAL (clicked ()), this, SLOT (openXMLFile ())); 00161 connect (m_defaultSave, SIGNAL (clicked ()), this, SLOT (saveXMLFileDef ())); 00162 connect (m_defaultLoad, SIGNAL (clicked ()), this, SLOT (openXMLFileDef ())); 00163 00164 QWhatsThis::add (m_saveAs, tr ("Save the grid plane configuration.")); 00165 QWhatsThis::add (m_open, tr ("Load a grid plane configruation.")); 00166 QWhatsThis::add (m_defaultSave, tr ("Save the grid plane configuration as default.")); 00167 QWhatsThis::add (m_defaultLoad, tr ("Load the default grid plane configruation.")); 00168 }
DOMNode * Ig3DGridCategory::addTextNodeWithValue | ( | DOMNode * | parent, | |
const char * | tagname, | |||
const XMLCh * | stringValue | |||
) | [private] |
Definition at line 415 of file Ig3DGridCategory.cc.
References ASSERT, m_doc, prof2calltree::node, and transcode().
Referenced by buildGridPlaneTree(), and buildGridTree().
00416 { 00417 ASSERT (m_doc && "m_doc must be initialized before using it!"); 00418 DOMNode* node = m_doc->createElement (XMLString::transcode (tagname)); 00419 node->setTextContent (stringValue); 00420 parent->appendChild (node); 00421 return node; 00422 }
Definition at line 171 of file Ig3DGridCategory.cc.
References reco::fitHelper::add(), Ig3DPlaneControl::axisRotationControl(), Ig3DRangeControl< C1, C2, C3 >::control(), Ig3DPlaneControl::distanceControl(), m_color, m_labelColor, m_manip, m_on, m_plane, m_spacing, m_xLen, m_xOrigin, m_zLen, m_zOrigin, IgControlCategory::panel(), Ig3DColorControl::widget(), IgQtRangeControlCommon::widget(), Ig3DBoolControl::widget(), Ig3DAxisRotationControl::xWidget(), Ig3DAxisRotationControl::yWidget(), and Ig3DAxisRotationControl::zWidget().
Referenced by Ig3DGridCategory().
00172 { 00173 QWhatsThis::add (panel (), "3D Grid-Plane Category"); 00174 QWhatsThis::add (m_plane->axisRotationControl ()->xWidget(), 00175 "Rotate 3D Grid Plane around X-axis."); 00176 QWhatsThis::add (m_plane->axisRotationControl ()->yWidget(), 00177 "Rotate 3D Grid Plane around Y-axis."); 00178 QWhatsThis::add (m_plane->axisRotationControl ()->zWidget(), 00179 "Rotate 3D Grid Plane around Z-axis."); 00180 QWhatsThis::add (m_plane->distanceControl ()->control ()->widget (), 00181 "y-coordinate distance of 3D Grid Plane from origin"); 00182 QWhatsThis::add (m_xOrigin->control ()->widget (), "Move the grid plane's origin in x direction."); 00183 QWhatsThis::add (m_zOrigin->control ()->widget (), "Move the grid plane's origin in z direction."); 00184 QWhatsThis::add (m_xLen->control ()->widget (), "Change the Grid Plane's width."); 00185 QWhatsThis::add (m_zLen->control ()->widget (), "Change the Grid Plane's height."); 00186 QWhatsThis::add (m_spacing->control ()->widget (), "Change the partition count of the Grid Plane"); 00187 QWhatsThis::add (m_on->widget (), "Activate/deactivate 3D Grid Plane"); 00188 QWhatsThis::add (m_color->widget (), "Color of the grid"); 00189 QWhatsThis::add (m_labelColor->widget (), "Color of the Grid Plane scale labels"); 00190 QWhatsThis::add (m_manip-> widget (), "Trun on/off the 3D Grid Plane's manipulator"); 00191 }
Reimplemented from IgControlCategory.
Definition at line 654 of file Ig3DGridCategory.cc.
References IgControlBase::apply(), m_color, m_labelColor, m_manip, m_on, m_plane, m_spacing, m_xLen, m_xOrigin, m_zLen, and m_zOrigin.
00655 { 00656 m_plane->apply (); 00657 m_xOrigin->apply (); 00658 m_zOrigin->apply (); 00659 m_xLen->apply (); 00660 m_zLen->apply (); 00661 m_spacing->apply (); 00662 m_on->apply (); 00663 m_color->apply (); 00664 m_labelColor->apply (); 00665 m_manip->apply (); 00666 }
Reimplemented from IgControlCategory.
Definition at line 607 of file Ig3DGridCategory.cc.
References IgSoGridPlane::color, IgControlCategory::currentItem(), IgSoGridPlane::labelColor, m_color, m_labelColor, m_manip, m_on, m_plane, m_spacing, m_xLen, m_xOrigin, m_zLen, m_zOrigin, IgSoGridPlane::manip, VarParsing::obj, Ig3DObjectCategory< IgSoGridPlane >::object(), IgSoGridPlane::on, IgSoGridPlane::plane, Ig3DPlaneControl::setField(), Ig3DBoolControl::setField(), Ig3DRangeControl< C1, C2, C3 >::setField(), Ig3DColorControl::setField(), IgSoGridPlane::spacing, IgSoGridPlane::xLen, IgSoGridPlane::xOrigin, IgSoGridPlane::zLen, and IgSoGridPlane::zOrigin.
Referenced by reconstruct().
00608 { 00609 IgSoGridPlane* obj = object (currentItem ()); 00610 m_plane->setField (&obj->plane); 00611 m_xOrigin->setField (&obj->xOrigin); 00612 m_zOrigin->setField (&obj->zOrigin); 00613 m_xLen->setField (&obj->xLen); 00614 m_xLen->setField (&obj->xLen); 00615 m_zLen->setField (&obj->zLen); 00616 m_spacing->setField (&obj->spacing); 00617 m_on->setField (&obj->on); 00618 m_color->setField (&obj->color); 00619 m_labelColor->setField (&obj->labelColor); 00620 m_manip->setField (&obj->manip); 00621 }
void Ig3DGridCategory::browserChanged | ( | Ig3DBaseBrowser * | browser | ) |
Definition at line 1043 of file Ig3DGridCategory.cc.
References m_source, and reconstruct().
Referenced by registerBrowser().
01044 { 01045 m_source = browser; 01046 reconstruct (); 01047 }
Definition at line 835 of file Ig3DGridCategory.cc.
References Ig3DBaseModel::attachPoint(), m_source, makeGrid(), Ig3DBaseBrowser::model(), name, VarParsing::obj, repActiveGrids(), repAllGrids(), and pydbsAccessor::root.
Referenced by reconstruct().
00836 { 00837 QString name ("Full Grid Plane"); 00838 IgSoGridPlane* obj = makeGrid (name, false, SbVec3f (0, 0, 0)); 00839 Ig3DBaseRep* root = m_source->model ()->attachPoint (); 00840 00841 repAllGrids (root, true)->addChild (obj); 00842 repActiveGrids (root, true)->addChild (obj); 00843 add (obj, true); 00844 }
void Ig3DGridCategory::buildGridPlaneTree | ( | DOMNode * | gridPlane | ) | [private] |
Definition at line 387 of file Ig3DGridCategory.cc.
References addTextNodeWithValue(), buildGridTree(), edm::getName(), i, m_doc, Ig3DObjectCategory< IgSoGridPlane >::objects(), and transcode().
Referenced by saveXMLFile().
00388 { 00389 if (gridPlane) 00390 { 00391 // build the grid tree, first child is 'all' 00392 DOMNode* n_all = m_doc->createElement (XMLString::transcode (TAG_ALL)); 00393 gridPlane->appendChild (n_all); 00394 00395 // within 'all' we have numGrids of grid children 00396 const unsigned numGrids = objects (); 00397 for (unsigned i = 0; i < numGrids; i++) 00398 { 00399 buildGridTree (n_all, i); 00400 } 00401 00402 // second child is 'active' 00403 DOMNode* n_active = m_doc->createElement (XMLString::transcode (TAG_ACTIVE)); 00404 gridPlane->appendChild (n_active); 00405 00406 //within active we have numGrids of name children 00407 for (unsigned i = 0; i < numGrids; i++) 00408 { 00409 addTextNodeWithValue (n_active, TAG_NAME, XMLString::transcode (object (i)->getName ())); 00410 } 00411 } 00412 }
void Ig3DGridCategory::buildGridTree | ( | DOMNode * | node, | |
unsigned | gridID | |||
) | [private] |
Definition at line 425 of file Ig3DGridCategory.cc.
References addTextNodeWithValue(), IgSoGridPlane::color, IgSoGridPlane::labelColor, m_doc, VarParsing::obj, Ig3DObjectCategory< IgSoGridPlane >::object(), IgSoGridPlane::on, IgSoGridPlane::plane, IgSoGridPlane::spacing, toChar(), transcode(), IgSoGridPlane::xLen, IgSoGridPlane::xOrigin, IgSoGridPlane::zLen, and IgSoGridPlane::zOrigin.
Referenced by buildGridPlaneTree().
00426 { 00427 // get the object in order to read its properties 00428 IgSoGridPlane* obj = object (gridID); 00429 00430 // build the dom tree with values 00431 DOMNode* n_grid = m_doc->createElement (XMLString::transcode (TAG_GRID)); 00432 node->appendChild (n_grid); 00433 00434 addTextNodeWithValue (n_grid, TAG_NAME, XMLString::transcode (obj->getName ())); 00435 00436 DOMNode* n_plane = m_doc->createElement (XMLString::transcode (TAG_PLANE)); 00437 n_grid->appendChild (n_plane); 00438 00439 DOMNode* n_vector = m_doc->createElement (XMLString::transcode (TAG_VECTOR)); 00440 n_plane->appendChild (n_vector); 00441 00442 SbPlane tempPlane = obj->plane.getValue (); 00443 addTextNodeWithValue (n_vector, TAG_X, toChar (tempPlane.getNormal ()[0])); 00444 addTextNodeWithValue (n_vector, TAG_Y, toChar (tempPlane.getNormal ()[1])); 00445 addTextNodeWithValue (n_vector, TAG_Z, toChar (tempPlane.getNormal ()[2])); 00446 00447 addTextNodeWithValue (n_plane, TAG_DISTANCE, toChar (tempPlane.getDistanceFromOrigin ())); 00448 addTextNodeWithValue (n_grid, TAG_XORIGIN, toChar (obj->xOrigin.getValue ())); 00449 addTextNodeWithValue (n_grid, TAG_ZORIGIN, toChar (obj->zOrigin.getValue ())); 00450 addTextNodeWithValue (n_grid, TAG_WIDTH, toChar (obj->xLen.getValue ())); 00451 addTextNodeWithValue (n_grid, TAG_HEIGHT, toChar (obj->zLen.getValue ())); 00452 addTextNodeWithValue (n_grid, TAG_SPACING, toChar (obj->spacing.getValue ())); 00453 addTextNodeWithValue (n_grid, TAG_ON, (obj->on.getValue () ? XMLString::transcode ("true") : XMLString::transcode ("false"))); 00454 00455 DOMNode* n_color = m_doc->createElement (XMLString::transcode (TAG_COLOR)); 00456 n_grid->appendChild (n_color); 00457 00458 n_vector = m_doc->createElement (XMLString::transcode (TAG_VECTOR)); 00459 n_color->appendChild (n_vector); 00460 00461 addTextNodeWithValue (n_vector, TAG_X, toChar (obj->color.getValue ()[0])); 00462 addTextNodeWithValue (n_vector, TAG_Y, toChar (obj->color.getValue ()[1])); 00463 addTextNodeWithValue (n_vector, TAG_Z, toChar (obj->color.getValue ()[2])); 00464 DOMNode* n_labColor = m_doc->createElement (XMLString::transcode (TAG_LABCOLOR)); 00465 n_grid->appendChild (n_labColor); 00466 00467 n_vector = m_doc->createElement (XMLString::transcode (TAG_VECTOR)); 00468 n_labColor->appendChild (n_vector); 00469 00470 addTextNodeWithValue (n_vector, TAG_X, toChar (obj->labelColor.getValue ()[0])); 00471 addTextNodeWithValue (n_vector, TAG_Y, toChar (obj->labelColor.getValue ()[1])); 00472 addTextNodeWithValue (n_vector, TAG_Z, toChar (obj->labelColor.getValue ()[2])); 00473 }
Reimplemented from IgControlCategory.
Definition at line 887 of file Ig3DGridCategory.cc.
References IgControlCategory::itemChanged(), IgControlCategory::items(), makeOne(), and IgControlCategory::setCurrentItem().
00888 { 00889 bool isMade = makeOne (); 00890 if (isMade) 00891 { 00892 setCurrentItem (items ()-1); 00893 itemChanged (-1); 00894 } 00895 }
Reimplemented from IgControlCategory.
Definition at line 898 of file Ig3DGridCategory.cc.
References deleteOne().
00899 { deleteOne (); }
Definition at line 1001 of file Ig3DGridCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), IgControlCategory::currentItem(), detach(), i, m_source, Ig3DBaseBrowser::model(), VarParsing::obj, Ig3DObjectCategory< IgSoGridPlane >::object(), dbtoconf::parent, pydbsAccessor::root, TRUE, and VERIFY.
Referenced by deleteItem().
01002 { 01003 // Search for the object in all reps below the root and remove it. 01004 int current = currentItem (); 01005 Ig3DBaseRep* root = m_source->model ()->attachPoint (); 01006 IgSoGridPlane* obj = object (current); 01007 01008 SoPath* location; 01009 SoSearchAction searcher; 01010 01011 searcher.setNode (obj); 01012 searcher.setInterest (SoSearchAction::ALL); 01013 searcher.setSearchingAll (TRUE); 01014 searcher.apply (root); 01015 01016 for (int i = 0; i < searcher.getPaths ().getLength (); ++i) 01017 { 01018 VERIFY (location = searcher.getPaths () [i]); 01019 ASSERT (location->getLength () >= 2); 01020 SoNode* parent = location->getNode (location->getLength () - 2); 01021 ASSERT (parent->isOfType (SoGroup::getClassTypeId ())); 01022 static_cast<SoGroup *> (parent)->removeChild (obj); 01023 } 01024 01025 detach (); 01026 remove (current); 01027 }
Reimplemented from IgControlCategory.
Definition at line 624 of file Ig3DGridCategory.cc.
References m_color, m_labelColor, m_manip, m_on, m_plane, m_spacing, m_xLen, m_xOrigin, m_zLen, m_zOrigin, Ig3DPlaneControl::setField(), Ig3DBoolControl::setField(), Ig3DRangeControl< C1, C2, C3 >::setField(), and Ig3DColorControl::setField().
Referenced by deleteOne(), and reconstruct().
00625 { 00626 m_plane->setField (0); 00627 m_xOrigin->setField (0); 00628 m_zOrigin->setField (0); 00629 m_xLen->setField (0); 00630 m_zLen->setField (0); 00631 m_spacing->setField (0); 00632 m_on->setField (0); 00633 m_color->setField (0); 00634 m_labelColor->setField (0); 00635 m_manip->setField (0); 00636 }
SoNode* Ig3DGridCategory::findFather | ( | SoNode * | node, | |
SoNode * | father, | |||
const char * | name, | |||
int & | child | |||
) | [private] |
DOMNode * Ig3DGridCategory::getGridPlaneReady | ( | DOMNode * | root, | |
DOMImplementation * | impl | |||
) | [private] |
Definition at line 339 of file Ig3DGridCategory.cc.
References IgXMLReader::getOneElementByTagName(), m_doc, removeAllChildren(), and transcode().
Referenced by saveXMLFile().
00340 { 00341 DOMNode* gridPlanes = 0; 00342 00343 // see if root exists and if its tag equals to 'application', if not the document 00344 // is overwritten 00345 if (root && XMLString::equals (root->getNodeName (), XMLString::transcode (TAG_APPLICATION))) 00346 { 00347 // see if the gridplane tag already exists, if so, delete it's children since 00348 // we are updating, if not, create it. by doing so we dont touch any siblings 00349 // of gridplanes in case there will be some additional tags in the future 00350 gridPlanes = IgXMLReader::getOneElementByTagName (root, XMLString::transcode (TAG_GRIDPLANES)); 00351 if (gridPlanes) 00352 { 00353 removeAllChildren (gridPlanes); 00354 } 00355 else 00356 { 00357 gridPlanes = m_doc->createElement (XMLString::transcode (TAG_GRIDPLANES)); 00358 root->appendChild (gridPlanes); 00359 } 00360 } 00361 else 00362 { 00363 m_doc = impl->createDocument (); 00364 m_doc->setEncoding (XMLString::transcode ("UTF-8")); 00365 m_doc->setVersion (XMLString::transcode ("1.0")); 00366 00367 root = m_doc->createElement (XMLString::transcode (TAG_APPLICATION)); 00368 gridPlanes = m_doc->createElement (XMLString::transcode (TAG_GRIDPLANES)); 00369 root->appendChild (gridPlanes); 00370 m_doc->appendChild (root); 00371 } 00372 return gridPlanes; 00373 }
SoGroup * Ig3DGridCategory::getParent | ( | SoNode * | node, | |
SoNode * | root | |||
) | [private] |
Definition at line 590 of file Ig3DGridCategory.cc.
References p.
Referenced by openIVFile().
00591 { 00592 // works only with one parent 00593 SoSearchAction sa; 00594 sa.setNode (node); 00595 sa.setInterest (SoSearchAction::FIRST); 00596 sa.apply (root); 00597 SoPath * p = sa.getPath (); 00598 assert (p && "father not found"); 00599 if (p->getLength () < 2) 00600 { 00601 return 0; // no parent 00602 } 00603 return (SoGroup *)p->getNodeFromTail (1); 00604 }
DOMNode * Ig3DGridCategory::getRootOfXMLDoc | ( | QString | fileName | ) | [private] |
Definition at line 510 of file Ig3DGridCategory.cc.
References m_doc, IgXMLReader::read(), and pydbsAccessor::root.
Referenced by openXMLFile(), and saveXMLFile().
00511 { 00512 // open the provided XMLFile 00513 IgXMLReader* reader = new IgXMLReader (); 00514 00515 // get domdocument 00516 m_doc = reader->read (std::string (filename.ascii ())); 00517 00518 // get root 00519 DOMNode* root = 0; 00520 if (m_doc) 00521 { 00522 root = m_doc->getFirstChild (); 00523 while (root && root->getNodeType () != DOMNode::ELEMENT_NODE) 00524 { 00525 root = root->getNextSibling (); 00526 } 00527 } 00528 return root; 00529 }
Ig3DGridCategory::IG_DECLARE_STATE_ELEMENT | ( | Ig3DGridCategory | ) | [private] |
bool Ig3DGridCategory::makeCustomGrids | ( | std::vector< std::string > & | textList | ) | [private] |
Definition at line 798 of file Ig3DGridCategory.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), i, j, and makeCustomOne().
Referenced by openXMLFile().
00799 { 00800 // please change tagCount if you add something to the GridPlane tags 00801 const unsigned textSize = textList.size (); 00802 const unsigned nbrGrids = textSize / tagCount; 00803 bool areMade = true; 00804 00805 //detach (); 00806 // remove all traces of old grids 00807 //clear (); 00808 //removeGrids (); 00809 00810 if (tagCount * nbrGrids == textSize) 00811 { 00812 for (unsigned i = 0; i < nbrGrids; i++) 00813 { 00814 // copy first grids tags into a new vector which is to be passed 00815 std::vector<std::string> gridTags; 00816 for (unsigned j = 0; j < tagCount; j++) 00817 { 00818 gridTags.push_back (textList[i * tagCount + j]); 00819 } 00820 00821 // if one of them fails, all fail. 00822 areMade = areMade && makeCustomOne (gridTags); 00823 } 00824 } 00825 else 00826 { 00827 std::cerr << "Wrong number of tags in XMLFile! Check tagCount or XMLFile!" << std::endl; 00828 areMade = false; 00829 } 00830 return areMade; 00831 }
bool Ig3DGridCategory::makeCustomOne | ( | std::vector< std::string > & | textList | ) | [private] |
Definition at line 962 of file Ig3DGridCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), IgXMLReader::getBool(), IgXMLReader::getFloat(), m_source, Ig3DBaseRep::magic(), makeGrid(), Ig3DBaseBrowser::model(), Ig3DBaseRep::node(), VarParsing::obj, repActiveGrids(), repAllGrids(), and pydbsAccessor::root.
Referenced by makeCustomGrids().
00963 { 00964 Ig3DBaseRep* root = m_source->model ()->attachPoint (); 00965 bool isMade = false; 00966 ASSERT (root && "root == 0!"); 00967 ASSERT (root->node () && "root->node () == 0!"); 00968 ASSERT (root->magic () && "root->magic () == 0!"); 00969 00970 // cast the strings from textList 00971 QString t_name (textList[0]); 00972 SbPlane t_plane (SbVec3f (IgXMLReader::getFloat (textList[1]), 00973 IgXMLReader::getFloat (textList[2]), 00974 IgXMLReader::getFloat (textList[3])), 00975 IgXMLReader::getFloat (textList[4])); 00976 float t_xOrig = IgXMLReader::getFloat (textList[5]); 00977 float t_zOrig = IgXMLReader::getFloat (textList[6]); 00978 float t_xLen = IgXMLReader::getFloat (textList[7]); 00979 float t_zLen = IgXMLReader::getFloat (textList[8]); 00980 float t_spacing = IgXMLReader::getFloat (textList[9]); 00981 bool t_on = IgXMLReader::getBool (textList[10]); 00982 SbVec3f t_color (IgXMLReader::getFloat (textList[11]), 00983 IgXMLReader::getFloat (textList[12]), 00984 IgXMLReader::getFloat (textList[13])); 00985 SbVec3f t_labColor (IgXMLReader::getFloat (textList[14]), 00986 IgXMLReader::getFloat (textList[15]), 00987 IgXMLReader::getFloat (textList[16])); 00988 00989 IgSoGridPlane* obj = makeGrid (t_name, t_plane, t_xOrig, t_zOrig, t_xLen, t_zLen, t_spacing, t_on, t_color, t_labColor); 00990 00991 // add the new loaded grids 00992 repAllGrids (root, true)->addChild (obj); 00993 repActiveGrids (root, true)->addChild (obj); 00994 00995 add (obj, true); 00996 return isMade = true; 00997 }
IgSoGridPlane * Ig3DGridCategory::makeGrid | ( | QString | name, | |
SbPlane | plane, | |||
float | xOrig, | |||
float | zOrig, | |||
float | xLen, | |||
float | zLen, | |||
float | spacing, | |||
bool | on, | |||
SbVec3f | color, | |||
SbVec3f | labColor | |||
) | [private] |
Definition at line 779 of file Ig3DGridCategory.cc.
References IgSoGridPlane::color, Ig3DBaseModel::encode(), IgSoGridPlane::labelColor, VarParsing::obj, IgSoGridPlane::on, IgSoGridPlane::plane, IgSoGridPlane::spacing, IgSoGridPlane::xLen, IgSoGridPlane::xOrigin, IgSoGridPlane::zLen, and IgSoGridPlane::zOrigin.
00782 { 00783 IgSoGridPlane* obj = new IgSoGridPlane; 00784 obj->setName (Ig3DBaseModel::encode (name.utf8 ().data ())); 00785 obj->plane = plane; 00786 obj->xOrigin = xOrig; 00787 obj->zOrigin = zOrig; 00788 obj->xLen = xLen; 00789 obj->zLen = zLen; 00790 obj->spacing = spacing; 00791 obj->on = on; 00792 obj->color = color; 00793 obj->labelColor = labColor; 00794 return obj; 00795 }
IgSoGridPlane * Ig3DGridCategory::makeGrid | ( | QString | name, | |
bool | on, | |||
SbVec3f | center | |||
) | [private] |
Definition at line 767 of file Ig3DGridCategory.cc.
References dot(), Ig3DBaseModel::encode(), VarParsing::obj, IgSoGridPlane::on, and IgSoGridPlane::plane.
Referenced by buildDefaults(), makeCustomOne(), and makeOne().
00768 { 00769 // Define the grid plane normal as -X axis translated by `center' 00770 // (i.e. distance by dot product of `center' and -X axis). 00771 IgSoGridPlane* obj = new IgSoGridPlane; 00772 obj->setName (Ig3DBaseModel::encode (name.utf8 ().data ())); 00773 obj->plane = SbPlane (SbVec3f (0,1,0), SbVec3f (0,1,0).dot (center)); 00774 obj->on = on; 00775 return obj; 00776 }
Definition at line 916 of file Ig3DGridCategory.cc.
References Ig3DBaseModel::attachPoint(), m_source, and Ig3DBaseBrowser::model().
Referenced by createNewItem().
00917 { return makeOne (m_source->model ()->attachPoint ());}
bool Ig3DGridCategory::makeOne | ( | Ig3DBaseRep * | rep | ) |
Definition at line 920 of file Ig3DGridCategory.cc.
References arg, ASSERT, Ig3DBaseModel::attachPoint(), pyDBSguiBaseClass::base, Ig3DBaseModel::decode(), m_source, Ig3DBaseRep::magic(), makeGrid(), Ig3DBaseBrowser::model(), name, Ig3DBaseRep::node(), edm::Normal, VarParsing::obj, IgControlCategory::panel(), prof2calltree::prefix, repActiveGrids(), repAllGrids(), and pydbsAccessor::root.
00921 { 00922 bool isMade = false; 00923 ASSERT (rep); 00924 ASSERT (rep->node ()); 00925 ASSERT (rep->magic ()); 00926 00927 // Build the base name looking at the number of grids first by 00928 // the node's own name, and failing that, the generic name. Make 00929 // names unique by counting slicers in that particular rep. 00930 bool ok = false; 00931 SoGroup* active = repActiveGrids (rep, false); 00932 int ngrids = active ? active->getNumChildren () : 0; 00933 QString prefix (!! rep->node ()->getName () 00934 ? (Ig3DBaseModel::decode (rep->node()->getName()).c_str ()) 00935 : "Grid Plane"); 00936 QString base (ngrids ? (prefix + " #%1").arg (ngrids + 1) : prefix); 00937 QString name (QInputDialog::getText (tr ("Name"), QString::null, 00938 QLineEdit::Normal,base,&ok, panel ())); 00939 00940 if (! ok || name.isEmpty ()) 00941 return isMade; 00942 00943 // OK to construct the grid plane: do so. Use object's bounding 00944 // box center to place the grid plane. 00945 SoGetBoundingBoxAction bba (m_source->getViewportRegion ()); 00946 SoSearchAction sa; 00947 Ig3DBaseRep* root = m_source->model ()->attachPoint (); 00948 00949 sa.setNode (rep); 00950 sa.apply (root); 00951 ASSERT (sa.getPath ()); 00952 bba.apply (sa.getPath ()); 00953 00954 IgSoGridPlane* obj = makeGrid (name, true, bba.getCenter ()); 00955 repAllGrids (root, true)->addChild (obj); 00956 repActiveGrids (rep, true)->addChild (obj); 00957 add (obj, true); 00958 return isMade = true; 00959 }
Definition at line 486 of file Ig3DGridCategory.cc.
References Ig3DBaseModel::attachPoint(), Ig3DBaseModel::encode(), Ig3DBaseBrowser::findGroup(), getParent(), getString(), m_source, Ig3DBaseBrowser::model(), prof2calltree::node, Ig3DBaseBrowser::openNode(), and reconstruct().
00487 { 00488 SoGroup* node = dynamic_cast<SoGroup*> (m_source->openNode ( 00489 Ig3DBaseModel::encode("Grid Planes").getString (), 00490 "Select Grid Planes to load", 00491 m_source->getShellWidget ())); 00492 00493 if (node) 00494 { 00495 SoGroup* gridPlanes = dynamic_cast<SoGroup*> (Ig3DBaseBrowser::findGroup ( 00496 m_source->model ()->attachPoint (), 00497 Ig3DBaseModel::encode ("Grid Planes").getString ())); 00498 00499 SoGroup* father = getParent (gridPlanes, m_source->model ()->attachPoint ()); 00500 00501 unsigned childNum = father->findChild (gridPlanes); 00502 father->removeChild (gridPlanes); 00503 father->insertChild (node, childNum); 00504 00505 reconstruct (); 00506 } 00507 }
void Ig3DGridCategory::openXMLFile | ( | const char * | def = 0 |
) | [private, virtual, slot] |
Definition at line 532 of file Ig3DGridCategory.cc.
References EgammaValidation_cff::filename, IgXMLReader::getOneElementByTagName(), getRootOfXMLDoc(), iguanaConfig, IgControlCategory::itemChanged(), IgControlCategory::items(), makeCustomGrids(), IgXMLReader::retrieveTexts(), pydbsAccessor::root, IgControlCategory::setCurrentItem(), and transcode().
Referenced by addButtons(), and openXMLFileDef().
00533 { 00534 QString filename; 00535 if (def) 00536 { 00537 filename = iguanaConfig; 00538 } 00539 else 00540 { 00541 // ask user to provide file (path) 00542 filename = 00543 QFileDialog::getOpenFileName ("./", 00544 "XML files (*.xml)", 00545 0, // this? 00546 "Open file dialog", 00547 "Choose a file"); 00548 } 00549 if (filename != QString::null && !filename.isEmpty ()) 00550 { 00551 DOMNode* root; 00552 root = getRootOfXMLDoc (filename); 00553 00554 // find 'grid_planes' node and within it, the 'all' node. By first looking 00555 // for grid_planes we make sure, that we even have that tag 00556 DOMNode* gridPlanes = 0; 00557 DOMNode* all_node = 0; 00558 gridPlanes = IgXMLReader::getOneElementByTagName (root, XMLString::transcode (TAG_GRIDPLANES)); 00559 if (gridPlanes) 00560 { 00561 all_node = IgXMLReader::getOneElementByTagName (gridPlanes, XMLString::transcode (TAG_ALL)); 00562 } 00563 00564 // read the values 00565 if (all_node) 00566 { 00567 std::vector<std::string> textList; 00568 00569 // read nodes' values and put them into a vector 00570 IgXMLReader::retrieveTexts (all_node, textList, true); 00571 00572 // use that vector to generate custom grids 00573 bool isMade = makeCustomGrids (textList); 00574 if (isMade) 00575 { 00576 setCurrentItem (items ()-1); 00577 itemChanged (-1); 00578 } 00579 } 00580 } 00581 }
Definition at line 584 of file Ig3DGridCategory.cc.
References openXMLFile().
Referenced by addButtons().
00585 { 00586 openXMLFile ("default"); 00587 }
Ig3DGridCategory& Ig3DGridCategory::operator= | ( | const Ig3DGridCategory & | ) | [private] |
void Ig3DGridCategory::reconstruct | ( | SoGroup * | from | ) | [private] |
Definition at line 867 of file Ig3DGridCategory.cc.
References ASSERT, attach(), IgControlCategory::currentItem(), detach(), i, n, prof2calltree::node, and update().
00868 { 00869 for (int i = 0, n = from->getNumChildren (); i < n; ++i) 00870 { 00871 ASSERT (from->getChild(i)->isOfType(IgSoGridPlane::getClassTypeId())); 00872 IgSoGridPlane* node = static_cast<IgSoGridPlane *>(from->getChild(i)); 00873 add (node, true); 00874 } 00875 00876 detach (); 00877 00878 if (object (currentItem ())) 00879 { 00880 attach (); 00881 update (); 00882 } 00883 }
void Ig3DGridCategory::reconstruct | ( | SoSwitch * | from | ) |
Definition at line 847 of file Ig3DGridCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), buildDefaults(), Ig3DObjectCategory< IgSoGridPlane >::clear(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_source, Ig3DBaseBrowser::model(), and s_group.
Referenced by browserChanged(), and openIVFile().
00848 { 00849 ASSERT (m_source); 00850 SoGroup* group = dynamic_cast<SoGroup *>( 00851 m_source->model ()->attachPoint ()->findMagic ( 00852 Ig3DBaseModel::encode (s_group))); 00853 clear (); 00854 00855 if (group) 00856 { 00857 ASSERT (group->getChild (0)->isOfType(SoGroup::getClassTypeId())); 00858 reconstruct (static_cast <SoGroup *>(group->getChild (0))); 00859 } 00860 else 00861 { 00862 buildDefaults (); 00863 } 00864 }
void Ig3DGridCategory::registerBrowser | ( | IgState * | state, | |
Ig3DBaseBrowser * | browser | |||
) | [virtual] |
Reimplemented from Ig3DObjectCategory< IgSoGridPlane >.
Definition at line 1031 of file Ig3DGridCategory.cc.
References IgQtAppContextService::addOnFocusIn(), ASSERT, browserChanged(), lat::CreateCallback(), DBSPlugin::get(), and IgControlCategory::registerMe().
Referenced by Ig3DWindow::initCategories().
01032 { 01033 IgQtAppContextService* cs = IgQtAppContextService::get (state); 01034 ASSERT (cs); 01035 cs->addOnFocusIn (lat::CreateCallback (this, 01036 &Ig3DGridCategory::browserChanged, 01037 browser)); 01038 IgControlCategory::registerMe (state); 01039 }
void Ig3DGridCategory::removeAllChildren | ( | DOMNode * | node | ) | [private] |
Definition at line 376 of file Ig3DGridCategory.cc.
Referenced by getGridPlaneReady().
00377 { 00378 // remove children if any 00379 while (node && node->hasChildNodes ()) 00380 { 00381 DOMNode* child = node->getFirstChild (); 00382 node->removeChild (child); 00383 } 00384 }
Definition at line 670 of file Ig3DGridCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), Ig3DBaseModel::encode(), edm::getName(), i, m_source, Ig3DBaseBrowser::model(), and s_group.
00671 { 00672 SoSwitch* grids = 0; 00673 SoNode* child; 00674 SoGroup* magic; 00675 magic = m_source->model ()->attachPoint ()-> magic (); 00676 00677 for (int i = 0; i < magic->getNumChildren () && !grids; ++i) 00678 { 00679 if ((child = magic->getChild (i))->getName () 00680 == SbName (Ig3DBaseModel::encode (s_group))) 00681 { 00682 ASSERT (child->isOfType (SoSwitch::getClassTypeId ())); 00683 grids = static_cast<SoSwitch *> (child); 00684 } 00685 } 00686 // remove 'all' and 'actives' 00687 if (grids) 00688 grids->removeAllChildren (); 00689 }
void Ig3DGridCategory::renameItem | ( | const QString & | newName | ) | [protected, virtual] |
Reimplemented from IgControlCategory.
Definition at line 902 of file Ig3DGridCategory.cc.
References IgControlCategory::currentItem(), IgControlCategory::currentText(), Ig3DBaseModel::decode(), edm::getName(), Ig3DObjectCategory< IgSoGridPlane >::rename(), and IgControlCategory::renameItem().
00903 { 00904 int current = currentItem (); 00905 QString oldName (Ig3DBaseModel::decode(object (current)->getName ()).c_str ()); 00906 00907 if (!newName.isEmpty() && newName != oldName) 00908 { 00909 IgControlCategory:: renameItem(newName); 00910 rename (current, currentText ()); 00911 } 00912 }
SoGroup * Ig3DGridCategory::repActiveGrids | ( | Ig3DBaseRep * | rep, | |
bool | make | |||
) | [private] |
Definition at line 749 of file Ig3DGridCategory.cc.
References Ig3DBaseRep::magic(), and repGrids().
Referenced by buildDefaults(), makeCustomOne(), and makeOne().
00750 { 00751 // Find the active grids group in the grids switch in rep's `magic()' 00752 SoGroup* active = 0; 00753 repGrids (rep->magic (), make, 0, &active); 00754 return active; 00755 }
SoGroup * Ig3DGridCategory::repAllGrids | ( | Ig3DBaseRep * | rep, | |
bool | make | |||
) | [private] |
Definition at line 758 of file Ig3DGridCategory.cc.
References Ig3DBaseRep::magic(), Ig3DObjectCategory< IgSoGridPlane >::objects(), and repGrids().
Referenced by buildDefaults(), makeCustomOne(), and makeOne().
00759 { 00760 // Find all grids group in the grids switch in rep's `magic()' 00761 SoGroup* objects = 0; 00762 repGrids (rep->magic (), make, &objects, 0); 00763 return objects; 00764 }
SoSwitch * Ig3DGridCategory::repGrids | ( | SoGroup * | magic, | |
bool | make, | |||
SoGroup ** | objects, | |||
SoGroup ** | active | |||
) | [private] |
Definition at line 693 of file Ig3DGridCategory.cc.
References ASSERT, Ig3DBaseModel::encode(), edm::getName(), i, s_active, s_all, and s_group.
Referenced by repActiveGrids(), and repAllGrids().
00696 { 00697 ASSERT (magic); 00698 00699 // Find the grid planes switch in `magic' 00700 SoSwitch* grids = 0; 00701 SoNode* child; 00702 00703 for (int i = 0; i < magic->getNumChildren () && !grids; ++i) 00704 { 00705 if ((child = magic->getChild (i))->getName () 00706 == SbName (Ig3DBaseModel::encode (s_group))) 00707 { 00708 ASSERT (child->isOfType (SoSwitch::getClassTypeId ())); 00709 grids = static_cast<SoSwitch *> (child); 00710 } 00711 } 00712 00713 // if the switch wasn't found before, create it 00714 if (!grids && make) 00715 { 00716 SoGroup* objs = new SoGroup; 00717 SoGroup* acts = new SoGroup; 00718 objs->setName (s_all); 00719 acts->setName (s_active); 00720 00721 grids = new SoSwitch; 00722 grids->setName (Ig3DBaseModel::encode (s_group)); 00723 grids->whichChild = 1; 00724 magic->addChild (grids); 00725 grids->addChild (objs); 00726 grids->addChild (acts); 00727 } 00728 00729 if (grids) 00730 { 00731 ASSERT (grids->whichChild.getValue () == 1); 00732 ASSERT (grids->getChild (0)->isOfType (SoGroup::getClassTypeId ())); 00733 ASSERT (grids->getChild (1)->isOfType (SoGroup::getClassTypeId ())); 00734 // ASSERT (active->getNumChildren () <= objects->getNumChildren ()); 00735 if (objects) 00736 { 00737 *objects = static_cast<SoGroup *> (grids->getChild (0)); 00738 } 00739 00740 if (active) 00741 { 00742 *active = static_cast<SoGroup *> (grids->getChild (1)); 00743 } 00744 } 00745 return grids; 00746 }
Definition at line 194 of file Ig3DGridCategory.cc.
References Ig3DBaseModel::attachPoint(), Ig3DBaseModel::encode(), Ig3DBaseBrowser::findGroup(), m_source, Ig3DBaseBrowser::model(), and Ig3DBaseBrowser::saveNode().
00195 { 00196 SoGroup* grid = dynamic_cast<SoGroup*> (Ig3DBaseBrowser::findGroup ( 00197 m_source->model ()->attachPoint (), 00198 Ig3DBaseModel::encode ("Grid Planes").getString ())); 00199 m_source->saveNode (grid, "Save Grids As...", m_source->getShellWidget () ); 00200 }
void Ig3DGridCategory::saveXMLFile | ( | const char * | def = 0 |
) | [private, virtual, slot] |
Definition at line 262 of file Ig3DGridCategory.cc.
References buildGridPlaneTree(), aod_PYTHIA_cfg::fileName, getGridPlaneReady(), getRootOfXMLDoc(), iguanaConfig, m_source, pydbsAccessor::root, savingXMLFileDialog(), and writeStringToFile().
Referenced by addButtons(), and saveXMLFileDef().
00263 { 00264 00265 QString fileName; 00266 00267 if (def) 00268 { // default save 00269 fileName = iguanaConfig; 00270 } 00271 else 00272 { // get the filename from the user 00273 fileName = savingXMLFileDialog ("Save Grids As...", m_source->getShellWidget ()); 00274 } 00275 00276 if (fileName && !fileName.isEmpty ()) 00277 { 00278 // read the file that was provided by the user and create an xml 00279 // tree if it's empty or else "update" the grid_planes subtree 00280 const XMLCh gLS[] = {chLatin_L, chLatin_S, chNull}; 00281 DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation (gLS); 00282 00283 DOMNode* root = 0; 00284 DOMNode* gridPlanes = 0; 00285 00286 // extract the root of the document, if any 00287 root = getRootOfXMLDoc (fileName); 00288 00289 // use the root to find the gridplanes if available, else create the tag 00290 gridPlanes = getGridPlaneReady (root, impl); 00291 00292 // use the gridplanes tag to add the remaining data to the xml tree 00293 buildGridPlaneTree (gridPlanes); 00294 00295 // serialize (write) the tree into the file 00296 writeStringToFile (fileName, impl); 00297 } 00298 }
Definition at line 301 of file Ig3DGridCategory.cc.
References saveXMLFile().
Referenced by addButtons().
00302 { 00303 saveXMLFile ("default"); 00304 }
QString Ig3DGridCategory::savingXMLFileDialog | ( | const QString & | title, | |
QWidget * | parent = 0 | |||
) | [private] |
Definition at line 203 of file Ig3DGridCategory.cc.
References warning.
Referenced by saveXMLFile().
00204 { 00205 QString tempFile = ""; 00206 QFileDialog dialog (QString::null, QString::null, parent, title, true); 00207 QString xml ("XML File (*.xml)"); 00208 QStringList filters (xml); 00209 dialog.setFilters (filters); 00210 dialog.setMode (QFileDialog::AnyFile); 00211 00212 bool tryagain = true; 00213 while (tryagain) 00214 { 00215 if (dialog.exec () != QDialog::Accepted) 00216 return false; 00217 00218 tempFile = dialog.selectedFile (); 00219 if (tempFile.isEmpty ()) 00220 return false; 00221 else 00222 { 00223 lat::Filename sealf (tempFile.latin1()); 00224 if (sealf.exists ()) 00225 { 00226 int button = QMessageBox::warning (parent, "File already exists", 00227 "File \""+tempFile+"\" already exists.\n" 00228 "Do you want to overwrite it?", 00229 "Yes", "No"); 00230 if (button == 0) 00231 { 00232 if (!sealf.isWritable ()) 00233 { 00234 int button = QMessageBox::warning (parent, "Access denied", 00235 "File \""+tempFile+"\" not write able.\n" 00236 "Do you want to select some other file?", 00237 "Yes", "No"); 00238 if (button == 1) 00239 return false; 00240 } 00241 else 00242 tryagain = false; 00243 } 00244 } 00245 else if (!lat::Filename(dialog.dirPath ().latin1()).isWritable ()) 00246 { 00247 int button = QMessageBox::warning (parent, "Access denied", 00248 "You do not have permissions to write in \""+dialog.dirPath ()+"\" directory.\n" 00249 "Do you want to select some other file?", 00250 "Yes", "No"); 00251 if (button == 1) 00252 return false; 00253 } 00254 else 00255 tryagain = false; 00256 } 00257 } 00258 return tempFile; 00259 }
const XMLCh * Ig3DGridCategory::toChar | ( | const T & | thing | ) | [inline, private] |
Definition at line 477 of file Ig3DGridCategory.cc.
References transcode().
Referenced by buildGridTree().
00478 { 00479 // conversion to XMLCh* 00480 std::ostringstream os; 00481 os << thing; 00482 return XMLString::transcode (os.str ().c_str ()); 00483 }
Reimplemented from IgControlCategory.
Definition at line 639 of file Ig3DGridCategory.cc.
References m_color, m_labelColor, m_manip, m_on, m_plane, m_spacing, m_xLen, m_xOrigin, m_zLen, m_zOrigin, and IgControlBase::update().
Referenced by reconstruct().
00640 { 00641 m_plane->update (); 00642 m_xOrigin->update (); 00643 m_zOrigin->update (); 00644 m_xLen->update (); 00645 m_zLen->update (); 00646 m_spacing->update (); 00647 m_on->update (); 00648 m_color->update (); 00649 m_labelColor->update (); 00650 m_manip->update (); 00651 }
void Ig3DGridCategory::writeStringToFile | ( | QString | fileName, | |
DOMImplementation * | impl | |||
) | [private] |
Definition at line 307 of file Ig3DGridCategory.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), m_doc, and transcode().
Referenced by saveXMLFile().
00308 { 00309 DOMWriter* theSerializer = ((DOMImplementationLS*) impl)->createDOMWriter (); 00310 //XMLFormatTarget *myFormTarget; 00311 //myFormTarget = new LocalFileFormatTarget (fileName.latin1 ()); 00312 00313 // set some features 00314 //FIXME add validation! 00315 if (theSerializer->canSetFeature (XMLUni::fgDOMXMLDeclaration, true)) 00316 theSerializer->setFeature (XMLUni::fgDOMXMLDeclaration, true); 00317 if (theSerializer->canSetFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true)) 00318 theSerializer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true); 00319 00320 std::ofstream fout (fileName.latin1 ()); 00321 try 00322 { 00323 // didn't use the writeNode because no immediate writing to file was 00324 // possible, only after closing the application 00325 fout << XMLString::transcode (theSerializer->writeToString (*m_doc)); 00326 fout.close (); 00327 // theSerializer->writeNode (myFormTarget, *m_doc); 00328 // myFormTarget->flush(); 00329 } 00330 catch (...) 00331 { 00332 std::cerr << "Could not save the config into the XMLFile!" << std::endl; 00333 } 00334 00335 theSerializer->release (); 00336 }
Ig3DColorControl* Ig3DGridCategory::m_color [private] |
QPushButton* Ig3DGridCategory::m_defaultLoad [private] |
QPushButton* Ig3DGridCategory::m_defaultSave [private] |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Ig3DGridCategory::m_doc [private] |
Definition at line 120 of file Ig3DGridCategory.h.
Referenced by addTextNodeWithValue(), buildGridPlaneTree(), buildGridTree(), getGridPlaneReady(), getRootOfXMLDoc(), and writeStringToFile().
Ig3DColorControl* Ig3DGridCategory::m_labelColor [private] |
Ig3DBoolControl* Ig3DGridCategory::m_manip [private] |
Ig3DBoolControl* Ig3DGridCategory::m_on [private] |
QPushButton* Ig3DGridCategory::m_open [private] |
Ig3DPlaneControl* Ig3DGridCategory::m_plane [private] |
QPushButton* Ig3DGridCategory::m_saveAs [private] |
Ig3DBaseBrowser* Ig3DGridCategory::m_source [private] |
Definition at line 105 of file Ig3DGridCategory.h.
Referenced by browserChanged(), buildDefaults(), deleteOne(), makeCustomOne(), makeOne(), openIVFile(), reconstruct(), removeGrids(), saveIVFile(), and saveXMLFile().
Ig3DFloatControl* Ig3DGridCategory::m_spacing [private] |
Definition at line 111 of file Ig3DGridCategory.h.
Referenced by addTips(), apply(), attach(), detach(), Ig3DGridCategory(), and update().
Ig3DFloatControl* Ig3DGridCategory::m_xLen [private] |
Definition at line 109 of file Ig3DGridCategory.h.
Referenced by addTips(), apply(), attach(), detach(), Ig3DGridCategory(), and update().
Ig3DFloatControl* Ig3DGridCategory::m_xOrigin [private] |
Definition at line 107 of file Ig3DGridCategory.h.
Referenced by addTips(), apply(), attach(), detach(), Ig3DGridCategory(), and update().
Ig3DFloatControl* Ig3DGridCategory::m_zLen [private] |
Definition at line 110 of file Ig3DGridCategory.h.
Referenced by addTips(), apply(), attach(), detach(), Ig3DGridCategory(), and update().
Ig3DFloatControl* Ig3DGridCategory::m_zOrigin [private] |
Definition at line 108 of file Ig3DGridCategory.h.
Referenced by addTips(), apply(), attach(), detach(), Ig3DGridCategory(), and update().
const char * Ig3DGridCategory::s_active = "Active" [static, private] |
const char * Ig3DGridCategory::s_all = "All" [static, private] |
const char * Ig3DGridCategory::s_group = "Grid Planes" [static, private] |
Definition at line 122 of file Ig3DGridCategory.h.
Referenced by reconstruct(), removeGrids(), and repGrids().