/*===========================================================================*\ * * * OpenFlipper * * Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen * * www.openflipper.org * * * *---------------------------------------------------------------------------* * This file is part of OpenFlipper. * * * * OpenFlipper is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of * * the License, or (at your option) any later version with the * * following exceptions: * * * * If other files instantiate templates or use macros * * or inline functions from this file, or you compile this file and * * link it with other files to produce an executable, this file does * * not by itself cause the resulting executable to be covered by the * * GNU Lesser General Public License. This exception does not however * * invalidate any other reasons why the executable file might be * * covered by the GNU Lesser General Public License. * * * * OpenFlipper is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU LesserGeneral Public * * License along with OpenFlipper. If not, * * see . * * * \*===========================================================================*/ /*===========================================================================*\ * * * $Revision$ * * $Author$ * * $Date$ * * * \*===========================================================================*/ #ifndef BSPLINESURFACESELECTIONPLUGIN_HH #define BSPLINESURFACESELECTIONPLUGIN_HH #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class BSplineSurfaceSelectionPlugin : public QObject, BaseInterface, KeyInterface, INIInterface, BackupInterface, LoggingInterface, ScriptInterface, SelectionInterface { Q_OBJECT Q_INTERFACES(BaseInterface) Q_INTERFACES(KeyInterface) Q_INTERFACES(INIInterface) Q_INTERFACES(BackupInterface) Q_INTERFACES(LoggingInterface) Q_INTERFACES(ScriptInterface) Q_INTERFACES(SelectionInterface) #if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-SelectionBSplineSurface") #endif public: /// Default constructor BSplineSurfaceSelectionPlugin(); /// Default destructor ~BSplineSurfaceSelectionPlugin(); signals: // BaseInterface void updateView(); void updatedObject(int, const UpdateType&); void nodeVisibilityChanged(int _identifier); void setSlotDescription(QString _slotName, QString _slotDescription, QStringList _parameters, QStringList _descriptions); // LoggingInterface void log(Logtype _type, QString _message); void log(QString _message); // BackupInterface void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL); // ScriptInterface void scriptInfo(QString _functionName); // SelectionInterface void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName); void registerType(QString _handleName, DataType _type); void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle); void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u); void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void getActiveDataTypes(SelectionInterface::TypeList& _types); void getActivePrimitiveType(SelectionInterface::PrimitiveType& _type); void targetObjectsOnly(bool& _targetsOnly); void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier); private slots: // INIInterface void loadIniFile(INIFile& _ini, int _id); void saveIniFile(INIFile& _ini, int _id); // BaseInterface void initializePlugin(); void pluginsInitialized(); void noguiSupported() {}; // SelectionInterface void slotSelectionOperation(QString _operation); void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotVolumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotLoadSelection(const INIFile& _file); void slotSaveSelection(INIFile& _file); void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers); public slots: // SelectionInterface void loadSelection(int _objId, const QString& _filename); public: // BaseInterface QString name() { return (QString(tr("BSplineSurface Selection"))); }; QString description() { return (QString(tr("Allows to select B-Spline surfaces"))); }; //=========================================================================== /** @name Private methods * @{ */ //=========================================================================== private: enum SelectionViewMode {CP, K}; /// Change selection view mode for every B-spline surface in the scene void setSelectionViewMode(const SelectionViewMode _mode); /// Set slot descriptions for scripting functions void updateSlotDescriptions(); /** @} */ public slots: QString version() { return QString("1.0"); }; //=========================================================================== /** @name Scriptable slots * @{ */ //=========================================================================== // Control point selection: /// Select all control points of a curve void selectAllControlPoints(int _objectId); /// Deselect all control points of a curve void deselectAllControlPoints(int _objectId); /// Invert control point selection void invertControlPointSelection(int _objectId); /// Delete selected control points // void deleteSelectedControlPointsU(int _objectId); // void deleteSelectedControlPointsV(int _objectId); /// Select specific control points of a curve void selectControlPoints(int _objectId, const IdList& _ids, bool _deselect = false); /// Get current control point selection IdList getControlPointSelection(int _objectId); // Knot selection: /// Select all knots of a curve void selectAllKnots(int _objectId); /// Deselect all knots of a curve void deselectAllKnots(int _objectId); /// Invert knot selection void invertKnotSelection(int _objectId); /// Delete selected knots void deleteSelectedKnotsU(int _objectId); void deleteSelectedKnotsV(int _objectId); /// Select specific knots of a curve void selectKnots(int _objectId, const IdList& _ids_u, const IdList& _ids_v, bool _deselect = false); /// Get current knot selection IdList getKnotSelectionU(int _objectId); IdList getKnotSelectionV(int _objectId); /** @} */ //=========================================================================== /** @name Member variables * @{ */ //=========================================================================== private: /// Handle to selection environment QString environmentHandle_; /// Primitive type handles: unsigned int controlPointType_; unsigned int knotType_; unsigned int allSupportedTypes_; /// Keep volume lasso points QVector volumeLassoPoints_; /** @} */ }; //============================================================================= #endif // BSPLINESURFACESELECTIONPLUGIN_HH defined //=============================================================================