50 #ifndef MESHOBJECTSELECTIONPLUGIN_HH 51 #define MESHOBJECTSELECTIONPLUGIN_HH 63 #include <OpenFlipper/BasePlugin/INIInterface.hh> 70 #include <OpenFlipper/INIFile/INIFile.hh> 75 #include <ACG/QtWidgets/QtColorChooserButton.hh> 77 #include "ConversionDialog.hh" 95 #if QT_VERSION >= 0x050000 96 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-SelectionMeshObject")
113 void nodeVisibilityChanged(
int _identifier);
114 void setSlotDescription(QString _slotName, QString _slotDescription,
115 QStringList _parameters, QStringList _descriptions);
121 void log(
Logtype _type, QString _message);
122 void log(QString _message);
125 void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
126 void registerType(QString _handleName,
DataType _type);
127 void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
128 void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
130 void showToggleSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
132 void showLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
133 void showVolumeLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
134 void showSphereSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
135 void showClosestBoundarySelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
136 void showFloodFillSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
137 void showComponentsSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
139 void getActiveDataTypes(SelectionInterface::TypeList& _types);
140 void getActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
141 void targetObjectsOnly(
bool& _targetsOnly);
143 void registerKeyShortcut(
int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
146 void deleteObject(
int _objectId);
147 void addEmptyObject(
DataType _type,
int& _id);
150 void scriptInfo(QString _functionName);
155 void loadSelection(
int _objId,
const QString& _filename);
160 void loadIniFile(
INIFile& _ini,
int _id);
161 void saveIniFile(
INIFile& _ini,
int _id);
164 void initializePlugin();
165 void pluginsInitialized();
166 void noguiSupported() {};
170 void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
172 void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
174 void slotSphereSelection(QMouseEvent* _event,
double _radius, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
176 void slotFloodFillSelection(QMouseEvent* _event,
double _maxAngle, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
177 void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
200 return (QString(tr(
"Mesh Object Selection")));
204 return (QString(tr(
"Allows to select parts of Mesh Objects")));
241 return QString(
"1.0");
245 bool vertexTypeActive() {
246 SelectionInterface::PrimitiveType t = 0u;
247 emit getActivePrimitiveType(t);
252 bool edgeTypeActive() {
253 SelectionInterface::PrimitiveType t = 0u;
254 emit getActivePrimitiveType(t);
259 bool faceTypeActive() {
260 SelectionInterface::PrimitiveType t = 0u;
261 emit getActivePrimitiveType(t);
476 void lassoSelect(QRegion& _region, PrimitiveType _primitiveType,
bool _deselection);
479 void convertSelection(
const int& _objectId ,
const QString& _from,
const QString& _to,
bool _deselect);
482 void conversion(
const QString& _from,
const QString& _to,
bool _deselect);
494 template<
typename MeshT>
498 template<
typename MeshT>
502 template<
typename MeshT>
506 template<
typename MeshT>
508 typename MeshT::Point _hitpoint,
double _radius,
509 PrimitiveType _primitiveTypes,
bool _deselection);
512 template<
class MeshT>
514 QRegion *_region, PrimitiveType _primitiveTypes,
bool _deselection);
517 template<
class MeshT>
519 PrimitiveType _primitiveTypes,
bool _deselection);
522 template<
class MeshT>
524 double _maxAngle, PrimitiveType _primitiveTypes,
bool _deselection);
527 template<
typename MeshT>
529 ACG::Vec3d& _hit_point, PrimitiveType _primitiveType);
532 template<
class MeshT>
533 void colorizeSelection(MeshT* _mesh, PrimitiveType _primitiveTypes,
int _red,
int _green,
int _blue,
int _alpha);
536 template<
class MeshT >
540 template<
class MeshT >
603 unsigned int _type,
bool _deselection,
ACG::GLState& _state) :
604 state_(_state), region_(_region), plugin_(_plugin), type_(_type), deselection_(_deselection) {};
620 #if defined(INCLUDE_TEMPLATES) && !defined(MESHOBJECTSELECTIONPLUGINT_CC) 621 #define MESHOBJECTSELECTIONPLUGINT_TEMPLATES 622 #include "MeshObjectSelectionPluginT.cc" 626 #endif // MESHOBJECTSELECTIONPLUGIN_HH defined void selectFaces(int objectId, IdList _facesList)
Select given faces.
void invertVertexSelection(int _objectId)
Invert the current vertex selection.
void setAllModelingVertices(int objectId)
Set all vertices to be part of the modeling area.
ACG::Vec4f areaColor_
Handle to selection environment.
bool deleteSelection(MeshT *_mesh, PrimitiveType _primitiveType)
Delete all selected elements of a mesh.
void selectVertices(int objectId, IdList _vertexList)
select given vertices
Options Dialog interface.
void deleteFaceSelection(int _objectId)
Delete face that are currently selected.
Interface class for receiving mouse events.
void paintSphereSelection(MeshT *_mesh, int _objectId, int _target_idx, typename MeshT::Point _hitpoint, double _radius, PrimitiveType _primitiveTypes, bool _deselection)
Use the event to paint selection with a sphere.
void setColorForSelection(const int _objectId, const PrimitiveType _primitiveType)
Set color for selection.
IdList getHandleVertices(int objectId)
Get a list of all handle vertices.
Logtype
Log types for Message Window.
void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
void addedEmptyObject(int _id)
An empty object has been added.
~MeshObjectSelectionPlugin()
Default destructor.
void selectAllVertices(int _objectId)
Select all Vertices.
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
MeshObjectSelectionPlugin()
Default constructor.
void selectAllHalfedges(int objectId)
Select all Halfedges.
void invertFaceSelection(int objectId)
Invert the current face selection.
Keyboard Event Interface.
SelectionInterface::PrimitiveType edgeType_
Handle to selection environment.
ACG::Vec4f handleColor_
Handle to selection environment.
void invertEdgeSelection(int objectId)
Unselect all Edges.
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
void selectAllEdges(int objectId)
Select all Edges.
void selectHandleVertices(int objectId, IdList _vertexList)
Set vertices to be part of the handle area.
void conversion(const QString &_from, const QString &_to, bool _deselect)
Convert the selection on all target objects.
Traverse the scenegraph and call the selection function for all mesh nodes.
ConversionDialog * conversionDialog_
Handle to selection environment.
QPolygon lasso_2Dpoints_
Used for lasso selection tool.
void loadFlipperModelingSelection(int _objectId, QString _filename)
Load a selection from an Flipper selection file for the given object.
void traceEdgePath(int objectId, double threshold)
Trace Edge Path.
Interface for all Plugins which provide scriptable Functions.
Interface class for Plugins which have to store information in ini files.
Interface class from which all plugins have to be created.
void colorizeEdgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
int createMeshFromEdgeSelection(int _objectId)
Create a mesh containing the face selection of the given mesh.
void createMeshFromSelection(MeshT &_mesh, MeshT &_newMesh, PrimitiveType _primitiveType)
Create a new mesh from the selection.
void closestBoundarySelection(MeshT *_mesh, int _vh, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are incident to closest boundary.
void selectEdges(int objectId, IdList _vertexList)
Select given Edges.
SelectionInterface::PrimitiveType allSupportedTypes_
Handle to selection environment.
Interface for all Plugins which do logging to the logging window of the framework.
void clearFaceSelection(int objectId)
Unselect all faces.
QtColorChooserButton * colorButtonSelection_
Options.
SelectionInterface::PrimitiveType faceType_
Handle to selection environment.
void floodFillSelection(MeshT *_mesh, int _objectId, uint _fh, double _maxAngle, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are connected (and do not exceed the maximum dihedral angle) ...
void unselectHandleVertices(int objectId, IdList _vertexList)
Remove vertices from handle area.
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
void growVertexSelection(int _objectId)
Grow the current vertex selection.
void slotFloodFillSelection(QMouseEvent *_event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill selection.
void updateSlotDescriptions()
Set descriptions for local public slots.
int createMeshFromFaceSelection(int _objectId)
Create a mesh containing the face selection of the given mesh.
void conversionRequested()
Show selection conversion dialog.
void clearEdgeSelection(int objectId)
Invert the current edge selection.
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
QtColorChooserButton * colorButtonHandle_
Handle to selection environment.
bool volumeSelection(MeshT *_mesh, int _objectId, ACG::GLState &_state, QRegion *_region, PrimitiveType _primitiveTypes, bool _deselection)
Surface volume selection tool.
void selectVerticesByValue(int _objectId, QString _component, bool _greater, double _value)
Select vertices by their value.
void shrinkFaceSelection(int objectId)
Shrink the current face selection.
void unselectVertices(int objectId, IdList _vertexList)
unselect given vertices
void saveFlipperModelingSelection(int _objectId, QString _filename)
Save a selection in Flipper Selection Format.
void slotVolumeLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
void selectModelingVertices(int objectId, IdList _vertexList)
Set vertices to be part of the modeling area.
IdList convertEdgesToVertexPairs(int _id, const IdList &_edges)
Convert edge ids to vertex pairs.
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
Class for the handling of simple configuration files.
IdList convertVertexPairsToEdges(int _id, const IdList &_vertices)
Inverse of function above.
void unselectHalfedges(int objectId, IdList _vertexList)
Unselect given Halfedges.
void shrinkVertexSelection(int _objectId)
Shrink the current vertex selection.
QtColorChooserButton * colorButtonArea_
Handle to selection environment.
void updateColorValues()
Set descriptions for local public slots.
void convertSelection(const int &_objectId, const QString &_from, const QString &_to, bool _deselect)
Convert the selection on one object.
QVector< QPoint > volumeLassoPoints_
Used for volume lasso tool.
IdList getVertexSelection(int _objectId)
Return a list of all selected vertices.
void clearVertexSelection(int _objectId)
Unselect all vertices.
Interface for all plugins which want to use selection functions.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
ACG::Vec4f featureColor_
Handle to selection environment.
void slotLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a lasso selection.
SelectionInterface::PrimitiveType vertexType_
Primitive type handles:
void unselectEdges(int objectId, IdList _vertexList)
Unselect given Edges.
void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
bool initializeOptionsWidget(QWidget *&_widget)
Initialize the Options Widget.
void deleteVertexSelection(int _objectId)
Delete vertices and faces that are currently selected.
void slotSelectionOperation(QString _operation)
A specific operation is requested.
void colorizeVertexSelection(int _objectId, int _r, int _g, int _b, int a)
Colorize the vertex selection.
void selectAllFaces(int objectId)
Select all faces.
void update_regions(MeshT *_mesh)
Update face selection to correspond to the vertex selection.
Interface for all plugins which want to Load or Save files and create Objects.
void selectBoundaryVertices(int _objectId)
Select all boundary vertices of the given object.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
void setAllHandleVertices(int objectId)
Set all vertices to be part of the handle area.
void slotMouseWheelEvent(QWheelEvent *event, std::string const &mode)
Wheel Event from main application.
void slotSphereSelection(QMouseEvent *_event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a sphere selection.
void unselectFaces(int objectId, IdList _facesList)
Unselect given faces.
ACG::Vec4f statusColor_
Handle to selection environment.
void slotComponentsSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
IdList getModelingVertices(int objectId)
Get a list of all modeling vertices.
void clearHandleVertices(int objectId)
Clear handle Area.
void slotClosestBoundarySelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary selection.
void slotToggleSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
void colorizeFaceSelection(int objectId, int r, int g, int b, int a)
Colorize the face selection.
void toggleMeshSelection(int _objectId, MeshT *_mesh, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Toggle mesh selection.
void selectClosestBoundaryVertices(int _objectId, int _vertexId)
Select all vertices of the boundary close to the given vertex.
void componentsMeshSelection(MeshT *_mesh, int _objectId, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Connected component mesh selection.
void unselectModelingVertices(int objectId, IdList _vertexList)
Remove vertices from modeling area.
void selectBoundaryEdges(int objectId)
select boundary edges
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void selectBoundaryFaces(int objectId)
Select all boundary faces of the given object.
void clearModelingVertices(int objectId)
Clear Modeling Area.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
void growFaceSelection(int objectId)
Grow the current face selection.
IdList getEdgeSelection(int objectId)
Return a list of all selected edges.
QString description()
Return a description of what the plugin is doing.
int createMeshFromVertexSelection(int _objectId)
select given vertices
QtColorChooserButton * colorButtonFeature_
Handle to selection environment.
void lassoSelect(QRegion &_region, PrimitiveType _primitiveType, bool _deselection)
Lasso selection tool.
Interface class for backup handling.
void colorizeSelection(MeshT *_mesh, PrimitiveType _primitiveTypes, int _red, int _green, int _blue, int _alpha)
Colorize the selection.
void setDefaultColorValues()
sets the default color values for selection/handle/region/feature nodes for all objects of this type ...
IdList getFaceSelection(int objectId)
Return a list of all selected faces.
QString environmentHandle_
Handle to selection environment.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
void deleteEdgeSelection(int _objectId)
Delete edges that are currently selected.