Commit c462c9e7 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added standard selection mode "connected components" to SelectionInterface and...

Added standard selection mode "connected components" to SelectionInterface and selection base plugin.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11500 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 52ec7a09
...@@ -314,6 +314,19 @@ class SelectionInterface { ...@@ -314,6 +314,19 @@ class SelectionInterface {
*/ */
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}; virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
/** \brief Show connected components selection mode in a specified selection environment
*
* Show or hide the connected components selection mode for the specified selection environment.
* Note that per default no interactive selection mode will be available.
* One will always have to explicitly add the required selection modes for
* each selection environment.
*
* @param _handleName The handle of the selection environment in which this mode should be available
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
/** \brief Add a custom interactive selection mode /** \brief Add a custom interactive selection mode
* *
* If a plugin should provide an interactive selection mode other than the * If a plugin should provide an interactive selection mode other than the
...@@ -746,6 +759,18 @@ class SelectionInterface { ...@@ -746,6 +759,18 @@ class SelectionInterface {
*/ */
virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {}; virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
/** \brief Called whenever the user performs a connected components selection
*
* This has to be implemented by each type selection plugin if this interactive selection mode should be provided.
* The metaphor behind it is that the user clicks on an object and all primitives that are connected to the
* clicked primitive are selected as well.
*
* @param _event The mouse event that currently is performed
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Called whenever the user performs a custom selection /** \brief Called whenever the user performs a custom selection
* *
* This has to be implemented by each type selection plugin if this * This has to be implemented by each type selection plugin if this
...@@ -784,7 +809,7 @@ class SelectionInterface { ...@@ -784,7 +809,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a toggle selection /** \brief Emitted by selection base plugin whenever the user performs a toggle selection
* *
* This connects to slotToggleSelection(QPoint,QString) which has to be implemented * This connects to slotToggleSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -795,7 +820,7 @@ class SelectionInterface { ...@@ -795,7 +820,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a lasso selection /** \brief Emitted by selection base plugin whenever the user performs a lasso selection
* *
* This connects to slotLassoSelection(QMouseEvent*,QString) which has to be implemented * This connects to slotLassoSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -806,7 +831,7 @@ class SelectionInterface { ...@@ -806,7 +831,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a volume lasso selection /** \brief Emitted by selection base plugin whenever the user performs a volume lasso selection
* *
* This connects to slotVolumeLassoSelection(QMouseEvent*,QString) which has to be implemented * This connects to slotVolumeLassoSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -817,7 +842,7 @@ class SelectionInterface { ...@@ -817,7 +842,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a surface lasso selection /** \brief Emitted by selection base plugin whenever the user performs a surface lasso selection
* *
* This connects to slotSurfaceLassoSelection(QMouseEvent*,QString) which has to be implemented * This connects to slotSurfaceLassoSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -828,7 +853,7 @@ class SelectionInterface { ...@@ -828,7 +853,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a sphere selection /** \brief Emitted by selection base plugin whenever the user performs a sphere selection
* *
* This connects to slotSphereSelection(QPoint,QString) which has to be implemented * This connects to slotSphereSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -840,7 +865,7 @@ class SelectionInterface { ...@@ -840,7 +865,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a closest boundary selection /** \brief Emitted by selection base plugin whenever the user performs a closest boundary selection
* *
* This connects to slotClosestBoundarySelection(QPoint,QString) which has to be implemented * This connects to slotClosestBoundarySelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -851,7 +876,7 @@ class SelectionInterface { ...@@ -851,7 +876,7 @@ class SelectionInterface {
/** \brief Emitted by selection base plugin whenever the user performs a flood fill selection /** \brief Emitted by selection base plugin whenever the user performs a flood fill selection
* *
* This connects to slotFloodFillSelection(QPoint,QString) which has to be implemented * This connects to slotFloodFillSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _event The mouse event that currently is performed * @param _event The mouse event that currently is performed
...@@ -861,6 +886,17 @@ class SelectionInterface { ...@@ -861,6 +886,17 @@ class SelectionInterface {
*/ */
virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {}; virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a connected components selection
*
* This connects to slotComponentsSelection() which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided.
*
* @param _event The mouse event that currently is performed
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a custom selection /** \brief Emitted by selection base plugin whenever the user performs a custom selection
* *
* This connects to slotCustomSelection(QMouseEvent*,QString) which has to be implemented * This connects to slotCustomSelection(QMouseEvent*,QString) which has to be implemented
...@@ -930,6 +966,7 @@ class SelectionInterface { ...@@ -930,6 +966,7 @@ class SelectionInterface {
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}; virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}; virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}; virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {}; virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {};
......
...@@ -282,6 +282,9 @@ signals: ...@@ -282,6 +282,9 @@ signals:
/// SelectionInterface: This signal is emitted when standard flood fill selection is required /// SelectionInterface: This signal is emitted when standard flood fill selection is required
void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: This signal is emitted when standard connected components selection is required
void showComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: This signal is emitted when standard toggle selection has been performed /// SelectionInterface: This signal is emitted when standard toggle selection has been performed
void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
...@@ -304,6 +307,9 @@ signals: ...@@ -304,6 +307,9 @@ signals:
/// SelectionInterface: This signal is emitted when standard flood fill selection has been performed /// SelectionInterface: This signal is emitted when standard flood fill selection has been performed
void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect); void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when standard connected components selection has been performed
void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when a custom selection operation has been performed /// SelectionInterface: This signal is emitted when a custom selection operation has been performed
void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect); void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
...@@ -524,6 +530,9 @@ signals: ...@@ -524,6 +530,9 @@ signals:
/// SelectionInterface: Provide flood fill selection operation for specific selection mode /// SelectionInterface: Provide flood fill selection operation for specific selection mode
void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: Provide connected components selection operation for specific selection mode
void slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: Called when toggle selection operation has been performed /// SelectionInterface: Called when toggle selection operation has been performed
void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
...@@ -545,6 +554,9 @@ signals: ...@@ -545,6 +554,9 @@ signals:
/// SelectionInterface: Called when flood fill selection operation has been performed /// SelectionInterface: Called when flood fill selection operation has been performed
void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when connected components selection operation has been performed
void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when custom selection operation has been performed /// SelectionInterface: Called when custom selection operation has been performed
void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect); void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
......
...@@ -1152,6 +1152,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO ...@@ -1152,6 +1152,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
if ( checkSlot( plugin , "slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) ) if ( checkSlot( plugin , "slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
connect(this , SIGNAL(showFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)), connect(this , SIGNAL(showFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
plugin , SLOT(slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection); plugin , SLOT(slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSignal(plugin,"showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
connect(plugin , SIGNAL(showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
this , SLOT(slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
connect(this , SIGNAL(showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
plugin , SLOT(slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSignal(plugin,"toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") ) if ( checkSignal(plugin,"toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
connect(plugin , SIGNAL(toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)), connect(plugin , SIGNAL(toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
...@@ -1208,6 +1216,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO ...@@ -1208,6 +1216,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
if ( checkSlot( plugin , "slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)" ) ) if ( checkSlot( plugin , "slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)" ) )
connect(this , SIGNAL(floodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)), connect(this , SIGNAL(floodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),
plugin , SLOT(slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection); plugin , SLOT(slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSignal(plugin,"componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
connect(plugin , SIGNAL(componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
this , SLOT(slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
connect(this , SIGNAL(componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
plugin , SLOT(slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSignal(plugin,"customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)") ) if ( checkSignal(plugin,"customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)") )
connect(plugin , SIGNAL(customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)), connect(plugin , SIGNAL(customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)),
......
...@@ -110,6 +110,10 @@ void Core::slotShowFloodFillSelectionMode(QString _handleName, bool _show, Selec ...@@ -110,6 +110,10 @@ void Core::slotShowFloodFillSelectionMode(QString _handleName, bool _show, Selec
emit showFloodFillSelectionMode(_handleName, _show, _associatedTypes); emit showFloodFillSelectionMode(_handleName, _show, _associatedTypes);
} }
void Core::slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
emit showComponentsSelectionMode(_handleName, _show, _associatedTypes);
}
void Core::slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit toggleSelection(_event, _currentType, _deselect); emit toggleSelection(_event, _currentType, _deselect);
} }
...@@ -138,6 +142,10 @@ void Core::slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, Selecti ...@@ -138,6 +142,10 @@ void Core::slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, Selecti
emit floodFillSelection(_event, _maxAngle, _currentType, _deselect); emit floodFillSelection(_event, _maxAngle, _currentType, _deselect);
} }
void Core::slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit componentsSelection(_event, _currentType, _deselect);
}
void Core::slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect) { void Core::slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {
emit customSelection(_event, _currentType, _customIdentifier, _deselect); emit customSelection(_event, _currentType, _customIdentifier, _deselect);
} }
...@@ -168,4 +176,4 @@ void Core::slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) { ...@@ -168,4 +176,4 @@ void Core::slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {
void Core::slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) { void Core::slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {
emit keyShortcutEvent(_key, _modifiers); emit keyShortcutEvent(_key, _modifiers);
} }
\ No newline at end of file
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#define SPHERE_IMG "selection_paintSphere.png" #define SPHERE_IMG "selection_paintSphere.png"
#define BOUNDARY_IMG "selection_boundary.png" #define BOUNDARY_IMG "selection_boundary.png"
#define FLOODFILL_IMG "selection_floodFill.png" #define FLOODFILL_IMG "selection_floodFill.png"
#define COMPONENTS_IMG "selection_connected.png"
// Standard selection mode descriptions // Standard selection mode descriptions
#define TOGGLE_DESC "Toggle Selection" #define TOGGLE_DESC "Toggle Selection"
...@@ -61,6 +62,7 @@ ...@@ -61,6 +62,7 @@
#define SPHERE_DESC "Sphere Selection" #define SPHERE_DESC "Sphere Selection"
#define BOUNDARY_DESC "Boundary Selection" #define BOUNDARY_DESC "Boundary Selection"
#define FLOODFILL_DESC "Floodfill Selection" #define FLOODFILL_DESC "Floodfill Selection"
#define COMPONENTS_DESC "Selected Components Selection"
// Standard selection mode names // Standard selection mode names
#define SB_TOGGLE "sb_toggle" #define SB_TOGGLE "sb_toggle"
...@@ -70,6 +72,7 @@ ...@@ -70,6 +72,7 @@
#define SB_SPHERE "sb_sphere" #define SB_SPHERE "sb_sphere"
#define SB_BOUNDARY "sb_closestboundary" #define SB_BOUNDARY "sb_closestboundary"
#define SB_FLOODFILL "sb_floodfill" #define SB_FLOODFILL "sb_floodfill"
#define SB_COMPONENTS "sb_components"
// Constant to set if no selection picking is enabled // Constant to set if no selection picking is enabled
#define NO_SELECTION_PICKING "No_Selection_Picking" #define NO_SELECTION_PICKING "No_Selection_Picking"
...@@ -92,6 +95,7 @@ surfaceLassoSelectionAction_(0), ...@@ -92,6 +95,7 @@ surfaceLassoSelectionAction_(0),
sphereSelectionAction_(0), sphereSelectionAction_(0),
boundarySelectionAction_(0), boundarySelectionAction_(0),
floodFillSelectionAction_(0), floodFillSelectionAction_(0),
componentsSelectionAction_(0),
nextFreePrimitiveType_(1u), nextFreePrimitiveType_(1u),
sphere_mat_node_(0), sphere_mat_node_(0),
sphere_node_(0), sphere_node_(0),
...@@ -210,6 +214,11 @@ void SelectionBasePlugin::initializePlugin() { ...@@ -210,6 +214,11 @@ void SelectionBasePlugin::initializePlugin() {
floodFillSelectionAction_->selectionModeHandle(SB_FLOODFILL); floodFillSelectionAction_->selectionModeHandle(SB_FLOODFILL);
toolsBar_->addAction(floodFillSelectionAction_); toolsBar_->addAction(floodFillSelectionAction_);
connect(floodFillSelectionAction_, SIGNAL(triggered(bool)), this, SLOT(slotEnterSelectionMode(bool))); connect(floodFillSelectionAction_, SIGNAL(triggered(bool)), this, SLOT(slotEnterSelectionMode(bool)));
componentsSelectionAction_ = new HandleAction(QIcon(iconPath + COMPONENTS_IMG), COMPONENTS_DESC, selectionModesGroup_);
componentsSelectionAction_->setCheckable(true);
componentsSelectionAction_->selectionModeHandle(SB_COMPONENTS);
toolsBar_->addAction(componentsSelectionAction_);
connect(componentsSelectionAction_, SIGNAL(triggered(bool)), this, SLOT(slotEnterSelectionMode(bool)));
emit setPickModeToolbar(SELECTION_PICKING, pickModeToolBar); emit setPickModeToolbar(SELECTION_PICKING, pickModeToolBar);
} }
...@@ -502,6 +511,7 @@ void SelectionBasePlugin::updatePickModeToolBar() { ...@@ -502,6 +511,7 @@ void SelectionBasePlugin::updatePickModeToolBar() {
sphereSelectionAction_->setEnabled(sphereSelectionAction_->isAssociated(currentPrimitiveType_, true)); sphereSelectionAction_->setEnabled(sphereSelectionAction_->isAssociated(currentPrimitiveType_, true));
boundarySelectionAction_->setEnabled(boundarySelectionAction_->isAssociated(currentPrimitiveType_, true)); boundarySelectionAction_->setEnabled(boundarySelectionAction_->isAssociated(currentPrimitiveType_, true));
floodFillSelectionAction_->setEnabled(floodFillSelectionAction_->isAssociated(currentPrimitiveType_, true)); floodFillSelectionAction_->setEnabled(floodFillSelectionAction_->isAssociated(currentPrimitiveType_, true));
componentsSelectionAction_->setEnabled(componentsSelectionAction_->isAssociated(currentPrimitiveType_, true));
// Custom selection modes // Custom selection modes
for(std::set<HandleAction*>::iterator cit = (*it).second.customSelectionModes.begin(); for(std::set<HandleAction*>::iterator cit = (*it).second.customSelectionModes.begin();
...@@ -554,6 +564,8 @@ void SelectionBasePlugin::slotMouseEvent(QMouseEvent* _event) { ...@@ -554,6 +564,8 @@ void SelectionBasePlugin::slotMouseEvent(QMouseEvent* _event) {
slotBoundarySelection(_event); slotBoundarySelection(_event);
} else if (currentSelectionMode_ == SB_FLOODFILL) { } else if (currentSelectionMode_ == SB_FLOODFILL) {
slotFloodFillSelection(_event); slotFloodFillSelection(_event);
} else if (currentSelectionMode_ == SB_COMPONENTS) {
slotComponentsSelection(_event);
} else { } else {
// Custom selection mode // Custom selection mode
slotCustomSelection(_event); slotCustomSelection(_event);
...@@ -899,6 +911,7 @@ void SelectionBasePlugin::slotPickModeChanged (const std::string& _pickmode) { ...@@ -899,6 +911,7 @@ void SelectionBasePlugin::slotPickModeChanged (const std::string& _pickmode) {
sphereSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_SPHERE); sphereSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_SPHERE);
boundarySelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_BOUNDARY); boundarySelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_BOUNDARY);
floodFillSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_FLOODFILL); floodFillSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_FLOODFILL);
componentsSelectionAction_->setChecked(!resetPickToolBar && currentSelectionMode_ == SB_COMPONENTS);
for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin(); for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
it != selectionEnvironments_.end(); ++it) { it != selectionEnvironments_.end(); ++it) {
...@@ -1004,6 +1017,17 @@ void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString ...@@ -1004,6 +1017,17 @@ void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString
floodFillSelectionAction_->removeAssociatedType(_associatedTypes); floodFillSelectionAction_->removeAssociatedType(_associatedTypes);
} }
} }
} else if (_mode == SB_COMPONENTS) {
if(_show) {
(*it).second.defaultSelectionModes.insert(componentsSelectionAction_);
componentsSelectionAction_->addAssociatedType(_associatedTypes);
} else {
std::set<HandleAction*>::iterator e = (*it).second.defaultSelectionModes.find(componentsSelectionAction_);
if(e != (*it).second.defaultSelectionModes.end()) {
(*it).second.defaultSelectionModes.erase(e);
componentsSelectionAction_->removeAssociatedType(_associatedTypes);
}
}
} }
} else { } else {
if(_show) { if(_show) {
...@@ -1130,6 +1154,17 @@ void SelectionBasePlugin::slotShowFloodFillSelectionMode(QString _handleName, bo ...@@ -1130,6 +1154,17 @@ void SelectionBasePlugin::slotShowFloodFillSelectionMode(QString _handleName, bo
//============================================================================================ //============================================================================================
void SelectionBasePlugin::slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
QIcon icon(iconPath + COMPONENTS_IMG);
QString dummy;
showSelectionMode(SB_COMPONENTS, icon, COMPONENTS_DESC, _handleName, _show, _associatedTypes, dummy);
updatePickModeToolBar();
}
//============================================================================================
void SelectionBasePlugin::slotGetActiveDataTypes(TypeList& _types) { void SelectionBasePlugin::slotGetActiveDataTypes(TypeList& _types) {
if(currentPickMode_ == NO_SELECTION_PICKING) { if(currentPickMode_ == NO_SELECTION_PICKING) {
...@@ -1374,6 +1409,19 @@ void SelectionBasePlugin::slotFloodFillSelection(QMouseEvent* _event) { ...@@ -1374,6 +1409,19 @@ void SelectionBasePlugin::slotFloodFillSelection(QMouseEvent* _event) {
//============================================================================================ //============================================================================================
void SelectionBasePlugin::slotComponentsSelection(QMouseEvent* _event) {
// Only emit componentsSelection if left mouse button was clicked
if (_event->type() == QEvent::MouseButtonPress) {
if (_event->button() == Qt::RightButton) return;
emit componentsSelection(_event, currentPrimitiveType_, deselection_);
}
}
//============================================================================================
void SelectionBasePlugin::slotCustomSelection(QMouseEvent* _event) { void SelectionBasePlugin::slotCustomSelection(QMouseEvent* _event) {
emit customSelection(_event, currentPrimitiveType_, currentSelectionMode_, deselection_); emit customSelection(_event, currentPrimitiveType_, currentSelectionMode_, deselection_);
......
...@@ -117,6 +117,7 @@ Q_INTERFACES(SelectionInterface) ...@@ -117,6 +117,7 @@ Q_INTERFACES(SelectionInterface)
void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect); void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect); void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect); void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
void selectionOperation(QString _operation); void selectionOperation(QString _operation);
...@@ -163,6 +164,7 @@ Q_INTERFACES(SelectionInterface) ...@@ -163,6 +164,7 @@ Q_INTERFACES(SelectionInterface)
void slotShowSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void slotShowSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotGetActiveDataTypes(SelectionInterface::TypeList& _types); void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);
void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type); void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
...@@ -190,6 +192,7 @@ Q_INTERFACES(SelectionInterface) ...@@ -190,6 +192,7 @@ Q_INTERFACES(SelectionInterface)
void slotSphereSelection(QMouseEvent* _event); void slotSphereSelection(QMouseEvent* _event);
void slotBoundarySelection(QMouseEvent* _event); void slotBoundarySelection(QMouseEvent* _event);
void slotFloodFillSelection(QMouseEvent* _event); void slotFloodFillSelection(QMouseEvent* _event);
void slotComponentsSelection(QMouseEvent* _event);
void slotCustomSelection(QMouseEvent* _event); void slotCustomSelection(QMouseEvent* _event);
void slotLoadSelection(); void slotLoadSelection();
...@@ -294,6 +297,7 @@ Q_INTERFACES(SelectionInterface) ...@@ -294,6 +297,7 @@ Q_INTERFACES(SelectionInterface)
HandleAction* sphereSelectionAction_; HandleAction* sphereSelectionAction_;
HandleAction* boundarySelectionAction_; HandleAction* boundarySelectionAction_;
HandleAction* floodFillSelectionAction_; HandleAction* floodFillSelectionAction_;
HandleAction* componentsSelectionAction_;
std::set<std::pair<int,Qt::KeyboardModifiers> > registeredKeys_; std::set<std::pair<int,Qt::KeyboardModifiers> > registeredKeys_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment