X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ViewerPrs.h;h=932fdee6a4c3ebdfb04ecacaa294448dcfecb98f;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=b9bcb2b9d5c18c4a2f61a00dd822e5f70d36ccba;hpb=4783f146b71a48c651523fcf0e12367bcf3d1fa8;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h index b9bcb2b9d..932fdee6a 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.h +++ b/src/ModuleBase/ModuleBase_ViewerPrs.h @@ -1,6 +1,21 @@ -// File: ModuleBase_ViewerPrs.h -// Created: 20 Apr 2014 -// Author: Natalia ERMOLAEVA +// Copyright (C) 2014-2023 CEA/DEN, EDF R&D +// +// This library 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 2.1 of the License, or (at your option) any later version. +// +// This library 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 Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef ModuleBase_ViewerPrs_H #define ModuleBase_ViewerPrs_H @@ -8,107 +23,108 @@ #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 { public: /// Constructor - ModuleBase_ViewerPrs() - { - } - - /// Constructor - /// \param theFeature a model feature + /// \param theResult an object /// \param theShape a viewer shape /// \param theOwner a selection owner - ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape, - Handle_SelectMgr_EntityOwner theOwner) - : myResult(theResult), - myShape(theShape), - myOwner(theOwner) - { - } + MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(), + const GeomShapePtr& theShape = GeomShapePtr(), + Handle(SelectMgr_EntityOwner) theOwner = NULL); /// Destructor - virtual ~ModuleBase_ViewerPrs() - { - } + MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs(); - /// Sets the feature. - /// \param theFeature a feature instance - void setFeature(ObjectPtr theResult) + /// Sets the object. + /// \param theResult an object instance + MODULEBASE_EXPORT void setObject(ObjectPtr theResult) { myResult = theResult; } /// Returns the feature. /// \return a feature instance - ObjectPtr object() const + MODULEBASE_EXPORT ObjectPtr object() const { return myResult; } - /// Returns the presentation owner - /// \param the owner - void setOwner(Handle_SelectMgr_EntityOwner 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 + MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const { return myOwner; } /// Sets the shape /// \param theShape a shape instance - void setShape(const TopoDS_Shape& theShape) + MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape) { myShape = theShape; } /// Returns the shape /// \return a shape instance - const TopoDS_Shape& shape() const + MODULEBASE_EXPORT const GeomShapePtr& shape() const { return myShape; } - void setInteractive(const Handle(AIS_InteractiveObject)& theIO) + /// Set interactive object + /// \param theIO an interactive object + MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO) { myInteractive = theIO; } - Handle(AIS_InteractiveObject) interactive() const + /// Returns interactive object if it is installed + MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const { return myInteractive; } - bool operator==(const ModuleBase_ViewerPrs& thePrs) + /// Returns true if all presentation fields are empty + /// \return boolean value + MODULEBASE_EXPORT bool isEmpty() const { - bool aResult = (myResult.get() == thePrs.object().get()); - bool aOwner = (myOwner.Access() == thePrs.owner().Access()); - bool aShape = myShape.IsEqual(thePrs.shape()) == Standard_True; - bool aIO = (myInteractive == thePrs.interactive()) == Standard_True; - return aResult && aOwner && aShape && aIO; + return (!myShape.get() || myShape->isNull()) && + myOwner.IsNull() && !myResult.get(); } + /// Returns true if all presentation fields are empty + /// \return boolean value + MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const; + + /// 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; + GeomShapePtr myShape; /// the shape + Handle(AIS_InteractiveObject) myInteractive; /// interactive object }; +typedef std::shared_ptr ModuleBase_ViewerPrsPtr; + #endif