#include <Iguana/GLBrowsers/interface/Ig3DLightsCategory.h>
Definition at line 37 of file Ig3DLightsCategory.h.
anonymous enum |
Definition at line 46 of file Ig3DLightsCategory.h.
00047 { 00048 //index of different types of SoLight 00049 SpotLight = 0, 00050 PointLight, 00051 DirectionalLight 00052 };
Ig3DLightsCategory::Ig3DLightsCategory | ( | IgState * | state | ) |
Definition at line 45 of file Ig3DLightsCategory.cc.
References reco::fitHelper::add(), ASSERT, IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), IgControlCategory::bottomLayout(), HLT_VtxMuL3::connect, Ig3DRangeControl< C1, C2, C3 >::control(), DirectionalLight, lightTypeChanged(), m_color, m_cutOffAngle, m_direction, m_dropOffRate, m_intensity, m_lightsType, m_location, m_manip, m_on, IgControlItem::makeBox(), IgControlCategory::panel(), PointLight, IgState::put(), row, IgControlItem::setDirty(), IgQtRangeControlFloat::setLongStep(), Ig3DVectorBaseControl::setMaxAxisAlign(), Ig3DVectorBaseControl::setMinAxisAlign(), IgQtRangeControlFloat::setRange(), IgQtRangeControlFloat::setSmallStep(), SpotLight, IgControlCategory::topArea(), IgControlCategory::topLayout(), IgControlCategory::tracking(), trackingChanged(), Ig3DColorControl::widget(), IgQtRangeControlCommon::widget(), and Ig3DBoolControl::widget().
00046 : Ig3DObjectCategory<SoLight> (state, "Lights"), 00047 m_source (0), 00048 m_lightsType (0), 00049 m_location (new Ig3DVec3fControl (this, "Location")), 00050 m_direction (new Ig3DUnitVec3fControl (this, "Direction")), 00051 m_dropOffRate (new Ig3DFloatControl (this, "Drop-off Rate", 00052 IgQtRangeControl::StepperPart 00053 | IgQtRangeControl::ValuePart 00054 | IgQtRangeControl::SliderPart)), 00055 m_cutOffAngle (new Ig3DAngleControl (this, "Cut-off Angle", 00056 IgQtRangeControl::StepperPart 00057 | IgQtRangeControl::ValuePart 00058 | IgQtRangeControl::SliderPart)), 00059 m_intensity (new Ig3DFloatControl (this, "Intensity", 00060 IgQtRangeControl::StepperPart 00061 | IgQtRangeControl::ValuePart 00062 | IgQtRangeControl::SliderPart)), 00063 m_color (new Ig3DColorControl (this, "Color")), 00064 m_on (new Ig3DBoolControl (this, "On")), 00065 m_manip (0), 00066 m_nrlights (0) 00067 { 00068 QWidget *area = bodyArea (); 00069 int row = bodyLayout ()->numRows (); 00070 ASSERT (row >= 0); 00071 00072 // Space it up 00073 bottomLayout ()->addItem (new QSpacerItem (20, 20, 00074 QSizePolicy::Minimum, 00075 QSizePolicy::Expanding)); 00076 00077 //Add ComboBox to change the type of selected light 00078 QHBoxLayout *topRow = new QHBoxLayout (topLayout ()); 00079 topRow->add (m_lightsType = new QComboBox (topArea ())); 00080 topRow->addItem (new QSpacerItem (20, 20, QSizePolicy::Expanding)); 00081 m_lightsType->insertItem ("Spot Light", SpotLight); 00082 m_lightsType->insertItem ("Point Light", PointLight); 00083 m_lightsType->insertItem ("Directional Light", DirectionalLight); 00084 00085 // Add a new row to the grid, value on the left and the label on the right 00086 m_manip = new QCheckBox ("Manipulator", area); 00087 bodyLayout ()->addWidget (makeBox (area, m_manip), row, 0); 00088 00089 m_direction->setMaxAxisAlign (-1.0); 00090 m_direction->setMinAxisAlign (0.0); 00091 00092 m_intensity->control ()->setRange (0, 1); 00093 m_intensity->control ()->setSmallStep (0.01); 00094 m_intensity->control ()->setLongStep (0.1); 00095 00096 m_dropOffRate->control ()->setRange (0, 1); 00097 m_dropOffRate->control ()->setSmallStep (0.01); 00098 m_dropOffRate->control ()->setLongStep (0.1); 00099 00100 m_cutOffAngle->control ()->setRange (0, 360); 00101 m_cutOffAngle->control ()->setSmallStep (1); 00102 m_cutOffAngle->control ()->setLongStep (15); 00103 00104 QWhatsThis::add (panel (), "3D Light Category"); 00105 QWhatsThis::add (m_location-> xControl ()->widget (), 00106 "X-axis of 3D Light location."); 00107 QWhatsThis::add (m_location-> yControl ()->widget (), 00108 "Y-axis of 3D Light location."); 00109 QWhatsThis::add (m_location-> zControl ()->widget (), 00110 "Z-axis of 3D Light location."); 00111 QWhatsThis::add (m_direction-> xControl ()->widget (), 00112 "X-axis of 3D Light direction."); 00113 QWhatsThis::add (m_direction-> yControl ()->widget (), 00114 "Y-axis of 3D Light direction."); 00115 QWhatsThis::add (m_direction-> zControl ()->widget (), 00116 "Z-axis of 3D Light direction."); 00117 QWhatsThis::add (m_dropOffRate->control ()->widget (), 00118 "Drop off Rate of 3D Spot Light"); 00119 QWhatsThis::add (m_cutOffAngle->control ()->widget (), 00120 "Cut off Angle of 3D Spot Light"); 00121 QWhatsThis::add (m_intensity->control ()->widget (), 00122 "Intensity of 3D Light"); 00123 QWhatsThis::add (m_manip, "Trun on/off the 3D Light manipulator"); 00124 QWhatsThis::add (m_color->widget (), "Color of 3D Light"); 00125 QWhatsThis::add (m_on->widget (), "Turn on/off 3D Light"); 00126 QWhatsThis::add (m_lightsType, "Select type of 3D light"); 00127 00128 connect (m_manip, SIGNAL (clicked ()), 00129 this, SLOT (setDirty ())); 00130 connect (this, SIGNAL (tracking (bool)), 00131 this, SLOT (trackingChanged (bool))); 00132 connect (m_lightsType, SIGNAL (activated (int)), 00133 this, SLOT (lightTypeChanged (int))); 00134 state->put (s_key, this); 00135 }
Ig3DLightsCategory::~Ig3DLightsCategory | ( | void | ) |
Definition at line 137 of file Ig3DLightsCategory.cc.
References IgState::detach(), and IgControlCategory::state().
Ig3DLightsCategory::Ig3DLightsCategory | ( | const Ig3DLightsCategory & | ) | [private] |
void Ig3DLightsCategory::addExtraLights | ( | SoGroup * | group | ) | [virtual] |
Definition at line 628 of file Ig3DLightsCategory.cc.
References Ig3DBaseModel::encode().
00629 { 00630 SoDirectionalLight *flood = new SoDirectionalLight; 00631 flood->direction.setValue (-1, 0, -1); 00632 flood->intensity.setValue (0.8); 00633 flood->color.setValue (1.0, 1.0, 1.0); 00634 flood->setName (Ig3DBaseModel::encode ("Top Left Flood")); 00635 group->addChild (flood); 00636 add (flood, true); 00637 00638 flood = new SoDirectionalLight; 00639 flood->direction.setValue (1, 0, -1); 00640 flood->intensity.setValue (0.8); 00641 flood->color.setValue (1.0, 1.0, 1.0); 00642 flood->setName (Ig3DBaseModel::encode ("Top Right Flood")); 00643 group->addChild (flood); 00644 add (flood, true); 00645 00646 flood = new SoDirectionalLight; 00647 flood->direction.setValue (-1, 0, 1); 00648 flood->intensity.setValue (0.8); 00649 flood->color.setValue (1.0, 1.0, 1.0); 00650 flood->setName (Ig3DBaseModel::encode ("Bottom Left Flood")); 00651 group->addChild (flood); 00652 add (flood, true); 00653 00654 flood = new SoDirectionalLight; 00655 flood->direction.setValue (1, 0, 1); 00656 flood->intensity.setValue (0.8); 00657 flood->color.setValue (1.0, 1.0, 1.0); 00658 flood->setName (Ig3DBaseModel::encode ("Bottom Right Flood")); 00659 group->addChild (flood); 00660 add (flood, true); 00661 00662 SoPointLight *point = new SoPointLight; 00663 point->location.setValue (0.0, 0.0, 0.0); 00664 point->intensity.setValue (0.8); 00665 point->color.setValue (1.0, 1.0, 1.0); 00666 point->setName (Ig3DBaseModel::encode ("Point")); 00667 group->addChild (point); 00668 add (point, true); 00669 }
void Ig3DLightsCategory::addOne | ( | SoLight * | object | ) |
Reimplemented from IgControlCategory.
Definition at line 258 of file Ig3DLightsCategory.cc.
References IgControlBase::apply(), IgControlBase::isShown(), m_color, m_cutOffAngle, m_direction, m_dropOffRate, m_intensity, m_location, m_manip, m_on, and manipulators().
00259 { 00260 m_intensity->apply (); 00261 m_color->apply (); 00262 m_on->apply (); 00263 00264 if (m_location->isShown ()) 00265 m_location->apply (); 00266 00267 if (m_direction->isShown ()) 00268 m_direction->apply (); 00269 00270 if (m_cutOffAngle->isShown ()) 00271 m_cutOffAngle->apply (); 00272 00273 if (m_dropOffRate->isShown ()) 00274 m_dropOffRate->apply (); 00275 00276 manipulators (m_manip->isChecked ()); 00277 }
SoDirectionalLight * Ig3DLightsCategory::asDirectionalLight | ( | SoLight * | object | ) | [private] |
Definition at line 147 of file Ig3DLightsCategory.cc.
Referenced by attach(), lightTypeChanged(), and toggleOne().
00148 { 00149 return object->isOfType (SoDirectionalLight::getClassTypeId ()) 00150 ? static_cast<SoDirectionalLight *> (object) : 0; 00151 }
SoPointLight * Ig3DLightsCategory::asPointLight | ( | SoLight * | object | ) | [private] |
Definition at line 154 of file Ig3DLightsCategory.cc.
Referenced by attach(), lightTypeChanged(), and toggleOne().
00155 { 00156 return object->isOfType (SoPointLight::getClassTypeId ()) 00157 ? static_cast<SoPointLight *> (object) : 0; 00158 }
SoSpotLight * Ig3DLightsCategory::asSpotLight | ( | SoLight * | object | ) | [private] |
Definition at line 161 of file Ig3DLightsCategory.cc.
Referenced by attach(), lightTypeChanged(), and toggleOne().
00162 { 00163 return object->isOfType (SoSpotLight::getClassTypeId ()) 00164 ? static_cast<SoSpotLight *> (object) : 0; 00165 }
Reimplemented from IgControlCategory.
Definition at line 179 of file Ig3DLightsCategory.cc.
References asDirectionalLight(), asPointLight(), asSpotLight(), IgControlCategory::currentItem(), d, DirectionalLight, m_color, m_cutOffAngle, m_direction, m_dropOffRate, m_intensity, m_lightsType, m_location, m_manip, m_on, VarParsing::obj, Ig3DObjectCategory< SoLight >::object(), p, PointLight, IgControlCategory::removeableItem(), s, Ig3DBoolControl::setField(), Ig3DVec3fControl::setField(), Ig3DRangeControl< C1, C2, C3 >::setField(), Ig3DColorControl::setField(), IgControlBase::setShown(), and SpotLight.
Referenced by lightTypeChanged(), reconstruct(), and toggleOne().
00180 { 00181 // From base light 00182 int current = currentItem (); 00183 SoLight *obj = object (current); 00184 SoDirectionalLight *d = asDirectionalLight (obj); 00185 SoPointLight *p = asPointLight (obj); 00186 SoSpotLight *s = asSpotLight (obj); 00187 00188 m_intensity->setField (&obj->intensity); 00189 m_color->setField (&obj->color); 00190 m_on->setField (&obj->on); 00191 00192 if (d) 00193 { 00194 m_direction->setField (&d->direction); 00195 m_lightsType->setCurrentItem (DirectionalLight); 00196 } 00197 00198 else if (p) 00199 { 00200 m_location->setField (&p->location); 00201 m_lightsType->setCurrentItem (PointLight); 00202 } 00203 00204 else if (s) 00205 { 00206 m_location->setField (&s->location); 00207 m_direction->setField (&s->direction); 00208 m_cutOffAngle->setField (&s->cutOffAngle); 00209 m_dropOffRate->setField (&s->dropOffRate); 00210 m_lightsType->setCurrentItem (SpotLight); 00211 } 00212 00213 m_location->setShown (p || s); 00214 m_direction->setShown (d || s); 00215 m_cutOffAngle->setShown (s); 00216 m_dropOffRate->setShown (s); 00217 00218 m_manip->setEnabled (current > 0); 00219 removeableItem (current > 0); 00220 m_lightsType->setEnabled (current > 0); 00221 }
void Ig3DLightsCategory::browserChanged | ( | Ig3DBaseBrowser * | browser | ) |
Definition at line 613 of file Ig3DLightsCategory.cc.
References m_source, and reconstruct().
Referenced by registerBrowser().
00614 { 00615 m_source = browser; 00616 reconstruct (); 00617 }
Definition at line 620 of file Ig3DLightsCategory.cc.
References Ig3DBaseModel::attachPoint(), Ig3DBaseModel::encode(), group, m_source, Ig3DBaseRep::magic(), and Ig3DBaseBrowser::model().
Referenced by reconstruct().
00621 { 00622 SoGroup *group = new SoGroup; 00623 group->setName (Ig3DBaseModel::encode ("Default Light Group")); 00624 m_source->model ()->attachPoint ()->magic ()->addChild (group); 00625 }
Reimplemented from IgControlCategory.
Definition at line 421 of file Ig3DLightsCategory.cc.
References IgControlCategory::itemChanged(), IgControlCategory::items(), m_nrlights, makeOne(), IgControlCategory::setCurrentItem(), StDecayID::status, and warning.
00422 { 00423 m_nrlights = SoGLLightIdElement::getMaxGLSources (); 00424 int numLights = items () + 1; 00425 00426 QString status = QString ("Create a new %1th light?\n" 00427 "Number of concurrent light sources\n" 00428 "in the scene will exceed maximum %2.\n" 00429 "Some of the lights will be ignored.\n") 00430 .arg (numLights) // current number of lights 00431 .arg (m_nrlights); // maximun number of lights 00432 00433 switch ((numLights > m_nrlights) ? (QMessageBox::warning (0, "Ig3DLightsCategory", 00434 status, 00435 "&Create", "Cancel", 00436 0, 1)) : 0) 00437 { 00438 case 0: 00439 makeOne (); 00440 setCurrentItem (items () - 1); 00441 itemChanged (items () - 1); 00442 break; 00443 case 1: 00444 break; 00445 } 00446 }
Reimplemented from IgControlCategory.
Definition at line 449 of file Ig3DLightsCategory.cc.
References deleteOne().
00450 { deleteOne (); }
Definition at line 498 of file Ig3DLightsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), IgControlCategory::currentItem(), detach(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_source, Ig3DBaseBrowser::model(), VarParsing::obj, and Ig3DObjectCategory< SoLight >::object().
Referenced by deleteItem().
00499 { 00500 int current = currentItem (); 00501 00502 if (current > 0) 00503 { 00504 SoLight *obj = object (current); 00505 detach (); 00506 SoGroup * group = dynamic_cast<SoGroup *>( 00507 m_source->model ()->attachPoint ()->findMagic ( 00508 Ig3DBaseModel::encode ("Default Light Group"))); 00509 ASSERT (group); 00510 group->removeChild (obj); 00511 remove (current); 00512 } 00513 }
Reimplemented from IgControlCategory.
Definition at line 224 of file Ig3DLightsCategory.cc.
References m_color, m_cutOffAngle, m_direction, m_dropOffRate, m_intensity, m_location, m_on, Ig3DBoolControl::setField(), Ig3DVec3fControl::setField(), Ig3DRangeControl< C1, C2, C3 >::setField(), and Ig3DColorControl::setField().
Referenced by deleteOne(), lightTypeChanged(), reconstruct(), and toggleOne().
00225 { 00226 m_intensity->setField (0); 00227 m_color->setField (0); 00228 m_on->setField (0); 00229 m_location->setField (0); 00230 m_direction->setField (0); 00231 m_cutOffAngle->setField (0); 00232 m_dropOffRate->setField (0); 00233 }
Ig3DLightsCategory::IG_DECLARE_STATE_ELEMENT | ( | Ig3DLightsCategory | ) | [private] |
bool Ig3DLightsCategory::isManipulatorType | ( | SoLight * | object | ) | [private] |
Definition at line 168 of file Ig3DLightsCategory.cc.
Referenced by manipulators(), toggleOne(), and update().
00169 { 00170 return (object->isOfType (SoSpotLightManip::getClassTypeId ()) || 00171 object->isOfType (SoPointLightManip::getClassTypeId ()) || 00172 object->isOfType (SoDirectionalLightManip::getClassTypeId ())); 00173 }
Definition at line 300 of file Ig3DLightsCategory.cc.
References asDirectionalLight(), asPointLight(), ASSERT, asSpotLight(), attach(), Ig3DBaseModel::attachPoint(), IgControlCategory::currentItem(), d, detach(), DirectionalLight, Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_manip, m_source, Ig3DBaseBrowser::model(), Ig3DObjectCategory< SoLight >::object(), p, PointLight, Ig3DObjectCategory< SoLight >::replace(), s, and SpotLight.
Referenced by Ig3DLightsCategory().
00301 { 00302 int current = currentItem (); 00303 if (current != -1) 00304 { 00305 SoLight *oldLight = object (current); 00306 SoLight *newLight = 0; 00307 SoDirectionalLight *d = asDirectionalLight (oldLight); 00308 SoPointLight *p = asPointLight (oldLight); 00309 SoSpotLight *s = asSpotLight (oldLight); 00310 00311 switch (index) 00312 { 00313 case SpotLight: 00314 if (!s) 00315 { 00316 SoSpotLight *light = m_manip->isChecked () ? 00317 new SoSpotLightManip : 00318 new SoSpotLight; 00319 newLight = light; 00320 if (p) 00321 { 00322 light->location = p->location; 00323 light->direction.setValue (0, 0, -1); 00324 } 00325 else if (d) 00326 { 00327 light->direction = d->direction; 00328 light->location.setValue (0, 0, 0); 00329 } 00330 else 00331 ASSERT (false); 00332 } 00333 break; 00334 case PointLight: 00335 if (!p) 00336 { 00337 SoPointLight *light = m_manip->isChecked () ? 00338 new SoPointLightManip : 00339 new SoPointLight; 00340 newLight = light; 00341 if (s) 00342 light->location = s->location; 00343 else if (d) 00344 light->location.setValue (0, 0, 0); 00345 else 00346 ASSERT (false); 00347 } 00348 break; 00349 case DirectionalLight: 00350 if (!d) 00351 { 00352 SoDirectionalLight *light = m_manip->isChecked () ? 00353 new SoDirectionalLightManip : 00354 new SoDirectionalLight; 00355 newLight = light; 00356 if (s) 00357 light->direction = s->direction; 00358 else if (p) 00359 light->direction.setValue (0, 0, -1); 00360 else 00361 ASSERT (false); 00362 } 00363 break; 00364 default: 00365 ASSERT (false); 00366 } 00367 if (newLight) 00368 { 00369 newLight->intensity = oldLight->intensity; 00370 newLight->color = oldLight->color; 00371 newLight->on = oldLight->on; 00372 newLight->setName (oldLight->getName ()); 00373 detach (); 00374 SoGroup * group = dynamic_cast<SoGroup *>( 00375 m_source->model ()->attachPoint ()->findMagic ( 00376 Ig3DBaseModel::encode ("Default Light Group"))); 00377 ASSERT (group); 00378 group->removeChild (oldLight); 00379 group->addChild (newLight); 00380 replace (current, newLight); 00381 attach (); 00382 } 00383 } 00384 }
Definition at line 466 of file Ig3DLightsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), pyDBSguiBaseClass::base, DirectionalLight, Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, index, IgControlCategory::items(), m_lightsType, m_source, Ig3DBaseBrowser::model(), name, edm::Normal, IgControlCategory::panel(), PointLight, and SpotLight.
Referenced by createNewItem().
00467 { 00468 bool ok = false; 00469 00470 QString base (m_lightsType->currentText () + " #%1"); 00471 QString name (QInputDialog::getText (tr("Name"), QString::null, 00472 QLineEdit::Normal, 00473 base.arg (items () + 1), 00474 &ok, panel ())); 00475 00476 if (! ok || name.isEmpty ()) 00477 return; 00478 00479 int index = m_lightsType->currentItem (); 00480 SoLight *light = (index == SpotLight) ? new SoSpotLight : 00481 (index == PointLight) ? new SoPointLight : 00482 (index == DirectionalLight) ? new SoDirectionalLight : 00483 (SoLight*)(0); 00484 00485 ASSERT (light); 00486 light->on = true; 00487 light->setName (Ig3DBaseModel::encode (name.utf8 ().data ())); 00488 00489 SoGroup * group = dynamic_cast<SoGroup *>( 00490 m_source->model ()->attachPoint ()->findMagic ( 00491 Ig3DBaseModel::encode ("Default Light Group"))); 00492 ASSERT (group); 00493 group->addChild (light); 00494 add (light, true); 00495 }
Definition at line 281 of file Ig3DLightsCategory.cc.
References IgControlCategory::currentItem(), isManipulatorType(), m_source, VarParsing::obj, Ig3DObjectCategory< SoLight >::object(), and toggleOne().
Referenced by apply(), and trackingChanged().
00282 { 00283 SoLight *obj = object (currentItem ()); 00284 if ((m_source->getHeadlight () != obj) && (isManipulatorType (obj) != on)) 00285 toggleOne (on, obj); 00286 }
Ig3DLightsCategory& Ig3DLightsCategory::operator= | ( | const Ig3DLightsCategory & | ) | [private] |
void Ig3DLightsCategory::reconstruct | ( | SoGroup * | from | ) | [private] |
Definition at line 403 of file Ig3DLightsCategory.cc.
References ASSERT, attach(), IgControlCategory::currentItem(), detach(), i, n, prof2calltree::node, and update().
00404 { 00405 for (int i = 0, n = from->getNumChildren (); i < n; ++i) 00406 { 00407 ASSERT (from->getChild (i)->isOfType (SoLight::getClassTypeId ())); 00408 SoLight *node = static_cast<SoLight *> (from->getChild (i)); 00409 add (node, true); 00410 } 00411 detach (); 00412 if (object (currentItem ())) 00413 { 00414 attach (); 00415 update (); 00416 } 00417 }
Definition at line 388 of file Ig3DLightsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), buildDefaults(), Ig3DObjectCategory< SoLight >::clear(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_source, and Ig3DBaseBrowser::model().
Referenced by browserChanged().
00389 { 00390 ASSERT (m_source); 00391 SoGroup * group = dynamic_cast<SoGroup *>( 00392 m_source->model ()->attachPoint ()->findMagic ( 00393 Ig3DBaseModel::encode ("Default Light Group"))); 00394 clear (); 00395 add (m_source->getHeadlight (), true); 00396 if (group) 00397 reconstruct (group); 00398 else 00399 buildDefaults (); 00400 }
void Ig3DLightsCategory::registerBrowser | ( | IgState * | state, | |
Ig3DBaseBrowser * | browser | |||
) | [virtual] |
Reimplemented from Ig3DObjectCategory< SoLight >.
Definition at line 601 of file Ig3DLightsCategory.cc.
References IgQtAppContextService::addOnFocusIn(), ASSERT, browserChanged(), lat::CreateCallback(), Ig3DBaseModel::encode(), DBSPlugin::get(), and Ig3DObjectCategory< T >::registerBrowser().
Referenced by IgSpareWindow::initCategories(), Ig3DWindow::initCategories(), IgRZWindow::initCategories(), IgLegoWindow::initCategories(), and IgRPhiWindow::initCategories().
00602 { 00603 IgQtAppContextService *cs = IgQtAppContextService::get (state); 00604 ASSERT (cs); 00605 cs->addOnFocusIn (lat::CreateCallback (this, 00606 &Ig3DLightsCategory::browserChanged, 00607 browser)); 00608 Ig3DObjectCategory<SoLight>::registerBrowser (state, browser); 00609 browser->getHeadlight ()->setName (Ig3DBaseModel::encode ("Head Light")); 00610 }
void Ig3DLightsCategory::renameItem | ( | const QString & | newName | ) | [protected, virtual] |
Reimplemented from IgControlCategory.
Definition at line 453 of file Ig3DLightsCategory.cc.
References IgControlCategory::currentItem(), IgControlCategory::currentText(), Ig3DBaseModel::decode(), edm::getName(), Ig3DObjectCategory< SoLight >::rename(), and IgControlCategory::renameItem().
00454 { 00455 int current = currentItem (); 00456 QString oldName (Ig3DBaseModel::decode(object (current)->getName ()).c_str ()); 00457 if (!newName.isEmpty () && newName != oldName) 00458 { 00459 IgControlCategory::renameItem (newName); 00460 rename (current, currentText ()); 00461 } 00462 }
Definition at line 517 of file Ig3DLightsCategory.cc.
References asDirectionalLight(), asPointLight(), ASSERT, asSpotLight(), attach(), Ig3DBaseModel::attachPoint(), detach(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, isManipulatorType(), m, m_source, Ig3DBaseBrowser::model(), name, and Ig3DObjectCategory< SoLight >::replace().
Referenced by manipulators().
00518 { 00519 // Hide or show the light manipulator: (hide) replace the 00520 // manipulator with the light; (show) replace the light 00521 // with manipulator. 00522 00523 SoPath *location; 00524 SoSearchAction searcher; 00525 00526 SoGroup * group = dynamic_cast<SoGroup *>( 00527 m_source->model ()->attachPoint ()->findMagic ( 00528 Ig3DBaseModel::encode ("Default Light Group"))); 00529 ASSERT (group); 00530 searcher.setNode (obj); 00531 searcher.apply (group); 00532 location = searcher.getPath (); 00533 ASSERT (location); 00534 00535 SoLight *newLight = 0; 00536 QString name (obj->getName ().getString ()); 00537 if (show && ! isManipulatorType (obj)) 00538 { 00539 if (asSpotLight (obj)) 00540 { 00541 SoSpotLightManip *replacement = new SoSpotLightManip; 00542 newLight = replacement; 00543 replacement->replaceNode (location); 00544 } 00545 else if (asPointLight (obj)) 00546 { 00547 SoPointLightManip *replacement = new SoPointLightManip; 00548 newLight = replacement; 00549 replacement->replaceNode (location); 00550 } 00551 else if (asDirectionalLight (obj)) 00552 { 00553 SoDirectionalLightManip *replacement = new SoDirectionalLightManip; 00554 newLight = replacement; 00555 replacement->replaceNode (location); 00556 } 00557 else 00558 ASSERT (false); 00559 } 00560 else if(! show && isManipulatorType (obj)) 00561 { 00562 if (asSpotLight (obj)) 00563 { 00564 SoSpotLightManip *m 00565 = static_cast<SoSpotLightManip *> (obj); 00566 SoSpotLight *light = new SoSpotLight; 00567 newLight = light; 00568 m->replaceManip (location, light); 00569 } 00570 else if (asPointLight (obj)) 00571 { 00572 SoPointLightManip *m 00573 = static_cast<SoPointLightManip *> (obj); 00574 SoPointLight *light = new SoPointLight; 00575 newLight = light; 00576 m->replaceManip (location, light); 00577 } 00578 else if (asDirectionalLight (obj)) 00579 { 00580 SoDirectionalLightManip *m 00581 = static_cast<SoDirectionalLightManip *> (obj); 00582 SoDirectionalLight *light = new SoDirectionalLight; 00583 newLight = light; 00584 m->replaceManip (location, light); 00585 } 00586 else 00587 ASSERT (false); 00588 } 00589 if (newLight) 00590 { 00591 newLight->setName (name.latin1 ()); 00592 detach (); 00593 replace (obj, newLight); 00594 attach (); 00595 } 00596 }
Definition at line 289 of file Ig3DLightsCategory.cc.
References HLT_VtxMuL3::connect, m_manip, and manipulators().
Referenced by Ig3DLightsCategory().
00290 { 00291 if (mode) 00292 connect (m_manip, SIGNAL (toggled (bool)), 00293 this, SLOT (manipulators (bool))); 00294 else 00295 disconnect (m_manip, SIGNAL (toggled (bool)), 00296 this, SLOT (manipulators (bool))); 00297 }
Reimplemented from IgControlCategory.
Definition at line 236 of file Ig3DLightsCategory.cc.
References IgControlCategory::currentItem(), isManipulatorType(), IgControlBase::isShown(), m_color, m_cutOffAngle, m_direction, m_dropOffRate, m_intensity, m_location, m_manip, m_on, and IgControlBase::update().
Referenced by reconstruct().
00237 { 00238 m_intensity->update (); 00239 m_color->update (); 00240 m_on->update (); 00241 00242 if (m_location->isShown ()) 00243 m_location->update (); 00244 00245 if (m_direction->isShown ()) 00246 m_direction->update (); 00247 00248 if (m_cutOffAngle->isShown ()) 00249 m_cutOffAngle->update (); 00250 00251 if (m_dropOffRate->isShown ()) 00252 m_dropOffRate->update (); 00253 00254 m_manip->setChecked (isManipulatorType (object (currentItem ()))); 00255 }
Ig3DColorControl* Ig3DLightsCategory::m_color [private] |
Definition at line 100 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
Definition at line 98 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
Definition at line 96 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
Definition at line 97 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
Ig3DFloatControl* Ig3DLightsCategory::m_intensity [private] |
Definition at line 99 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
QComboBox* Ig3DLightsCategory::m_lightsType [private] |
Definition at line 94 of file Ig3DLightsCategory.h.
Referenced by attach(), Ig3DLightsCategory(), and makeOne().
Ig3DVec3fControl* Ig3DLightsCategory::m_location [private] |
Definition at line 95 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
QCheckBox* Ig3DLightsCategory::m_manip [private] |
Definition at line 102 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), Ig3DLightsCategory(), lightTypeChanged(), trackingChanged(), and update().
int Ig3DLightsCategory::m_nrlights [private] |
Ig3DBoolControl* Ig3DLightsCategory::m_on [private] |
Definition at line 101 of file Ig3DLightsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DLightsCategory(), and update().
Ig3DBaseBrowser* Ig3DLightsCategory::m_source [private] |
Definition at line 92 of file Ig3DLightsCategory.h.
Referenced by browserChanged(), buildDefaults(), deleteOne(), lightTypeChanged(), makeOne(), manipulators(), reconstruct(), and toggleOne().