Salome HOME
Lot 2: change bathy associated to natural object propagated to all cases without...
[modules/hydro.git] / src / HYDROData / HYDROData_Region.h
index 1579be6ccc93834093a6612d9add305a0330de56..b9a5314c6ae5febf2442120a457ad5d8fea4550b 100644 (file)
@@ -1,42 +1,51 @@
+// Copyright (C) 2014-2015  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 HYDROData_Region_HeaderFile
 #define HYDROData_Region_HeaderFile
 
-#include "HYDROData_Entity.h"
+#include "HYDROData_ShapesGroup.h"
 
 
-DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
-
-class Handle(HYDROData_Zone);
+class HYDROData_Zone;
+class HYDROData_Document;
+class TopoDS_Shape;
+class TopoDS_Face;
+class QStringList;
 
 /**\class HYDROData_Region
  * \brief Regions are groups (lists) of zones, they can include one or several zones.
  */
 class HYDROData_Region : public HYDROData_Entity
 {
-
 protected:
-
   /**
    * Enumeration of tags corresponding to the persistent object parameters.
    */
   enum DataTag
   {
     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
-    DataTag_Zone    ///< reference zones
-  };
-
-  /**
-   * Enumeration of tags corresponding to the child sub-objects of object.
-   */
-  enum ChildTag
-  {
-    ChildTag_First = HYDROData_Entity::ChildTag_First + 100, ///< first tag, to reserve
-    ChildTag_Zone      ///< child zones
+    DataTag_ChildZone,    ///< child zones
+    DataTag_Zone,         ///< reference zones
   };
 
 public:
-  DEFINE_STANDARD_RTTI(HYDROData_Region);
+  DEFINE_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Entity);
 
   /**
    * Returns the kind of this object. Must be redefined in all objects of known type.
@@ -46,52 +55,38 @@ public:
   /**
    * Dump object to Python script representation.
    */
-  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
-
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
+                                                     MapOfTreatedObjects& theTreatedObjects,
+                                                     QString defRegName = QString()) const;
 
   /**
-   * Create new one reference zone for region on child label.
-   * The new zone is not added into the list of reference zones.
+   * Returns flag indicating that object is updateble or not.
    */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) AddNewZone();
-
-  /**
-   * Removes all child zones from region.
-   */
-  HYDRODATA_EXPORT virtual void RemoveChildZones();
-
+  HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
 
-  /**
-   * Returns number of reference zones of region.
-   */
-  int NbZones() const;
 
   /**
-   * Add new one reference zone for region.
+   * Removes object and it child sub-objects from the data structure.
+   * Reimplemented to update names of regions in father calculation.
    */
-  HYDRODATA_EXPORT virtual void AddZone( const Handle(HYDROData_Zone)& theZone );
+  HYDRODATA_EXPORT virtual void Remove();
 
   /**
-   * Replace the reference zone for region.
+   * Returns flag indicating that object can be removed or not.
    */
-  HYDRODATA_EXPORT virtual void SetZone( const int                     theIndex,
-                                         const Handle(HYDROData_Zone)& theZone );
+  HYDRODATA_EXPORT virtual bool CanRemove();
 
   /**
-   * Inserts the reference zone for region before given index.
+   * Returns the list of all reference objects of this object.
    */
-  HYDRODATA_EXPORT virtual void InsertZone( const int                     theBeforeIndex,
-                                            const Handle(HYDROData_Zone)& theZone );
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
 
-  /**
-   * Sets reference zones for calculation region.
-   */
-  HYDRODATA_EXPORT virtual void SetZones( const HYDROData_SequenceOfObjects& theZones );
 
   /**
-   * Returns reference zone of region by index.
+   * Add new one reference zone for region.
+   * The label of theZone is changed in case if old parent is not this region.
    */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZone( const int theIndex ) const;
+  HYDRODATA_EXPORT virtual bool AddZone( const Handle(HYDROData_Zone)& theZone );
 
   /**
    * Returns all reference zone of region.
@@ -101,34 +96,49 @@ public:
   /**
    * Removes reference zone from region.
    */
-  HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone );
+  HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone, bool removeRegion = true );
 
   /**
-   * Removes reference zone from region by it index.
+   * Removes all reference zones from region.
    */
-  HYDRODATA_EXPORT virtual void RemoveZone( const int theIndex );
+  HYDRODATA_EXPORT virtual void RemoveZones();
 
   /**
-   * Removes all reference zones from region.
+   * \brief Returns the shape of the region.
+   * Shape of the region could be:
+   * - a face which is the union of the region zones faces
+   * - a shell if the zones faces can't be united into one face
+   * \return shape as TopoDS_Shape
    */
-  HYDRODATA_EXPORT virtual void RemoveZones();
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups = 0, 
+                                                  const TopTools_SequenceOfShape* IntSh = NULL ) const;
+
+  HYDRODATA_EXPORT bool IsSubmersible() const;
 
+  /**
+   * Create new one reference zone for region on child label.
+   * The new zone is added into the list of reference zones.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) addNewZone( const Handle(HYDROData_Document)& theDoc,
+                                                              const QString& thePrefix,
+                                                              const TopoDS_Face& theFace,
+                                                              const QStringList& theRefObjects );
 
 protected:
 
-  friend class HYDROData_Calculation;
+  friend class HYDROData_CalculationCase;
   friend class HYDROData_Iterator;
 
   /**
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDROData_Region();
+  HYDRODATA_EXPORT HYDROData_Region();
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
    */
-  ~HYDROData_Region();
+  HYDRODATA_EXPORT ~HYDROData_Region();
 };
 
 #endif