Salome HOME
Import profiles protection (Bug #203).
[modules/hydro.git] / src / HYDROData / HYDROData_Region.h
index e79f93943e1a2521756b6e44d66363e73cb4c5d4..7139837bc89959d04bf38453ffeef4722ded3a6e 100644 (file)
@@ -9,21 +9,14 @@ DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
 
 class Handle(HYDROData_Zone);
 
+class TopoDS_Shape;
+
 /**\class HYDROData_Region
  * \brief Regions are groups (lists) of zones, they can include one or several zones.
  */
 class HYDROData_Region : public HYDROData_Entity
 {
 
-public:
-
-  // Enumeration of mergin types for conflict bathymetries
-  enum MergeBathymetriesType
-  {
-    Merge_ZMIN,
-    Merge_ZMAX
-  };
-
 protected:
 
   /**
@@ -32,17 +25,8 @@ protected:
   enum DataTag
   {
     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+    DataTag_ChildZone,    ///< child zones
     DataTag_Zone,         ///< reference zones
-    DataTag_MergeType,    ///< mergin type of conflict bathymetries
-  };
-
-  /**
-   * 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
   };
 
 public:
@@ -60,61 +44,33 @@ public:
 
 
   /**
-   * Create new one reference zone for region on child label.
-   * The new zone is not added into the list of reference zones.
-   */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) AddNewZone();
-
-  /**
-   * Removes all child zones from region.
+   * Returns flag indicating that object is updateble or not.
    */
-  HYDRODATA_EXPORT virtual void RemoveChildZones();
+  HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
 
 
   /**
-   * Sets the merging type for conflict bathymetries.
-   * By default it is set to Merge_ZMIN.
+   * Removes object and it child sub-objects from the data structure.
+   * Reimplemented to update names of regions in father calculation.
    */
-  HYDRODATA_EXPORT virtual void SetMergeType( const MergeBathymetriesType& theType );
+  HYDRODATA_EXPORT virtual void Remove();
 
   /**
-   * Returns the merging type for conflict bathymetries.
+   * Returns flag indicating that object can be removed or not.
    */
-  HYDRODATA_EXPORT virtual MergeBathymetriesType GetMergeType() const;
-
-
+  HYDRODATA_EXPORT virtual bool CanRemove();
 
   /**
-   * Returns number of reference zones of region.
+   * Returns the list of all reference objects of this object.
    */
-  int NbZones() const;
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
 
-  /**
-   * Add new one reference zone for region.
-   */
-  HYDRODATA_EXPORT virtual void AddZone( const Handle(HYDROData_Zone)& theZone );
 
   /**
-   * Replace the reference zone for region.
-   */
-  HYDRODATA_EXPORT virtual void SetZone( const int                     theIndex,
-                                         const Handle(HYDROData_Zone)& theZone );
-
-  /**
-   * Inserts the reference zone for region before given index.
-   */
-  HYDRODATA_EXPORT virtual void InsertZone( const int                     theBeforeIndex,
-                                            const Handle(HYDROData_Zone)& theZone );
-
-  /**
-   * 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.
@@ -127,31 +83,42 @@ public:
   HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone );
 
   /**
-   * 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() const;
 
+protected:
+
+  /**
+   * 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();
 
 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