Commit 6511d116 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'AngleBasedEdgeSelection' into 'master'

Angle based edge selection

See merge request !195
parents 05a7d830 6217dc8a
......@@ -659,6 +659,18 @@ class SelectionInterface {
*/
virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {};
/** \brief Add interactive selection parameters for a specific primitive type
*
* One can add interactive selection parameters for each primitive type
* that will appear as widgets in the selection base toolbar.
*
* @param _handleName The handle of the selection environment in which this operation should be available
* @param _widget The widget that shall be added for parameters enabled for a given primitive type
* @param _category The category under which the specified operations will be listed
* @param _type The primitive type for which the specified operations will be available (0u if operation should always be available)
*/
virtual void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
private slots:
/** \brief A specific operation is requested
......@@ -802,11 +814,10 @@ class SelectionInterface {
* the specified angle.
*
* @param _event The mouse event that currently is performed
* @param _maxAngle The maximum angle used for flood filling
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
virtual void slotFloodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Called whenever the user performs a connected components selection
*
......@@ -930,11 +941,10 @@ class SelectionInterface {
* by each type selection plugin if this interactive selection mode should be provided.
*
* @param _event The mouse event that currently is performed
* @param _maxAngle The maximum angle used for flood filling
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
virtual void floodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a connected components selection
*
......@@ -1156,6 +1166,15 @@ class SelectionInterface {
*/
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {};
/** Do not use. Implemented in SelectionBasePlugin
*
* @param _handleName handle of the mode
* @param _widget The widget that controls the parameters
* @param _category Category
* @param _type primitive types
*/
virtual void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
/** @} */
......
......@@ -274,6 +274,9 @@ signals:
/// SelectionInterface: This signal is used to add non-interactive operations for a specific primitive type
void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
/// SelectionInterface: This signal is used to add interactive selection parameters for a specific primitive type
void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
/// SelectionInterface: This signal is emitted when a non-interactive operation has been performed
void selectionOperation(QString _operation);
......@@ -321,7 +324,7 @@ signals:
void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// 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, 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);
......@@ -538,6 +541,9 @@ signals:
/// SelectionInterface: Called in order to add non-interactive operations for a specific primitive type
void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
/// SelectionInterface: Called in order to add interactive parameters for a specific primitive type
void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
/// SelectionInterface: Called when a non-interactive operation has been performed
void slotSelectionOperation(QString _operation);
......@@ -585,7 +591,7 @@ signals:
void slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// 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, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when connected components selection operation has been performed
void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
......
......@@ -1359,6 +1359,15 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( checkSlot( plugin , "slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)" ) )
connect(this , SIGNAL(addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),
plugin , SLOT(slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSignal(plugin,"addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)") )
connect(plugin , SIGNAL(addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),
this , SLOT(slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)" ) )
connect(this , SIGNAL(addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),
plugin , SLOT(slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
if ( checkSignal(plugin,"selectionOperation(QString)") )
connect(plugin , SIGNAL(selectionOperation(QString)),
......@@ -1480,13 +1489,13 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
connect(this , SIGNAL(closestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
plugin , SLOT(slotClosestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSignal(plugin,"floodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)") )
connect(plugin , SIGNAL(floodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),
this , SLOT(slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSignal(plugin,"floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
connect(plugin , SIGNAL(floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
this , SLOT(slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)" ) )
connect(this , SIGNAL(floodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),
plugin , SLOT(slotFloodFillSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
connect(this , SIGNAL(floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
plugin , SLOT(slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
if ( checkSignal(plugin,"componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
connect(plugin , SIGNAL(componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
......
......@@ -53,7 +53,6 @@
//
//=============================================================================
//== INCLUDES =================================================================
#include "Core.hh"
......@@ -90,6 +89,10 @@ void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QS
void Core::slotAddSelectionOperations(QString _handleName,QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type) {
emit addSelectionOperations(_handleName, _operationsList, _category, _type);
}
void Core::slotAddSelectionParameters(QString _handleName,QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type) {
emit addSelectionParameters(_handleName, _widget, _category, _type);
}
void Core::slotSelectionOperation(QString _operation) {
emit selectionOperation(_operation);
......@@ -151,8 +154,8 @@ void Core::slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface:
emit closestBoundarySelection(_event, _currentType, _deselect);
}
void Core::slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit floodFillSelection(_event, _maxAngle, _currentType, _deselect);
void Core::slotFloodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit floodFillSelection(_event, _currentType, _deselect);
}
void Core::slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
......
......@@ -78,4 +78,4 @@ find_package_handle_standard_args(CLP DEFAULT_MSG
mark_as_advanced(CLP_INCLUDE_DIR CLP_LIBRARY)
endif( NOT CLP_FOUND)
endif(NOT CLP_FOUND)
......@@ -521,13 +521,14 @@ std::vector< int > getArea(MeshT* _mesh, unsigned int _type , bool& _invert) {
template< typename MeshT >
inline
void selectEdges(MeshT* _mesh, const std::vector< int >& _edges) {
void selectEdges(MeshT* _mesh, const std::vector< int >& _edges, const double _dihedral_angle_threshold) {
const int n_edges = (int)_mesh->n_edges();
for ( uint i = 0 ; i < _edges.size() ; ++i )
if ( (_edges[i] >= 0) && ( _edges[i] < n_edges ) ) {
typename MeshT::EdgeHandle eh(_edges[i]);
_mesh->status(eh).set_selected(true);
if(!_mesh->has_face_normals() || std::abs(_mesh->calc_dihedral_angle_fast(eh)) >= _dihedral_angle_threshold)
_mesh->status(eh).set_selected(true);
}
}
......
......@@ -261,7 +261,7 @@ std::vector< int > getArea(MeshT* _mesh, unsigned int _type , bool& _invert);
/// Select given edges of a mesh
template< typename MeshT >
inline
void selectEdges(MeshT* _mesh, const std::vector< int >& _edges);
void selectEdges(MeshT* _mesh, const std::vector< int >& _edges, const double _dihedral_angle_threshold = 0.0);
/// Unselect given edges of a mesh
template< typename MeshT >
......
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