Commit 8907b102 authored by Isaak Lim's avatar Isaak Lim
Browse files

added documentation for setSelectionMetaphor and setSelectionPrimitiveType

refs #1687

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17075 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fdd9ab5a
......@@ -92,26 +92,26 @@ Q_INTERFACES(LoadSaveInterface)
Q_INTERFACES(SelectionInterface)
public:
/// Default constructor
SelectionBasePlugin();
// BaseInterface
QString name() { return (QString(tr("SelectionBase"))); };
QString description( ) { return (QString(tr("Provides basic selection functions"))); };
signals:
// BaseInterface
void updateView();
// LoggingInterface
void log(Logtype _type, QString _message);
void log(QString _message);
// ToolbarInterface
void addToolbar(QToolBar* _toolbar);
// SelectionInterface
void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
......@@ -122,35 +122,35 @@ Q_INTERFACES(SelectionInterface)
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 selectionOperation(QString _operation);
void loadSelection(const INIFile& _file);
void saveSelection(INIFile& _file);
void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
// PickingInterface
void addPickMode(const std::string& _mode);
void setPickModeMouseTracking(const std::string& _mode, bool _mouseTracking);
void setPickModeCursor(const std::string& _mode, QCursor _cursor);
void setPickModeToolbar (const std::string& _mode, QToolBar * _toolbar);
// KeyInterface
void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
// ToolboxInterface
void addToolbox(QString _name, QWidget* _widget, QIcon* _icon);
void addToolbox(QString _name, QWidget* _widget, QIcon* _icon);
private slots:
// BaseInterface
void initializePlugin();
void pluginsInitialized();
//MouseInterface
void slotMouseWheelEvent(QWheelEvent* _event, const std::string& _mode);
void slotMouseEvent(QMouseEvent* _event);
// SelectionInterface
void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
void slotRegisterType(QString _handleName, DataType _type);
......@@ -160,9 +160,9 @@ Q_INTERFACES(SelectionInterface)
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction);
void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
void slotShowToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotShowLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
......@@ -171,26 +171,26 @@ Q_INTERFACES(SelectionInterface)
void slotShowClosestBoundarySelectionMode(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 slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
void slotTargetObjectsOnly(bool& _targetsOnly);
void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
// LoadSaveInterface
void addedEmptyObject (int _id);
void objectDeleted (int _id);
// PickingInterface
void slotPickModeChanged (const std::string& _pickmode);
// KeyInterface
void slotKeyEvent(QKeyEvent* _event);
void slotKeyReleaseEvent(QKeyEvent* _event);
// ============== Selection Actions ===============
void slotMouseToggleSelection(QMouseEvent* _event);
void slotMouseLassoSelection(QMouseEvent* _event);
void slotMouseVolumeLassoSelection(QMouseEvent* _event);
......@@ -200,32 +200,59 @@ Q_INTERFACES(SelectionInterface)
void slotMouseFloodFillSelection(QMouseEvent* _event);
void slotMouseComponentsSelection(QMouseEvent* _event);
void slotMouseCustomSelection(QMouseEvent* _event);
void slotLoadSelectionButton();
void slotSaveSelectionButton();
void slotOperationRequested();
void slotShowAndHideOperations();
// ==================== GUI =======================
void slotSelectionEnvironmentRequested(bool _checked);
void slotEnterSelectionMode(bool _checked);
void updateActivePrimitiveTypes(bool _checked);
public slots:
QString version() { return QString("1.0"); };
/// Enables setting the selection metaphor (e.g. "sb_sphere") via scripting
/** \brief Enables setting the selection metaphor via scripting
* The default selection metaphors are:
* - "sb_toggle"
* - "sb_lasso"
* - "sb_volumelasso"
* - "sb_surfacelasso"
* - "sb_sphere"
* - "sb_closestboundary"
* - "sb_floodfill"
* - "sb_components"
*
* Note that furhter custom methaphors can be defined and used
*/
void setSelectionMetaphor(QString _metaphor);
/// Enables setting the selection primitive (e.g. "Select Faces") via scripting
/** \brief Enables setting the selection primitive via scripting
* The default primitives for OpenMesh are:
* - "Select Vertices"
* - "Select Halfedges"
* - "Select Edges"
* - "Select Faces"
* The default primitives for OpenVolumeMesh are:
* - "Select Volume Mesh Vertices"
* - "Select Volume Mesh Edges"
* - "Select Volume Mesh Faces"
* - "Select Volume Mesh Cells"
* - "Column Selection"
* - "Sheet Selection"
*
* Note that further custom primitive types can be defined and used
*/
void setSelectionPrimitiveType(QString _primitive);
private:
struct SelectionEnvironment {
// Name of the environment
QString name;
......@@ -253,16 +280,16 @@ Q_INTERFACES(SelectionInterface)
// Keep name of tab for selection environment
QWidget* tabWidget;
};
/// Get a unique pickmode name
QString getUniqueIdentifierName(QString _name, int _num = 0);
/// Get a unique handle name
QString getUniqueHandleName(QString _name, int _num = 0);
/// Test if at least one object of type _type is in the scene graph
bool typeExists(DataType _type, int _excludeId = -1);
/// Caches the number of available elements of a certain data type for the typeExists function
QMap<DataType,int> typeCounter_;
......@@ -271,34 +298,34 @@ Q_INTERFACES(SelectionInterface)
void showSelectionMode(QString _mode, QString _icon, QString _desc,
QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes,
QString& _customIdentifier, bool _custom = false, DataType _objectTypeRestriction = DATA_ALL);
/// Create new type frame for tabs widget
SelectionTypeFrameWidget* createNewTypeFrame(SelectionEnvironment& _env);
SelectionTypeFrameWidget* createNewTypeFrame(SelectionEnvironment& _env);
/// Update the pickmode toolbar
void updatePickModeToolBar();
// Update the tabs widgets' order
void updateTabsOrder();
// Map of registered selection environments (handle, environment)
std::map<QString,SelectionEnvironment> selectionEnvironments_;
//================== GUI ======================
// List of primitive type buttons (primitivetype, button)
std::map<PrimitiveType,QAction*> primitiveTypeButtons_;
// Toolbar in OpenFlipper that contains the selection button
QToolBar* toolBar_;
// Widget for Toolbox
SelectionBaseToolboxWidget* tool_;
// Toolbar that displays ALL primitive types of all selection environments
QActionGroup* primitivesBarGroup_;
QToolBar* pickModeToolBar_;
QActionGroup* selectionModesGroup_;
// Actions for default selection modes
......@@ -310,46 +337,46 @@ Q_INTERFACES(SelectionInterface)
HandleAction* boundarySelectionAction_;
HandleAction* floodFillSelectionAction_;
HandleAction* componentsSelectionAction_;
std::set<std::pair<int,Qt::KeyboardModifiers> > registeredKeys_;
//================== Status ===================
// Keep the current pick mode
QString currentPickMode_;
// Keep the last used pick mode
QString lastPickMode_;
// Keep the current selection mode
QString currentSelectionMode_;
// Bitmask for currently selected primitive types
SelectionInterface::PrimitiveType currentPrimitiveType_;
// Next free primitive handle
unsigned int nextFreePrimitiveType_;
// Indicates whether we want to deselect primitives
bool deselection_;
//=============== Rendering ====================
// Sphere Nodes material
ACG::SceneGraph::MaterialNode* sphere_mat_node_;
// Sphere Node
ACG::SceneGraph::GlutPrimitiveNode* sphere_node_;
// Sphere radius
double sphere_radius_;
// Line Node
ACG::SceneGraph::LineNode* line_node_;
// Indicates if lasso selection is currently active
bool lassoSelection_;
// List of points for line node
std::vector<ACG::Vec3d> linePoints_;
......
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