#include <QString>
#include <QMap>
+#include <QObject>
+#include <QColor>
class ModelAPI_Feature;
class XGUI_Workshop;
* \ingroup GUI
* \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
*/
-class XGUI_EXPORT XGUI_Displayer
+class XGUI_EXPORT XGUI_Displayer: public QObject
{
+ Q_OBJECT
public:
/// \enum DisplayMode display mode
enum DisplayMode {
/// \param isUpdate the parameter whether the viewer should be update immediatelly
void displayAIS(AISObjectPtr theAIS, bool isUpdate = true);
+ /** Redisplay the shape if it was displayed
+ * \param theObject an object instance
+ * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+ */
+ void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
+
/**
* Add presentations which corresponds to the given features to current selection
* \param theFeatures a list of features to be selected
*/
void setSelected(const QObjectPtrList& theFeatures, bool isUpdateViewer = true);
+ void setSelected(const QList<ModuleBase_ViewerPrs>& theValues, bool isUpdateViewer = true);
+
/// Unselect all objects
void clearSelected();
bool enableUpdateViewer(const bool isEnabled);
/// Updates the viewer
- void updateViewer();
+ void updateViewer() const;
/// Searches the interactive object by feature
/// \param theObject the object or presentable feature
/// Returns list of displayed objects
QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); }
+ /// Returns list of displayed objects
+ QList<AISObjectPtr> displayedPresentations() const { return myResult2AISObjectMap.values(); }
+
/// Returns true if the given object can be shown in shaded mode
/// \param theObject object to check
bool canBeShaded(ObjectPtr theObject) const;
+ /// Set color on presentation of an object if it is displayed
+ /// \param theObject an object
+ /// \param theColor a color which has to be set
+ /// \param toUpdate update viewer flag
+ /// \return previously defined color on the object
+ QColor setObjectColor(ObjectPtr theObject, const QColor& theColor, bool toUpdate = true);
+
+signals:
+ /// Signal on object display
+ /// \param theObject a data object
+ /// \param theAIS a presentation object
+ void objectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS);
+
+ /// Signal on before object erase
+ /// \param theObject a data object
+ /// \param theAIS a presentation object
+ void beforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS);
+
protected:
/// Returns currently installed AIS_InteractiveContext
Handle(AIS_InteractiveContext) AISContext() const;
void display(ObjectPtr theObject, AISObjectPtr theAIS, bool isShading,
bool isUpdateViewer = true);
- /** Redisplay the shape if it was displayed
- * \param theObject an object instance
- * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- */
- void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
-
+private:
/// Activates the interactive object in the local context.
/// \param theIO an interactive object
/// \param theModes - modes on which it has to be activated (can be empty)