X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ViewerPrs.h;h=419447edb1096006ce2c438123e49df921dd9a14;hb=f9fd953bf814fad40ae045f6164c7f80229b0872;hp=274ec2c2aed7e0d78fc0a785cb2b14f5620feb27;hpb=3985b767e74385e51d1b503d2c97d3bb1e3f6faa;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h index 274ec2c2a..419447edb 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.h +++ b/src/ModuleBase/ModuleBase_ViewerPrs.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_ViewerPrs.h // Created: 20 Apr 2014 // Author: Natalia ERMOLAEVA @@ -7,70 +9,112 @@ #include "ModuleBase.h" -#include +#include #include #include +#include #include /**\class ModuleBase_ViewerPrs - * \ingroup Module base + * \ingroup GUI * \brief Presentation. Provides container to have feature, shape and/or selection owner. */ -class ModuleBase_ViewerPrs +class MODULEBASE_EXPORT ModuleBase_ViewerPrs { -public: + public: /// Constructor - ModuleBase_ViewerPrs() {} - + ModuleBase_ViewerPrs(); + /// Constructor - /// \param theFeature a model feature + /// \param theResult an object /// \param theShape a viewer shape /// \param theOwner a selection owner - ModuleBase_ViewerPrs(ResultPtr theResult, - const TopoDS_Shape& theShape, - Handle_SelectMgr_EntityOwner theOwner) - : myResult(theResult), myShape(theShape), myOwner(theOwner) {} - + ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape, + Handle_SelectMgr_EntityOwner theOwner); + /// Destructor - virtual ~ModuleBase_ViewerPrs() {} + virtual ~ModuleBase_ViewerPrs(); - /// Sets the feature. - /// \param theFeature a feature instance - void setFeature(ResultPtr theResult) { myResult = theResult; } + /// Sets the object. + /// \param theResult an object instance + void setObject(ObjectPtr theResult) + { + myResult = theResult; + } /// Returns the feature. /// \return a feature instance - ResultPtr result() const { return myResult; } + 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 + void setOwner(Handle_SelectMgr_EntityOwner theOwner) + { + myOwner = theOwner; + } /// Returns the presentation owner /// \return an owner - Handle_SelectMgr_EntityOwner owner() const { return myOwner; } + Handle_SelectMgr_EntityOwner owner() const + { + return myOwner; + } /// Sets the shape /// \param theShape a shape instance - void setShape(const TopoDS_Shape& theShape) { myShape = theShape; } + void setShape(const TopoDS_Shape& theShape) + { + myShape = theShape; + } /// Returns the shape /// \return a shape instance - const TopoDS_Shape& shape() const { return myShape; } + const TopoDS_Shape& shape() const + { + return myShape; + } + + /// Set interactive object + /// \param theIO an interactive object + void setInteractive(const Handle(AIS_InteractiveObject)& theIO) + { + myInteractive = theIO; + } + + /// Returns interactive object if it is installed + Handle(AIS_InteractiveObject) interactive() const + { + return myInteractive; + } + + /// Returns true if all presentation fields are empty + /// \return boolean value + 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 bool operator==(const ModuleBase_ViewerPrs& thePrs) { - bool aResult = (myResult.get() == thePrs.result().get()); + bool aResult = (myResult.get() == thePrs.object().get()); bool aOwner = (myOwner.Access() == thePrs.owner().Access()); - bool aShape = myShape.IsEqual(thePrs.shape()); - return aResult && aOwner && aShape; + bool aShape = myShape.IsEqual(thePrs.shape()) == Standard_True; + bool aIO = (myInteractive == thePrs.interactive()) == Standard_True; + return aResult && aOwner && aShape && aIO; } -private: - ResultPtr myResult; /// the feature - Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner - TopoDS_Shape myShape; /// the shape + private: + ObjectPtr myResult; /// the feature + Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner + TopoDS_Shape myShape; /// the shape + Handle(AIS_InteractiveObject) myInteractive; /// interactive object }; #endif