Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerPrs.h
index 723a15fb6445e723648e197cbef92173c0acbb6d..443c69084b332e867a2a4d80d51abc812fd3b6d8 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_ViewerPrs.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef ModuleBase_ViewerPrs_H
 #define ModuleBase_ViewerPrs_H
 #include "ModuleBase.h"
 
 #include <memory>
-#include <TopoDS_Shape.hxx>
 #include <SelectMgr_EntityOwner.hxx>
 #include <AIS_InteractiveObject.hxx>
 
 #include <ModelAPI_Result.h>
+#include <GeomAPI_Shape.h>
 
 /**\class ModuleBase_ViewerPrs
  * \ingroup GUI
 class ModuleBase_ViewerPrs
 {
  public:
-  /// Constructor
-  MODULEBASE_EXPORT ModuleBase_ViewerPrs();
-
   /// Constructor
   /// \param theResult an object
   /// \param theShape a viewer shape
   /// \param theOwner a selection owner
-  MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
-                       Handle_SelectMgr_EntityOwner theOwner);
+  MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
+                                         const GeomShapePtr& theShape = GeomShapePtr(),
+                                         Handle(SelectMgr_EntityOwner) theOwner = NULL);
 
   /// Destructor
   MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
@@ -66,14 +78,14 @@ class ModuleBase_ViewerPrs
 
   /// Sets the shape
   /// \param theShape a shape instance
-  MODULEBASE_EXPORT void setShape(const TopoDS_Shape& theShape)
+  MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape)
   {
     myShape = theShape;
   }
 
   /// Returns the shape
   /// \return a shape instance
-  MODULEBASE_EXPORT const TopoDS_Shape& shape() const
+  MODULEBASE_EXPORT const GeomShapePtr& shape() const
   {
     return myShape;
   }
@@ -95,10 +107,14 @@ class ModuleBase_ViewerPrs
   /// \return boolean value
   MODULEBASE_EXPORT bool isEmpty() const
   {
-    return myShape.IsNull() &&
+    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);
@@ -106,8 +122,10 @@ class ModuleBase_ViewerPrs
  private:
   ObjectPtr myResult;  /// the feature
   Handle(SelectMgr_EntityOwner) myOwner;  /// the selection owner
-  TopoDS_Shape myShape;  /// the shape
+  GeomShapePtr myShape;  /// the shape
   Handle(AIS_InteractiveObject) myInteractive;  /// interactive object
 };
 
+typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;
+
 #endif