+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: ModuleBase_ViewerPrs.h
// Created: 20 Apr 2014
// Author: Natalia ERMOLAEVA
#include "ModuleBase.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <TopoDS_Shape.hxx>
#include <SelectMgr_EntityOwner.hxx>
+#include <AIS_InteractiveObject.hxx>
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
/**\class ModuleBase_ViewerPrs
- * \ingroup Module base
+ * \ingroup GUI
* \brief Presentation. Provides container to have feature, shape and/or selection owner.
*/
class ModuleBase_ViewerPrs
{
-public:
+ public:
/// Constructor
- ModuleBase_ViewerPrs() {}
-
+ MODULEBASE_EXPORT ModuleBase_ViewerPrs();
+
/// Constructor
- /// \param theFeature a model feature
+ /// \param theResult an object
/// \param theShape a viewer shape
/// \param theOwner a selection owner
- ModuleBase_ViewerPrs(FeaturePtr theFeature,
- const TopoDS_Shape& theShape,
- Handle_SelectMgr_EntityOwner theOwner)
- : myFeature(theFeature), myShape(theShape), myOwner(theOwner) {}
-
+ MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
+ Handle_SelectMgr_EntityOwner theOwner);
+
/// Destructor
- virtual ~ModuleBase_ViewerPrs() {}
+ MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
- /// Sets the feature.
- /// \param theFeature a feature instance
- void setFeature(FeaturePtr theFeature) { myFeature = theFeature; }
+ /// Sets the object.
+ /// \param theResult an object instance
+ MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
+ {
+ myResult = theResult;
+ }
/// Returns the feature.
/// \return a feature instance
- FeaturePtr feature() const { return myFeature; }
+ MODULEBASE_EXPORT ObjectPtr object() const
+ {
+ return myResult;
+ }
- /// Returns the presentation owner
- /// \param the owner
- void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; }
+ /// Set the presentation owner
+ /// \param theOwner an owner to set
+ MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
+ {
+ myOwner = theOwner;
+ }
/// Returns the presentation owner
/// \return an owner
- Handle_SelectMgr_EntityOwner owner() const { return myOwner; }
+ MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
+ {
+ return myOwner;
+ }
/// Sets the shape
/// \param theShape a shape instance
- void setShape(const TopoDS_Shape& theShape) { myShape = theShape; }
+ MODULEBASE_EXPORT void setShape(const TopoDS_Shape& theShape)
+ {
+ myShape = theShape;
+ }
/// Returns the shape
/// \return a shape instance
- const TopoDS_Shape& shape() const { return myShape; }
+ MODULEBASE_EXPORT const TopoDS_Shape& shape() const
+ {
+ return myShape;
+ }
- bool operator==(const ModuleBase_ViewerPrs& thePrs)
+ /// Set interactive object
+ /// \param theIO an interactive object
+ MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
{
- bool aFeature = (myFeature.get() == thePrs.feature().get());
- bool aOwner = (myOwner.Access() == thePrs.owner().Access());
- bool aShape = myShape.IsEqual(thePrs.shape());
- return aFeature && aOwner && aShape;
+ myInteractive = theIO;
}
-private:
- FeaturePtr myFeature; /// the feature
- Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
- TopoDS_Shape myShape; /// the shape
+ /// Returns interactive object if it is installed
+ MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
+ {
+ return myInteractive;
+ }
+
+ /// Returns true if all presentation fields are empty
+ /// \return boolean value
+ MODULEBASE_EXPORT bool isEmpty() const
+ {
+ return myShape.IsNull() &&
+ myOwner.IsNull() && !myResult.get();
+ }
+
+ /// Returns True if the current object is equal to the given one
+ /// \param thePrs an object to compare
+ MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs);
+
+ private:
+ ObjectPtr myResult; /// the feature
+ Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
+ TopoDS_Shape myShape; /// the shape
+ Handle(AIS_InteractiveObject) myInteractive; /// interactive object
};
#endif