Salome HOME
Preparation of intermediate revision
[modules/geom.git] / src / GEOMBase / GEOMBase_Helper.h
index ac07a3ede14c0a5a6c8708f786f0624e610968e8..5aa304374eab03be6cb7d5d1b05652e55976051d 100755 (executable)
@@ -1,51 +1,51 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2004  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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. 
-// 
-//  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.org 
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+//  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.
 //
+//  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
+//
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : GEOMBase_Helper.h
+// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
 //
-//  File   : GEOMBase_Helper.h
-//  Author : Sergey ANIKIN
-//  Module : GEOM
-//  $Header$
-
 #ifndef GEOMBASE_HELPER_H
 #define GEOMBASE_HELPER_H
 
-#include "GEOM_Displayer.h"
-#include "SALOME_Prs.h"
-#include "SALOME_ListIO.hxx"
+#include "GEOM_GEOMBase.hxx"
+
+#include <GEOM_Displayer.h>
+#include <SALOME_ListIO.hxx>
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
 
-#include <qstring.h>
+#include <QString>
+#include <QMap>
 
 #include <list>
 
 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
 
+class SalomeApp_Notebook;
 class SalomeApp_Study;
 class SUIT_Desktop;
 class SUIT_ViewWindow;
+class SALOME_Prs;
 class GEOM_Operation;
-class TopoDS_Shape;
 class TColStd_MapOfInteger;
 
 //================================================================
@@ -55,7 +55,7 @@ class TColStd_MapOfInteger;
 //               performing common operations (display/erase, selection activation,
 //               publication in a study, transaction management)
 //================================================================
-class GEOMBase_Helper
+class GEOMBASE_EXPORT GEOMBase_Helper
 {
 public:
   GEOMBase_Helper( SUIT_Desktop* );
@@ -74,7 +74,9 @@ protected:
   virtual void displayPreview ( const bool   activate = false, 
                                 const bool   update = true,
                                 const bool   toRemoveFromEngine = true,
-                                const double lineWidth = -1 );
+                                const double lineWidth = -1, 
+                                const int    displayMode = -1,
+                                const int    color  = -1 );
   // This is the easiest way to show preview. It is based on execute() method.
   // It removes temporary GEOM::GEOM_Objects automatically.
 
@@ -82,7 +84,9 @@ protected:
                                  const bool   append = false, 
                                  const bool   activate = false, 
                                  const bool   update = true,
-                                 const double lineWidth = -1 );
+                                 const double lineWidth = -1, 
+                                 const int    displayMode = -1,
+                                 const int    color  = -1 );
   void displayPreview  ( const SALOME_Prs* prs, 
                         const bool append = false, 
                         const bool = true );
@@ -93,6 +97,7 @@ protected:
   void activate( const int );
   void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false  );
   void globalSelection( const TColStd_MapOfInteger&, const bool = false );
+  void globalSelection( const TColStd_MapOfInteger&, const QList<int>& ,const bool = false );
   void updateViewer    ();
 
   void prepareSelection( const ObjectList&, const int );
@@ -127,21 +132,9 @@ protected:
 
   inline void setPrefix( const QString& prefix ) { myPrefix = prefix; }
   QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const;
-
-  const SALOME_ListIO& selectedIO();
-  // Function returns a list of SALOME_InteractiveObject's from
-  // selection manager in GUI
-
-  int   IObjectCount() ;
-  // Function returns the number of selected objects
   
-  Handle(SALOME_InteractiveObject) firstIObject() ;
-  // Function returns the first selected object in the list
-  // of selected objects
-
-  Handle(SALOME_InteractiveObject) lastIObject() ;
-  // Function returns the last selected object in the list
-  // of selected objects
+  bool selectObjects( ObjectList& objects );
+  // Selects list of objects 
 
   ////////////////////////////////////////////////////////////////////////////
   // Virtual methods, to be redefined in dialog classes
@@ -160,12 +153,21 @@ protected:
   // It should perform the required operation and put all new or modified objects into 
   // <objects> argument.Should return <false> if some error occurs during its execution. 
 
+  virtual void restoreSubShapes( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject );
+  // This method is called by addInStudy().
+
   virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr theObj );
   // This method is called by addInStudy(). It should return a father object
   // for <theObj> or a nil reference if <theObj> should be published
   // as a top-level object.
 
-  virtual const char* getNewObjectName() const; 
+  virtual QString getNewObjectName() const; 
+  virtual void addSubshapesToStudy();
+
+  GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName );
+  //This Metod to find SubObject in theFather Object by Name (theName)
+
+  void addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap );
 
   void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
   bool IsPreview() {return isPreview;}
@@ -173,6 +175,10 @@ protected:
   GEOM_Displayer*             getDisplayer();
   SUIT_Desktop*               getDesktop() const;
 
+protected:
+  // To do: make this field private and add method getNoteBook()
+  SalomeApp_Notebook*         myNoteBook;
+
 private:
   char* getEntry              ( GEOM::GEOM_Object_ptr ) const;
   void                        clearShapeBuffer( GEOM::GEOM_Object_ptr );
@@ -192,4 +198,4 @@ private:
 
 };
 
-#endif
+#endif // GEOMBASE_HELPER_H