![]() |
![]() |
#include <Iguana/GLBrowsers/interface/Ig3DViewpointsCategory.h>
Definition at line 32 of file Ig3DViewpointsCategory.h.
Ig3DViewpointsCategory::Ig3DViewpointsCategory | ( | IgState * | state, | |
Ig3DBaseBrowser * | source | |||
) |
Definition at line 59 of file Ig3DViewpointsCategory.cc.
References reco::fitHelper::add(), alignToAxis(), ASSERT, autoClipping(), IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), IgControlCategory::bottomLayout(), IgControlItem::clean(), HLT_VtxMuL3::connect, Ig3DRangeControl< C1, C2, C3 >::control(), IgControlItem::dirty(), IgControlItem::editable(), Ig3DBaseModel::encode(), load(), m_alignment, m_aspectRatio, m_autoClipping, m_farDistance, m_focalDistance, m_group, m_nearDistance, m_source, m_zoom, IgControlItem::makeBox(), IgControlCategory::makeIndentedLabel(), makeOne(), IgControlItem::makeSpacedBox(), IgControlCategory::panel(), IgState::put(), row, save(), IgControlItem::setClean(), IgQtRangeControlFloat::setLongStep(), IgQtAxisAlignment::setMaxAxisAlign(), IgQtAxisAlignment::setMinAxisAlign(), IgQtRangeValue< T >::setMinValue(), IgQtRangeControlFloat::setSmallStep(), Ig3DFloatControl::setValue(), IgControlCategory::tracking(), updateCameraPosition(), IgQtRangeControlCommon::widget(), IgQtAxisAlignment::widget(), and zoom().
00061 : Ig3DObjectCategory<IgSoViewpoint> (state, "Viewpoints"), 00062 m_source (source), 00063 m_group (new SoGroup), 00064 m_previous (-1), 00065 m_orientation (new Ig3DCameraRotControl (this, "Orientation")), 00066 m_alignment (0), 00067 m_focalDistance (new Ig3DFloatControl (this, "Focal Distance", 00068 IgQtRangeControl::StepperPart 00069 | IgQtRangeControl::ValuePart 00070 | IgQtRangeControl::SliderPart)), 00071 m_aspectRatio (new Ig3DFloatControl (this, "Aspect Ratio", 00072 IgQtRangeControl::StepperPart 00073 | IgQtRangeControl::ValuePart 00074 | IgQtRangeControl::SliderPart)), 00075 m_nearDistance (new Ig3DFloatControl (this, "Near Clip Plane", 00076 IgQtRangeControl::StepperPart 00077 | IgQtRangeControl::ValuePart 00078 | IgQtRangeControl::SliderPart)), 00079 m_farDistance (new Ig3DFloatControl (this, "Far Clip Plane", 00080 IgQtRangeControl::StepperPart 00081 | IgQtRangeControl::ValuePart 00082 | IgQtRangeControl::SliderPart)), 00083 m_zoom (new Ig3DFloatControl (this, "Zoom", 00084 IgQtRangeControl::StepperPart)), 00085 m_autoClipping (0), 00086 m_autoClippings (0) 00087 { 00088 QWidget *area = bodyArea (); 00089 int row = bodyLayout ()->numRows (); 00090 00091 ASSERT (m_source); 00092 00093 m_group->ref (); 00094 m_group->setName (Ig3DBaseModel::encode ("Default View Points")); 00095 00096 makeOne ("Current Viewpoint"); 00097 00098 m_aspectRatio->control ()->setMinValue (0.01); 00099 m_aspectRatio->control ()->setLongStep (0.1); 00100 m_aspectRatio->control ()->setSmallStep (0.01); 00101 00102 m_nearDistance->control ()->setMinValue (0.); 00103 m_nearDistance->control ()->setLongStep (1.0); 00104 m_nearDistance->control ()->setSmallStep (0.1); 00105 00106 m_farDistance->control ()->setMinValue (0.); 00107 m_farDistance->control ()->setLongStep (1.0); 00108 m_farDistance->control ()->setSmallStep (0.1); 00109 00110 m_focalDistance->control ()->setMinValue (1.0); 00111 m_focalDistance->control ()->setLongStep (1.0); 00112 m_focalDistance->control ()->setSmallStep (0.1); 00113 00114 00115 //alignment widget 00116 QWidget *vlab = makeIndentedLabel ("Align Camera", 00117 area); 00118 bodyLayout ()->addWidget (vlab, row, 0); 00119 00120 m_alignment = new IgQtAxisAlignment (area); 00121 m_alignment->setMaxAxisAlign (1.); 00122 m_alignment->setMinAxisAlign (0.); 00123 bodyLayout ()->addWidget (makeSpacedBox (area,m_alignment->widget ()), 00124 row++, 1); 00125 00126 //Zoom control 00127 m_zoom->control ()->setLongStep (0.5); 00128 m_zoom->control ()->setSmallStep (0.01); 00129 m_zoom->setValue (0); 00130 m_zoom->setClean (); 00131 m_zoom->control ()-> 00132 addRevWidget (makeIndentedLabel ("In", m_zoom->control ()->widget ())); 00133 m_zoom->control ()-> 00134 addFwdWidget (makeIndentedLabel ("Out", m_zoom->control ()->widget ())); 00135 00136 //Auto clipping option 00137 m_autoClipping = new QCheckBox ("Auto Clipping", area); 00138 bodyLayout ()->addWidget (makeBox (area, m_autoClipping), row++, 0); 00139 00140 QHBoxLayout *layout1 = new QHBoxLayout (bottomLayout ()); 00141 00142 layout1->addItem (new QSpacerItem (20, 20, 00143 QSizePolicy::Expanding, QSizePolicy::Minimum)); 00144 00145 QPushButton *saveme = new QPushButton ("Export viewpoints", area); 00146 layout1->addWidget (saveme); 00147 00148 layout1->addItem (new QSpacerItem (20, 20, 00149 QSizePolicy::Expanding, QSizePolicy::Minimum)); 00150 00151 QPushButton *loadme = new QPushButton ("Import viewpoints", area); 00152 layout1->addWidget (loadme); 00153 00154 layout1->addItem (new QSpacerItem (20, 20, 00155 QSizePolicy::Expanding, QSizePolicy::Minimum)); 00156 00157 // Space it up 00158 bottomLayout ()->addItem (new QSpacerItem (20, 20, 00159 QSizePolicy::Minimum, QSizePolicy::Expanding)); 00160 00161 QWhatsThis::add (panel (), "3D Viewpoint Category"); 00162 QWhatsThis::add (m_focalDistance->control ()->widget (), 00163 "Set distance from the view point to the point of focus"); 00164 QWhatsThis::add (m_farDistance->control ()->widget (), 00165 "Set distance of the camera viewpoint to the far clipping plane"); 00166 QWhatsThis::add (m_nearDistance->control ()->widget (), 00167 "Set distance of the camera viewpoint to the far clipping plane"); 00168 QWhatsThis::add (m_aspectRatio->control ()->widget (), 00169 "Set the ratio of camera viewing width to height.\n" 00170 "This must be greater than 0.0"); 00171 QWhatsThis::add (m_zoom->control ()->widget (), 00172 "Camera Zoom In/Out"); 00173 QWhatsThis::add (m_autoClipping, "Turn on/off continuous automatic adjustments\n" 00174 "of the near and far clipping planes"); 00175 QWhatsThis::add (vlab, "Align camera to x, y or z axis"); 00176 QWhatsThis::add (m_alignment->widget (), "Align camera to x, y or z axis"); 00177 00178 connect (this, SIGNAL (editable (bool)), 00179 m_alignment->widget (), SLOT (setEnabled (bool))); 00180 connect (this, SIGNAL (editable (bool)), 00181 saveme, SLOT (setEnabled (bool))); 00182 connect (this, SIGNAL (editable (bool)), 00183 loadme, SLOT (setEnabled (bool))); 00184 connect (m_alignment, SIGNAL (dirty()), 00185 this, SLOT (alignToAxis ())); 00186 connect (this, SIGNAL (clean()), 00187 m_alignment, SLOT (setClean ())); 00188 00189 connect (saveme, SIGNAL (clicked ()), 00190 this, SLOT (save ())); 00191 connect (loadme, SIGNAL (clicked ()), 00192 this, SLOT (load ())); 00193 connect (m_zoom, SIGNAL (dirty ()), 00194 this, SLOT (zoom ())); 00195 connect (this, SIGNAL (tracking (bool)), 00196 this, SLOT (updateCameraPosition (bool))); 00197 connect (m_autoClipping, SIGNAL (clicked ()), 00198 this, SLOT (autoClipping ())); 00199 00200 connect (m_autoClipping, SIGNAL (toggled (bool)), 00201 m_nearDistance->control()->widget(),SLOT(setDisabled(bool))); 00202 connect (m_autoClipping, SIGNAL (toggled (bool)), 00203 m_farDistance->control()->widget(), SLOT(setDisabled(bool))); 00204 00205 disconnect (m_nearDistance, SIGNAL (editable(bool)), 00206 m_nearDistance->control()->widget(),SLOT (setEnabled(bool))); 00207 disconnect (m_farDistance, SIGNAL (editable(bool)), 00208 m_farDistance->control()->widget(), SLOT (setEnabled(bool))); 00209 00210 state->put (s_key, this); 00211 }
Ig3DViewpointsCategory::~Ig3DViewpointsCategory | ( | void | ) |
Definition at line 213 of file Ig3DViewpointsCategory.cc.
References IgState::detach(), m_group, and IgControlCategory::state().
Ig3DViewpointsCategory::Ig3DViewpointsCategory | ( | const Ig3DViewpointsCategory & | ) | [private] |
Definition at line 322 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::currentItem(), IgControlCategory::isTracking(), m_alignment, m_source, IgControlItem::setClean(), Ig3DBaseBrowser::viewPlaneX(), Ig3DBaseBrowser::viewPlaneY(), Ig3DBaseBrowser::viewPlaneZ(), IgQtAxisAlignment::xAlign(), and IgQtAxisAlignment::yAlign().
Referenced by Ig3DViewpointsCategory().
00323 { 00324 m_alignment->setClean (); 00325 if (isTracking () && currentItem () > -1) 00326 { 00327 if (m_alignment->xAlign ()) 00328 m_source->viewPlaneX (); 00329 else if (m_alignment->yAlign ()) 00330 m_source->viewPlaneY (); 00331 else 00332 m_source->viewPlaneZ (); 00333 } 00334 }
Reimplemented from IgControlCategory.
Definition at line 232 of file Ig3DViewpointsCategory.cc.
References IgControlBase::apply(), m_aspectRatio, m_farDistance, m_focalDistance, m_nearDistance, m_orientation, and updateCameraPosition().
00233 { 00234 m_aspectRatio->apply (); 00235 m_nearDistance->apply (); 00236 m_farDistance->apply (); 00237 m_focalDistance->apply (); 00238 updateCameraPosition (); 00239 m_orientation->apply (); 00240 }
Reimplemented from IgControlCategory.
Definition at line 243 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, autoClipping(), connectCameraFromViewpoint(), connectViewpointFromCamera(), IgControlCategory::currentItem(), IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, m_aspectRatio, m_autoClipping, m_autoClippings, m_farDistance, m_focalDistance, m_nearDistance, m_orientation, m_source, IgSoViewpoint::nearDistance, VarParsing::obj, Ig3DObjectCategory< IgSoViewpoint >::object(), IgSoViewpoint::orientation, IgSoViewpoint::position, IgControlCategory::removeableItem(), Ig3DCameraUtils::setCamera(), Ig3DRotationControl::setField(), and Ig3DRangeControl< C1, C2, C3 >::setField().
00244 { 00245 int current = currentItem (); 00246 IgSoViewpoint *obj = object (current); 00247 00248 if (current > 0) 00249 { 00250 if (m_source->isAnimating()) 00251 m_source->stopAnimating (); 00252 connectCameraFromViewpoint (obj); 00253 connectViewpointFromCamera (obj); 00254 } 00255 else 00256 { 00257 connectViewpointFromCamera (obj); 00258 connectCameraFromViewpoint (obj); 00259 m_autoClippings [current] = m_source->isAutoClipping (); 00260 } 00261 00262 m_orientation->setField (&obj->orientation); 00263 m_orientation->setCamera (&obj->orientation, 00264 &obj->position, 00265 &obj->focalDistance); 00266 m_focalDistance->setField (&obj->focalDistance); 00267 m_aspectRatio->setField (&obj->aspectRatio); 00268 m_nearDistance->setField (&obj->nearDistance); 00269 m_farDistance->setField (&obj->farDistance); 00270 m_autoClipping->setChecked (m_autoClippings [current]); 00271 autoClipping (); 00272 00273 removeableItem (current > 0); 00274 }
Definition at line 313 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::currentItem(), m_autoClipping, m_autoClippings, m_source, and Ig3DBaseBrowser::setAutoClipping().
Referenced by attach(), and Ig3DViewpointsCategory().
00314 { 00315 bool clipping = m_autoClipping->isChecked (); 00316 m_autoClippings [currentItem ()] = clipping; 00317 if (m_source->isAutoClipping () != clipping) 00318 m_source->setAutoClipping (clipping); 00319 }
void Ig3DViewpointsCategory::browserChanged | ( | Ig3DBaseBrowser * | browser | ) |
Definition at line 601 of file Ig3DViewpointsCategory.cc.
References detach(), m_previous, and m_source.
Referenced by registerBrowser().
00602 { 00603 detach (); 00604 m_previous = -1; 00605 m_source = browser; 00606 }
void Ig3DViewpointsCategory::connectCameraFromViewpoint | ( | IgSoViewpoint * | obj | ) | [private] |
Definition at line 416 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, ASSERT, IgSoViewpoint::cameraType, IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, IgSoViewpoint::heightAngle, m_source, IgSoViewpoint::nearDistance, IgSoViewpoint::orientation, IgSoViewpoint::Orthographic, IgSoViewpoint::Perspective, IgSoViewpoint::position, and setCamera().
Referenced by attach(), and newCamera().
00417 { 00418 setCamera(m_source, obj); 00419 SoCamera *camera = m_source->getCamera (); 00420 camera->orientation.connectFrom (&obj->orientation); 00421 camera->position.connectFrom (&obj->position); 00422 camera->focalDistance.connectFrom (&obj->focalDistance); 00423 camera->aspectRatio.connectFrom (&obj->aspectRatio); 00424 camera->nearDistance.connectFrom (&obj->nearDistance); 00425 camera->farDistance.connectFrom (&obj->farDistance); 00426 int cameraType = obj->cameraType.getValue (); 00427 if (cameraType == IgSoViewpoint::Perspective) 00428 ((SoPerspectiveCamera *)camera)-> 00429 heightAngle.connectFrom (&obj->heightAngle); 00430 else if (cameraType == IgSoViewpoint::Orthographic) 00431 ((SoOrthographicCamera *)camera)-> 00432 height.connectFrom (&obj->heightAngle); 00433 else 00434 ASSERT (false); 00435 }
void Ig3DViewpointsCategory::connectViewpointFromCamera | ( | IgSoViewpoint * | obj | ) | [private] |
Definition at line 384 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, ASSERT, IgSoViewpoint::cameraType, IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, IgSoViewpoint::heightAngle, m_source, IgSoViewpoint::nearDistance, IgSoViewpoint::orientation, IgSoViewpoint::Orthographic, IgSoViewpoint::Perspective, IgSoViewpoint::position, and setViewpoint().
Referenced by attach(), and newCamera().
00385 { 00386 setViewpoint (m_source, obj); 00387 SoCamera *camera = m_source->getCamera (); 00388 obj->orientation.connectFrom (&camera->orientation); 00389 obj->position.connectFrom (&camera->position); 00390 obj->focalDistance.connectFrom (&camera->focalDistance); 00391 obj->aspectRatio.connectFrom (&camera->aspectRatio); 00392 obj->nearDistance.connectFrom (&camera->nearDistance); 00393 obj->farDistance.connectFrom (&camera->farDistance); 00394 int cameraType = obj->cameraType.getValue (); 00395 if (cameraType == IgSoViewpoint::Perspective) 00396 obj->heightAngle.connectFrom (&((SoPerspectiveCamera *)camera)->heightAngle); 00397 else if (cameraType == IgSoViewpoint::Orthographic) 00398 obj->heightAngle.connectFrom (&((SoOrthographicCamera *)camera)->height); 00399 else 00400 ASSERT (false); 00401 }
Reimplemented from IgControlCategory.
Definition at line 482 of file Ig3DViewpointsCategory.cc.
References makeOne().
00483 { 00484 makeOne (); 00485 //setCurrentItem (items ()-1); 00486 //itemChanged (items ()-1); 00487 }
Reimplemented from IgControlCategory.
Definition at line 490 of file Ig3DViewpointsCategory.cc.
References deleteOne().
00491 { deleteOne (); }
Definition at line 534 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::currentItem(), detach(), m_autoClippings, m_group, m_previous, VarParsing::obj, and Ig3DObjectCategory< IgSoViewpoint >::object().
Referenced by deleteItem().
00535 { 00536 int current = currentItem (); 00537 00538 if (current > 0) 00539 { 00540 IgSoViewpoint *obj = object (current); 00541 detach (); 00542 m_autoClippings.erase (m_autoClippings.begin () + current); 00543 m_previous = -1 ; 00544 m_group->removeChild (obj); 00545 remove (current); 00546 } 00547 }
Reimplemented from IgControlCategory.
Definition at line 277 of file Ig3DViewpointsCategory.cc.
References disconnectCamera(), disconnectViewpoint(), m_aspectRatio, m_farDistance, m_focalDistance, m_nearDistance, m_orientation, m_previous, Ig3DCameraUtils::setCamera(), Ig3DRotationControl::setField(), and Ig3DRangeControl< C1, C2, C3 >::setField().
Referenced by browserChanged(), deleteOne(), and focusOut().
00278 { 00279 if (m_previous == -1) 00280 return; 00281 00282 disconnectCamera (); 00283 disconnectViewpoint (object (m_previous)); 00284 00285 m_orientation->setField (0); 00286 m_orientation->setCamera (0, 0, 0); 00287 m_focalDistance->setField (0); 00288 m_aspectRatio->setField (0); 00289 m_nearDistance->setField (0); 00290 m_farDistance->setField (0); 00291 }
Definition at line 438 of file Ig3DViewpointsCategory.cc.
References ASSERT, and m_source.
Referenced by detach().
00439 { 00440 SoCamera *camera = m_source->getCamera (); 00441 camera->orientation.disconnect (); 00442 camera->position.disconnect (); 00443 camera->focalDistance.disconnect (); 00444 camera->aspectRatio.disconnect (); 00445 camera->nearDistance.disconnect (); 00446 camera->farDistance.disconnect (); 00447 if (camera->isOfType (SoPerspectiveCamera::getClassTypeId ())) 00448 ((SoPerspectiveCamera *)camera)->heightAngle.disconnect (); 00449 else if (camera->isOfType (SoOrthographicCamera::getClassTypeId ())) 00450 ((SoOrthographicCamera *)camera)->height.disconnect (); 00451 else 00452 ASSERT (false); 00453 }
void Ig3DViewpointsCategory::disconnectViewpoint | ( | IgSoViewpoint * | obj | ) | [private] |
Definition at line 404 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, IgSoViewpoint::heightAngle, IgSoViewpoint::nearDistance, IgSoViewpoint::orientation, and IgSoViewpoint::position.
Referenced by detach().
00405 { 00406 obj->orientation.disconnect (); 00407 obj->position.disconnect (); 00408 obj->focalDistance.disconnect (); 00409 obj->aspectRatio.disconnect (); 00410 obj->nearDistance.disconnect (); 00411 obj->farDistance.disconnect (); 00412 obj->heightAngle.disconnect (); 00413 }
Reimplemented from IgControlCategory.
Definition at line 347 of file Ig3DViewpointsCategory.cc.
References itemChanged(), m_previous, and IgControlCategory::setCurrentItem().
00348 { 00349 setCurrentItem (m_previous = 0); 00350 itemChanged (m_previous); 00351 }
Reimplemented from IgControlCategory.
Definition at line 354 of file Ig3DViewpointsCategory.cc.
References detach(), IgControlCategory::focusOut(), and m_previous.
00355 { 00356 detach (); 00357 m_previous = -1; 00358 IgControlCategory::focusOut (); 00359 }
Ig3DViewpointsCategory::IG_DECLARE_STATE_ELEMENT | ( | Ig3DViewpointsCategory | ) | [private] |
Reimplemented from IgControlCategory.
Definition at line 362 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::itemChanged(), and m_previous.
Referenced by focusIn().
00363 { 00364 IgControlCategory::itemChanged (index); 00365 m_previous = index; 00366 }
Definition at line 616 of file Ig3DViewpointsCategory.cc.
References ASSERT, Ig3DBaseModel::encode(), getString(), m_source, prof2calltree::node, Ig3DBaseBrowser::openNode(), IgControlCategory::panel(), and reconstruct().
Referenced by Ig3DViewpointsCategory().
00617 { 00618 ASSERT (m_source); 00619 SoNode * node = m_source->openNode (Ig3DBaseModel::encode 00620 ("Default View Points").getString (), 00621 "Select viewpoints to load", panel ()); 00622 if (node) reconstruct (static_cast<SoGroup*>(node)); 00623 }
void Ig3DViewpointsCategory::makeOne | ( | QString | name = "" |
) | [private, virtual, slot] |
Definition at line 507 of file Ig3DViewpointsCategory.cc.
References pyDBSguiBaseClass::base, Ig3DBaseModel::encode(), IgControlCategory::items(), m_autoClippings, m_group, m_source, edm::Normal, VarParsing::obj, IgControlCategory::panel(), and setViewpoint().
Referenced by createNewItem(), and Ig3DViewpointsCategory().
00508 { 00509 if (name.isEmpty ()) 00510 { 00511 bool ok = false; 00512 QString base ("Viewpoint #%1"); 00513 name = QInputDialog::getText (tr("Name"), QString::null, 00514 QLineEdit::Normal, 00515 base.arg (items () + 1), 00516 &ok, panel ()); 00517 00518 00519 if (! ok || name.isEmpty ()) 00520 return; 00521 } 00522 00523 // FIXME: Remember camera type! 00524 IgSoViewpoint *obj = new IgSoViewpoint; 00525 obj->setName (Ig3DBaseModel::encode (name.utf8 ().data ())); 00526 setViewpoint(m_source, obj); 00527 00528 m_group->addChild (obj); 00529 add (obj, true); 00530 m_autoClippings.push_back (m_source->isAutoClipping ()); 00531 }
Definition at line 373 of file Ig3DViewpointsCategory.cc.
References connectCameraFromViewpoint(), connectViewpointFromCamera(), IgControlCategory::currentItem(), VarParsing::obj, Ig3DObjectCategory< IgSoViewpoint >::object(), and IgControlCategory::panel().
00374 { 00375 if (panel ()->isVisible ()) 00376 { 00377 IgSoViewpoint *obj = object (currentItem ()); 00378 connectViewpointFromCamera (obj); 00379 connectCameraFromViewpoint (obj); 00380 } 00381 }
Ig3DViewpointsCategory& Ig3DViewpointsCategory::operator= | ( | const Ig3DViewpointsCategory & | ) | [private] |
void Ig3DViewpointsCategory::reconstruct | ( | SoGroup * | from | ) |
Definition at line 459 of file Ig3DViewpointsCategory.cc.
References ASSERT, i, j, m_group, n, prof2calltree::node, Ig3DObjectCategory< IgSoViewpoint >::object(), Ig3DObjectCategory< IgSoViewpoint >::objects(), and update().
Referenced by load(), and registerBrowser().
00460 { 00461 for (int i = 0, n = from->getNumChildren (); i < n; ++i) 00462 { 00463 ASSERT (from->getChild(i)->isOfType(IgSoViewpoint::getClassTypeId())); 00464 IgSoViewpoint *node = static_cast<IgSoViewpoint *>(from->getChild(i)); 00465 bool already_exists = false; 00466 for (unsigned int j = 0; j < objects () && !already_exists; j++) 00467 { 00468 if (node->getName () == object (j)->getName ()) 00469 already_exists = true; 00470 } 00471 if (!already_exists) 00472 { 00473 m_group->addChild (node); 00474 add (node, true); 00475 } 00476 } 00477 update (); 00478 }
void Ig3DViewpointsCategory::registerBrowser | ( | IgState * | state, | |
Ig3DBaseBrowser * | browser | |||
) | [virtual] |
Reimplemented from Ig3DObjectCategory< IgSoViewpoint >.
Definition at line 575 of file Ig3DViewpointsCategory.cc.
References IgQtAppContextService::addOnFocusIn(), ASSERT, Ig3DBaseModel::attachPoint(), browserChanged(), lat::CreateCallback(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), DBSPlugin::get(), group, m_group, m_source, Ig3DBaseRep::magic(), Ig3DBaseBrowser::model(), reconstruct(), and IgControlCategory::registerMe().
Referenced by Ig3DWindow::initCategories().
00576 { 00577 m_source = dynamic_cast <Ig3DBaseBrowser *>(browser); 00578 ASSERT (m_source); 00579 00580 IgQtAppContextService *cs = IgQtAppContextService::get (state); 00581 ASSERT (cs); 00582 cs->addOnFocusIn (lat::CreateCallback (this, 00583 &Ig3DViewpointsCategory::browserChanged, 00584 m_source)); 00585 00586 IgControlCategory::registerMe (state); 00587 SoGroup *group = dynamic_cast<SoGroup *>( 00588 m_source->model ()->attachPoint ()->findMagic ( 00589 Ig3DBaseModel::encode ("Default View Points"))); 00590 if (group) 00591 { 00592 reconstruct (group); 00593 m_source->model ()->attachPoint ()->magic ()->replaceChild (group, m_group); 00594 } 00595 else 00596 m_source->model ()->attachPoint ()->magic ()->addChild (m_group); 00597 }
void Ig3DViewpointsCategory::renameItem | ( | const QString & | newName | ) | [protected, virtual] |
Reimplemented from IgControlCategory.
Definition at line 494 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::currentItem(), IgControlCategory::currentText(), Ig3DBaseModel::decode(), edm::getName(), Ig3DObjectCategory< IgSoViewpoint >::rename(), and IgControlCategory::renameItem().
00495 { 00496 int current = currentItem (); 00497 QString oldName (Ig3DBaseModel::decode(object (current)->getName ()).c_str ()); 00498 if (!newName.isEmpty() && newName != oldName) 00499 { 00500 IgControlCategory:: renameItem(newName); 00501 rename (current, currentText ()); 00502 } 00503 }
Definition at line 609 of file Ig3DViewpointsCategory.cc.
References ASSERT, m_group, m_source, IgControlCategory::panel(), and Ig3DBaseBrowser::saveNode().
Referenced by Ig3DViewpointsCategory().
00610 { 00611 ASSERT (m_source); 00612 m_source->saveNode (m_group, "Save Viewpoints As...", panel ()); 00613 }
void Ig3DViewpointsCategory::setCamera | ( | Ig3DBaseBrowser * | browser, | |
IgSoViewpoint * | view | |||
) | [static] |
Definition at line 651 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, ASSERT, IgSoViewpoint::cameraType, IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, IgSoViewpoint::heightAngle, IgSoViewpoint::nearDistance, IgSoViewpoint::orientation, IgSoViewpoint::Orthographic, IgSoViewpoint::Perspective, IgSoViewpoint::position, and Ig3DBaseBrowser::toggleCameraType().
Referenced by connectCameraFromViewpoint(), and Ig3DWindow::printViews().
00652 { 00653 ASSERT (browser && view); 00654 SoCamera *camera = browser->getCamera (); 00655 00656 int cameraType = view->cameraType.getValue (); 00657 bool toggle = false; 00658 if ((cameraType == IgSoViewpoint::Perspective) && 00659 (!camera->isOfType (SoPerspectiveCamera::getClassTypeId ()))) 00660 toggle = true; 00661 else if ((cameraType == IgSoViewpoint::Orthographic) && 00662 (!camera->isOfType (SoOrthographicCamera::getClassTypeId ()))) 00663 toggle = true; 00664 00665 if (toggle) 00666 { 00667 browser->toggleCameraType (); 00668 camera = browser->getCamera (); 00669 } 00670 camera->orientation.connectFrom (&view->orientation); 00671 camera->position.connectFrom (&view->position); 00672 camera->focalDistance.connectFrom (&view->focalDistance); 00673 camera->aspectRatio.connectFrom (&view->aspectRatio); 00674 camera->nearDistance.connectFrom (&view->nearDistance); 00675 camera->farDistance.connectFrom (&view->farDistance); 00676 if (cameraType == IgSoViewpoint::Perspective) 00677 ((SoPerspectiveCamera *)camera)-> 00678 heightAngle.setValue (view->heightAngle.getValue ()); 00679 else if (cameraType == IgSoViewpoint::Orthographic) 00680 ((SoOrthographicCamera *)camera)-> 00681 height.setValue (view->heightAngle.getValue ()); 00682 else 00683 ASSERT(false); 00684 }
void Ig3DViewpointsCategory::setViewpoint | ( | Ig3DBaseBrowser * | browser, | |
IgSoViewpoint * | view | |||
) | [static] |
Definition at line 626 of file Ig3DViewpointsCategory.cc.
References IgSoViewpoint::aspectRatio, ASSERT, IgSoViewpoint::cameraType, IgSoViewpoint::farDistance, IgSoViewpoint::focalDistance, IgSoViewpoint::heightAngle, IgSoViewpoint::nearDistance, IgSoViewpoint::orientation, IgSoViewpoint::Orthographic, IgSoViewpoint::Perspective, and IgSoViewpoint::position.
Referenced by connectViewpointFromCamera(), makeOne(), and Ig3DWindow::printViews().
00627 { 00628 ASSERT (browser && view); 00629 SoCamera *camera = browser->getCamera (); 00630 view->orientation.setValue (camera->orientation.getValue ()); 00631 view->position.setValue (camera->position.getValue ()); 00632 view->focalDistance.setValue (camera->focalDistance.getValue ()); 00633 view->aspectRatio.setValue (camera->aspectRatio.getValue ()); 00634 view->nearDistance.setValue (camera->nearDistance.getValue ()); 00635 view->farDistance.setValue (camera->farDistance.getValue ()); 00636 if (camera->isOfType (SoPerspectiveCamera::getClassTypeId ())) 00637 { 00638 view->heightAngle.setValue (((SoPerspectiveCamera *)camera)->heightAngle.getValue ()); 00639 view->cameraType.setValue(IgSoViewpoint::Perspective); 00640 } 00641 else if (camera->isOfType (SoOrthographicCamera::getClassTypeId ())) 00642 { 00643 view->heightAngle.setValue (((SoOrthographicCamera *)camera)->height.getValue ()); 00644 view->cameraType.setValue(IgSoViewpoint::Orthographic); 00645 } 00646 else 00647 ASSERT (false); 00648 }
Reimplemented from IgControlCategory.
Definition at line 340 of file Ig3DViewpointsCategory.cc.
References m_previous, IgControlCategory::setCurrentItem(), and IgControlCategory::show().
00341 { 00342 setCurrentItem (m_previous = 0); 00343 IgControlCategory::show (); 00344 }
Reimplemented from IgControlCategory.
Definition at line 222 of file Ig3DViewpointsCategory.cc.
References m_aspectRatio, m_farDistance, m_focalDistance, m_nearDistance, m_orientation, and IgControlBase::update().
Referenced by reconstruct().
00223 { 00224 m_aspectRatio->update (); 00225 m_nearDistance->update (); 00226 m_farDistance->update (); 00227 m_focalDistance->update (); 00228 m_orientation->update (); 00229 }
Definition at line 565 of file Ig3DViewpointsCategory.cc.
References IgControlCategory::currentItem(), m_focalDistance, VarParsing::obj, Ig3DObjectCategory< IgSoViewpoint >::object(), IgSoViewpoint::position, and Ig3DRangeControl< C1, C2, C3 >::value().
Referenced by apply(), Ig3DViewpointsCategory(), and updateCameraPosition().
00566 { 00567 IgSoViewpoint *obj= object (currentItem ()); 00568 obj->position = 00569 obj->position.getValue () * 00570 ( m_focalDistance->value () / obj->position.getValue ().length ()); 00571 }
Definition at line 550 of file Ig3DViewpointsCategory.cc.
References HLT_VtxMuL3::connect, IgControlItem::dirty(), m_focalDistance, and updateCameraPosition().
00551 { 00552 if (tracking) 00553 { 00554 connect (m_focalDistance, SIGNAL (dirty ()), 00555 this, SLOT (updateCameraPosition ())); 00556 } 00557 else 00558 { 00559 disconnect (m_focalDistance, SIGNAL (dirty ()), 00560 this, SLOT (updateCameraPosition ())); 00561 } 00562 }
Definition at line 297 of file Ig3DViewpointsCategory.cc.
References HLT_VtxMuL3::connect, IgControlCategory::currentItem(), IgControlItem::dirty(), IgControlCategory::isTracking(), m_source, m_zoom, IgControlItem::setClean(), Ig3DFloatControl::setValue(), value, Ig3DRangeControl< C1, C2, C3 >::value(), and Ig3DBaseBrowser::zoom().
Referenced by Ig3DViewpointsCategory().
00298 { 00299 float value = m_zoom->value (); 00300 00301 //move the Zoom value back to 0 00302 disconnect(m_zoom, SIGNAL (dirty ()), this, SLOT (zoom ())); 00303 m_zoom->setValue (0.); 00304 m_zoom->setClean (); 00305 connect(m_zoom, SIGNAL (dirty ()),this, SLOT (zoom ())); 00306 00307 if (! isTracking () || currentItem () == -1) 00308 return; 00309 m_source->zoom (value); 00310 }
Definition at line 94 of file Ig3DViewpointsCategory.h.
Referenced by alignToAxis(), and Ig3DViewpointsCategory().
Definition at line 96 of file Ig3DViewpointsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DViewpointsCategory(), and update().
QCheckBox* Ig3DViewpointsCategory::m_autoClipping [private] |
Definition at line 100 of file Ig3DViewpointsCategory.h.
Referenced by attach(), autoClipping(), and Ig3DViewpointsCategory().
std::vector<bool> Ig3DViewpointsCategory::m_autoClippings [private] |
Definition at line 102 of file Ig3DViewpointsCategory.h.
Referenced by attach(), autoClipping(), deleteOne(), and makeOne().
Definition at line 98 of file Ig3DViewpointsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DViewpointsCategory(), and update().
Definition at line 95 of file Ig3DViewpointsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DViewpointsCategory(), update(), and updateCameraPosition().
SoGroup* Ig3DViewpointsCategory::m_group [private] |
Definition at line 90 of file Ig3DViewpointsCategory.h.
Referenced by deleteOne(), Ig3DViewpointsCategory(), makeOne(), reconstruct(), registerBrowser(), save(), and ~Ig3DViewpointsCategory().
Definition at line 97 of file Ig3DViewpointsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DViewpointsCategory(), and update().
int Ig3DViewpointsCategory::m_previous [private] |
Definition at line 92 of file Ig3DViewpointsCategory.h.
Referenced by browserChanged(), deleteOne(), detach(), focusIn(), focusOut(), itemChanged(), and show().
Ig3DBaseBrowser* Ig3DViewpointsCategory::m_source [private] |
Definition at line 89 of file Ig3DViewpointsCategory.h.
Referenced by alignToAxis(), attach(), autoClipping(), browserChanged(), connectCameraFromViewpoint(), connectViewpointFromCamera(), disconnectCamera(), Ig3DViewpointsCategory(), load(), makeOne(), registerBrowser(), save(), and zoom().
Ig3DFloatControl* Ig3DViewpointsCategory::m_zoom [private] |
Definition at line 99 of file Ig3DViewpointsCategory.h.
Referenced by Ig3DViewpointsCategory(), and zoom().