50#include "SelectionBasePlugin.hh"
54#include <QActionGroup>
57#define TOGGLE_IMG "selection_toggle.png"
58#define LASSO_IMG "selection_lasso.png"
59#define VOLUME_LASSO_IMG "selection_lasso2.png"
60#define SURFACE_LASSO_IMG "surface-lasso.png"
61#define SPHERE_IMG "selection_paintSphere.png"
62#define BOUNDARY_IMG "selection_boundary.png"
63#define FLOODFILL_IMG "selection_floodFill.png"
64#define COMPONENTS_IMG "selection_connected.png"
67#define TOGGLE_DESC "Toggle Selection"
68#define LASSO_DESC "Lasso Selection"
69#define VOLUME_LASSO_DESC "Volume Lasso Selection"
70#define SURFACE_LASSO_DESC "Surface Lasso Selection"
71#define SPHERE_DESC "Sphere Selection"
72#define BOUNDARY_DESC "Boundary Selection"
73#define FLOODFILL_DESC "Floodfill Selection"
74#define COMPONENTS_DESC "Selected Components Selection"
77#define SB_TOGGLE "sb_toggle"
78#define SB_LASSO "sb_lasso"
79#define SB_VOLUME_LASSO "sb_volumelasso"
80#define SB_SURFACE_LASSO "sb_surfacelasso"
81#define SB_SPHERE "sb_sphere"
82#define SB_BOUNDARY "sb_closestboundary"
83#define SB_FLOODFILL "sb_floodfill"
84#define SB_COMPONENTS "sb_components"
87#define NO_SELECTION_PICKING "No_Selection_Picking"
88#define NO_SELECTION_MODE "No_Selection_Mode"
90#define SELECTION_PICKING "SelectionBasePicking"
96primitivesBarGroup_(nullptr),
97pickModeToolBar_(nullptr),
98selectionModesGroup_(nullptr),
99toggleSelectionAction_(nullptr),
100lassoSelectionAction_(nullptr),
101volumeLassoSelectionAction_(nullptr),
102surfaceLassoSelectionAction_(nullptr),
103sphereSelectionAction_(nullptr),
104boundarySelectionAction_(nullptr),
105floodFillSelectionAction_(nullptr),
106componentsSelectionAction_(nullptr),
107currentPickMode_(NO_SELECTION_PICKING),
108lastPickMode_(NO_SELECTION_PICKING),
109currentSelectionMode_(NO_SELECTION_MODE),
110currentPrimitiveType_(0u),
111nextFreePrimitiveType_(1u),
113sphere_mat_node_(nullptr),
114sphere_node_(nullptr),
117lassoSelection_(false),
119availableObjectTypes_(0u)
124SelectionBasePlugin::~SelectionBasePlugin() {
130void SelectionBasePlugin::initializePlugin() {
133 if (OpenFlipper::Options::nogui())
138 QSize size(300, 300);
142 connect(tool_->loadSelection, SIGNAL(clicked()),
this, SLOT(slotLoadSelectionButton()));
143 connect(tool_->saveSelection, SIGNAL(clicked()),
this, SLOT(slotSaveSelectionButton()));
146 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"selection_base.png");
147 emit addToolbox(
"Selections", tool_, toolIcon_ );
150 toolBar_ =
new QToolBar(tr(
"Selection Base"));
151 emit addToolbar(toolBar_);
153 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
154 QAction* selectionEnvironmentButton =
new QAction(QIcon(iconPath +
"selection_base.png"),
"Selections", toolBar_);
155 toolBar_->addAction(selectionEnvironmentButton);
158 connect(selectionEnvironmentButton, SIGNAL(triggered(
bool)),
this, SLOT(slotSelectionEnvironmentRequested(
bool)));
161 emit registerKey(Qt::Key_Control, Qt::NoModifier, tr(
"Deselection"),
true);
162 emit registerKey(Qt::Key_Control, Qt::ControlModifier, tr(
"Deselection"),
true);
164 emit registerKey(Qt::Key_Shift, Qt::NoModifier, tr(
"Source/Target Selection"),
true);
165 emit registerKey(Qt::Key_Shift, Qt::ShiftModifier, tr(
"Source/Target Selection"),
true);
168 emit addPickMode(SELECTION_PICKING);
170 emit setPickModeMouseTracking(SELECTION_PICKING,
true);
173 tool_->typeTabWidget->setMovable(
true);
176 pickModeToolBar_ =
new QToolBar(
"Selection Picking Toolbar");
177 pickModeToolBar_->setObjectName(
"Selection_Picking_Toolbar");
180 primitivesBarGroup_ =
new QActionGroup(pickModeToolBar_);
181 primitivesBarGroup_->setExclusive(
true);
185 selectionModesGroup_ =
new QActionGroup(pickModeToolBar_);
186 selectionModesGroup_->setExclusive(
true);
187 toggleSelectionAction_ =
new HandleAction(QIcon(iconPath + TOGGLE_IMG), TOGGLE_DESC, selectionModesGroup_);
188 toggleSelectionAction_->setCheckable(
true);
190 connect(toggleSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
191 lassoSelectionAction_ =
new HandleAction(QIcon(iconPath + LASSO_IMG), LASSO_DESC, selectionModesGroup_);
192 lassoSelectionAction_->setCheckable(
true);
194 connect(lassoSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
195 volumeLassoSelectionAction_ =
new HandleAction(QIcon(iconPath + VOLUME_LASSO_IMG), VOLUME_LASSO_DESC, selectionModesGroup_);
196 volumeLassoSelectionAction_->setCheckable(
true);
198 connect(volumeLassoSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
199 surfaceLassoSelectionAction_ =
new HandleAction(QIcon(iconPath + SURFACE_LASSO_IMG), SURFACE_LASSO_DESC, selectionModesGroup_);
200 surfaceLassoSelectionAction_->setCheckable(
true);
202 connect(surfaceLassoSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
203 sphereSelectionAction_ =
new HandleAction(QIcon(iconPath + SPHERE_IMG), SPHERE_DESC, selectionModesGroup_);
204 sphereSelectionAction_->setCheckable(
true);
206 connect(sphereSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
207 boundarySelectionAction_ =
new HandleAction(QIcon(iconPath + BOUNDARY_IMG), BOUNDARY_DESC, selectionModesGroup_);
208 boundarySelectionAction_->setCheckable(
true);
210 connect(boundarySelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
211 floodFillSelectionAction_ =
new HandleAction(QIcon(iconPath + FLOODFILL_IMG), FLOODFILL_DESC, selectionModesGroup_);
212 floodFillSelectionAction_->setCheckable(
true);
214 connect(floodFillSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
215 componentsSelectionAction_ =
new HandleAction(QIcon(iconPath + COMPONENTS_IMG), COMPONENTS_DESC, selectionModesGroup_);
216 componentsSelectionAction_->setCheckable(
true);
218 connect(componentsSelectionAction_, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
220 pickModeToolBar_->clear();
221 pickModeToolBar_->addActions(primitivesBarGroup_->actions());
222 pickModeToolBar_->addSeparator();
223 pickModeToolBar_->addActions(selectionModesGroup_->actions());
228 pickModeToolBar_->setWindowOpacity(0.99);
230 emit setPickModeToolbar(SELECTION_PICKING, pickModeToolBar_);
235void SelectionBasePlugin::pluginsInitialized() {
242 std::string nodeName = std::string( tr(
"Selection Base Plugin: Selection Sphere Material").toUtf8() );
255 nodeName = std::string( tr(
"Selection Base Plugin: Selection Sphere").toUtf8() );
259 sphere_node_->
hide();
263 nodeName = std::string( tr(
"Selection Base Plugin: Lasso Selection Line").toUtf8() );
281 _env.primitivesBar =
new QHBoxLayout(tab->toolPrimitivesBar);
284 _env.operationsBar =
new QVBoxLayout(tab->toolOperationsWidget);
287 policy.setVerticalPolicy(QSizePolicy::MinimumExpanding);
288 policy.setHorizontalPolicy(QSizePolicy::Preferred);
289 tab->selectionGroup->setSizePolicy(policy);
291 tab->toolPrimitivesBar->setLayout(_env.primitivesBar);
292 tab->toolPrimitivesBar->setMinimumHeight(68);
293 tab->toolOperationsWidget->setLayout(_env.operationsBar);
294 tab->toolOperationsWidget->setMinimumHeight(150);
296 _env.primitiveActions =
new QActionGroup(0);
297 _env.primitiveActions->setExclusive(
true);
304void SelectionBasePlugin::slotLoadSelectionButton() {
307 QString filename = QFileDialog::getOpenFileName(0, tr(
"Load Selection"),
"selection.ini", tr(
"Selection files ( *.ini )"));
309 if(filename.length() > 0) {
313 if(!file.
connect(filename,
false)) {
314 emit log(
LOGERR, QString(
"Could not read file '%1'!").arg(filename));
319 emit loadSelection(file);
328void SelectionBasePlugin::slotSaveSelectionButton() {
331 QString filename = QFileDialog::getSaveFileName(0, tr(
"Save Selection"),
"selection.ini", tr(
"Selection files ( *.ini )"));
333 if(filename.length() > 0) {
337 if(!file.
connect(filename,
true)) {
338 emit log(
LOGERR, QString(
"Could not create file '%1'!").arg(filename));
343 emit saveSelection(file);
352void SelectionBasePlugin::slotKeyEvent(QKeyEvent* _event) {
355 if ((_event->modifiers() & Qt::ControlModifier) || (_event->key() == Qt::Key_Control)) {
357 primitivesBarGroup_->setExclusive(
false);
359 deselection_ =
false;
360 primitivesBarGroup_->setExclusive(
true);
364 if ((_event->modifiers() & Qt::ShiftModifier) || (_event->key() == Qt::Key_Shift))
365 tool_->restrictOnTargets->setChecked(
true);
367 tool_->restrictOnTargets->setChecked(
false);
374 std::set<std::pair<int,Qt::KeyboardModifiers> >::iterator f =
375 registeredKeys_.find(std::pair<int,Qt::KeyboardModifiers>(_event->key(), _event->modifiers()));
377 if(f != registeredKeys_.end()) {
379 emit keyShortcutEvent((*f).first,(*f).second);
385void SelectionBasePlugin::slotKeyReleaseEvent(QKeyEvent* _event) {
388 if ((_event->modifiers() & Qt::ControlModifier) || (_event->key() == Qt::Key_Control)) {
389 deselection_ =
false;
390 primitivesBarGroup_->setExclusive(
true);
394 if ((_event->modifiers() & Qt::ShiftModifier) || (_event->key() == Qt::Key_Shift))
395 tool_->restrictOnTargets->setChecked(
false);
400void SelectionBasePlugin::loadIniFileOptionsLast(
INIFile &_ini)
402 emit loadSelection(_ini);
407void SelectionBasePlugin::slotAddSelectionEnvironment(QString _modeName,
const QString& _description,
const QString& _icon, QString& _handleName) {
414 std::map<QString,SelectionEnvironment>::iterator it =
415 selectionEnvironments_.begin();
417 for(; it != selectionEnvironments_.end(); ++it) {
418 if(_modeName == (*it).second.name) {
419 emit log(
LOGINFO, QString(
"Selection environment %1 already exists.").arg(_modeName));
425 SelectionEnvironment env;
426 env.name = _modeName;
430 if ( OpenFlipper::Options::gui() ) {
433 int index = tool_->typeTabWidget->addTab(tab, QIcon(_icon), _modeName);
434 env.tabWidget = tool_->typeTabWidget->widget(index);
438 tool_->typeTabWidget->setTabEnabled(index,
false);
439 tool_->typeTabWidget->widget(index)->setEnabled(
false);
447 env.handle = _handleName;
453 selectionEnvironments_.insert(std::pair<QString,SelectionEnvironment>(_handleName, env));
458void SelectionBasePlugin::slotRegisterType(
const QString& _handleName,
DataType _type) {
463 SelectionEnvironment* env;
469 for(std::vector<DataType>::iterator t_it = env->types.begin();
470 t_it != env->types.end(); ++t_it) {
472 if ((*t_it) == _type)
return;
475 env->types.push_back(_type);
480 tool_->typeTabWidget->setTabEnabled(tool_->typeTabWidget->indexOf(env->tabWidget),
true);
481 env->tabWidget->setEnabled(
true);
485 emit log(
LOGERR,
"The specified selection environment has not been found! The data type could not be registered.");
494 QList<QAction*> primitivesList = primitivesBarGroup_->actions();
496 for(QList<QAction*>::iterator it = primitivesList.begin(); it != primitivesList.end(); ++it) {
497 (*it)->setEnabled(
false);
503 std::map<QString,SelectionEnvironment>::iterator sit =
505 if(sit != selectionEnvironments_.end()) {
507 bool atLeastOne =
false;
508 for(std::vector<DataType>::iterator tit = (*sit).second.types.begin();
509 tit != (*sit).second.types.end(); ++tit) {
516 (*it)->setEnabled(
true);
525 for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
526 it != selectionEnvironments_.end(); ++it) {
529 toggleSelectionAction_->setEnabled(toggleSelectionAction_->isAssociated(currentPrimitiveType_,
true));
530 lassoSelectionAction_->setEnabled(lassoSelectionAction_->isAssociated(currentPrimitiveType_,
true));
531 volumeLassoSelectionAction_->setEnabled(volumeLassoSelectionAction_->isAssociated(currentPrimitiveType_,
true));
532 surfaceLassoSelectionAction_->setEnabled(surfaceLassoSelectionAction_->isAssociated(currentPrimitiveType_,
true));
533 sphereSelectionAction_->setEnabled(sphereSelectionAction_->isAssociated(currentPrimitiveType_,
true));
534 boundarySelectionAction_->setEnabled(boundarySelectionAction_->isAssociated(currentPrimitiveType_,
true));
535 floodFillSelectionAction_->setEnabled(floodFillSelectionAction_->isAssociated(currentPrimitiveType_,
true));
536 componentsSelectionAction_->setEnabled(componentsSelectionAction_->isAssociated(currentPrimitiveType_,
true));
539 for(std::set<HandleAction*>::iterator cit = (*it).second.customSelectionModes.begin();
540 cit != (*it).second.customSelectionModes.end(); ++cit) {
542 (*cit)->setEnabled((availableObjectTypes_ & (*cit)->objectTypeRestriction()) &&
543 (*cit)->isAssociated(currentPrimitiveType_,
true));
550void SelectionBasePlugin::slotMouseWheelEvent(QWheelEvent* _event,
const std::string& _mode) {
552 if(currentPickMode_ == NO_SELECTION_PICKING)
return;
555 if (currentSelectionMode_ == SB_SPHERE) {
557 float d = -(float)_event->angleDelta().y() / 120.0 * 0.1;
558 sphere_radius_ *= 1.0 + d;
560 sphere_node_->
set_size(sphere_radius_);
561 sphere_node_->
show();
569void SelectionBasePlugin::slotMouseEvent(QMouseEvent* _event) {
571 if(currentPickMode_ == NO_SELECTION_PICKING)
return;
574 if(currentSelectionMode_ == SB_TOGGLE) {
575 slotMouseToggleSelection(_event);
576 }
else if (currentSelectionMode_ == SB_LASSO) {
577 slotMouseLassoSelection(_event);
578 }
else if (currentSelectionMode_ == SB_VOLUME_LASSO) {
579 slotMouseVolumeLassoSelection(_event);
580 }
else if (currentSelectionMode_ == SB_SURFACE_LASSO) {
581 slotMouseSurfaceLassoSelection(_event);
582 }
else if (currentSelectionMode_ == SB_SPHERE) {
583 slotMouseSphereSelection(_event);
584 }
else if (currentSelectionMode_ == SB_BOUNDARY) {
585 slotMouseBoundarySelection(_event);
586 }
else if (currentSelectionMode_ == SB_FLOODFILL) {
587 slotMouseFloodFillSelection(_event);
588 }
else if (currentSelectionMode_ == SB_COMPONENTS) {
589 slotMouseComponentsSelection(_event);
592 slotMouseCustomSelection(_event);
598void SelectionBasePlugin::slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle) {
600 if ( !OpenFlipper::Options::gui() )
604 SelectionEnvironment* env;
607 emit log(
LOGERR, QString(
"Could not find selection environment width handle '%1'!").arg(_handleName));
613 if(nextFreePrimitiveType_ > nextFreePrimitiveType_ << 1) {
614 emit log(
LOGERR,
"Maximum number of custom primitive types for selection reached!");
619 QList<QAction*>::const_iterator a_it = env->primitiveActions->actions().constBegin();
620 for(; a_it != env->primitiveActions->actions().constEnd(); ++a_it) {
621 if((*a_it)->text() == _name) {
622 emit log(
LOGERR, QString(
"A custom primitive type with name \"%1\" already exists!").arg(_name));
629 action->setCheckable(
true);
631 primitivesBarGroup_->addAction(action);
632 pickModeToolBar_->clear();
633 pickModeToolBar_->addActions(primitivesBarGroup_->actions());
634 pickModeToolBar_->addSeparator();
635 pickModeToolBar_->addActions(selectionModesGroup_->actions());
639 button->setMinimumSize(QSize(32,32));
640 button->setMaximumSize(QSize(64,64));
641 env->primitivesBar->addWidget(button);
643 _typeHandle = nextFreePrimitiveType_;
647 env->primitiveTypes |= _typeHandle;
649 primitiveTypeButtons_.insert(std::pair<PrimitiveType,QAction*>(_typeHandle,action));
652 nextFreePrimitiveType_ <<= 1;
655 connect(action, SIGNAL(toggled(
bool)),
this, SLOT(updateActivePrimitiveTypes(
bool)));
662void SelectionBasePlugin::updateActivePrimitiveTypes(
bool _checked) {
664 QObject* sender = QObject::sender();
668 if(!clickedAction)
return;
671 clickedAction->setChecked(_checked);
674 currentPrimitiveType_ = 0u;
676 QList<QAction*> actions = primitivesBarGroup_->actions();
677 for(
int i = 0; i < actions.size(); ++i) {
679 if(actions[i]->isChecked()) {
692 slotSelectionEnvironmentRequested(_checked);
697 QList<QAction*> sm_actions = selectionModesGroup_->actions();
698 bool atLeastOneSelectionMode =
false;
699 for(
int i = 0; i < sm_actions.size(); ++i) {
701 if(sm_actions[i]->isChecked()) {
702 atLeastOneSelectionMode =
true;
706 if(!ha->isAssociated(currentPrimitiveType_)) {
707 ha->blockSignals(
true);
708 ha->setChecked(
false);
709 ha->blockSignals(
false);
710 toggleSelectionAction_->trigger();
716 if(!atLeastOneSelectionMode) {
717 toggleSelectionAction_->trigger();
721 SelectionEnvironment* env =
nullptr;
723 tool_->typeTabWidget->setCurrentIndex(tool_->typeTabWidget->indexOf(env->tabWidget));
729 lassoSelection_ =
false;
733 slotShowAndHideOperations();
734 slotShowAndHideParameters();
743 if (_metaphor == SB_TOGGLE)
744 toggleSelectionAction_->trigger();
745 else if (_metaphor == SB_LASSO)
746 lassoSelectionAction_->trigger();
747 else if (_metaphor == SB_VOLUME_LASSO)
748 volumeLassoSelectionAction_->trigger();
749 else if (_metaphor == SB_SURFACE_LASSO)
750 surfaceLassoSelectionAction_->trigger();
751 else if (_metaphor == SB_SPHERE)
752 sphereSelectionAction_->trigger();
753 else if (_metaphor == SB_BOUNDARY)
754 boundarySelectionAction_->trigger();
755 else if (_metaphor == SB_FLOODFILL)
756 floodFillSelectionAction_->trigger();
757 else if (_metaphor == SB_COMPONENTS)
758 componentsSelectionAction_->trigger();
761 std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
763 for (; it != selectionEnvironments_.end() && !found; ++it) {
764 std::set<HandleAction*>::iterator e = it->second.customSelectionModes.begin();
765 for(; e != it->second.customSelectionModes.end(); ++e) {
767 QString customModeName = QString((*e)->selectionEnvironmentHandle() +
"_" + _metaphor).replace(
" ",
"_");
768 if((*e)->selectionModeHandle().contains(customModeName)) {
781 QList<QAction*>::iterator a_it = primitivesBarGroup_->actions().begin();
782 for(; a_it != primitivesBarGroup_->actions().end(); ++a_it) {
783 if((*a_it)->text() == _primitive) {
792void SelectionBasePlugin::slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {
795 SelectionEnvironment* env =
nullptr;
797 emit log(
LOGERR, QString(
"Could not find selection environment with handle '%1'!").arg(_handleName));
802 std::map<QString,std::pair<FillingLayout*,QGroupBox*> >::iterator it = env->categories.find(_category);
803 if(it == env->categories.end()) {
806 QGroupBox* group =
new QGroupBox(_category);
807 group->setLayout(fillLayout);
809 std::pair<std::map<QString,std::pair<FillingLayout*,QGroupBox*> >::iterator,
bool> ret;
810 ret = env->categories.insert(std::pair<QString,std::pair<FillingLayout*,QGroupBox*> >(_category,
811 std::pair<FillingLayout*,QGroupBox*>(fillLayout,group)));
814 env->operationsBar->addWidget(group);
818 for(
int i = 0; i < _operationsList.size(); ++i) {
819 QPushButton* button =
new QPushButton(_operationsList[i]);
820 button->setDisabled(
true);
821 button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
822 int width = button->fontMetrics().horizontalAdvance(_operationsList[i]);
823 button->setMinimumWidth(width);
824 button->setFixedHeight(26);
826 connect(button, SIGNAL(clicked()),
this, SLOT(slotOperationRequested()));
828 env->operations.insert(std::pair<PrimitiveType,QPushButton*>(_type, button));
830 (*it).second.first->addWidget(button);
833 slotShowAndHideOperations();
838void SelectionBasePlugin::slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type)
841 SelectionEnvironment* env =
nullptr;
843 emit log(
LOGERR, QString(
"Could not find selection environment with handle '%1'!").arg(_handleName));
848 std::map<QString,std::pair<FillingLayout*,QGroupBox*> >::iterator it = env->categories.find(_category);
849 if(it == env->categories.end()) {
852 QGroupBox* group =
new QGroupBox(_category);
853 group->setLayout(fillLayout);
855 std::pair<std::map<QString,std::pair<FillingLayout*,QGroupBox*> >::iterator,
bool> ret;
856 ret = env->categories.insert(std::pair<QString,std::pair<FillingLayout*,QGroupBox*> >(_category,
857 std::pair<FillingLayout*,QGroupBox*>(fillLayout,group)));
860 env->operationsBar->addWidget(group);
864 env->parameters.insert(std::pair<PrimitiveType,QWidget*>(_type, _widget));
866 (*it).second.first->addWidget(_widget);
869 slotShowAndHideParameters();
874void SelectionBasePlugin::slotOperationRequested() {
876 QObject* sender = QObject::sender();
877 QPushButton* button = 0;
878 button =
dynamic_cast<QPushButton*
>(sender);
882 emit selectionOperation(button->text());
887void SelectionBasePlugin::slotShowAndHideOperations() {
889 for(std::map<QString,SelectionEnvironment>::iterator e_it = selectionEnvironments_.begin();
890 e_it != selectionEnvironments_.end(); ++e_it) {
892 for(std::multimap<PrimitiveType,QPushButton*>::iterator it = (*e_it).second.operations.begin();
893 it != (*e_it).second.operations.end(); ++it) {
895 if((currentPrimitiveType_ & (*it).first) || (*it).first == 0u) {
897 (*it).second->setDisabled(
false);
900 (*it).second->setDisabled(
true);
908void SelectionBasePlugin::slotShowAndHideParameters() {
910 for(std::map<QString,SelectionEnvironment>::iterator e_it = selectionEnvironments_.begin();
911 e_it != selectionEnvironments_.end(); ++e_it) {
913 for(std::multimap<PrimitiveType,QWidget*>::iterator it = (*e_it).second.parameters.begin();
914 it != (*e_it).second.parameters.end(); ++it) {
916 if((currentPrimitiveType_ & (*it).first) || (*it).first == 0u) {
918 (*it).second->setDisabled(
false);
921 (*it).second->setDisabled(
true);
929void SelectionBasePlugin::slotSelectionEnvironmentRequested(
bool _checked) {
936 currentPickMode_ = SELECTION_PICKING;
941void SelectionBasePlugin::slotEnterSelectionMode(
bool _checked) {
943 QObject* obj = QObject::sender();
950 act->setChecked(_checked);
960 lassoSelection_ =
false;
962 if(currentSelectionMode_ == SB_SPHERE) {
970void SelectionBasePlugin::slotPickModeChanged (
const std::string& _pickmode) {
973 bool selectionPicking = (_pickmode ==
"SelectionBasePicking");
976 if(currentSelectionMode_ == SB_SPHERE)
977 sphere_node_->
show();
979 sphere_node_->
hide();
981 if(currentSelectionMode_ == SB_LASSO || currentSelectionMode_ == SB_VOLUME_LASSO)
986 bool resetPickToolBar =
false;
988 if(currentPickMode_ != NO_SELECTION_PICKING) {
992 sphere_node_->
hide();
996 lastPickMode_ = currentPickMode_;
997 currentPickMode_ = NO_SELECTION_PICKING;
999 }
else if (selectionPicking && currentPickMode_ == NO_SELECTION_PICKING && lastPickMode_ != NO_SELECTION_PICKING) {
1002 currentPickMode_ = lastPickMode_;
1004 }
else if (!selectionPicking && currentPickMode_ == NO_SELECTION_PICKING) {
1008 linePoints_.clear();
1013 currentPickMode_ = NO_SELECTION_PICKING;
1014 currentSelectionMode_ = NO_SELECTION_MODE;
1015 lastPickMode_ = NO_SELECTION_PICKING;
1018 resetPickToolBar =
true;
1024 lastPickMode_ = currentPickMode_ = _pickmode.c_str();
1027 resetPickToolBar =
true;
1030 linePoints_.clear();
1035 toggleSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_TOGGLE);
1036 lassoSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_LASSO);
1037 volumeLassoSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_VOLUME_LASSO);
1038 surfaceLassoSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_SURFACE_LASSO);
1039 sphereSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_SPHERE);
1040 boundarySelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_BOUNDARY);
1041 floodFillSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_FLOODFILL);
1042 componentsSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_COMPONENTS);
1044 for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
1045 it != selectionEnvironments_.end(); ++it) {
1048 for(std::set<HandleAction*>::iterator csm_it = (*it).second.customSelectionModes.begin();
1049 csm_it != (*it).second.customSelectionModes.end(); ++csm_it) {
1050 (*csm_it)->setChecked(!resetPickToolBar && currentSelectionMode_ == (*csm_it)->selectionModeHandle());
1054 if(selectionPicking)
1061 bool _show, SelectionInterface::PrimitiveType _associatedTypes,
1062 QString& _customIdentifier,
bool _custom,
DataType _objectTypeRestriction) {
1064 if ( !OpenFlipper::Options::gui() )
1073 if(_mode == SB_TOGGLE) {
1075 }
else if (_mode == SB_LASSO) {
1077 }
else if (_mode == SB_VOLUME_LASSO) {
1079 }
else if (_mode == SB_SURFACE_LASSO) {
1081 }
else if (_mode == SB_SPHERE) {
1083 }
else if (_mode == SB_BOUNDARY) {
1085 }
else if (_mode == SB_FLOODFILL) {
1087 }
else if (_mode == SB_COMPONENTS) {
1098 action->setCheckable(
true);
1104 selectionModesGroup_->addAction(action);
1105 pickModeToolBar_->clear();
1106 pickModeToolBar_->addActions(primitivesBarGroup_->actions());
1107 pickModeToolBar_->addSeparator();
1108 pickModeToolBar_->addActions(selectionModesGroup_->actions());
1111 env->customSelectionModes.insert(action);
1113 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(slotEnterSelectionMode(
bool)));
1116 std::set<HandleAction*>::iterator e = env->customSelectionModes.begin();
1117 for(; e != env->customSelectionModes.end(); ++e) {
1118 if((*e)->selectionEnvironmentHandle() == _handleName)
1123 if(e != env->customSelectionModes.end()) {
1124 (*e)->removeAssociatedType(_associatedTypes);
1125 env->customSelectionModes.erase(e);
1133void SelectionBasePlugin::slotAddCustomSelectionMode(
const QString& _handleName,
const QString& _modeName,
const QString& _description,
const QString &_icon,
1134 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier) {
1136 showSelectionMode(_modeName, _icon, _description, _handleName,
true, _associatedTypes, _customIdentifier,
true);
1142void SelectionBasePlugin::slotAddCustomSelectionMode(
const QString& _handleName,
const QString& _modeName,
const QString& _description,
const QString& _icon,
1143 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
1146 showSelectionMode(_modeName, _icon, _description, _handleName,
true, _associatedTypes, _customIdentifier,
true, _objectTypeRestriction);
1152void SelectionBasePlugin::slotShowToggleSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1154 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1156 showSelectionMode(SB_TOGGLE, iconPath + TOGGLE_IMG, TOGGLE_DESC, _handleName, _show, _associatedTypes, dummy);
1162void SelectionBasePlugin::slotShowLassoSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1164 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1166 showSelectionMode(SB_LASSO, iconPath + LASSO_IMG, LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
1172void SelectionBasePlugin::slotShowVolumeLassoSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1174 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1176 showSelectionMode(SB_VOLUME_LASSO, iconPath + VOLUME_LASSO_IMG, VOLUME_LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
1182void SelectionBasePlugin::slotShowSurfaceLassoSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1184 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1186 showSelectionMode(SB_SURFACE_LASSO, iconPath + SURFACE_LASSO_IMG, SURFACE_LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
1192void SelectionBasePlugin::slotShowSphereSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1194 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1196 showSelectionMode(SB_SPHERE, iconPath + SPHERE_IMG, SPHERE_DESC, _handleName, _show, _associatedTypes, dummy);
1202void SelectionBasePlugin::slotShowClosestBoundarySelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1204 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1206 showSelectionMode(SB_BOUNDARY, iconPath + BOUNDARY_IMG, BOUNDARY_DESC, _handleName, _show, _associatedTypes, dummy);
1212void SelectionBasePlugin::slotShowFloodFillSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1214 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1216 showSelectionMode(SB_FLOODFILL, iconPath + FLOODFILL_IMG, FLOODFILL_DESC, _handleName, _show, _associatedTypes, dummy);
1222void SelectionBasePlugin::slotShowComponentsSelectionMode(
const QString& _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
1224 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
1226 showSelectionMode(SB_COMPONENTS, iconPath + COMPONENTS_IMG, COMPONENTS_DESC, _handleName, _show, _associatedTypes, dummy);
1232void SelectionBasePlugin::slotGetActiveDataTypes(TypeList& _types) {
1234 if(currentPickMode_ == NO_SELECTION_PICKING) {
1235 _types = TypeList();
1237 std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.find(currentPickMode_);
1238 if(it == selectionEnvironments_.end()) {
1239 _types = TypeList();
1241 _types = (*it).second.types;
1248void SelectionBasePlugin::slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type) {
1250 _type = currentPrimitiveType_;
1255void SelectionBasePlugin::slotMouseToggleSelection(QMouseEvent* _event) {
1258 if (_event->type() == QEvent::MouseButtonPress) {
1260 if (_event->button() == Qt::RightButton)
return;
1262 emit toggleSelection(_event, currentPrimitiveType_, deselection_);
1268void SelectionBasePlugin::slotMouseLassoSelection(QMouseEvent* _event) {
1271 if (_event->button() == Qt::RightButton)
return;
1273 size_t node_idx, target_idx;
1281 if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
1284 if(!lassoSelection_) {
1286 linePoints_.clear();
1287 lassoSelection_ =
true;
1293 linePoints_.push_back(hit_point);
1296 emit lassoSelection(_event, currentPrimitiveType_, deselection_);
1298 }
else if(_event->type() == QEvent::MouseMove) {
1300 if(!lassoSelection_)
return;
1310 line_node_->
clear();
1311 for (std::vector< ACG::Vec3d >::iterator it = linePoints_.begin(); it != linePoints_.end(); ++it)
1317 if( !linePoints_.empty() )
1320 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1323 lassoSelection_ =
false;
1324 linePoints_.clear();
1325 line_node_->
clear();
1329 emit lassoSelection(_event, currentPrimitiveType_, deselection_);
1335void SelectionBasePlugin::slotMouseVolumeLassoSelection(QMouseEvent* _event) {
1338 if (_event->button() == Qt::RightButton)
return;
1340 size_t node_idx, target_idx;
1348 if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
1351 if(!lassoSelection_) {
1353 linePoints_.clear();
1354 lassoSelection_ =
true;
1361 linePoints_.push_back(hit_point);
1364 emit volumeLassoSelection(_event, currentPrimitiveType_, deselection_);
1366 }
else if(_event->type() == QEvent::MouseMove) {
1368 if(!lassoSelection_)
return;
1378 line_node_->
clear();
1379 for (std::vector< ACG::Vec3d >::iterator it = linePoints_.begin(); it != linePoints_.end(); ++it)
1385 if( !linePoints_.empty() )
1388 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1391 lassoSelection_ =
false;
1392 linePoints_.clear();
1393 line_node_->
clear();
1397 emit volumeLassoSelection(_event, currentPrimitiveType_, deselection_);
1403void SelectionBasePlugin::slotMouseSurfaceLassoSelection(QMouseEvent* _event) {
1410void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
1413 if (_event->button() == Qt::RightButton)
return;
1416 size_t node_idx, target_idx;
1420 sphere_node_->
hide();
1424 _event->pos(), node_idx, target_idx, &hit_point)) {
1431 sphere_node_->
show();
1433 sphere_node_->
set_size(sphere_radius_);
1436 if( (_event->buttons() & Qt::LeftButton)
1437 ||( (_event->buttons() == Qt::NoButton) && (_event->type() == QEvent::MouseButtonRelease))
1440 emit sphereSelection(_event, sphere_radius_, currentPrimitiveType_, deselection_);
1446 sphere_node_->
hide();
1452void SelectionBasePlugin::slotMouseBoundarySelection(QMouseEvent* _event) {
1455 if (_event->type() == QEvent::MouseButtonPress) {
1457 if (_event->button() == Qt::RightButton)
return;
1459 emit closestBoundarySelection(_event, currentPrimitiveType_, deselection_);
1465void SelectionBasePlugin::slotMouseFloodFillSelection(QMouseEvent* _event) {
1468 if (_event->type() == QEvent::MouseButtonPress) {
1470 if (_event->button() == Qt::RightButton)
return;
1472 emit floodFillSelection(_event, currentPrimitiveType_, deselection_);
1478void SelectionBasePlugin::slotMouseComponentsSelection(QMouseEvent* _event) {
1481 if (_event->type() == QEvent::MouseButtonPress) {
1483 if (_event->button() == Qt::RightButton)
return;
1485 emit componentsSelection(_event, currentPrimitiveType_, deselection_);
1491void SelectionBasePlugin::slotMouseCustomSelection(QMouseEvent* _event) {
1493 emit customSelection(_event, currentPrimitiveType_, currentSelectionMode_, deselection_);
1498void SelectionBasePlugin::addedEmptyObject (
int _id) {
1505 SelectionEnvironment* env =
nullptr;
1512 availableObjectTypes_ |= obj->
dataType();
1519 if (bObject && !bObject->
isGroup()) {
1520 emit log(
LOGERR,
"Could not retrieve object type! Maybe a selection environment will be missing.");
1527 tool_->typeTabWidget->setTabEnabled(tool_->typeTabWidget->indexOf(env->tabWidget),
true);
1528 env->tabWidget->setEnabled(
true);
1546void SelectionBasePlugin::objectDeleted (
int _id) {
1554 SelectionEnvironment* env =
nullptr;
1559 availableObjectTypes_ = (availableObjectTypes_ & ~obj->dataType().
value());
1561 emit log(
LOGERR,
"Could not retrieve object type!");
1572 bool atLeastOne =
false;
1573 for(std::vector<DataType>::iterator t_it = env->types.begin();
1574 t_it != env->types.end(); ++t_it) {
1583 tool_->typeTabWidget->setTabEnabled(tool_->typeTabWidget->indexOf(env->tabWidget), atLeastOne);
1584 env->tabWidget->setEnabled(atLeastOne);
1594 std::cerr <<
"====== ERROR =======" << std::endl;
1595 std::cerr <<
"Negative counter for type " << obj->
dataType().name().toStdString() << std::endl;
1598 std::cerr <<
"Error: No counter for type " << obj->
dataType().name().toStdString() << std::endl;
1608void SelectionBasePlugin::updateTabsOrder() {
1610 std::map<int, int> newMappings;
1613 for(
int i = 0; i < tool_->typeTabWidget->count(); ++i) {
1614 if(tool_->typeTabWidget->isTabEnabled(i)) {
1615 tool_->typeTabWidget->insertTab(firstFree, tool_->typeTabWidget->widget(i), tool_->typeTabWidget->tabText(i));
1616 newMappings.insert(std::pair<int,int>(i,firstFree));
1620 newMappings.insert(std::pair<int,int>(i,i));
1625 if(tool_->typeTabWidget->count() > 0) tool_->typeTabWidget->setCurrentIndex(0);
1630void SelectionBasePlugin::slotTargetObjectsOnly(
bool& _targetsOnly) {
1632 if(OpenFlipper::Options::nogui() || tool_ == 0) {
1633 _targetsOnly =
true;
1635 _targetsOnly = tool_->restrictOnTargets->isChecked();
1650 QString needle = _name;;
1653 needle.append(QString::number(_num));
1657 for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
1658 it != selectionEnvironments_.end(); ++it) {
1662 for(std::set<HandleAction*>::iterator dsm_it = (*it).second.defaultSelectionModes.begin();
1663 dsm_it != (*it).second.defaultSelectionModes.end(); ++dsm_it) {
1665 if((*dsm_it)->selectionModeHandle() == needle) {
1686 QString needle = _name;;
1689 needle.append(QString::number(_num));
1693 for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
1694 it != selectionEnvironments_.end(); ++it) {
1696 if((*it).first == needle) {
1710 QMap<DataType, int>::iterator iterator =
typeCounter_.find(_type);
1715 if ( _excludeId != -1 ) {
1721 if (
object == 0 ) {
1722 std::cerr <<
"Unable to get Object for type exists" << std::endl;
1732 std::cerr <<
"Type exists Error after mismatch exclude: " << _type.
name().toStdString() <<
" negative count" << std::endl;
1744 std::cerr <<
"Type exists Error " << _type.
name().toStdString() <<
" negative count" << std::endl;
1755 std::cerr <<
"Type exists Error " << _type.
name().toStdString() <<
" negative count" << std::endl;
1771void SelectionBasePlugin::slotRegisterKeyShortcut(
int _key, Qt::KeyboardModifiers _modifiers) {
1773 std::set<std::pair<int,Qt::KeyboardModifiers> >::iterator f =
1774 registeredKeys_.find(std::pair<int,Qt::KeyboardModifiers>(_key,_modifiers));
1776 if(f == registeredKeys_.end()) {
1778 emit registerKey(_key, _modifiers, QString(
"Selection base key %1").arg(_key),
true);
1779 registeredKeys_.insert(std::pair<int,Qt::KeyboardModifiers>(_key,_modifiers));
1788 std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.find(_handleName);
1791 if(it == selectionEnvironments_.end())
return false;
1792 env = &(it->second);
1799 HandleAction* toggleSelectionAction_, PrimitiveType& _associatedTypes)
1802 env->defaultSelectionModes.insert(toggleSelectionAction_);
1805 std::set<HandleAction*>::iterator e = env->defaultSelectionModes.find(toggleSelectionAction_);
1806 if(e != env->defaultSelectionModes.end()) {
1807 env->defaultSelectionModes.erase(e);
1808 toggleSelectionAction_->removeAssociatedType(_associatedTypes);
1817 std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
1825 for(;it != selectionEnvironments_.end(); ++it) {
1828 for(std::vector<DataType>::iterator t_it = (*it).second.types.begin();
1829 t_it != (*it).second.types.end(); ++t_it) {
int context_height() const
get gl context height
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
bool hidden()
Is node not visible (status != Active)?
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
void enablePicking(bool _enable)
@ NodeFirst
Execute action on node first and then on its children.
@ SecondPass
Draw node in second pass.
void hide()
Hide Node: set status to HideNode.
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
void show()
Show node: set status to Active.
void set_position(const Vec3d &_p, int _idx=0)
set position
Primitive & get_primitive(int _idx)
get a primitive
void set_size(double _s, int _idx=0)
set size
bool & alwaysOnTop()
get and set always on top
void set_color(const Vec4f &_c)
Override material node's set color function in order to locally add color.
void clear()
clear points/lines and colors
void add_point(const Vec3d &_v)
add point (for LineMode == PolygonMode)
void clear_points()
clear points/lines
void enable_backface_culling()
enable backface culling (not active by default, see applyProperties)
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
@ BackFaceCulling
backface culling
@ Material
apply material (ambient, diffuse, specular, shininess)
@ AlphaTest
use alpha test
void set_base_color(const Vec4f &_c)
set the base color ( Same as set_emission(const Vec4f& _c) )
unsigned int applyProperties() const
get properties that will be applied (OR'ed ApplyProperties)
void set_line_width(float _sz)
set line width (default: 1.0)
void disable_alpha_test()
disable alpha test
void enable_blending(GLenum _p1=GL_SRC_ALPHA, GLenum _p2=GL_ONE_MINUS_SRC_ALPHA)
enable blending with Parameters (_p1, _p2)
bool dataType(DataType _type) const
bool isGroup() const
Check if object is a group.
QString name() const
Return the name of this type as text.
unsigned int value() const
void selectionEnvironmentHandle(QString _handle)
Get/Set selection environment handle name.
void selectionModeHandle(QString _handle)
Get/Set selection mode handle name.
void addAssociatedType(unsigned int _associatedType)
Get/Set associated primitive types.
Class for the handling of simple configuration files.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
void disconnect()
Remove connection of this object to a file.
void selectionEnvironmentHandle(const QString _handle)
Get/Set associated selection environment handle.
void primitiveType(unsigned int _type)
Get/Set primitive type.
bool typeExists(DataType _type, int _excludeId=-1)
Test if at least one object of type _type is in the scene graph.
QMap< DataType, int > typeCounter_
Caches the number of available elements of a certain data type for the typeExists function.
void setSelectionPrimitiveType(const QString &_primitive)
Enables setting the selection primitive via scripting The default primitives for OpenMesh are:
void updatePickModeToolBar()
Update the pickmode toolbar.
void showSelectionMode(const QString &_mode, const QString &_icon, const QString &_desc, const QString &_handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes, QString &_customIdentifier, bool _custom=false, DataType _objectTypeRestriction=DATA_ALL)
bool findObjectType(BaseObjectData *&obj, bool &found, SelectionEnvironment *&env, int _id)
helper function to find a baseObjectData and selection environment given a specific id
void setSelectionMetaphor(const QString &_metaphor)
Enables setting the selection metaphor via scripting The default selection metaphors are:
QString getUniqueHandleName(const QString &_name, int _num=0)
Get a unique handle name.
SelectionBasePlugin()
Default constructor.
SelectionTypeFrameWidget * createNewTypeFrame(SelectionEnvironment &_env)
Create new type frame for tabs widget.
bool getSelectionEnvironment(SelectionEnvironment *&env, const QString &_handleName)
Get a selectionEnvironment by a given name.
QString getUniqueIdentifierName(const QString &_name, int _num=0)
Get a unique pickmode name.
void selectionModeShowSwitch(bool _show, SelectionEnvironment *&env, HandleAction *toggleSelectionAction_, SelectionInterface::PrimitiveType &_associatedTypes)
helper function for showSelectionMode
ACG::GLState & glState()
Get the glState of the Viewer.
DrawMode SOLID_SMOOTH_SHADED
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
@ PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
@ PICK_FACE
picks faces (should be implemented for all nodes)
VectorT< float, 4 > Vec4f
void addGlobalNode(ACG::SceneGraph::BaseNode *_node)
Add a global node.
double sceneRadius()
Returns the current scene radius from the active examiner widget.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
const std::string pickMode()
Get the current Picking mode.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
Viewer::ActionMode actionMode()
Get the current Action mode.