]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Name calculation calss hass been changed in accordance with spec diagram of classes.
authoradv <adv@opencascade.com>
Wed, 30 Oct 2013 03:47:38 +0000 (03:47 +0000)
committeradv <adv@opencascade.com>
Wed, 30 Oct 2013 03:47:38 +0000 (03:47 +0000)
12 files changed:
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_Calculation.cxx [deleted file]
src/HYDROData/HYDROData_Calculation.h [deleted file]
src/HYDROData/HYDROData_CalculationCase.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_CalculationCase.h [new file with mode: 0644]
src/HYDROData/HYDROData_Iterator.cxx
src/HYDROData/HYDROData_Region.h
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_DataModel.cxx

index 78eae8e3a20ec510a0f2b30cda19bf9ca9236b01..9308991b7edfeacde75e9232261bdc556ba30d97 100644 (file)
@@ -7,7 +7,7 @@ set(PROJECT_HEADERS
     HYDROData_ArtificialObject.h
     HYDROData_Bathymetry.h
     HYDROData_BSplineOperation.h
-    HYDROData_Calculation.h
+    HYDROData_CalculationCase.h
     HYDROData_Document.h
     HYDROData_Entity.h
     HYDROData_IAltitudeObject.h
@@ -32,7 +32,7 @@ set(PROJECT_SOURCES
     HYDROData_ArtificialObject.cxx
     HYDROData_Bathymetry.cxx
     HYDROData_BSplineOperation.cxx
-    HYDROData_Calculation.cxx
+    HYDROData_CalculationCase.cxx
     HYDROData_Document.cxx
     HYDROData_Entity.cxx
     HYDROData_IAltitudeObject.cxx
diff --git a/src/HYDROData/HYDROData_Calculation.cxx b/src/HYDROData/HYDROData_Calculation.cxx
deleted file mode 100644 (file)
index ff8415a..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-
-#include "HYDROData_Calculation.h"
-
-#include "HYDROData_ArtificialObject.h"
-#include "HYDROData_Document.h"
-#include "HYDROData_Iterator.h"
-#include "HYDROData_NaturalObject.h"
-#include "HYDROData_SplitToZonesTool.h"
-#include "HYDROData_Region.h"
-#include "HYDROData_Tool.h"
-#include "HYDROData_Zone.h"
-
-#define PYTHON_CALCULATION_ID "KIND_CALCULATION"
-
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Entity)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Calculation, HYDROData_Entity)
-
-HYDROData_Calculation::HYDROData_Calculation()
-: HYDROData_Entity()
-{
-}
-
-HYDROData_Calculation::~HYDROData_Calculation()
-{
-}
-
-QStringList HYDROData_Calculation::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
-{
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
-  QString aCalculName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aCalculName ).arg( aDocName ).arg( PYTHON_CALCULATION_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aCalculName ).arg( aCalculName );
-  aResList << QString( "" );
-
-  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
-  HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
-  for ( ; anIter.More(); anIter.Next() )
-  {
-    Handle(HYDROData_Object) aRefGeomObj =
-      Handle(HYDROData_Object)::DownCast( anIter.Value() );
-    if ( !aRefGeomObj.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
-  }
-  aResList << QString( "" );
-
-  aResList << QString( "%1.SplitGeometryObjects();" ).arg( aCalculName );
-  aResList << QString( "" );
-
-  // Now we restore the regions and zones order
-  HYDROData_SequenceOfObjects aRegions = GetRegions();
-  anIter.Init( aRegions );
-  for ( ; anIter.More(); anIter.Next() )
-  {
-    Handle(HYDROData_Region) aRegion =
-      Handle(HYDROData_Region)::DownCast( anIter.Value() );
-    if ( aRegion.IsNull() )
-      continue;
-
-    QString aRegionName = aRegion->GetName();
-    // TODO
-  }
-
-  return aResList;
-}
-
-void HYDROData_Calculation::SplitGeometryObjects()
-{
-  // At first we remove previously created regions
-  RemoveRegions();
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
-  if ( aDocument.IsNull() )
-    return;
-
-  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
-  if ( aGeomObjects.IsEmpty() )
-    return;
-
-  HYDROData_SplitToZonesTool::SplitDataList aSplitedZones =
-    HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects );
-  if ( aSplitedZones.isEmpty() )
-    return;
-
-  // Create result regions for case, by default one zone for one region
-  HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitedZones );
-  while( anIter.hasNext() )
-  {
-    const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
-
-    // Create new region
-    Handle(HYDROData_Region) aRegion = addNewRegion();
-
-    QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
-    aRegion->SetName( aRegionName );
-
-    // Add the zone for region
-    Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone();
-
-    QString aZoneName = HYDROData_Tool::GenerateObjectName( aDocument, "Zone" );
-    aRegionZone->SetName( aZoneName );
-
-    aRegionZone->SetShape( aSplitData.Face() );
-
-    // Add the reference object for zone
-    for ( int i = 0, n = aSplitData.ObjectNames.length(); i < n; ++i )
-    {
-      const QString& anObjName = aSplitData.ObjectNames.at( i );
-      
-      Handle(HYDROData_Object) aRefObject = Handle(HYDROData_Object)::DownCast(
-        HYDROData_Tool::FindObjectByName( aDocument, anObjName ) );
-      if ( aRefObject.IsNull() )
-        continue;
-
-      aRegionZone->AddGeometryObject( aRefObject );
-    }
-  }
-}
-
-bool HYDROData_Calculation::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
-{
-  if ( theObject.IsNull() )
-    return false;
-  
-  if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
-       !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
-    return false; // Wrong type of object
-
-  if ( HasReference( theObject, DataTag_GeometryObject ) )
-    return false; // Object is already in reference list
-
-  AddReferenceObject( theObject, DataTag_GeometryObject );
-  return true;
-}
-
-HYDROData_SequenceOfObjects HYDROData_Calculation::GetGeometryObjects() const
-{
-  return GetReferenceObjects( DataTag_GeometryObject );
-}
-
-void HYDROData_Calculation::RemoveGeometryObject( const Handle(HYDROData_Object)& theObject )
-{
-  if ( theObject.IsNull() )
-    return;
-
-  RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
-}
-
-void HYDROData_Calculation::RemoveGeometryObjects()
-{
-  ClearReferenceObjects( DataTag_GeometryObject );
-}
-
-Handle(HYDROData_Region) HYDROData_Calculation::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
-{
-  Handle(HYDROData_Region) aNewRegion = addNewRegion();
-  if ( aNewRegion.IsNull() )
-    return aNewRegion;
-
-  // Generate new name for new region
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
-  if ( !aDocument.IsNull() )
-  {
-    QString aNewRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
-    aNewRegion->SetName( aNewRegionName );
-  }
-
-  aNewRegion->AddZone( theZone );
-
-  return aNewRegion;
-}
-
-bool HYDROData_Calculation::AddRegion( const Handle(HYDROData_Region)& theRegion )
-{
-  if ( theRegion.IsNull() )
-    return false;
-  
-  if ( HasReference( theRegion, DataTag_Region ) )
-    return false; // Object is already in reference list
-
-  // Move the region from other calculation
-  Handle(HYDROData_Calculation) aFatherCalc = 
-    Handle(HYDROData_Calculation)::DownCast( theRegion->GetFatherObject() );
-  if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
-  {
-    Handle(HYDROData_Region) aNewRegion = addNewRegion();
-    theRegion->CopyTo( aNewRegion );
-
-    aFatherCalc->RemoveRegion( theRegion );
-
-    theRegion->SetLabel( aNewRegion->Label() );
-  }
-
-  AddReferenceObject( theRegion, DataTag_Region );
-  return true;
-}
-
-HYDROData_SequenceOfObjects HYDROData_Calculation::GetRegions() const
-{
-  return GetReferenceObjects( DataTag_Region );
-}
-
-void HYDROData_Calculation::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
-{
-  if ( theRegion.IsNull() )
-    return;
-
-  RemoveReferenceObject( theRegion->Label(), DataTag_Region );
-
-  // Remove region from data model
-  Handle(HYDROData_Calculation) aFatherCalc = 
-    Handle(HYDROData_Calculation)::DownCast( theRegion->GetFatherObject() );
-  if ( !aFatherCalc.IsNull() && aFatherCalc->Label() == myLab )
-    theRegion->Remove();
-}
-
-void HYDROData_Calculation::RemoveRegions()
-{
-  ClearReferenceObjects( DataTag_Region );
-  myLab.FindChild( ChildTag_Region ).ForgetAllAttributes( true );
-}
-
-Handle(HYDROData_Region) HYDROData_Calculation::addNewRegion()
-{
-  TDF_Label aNewLab = myLab.FindChild( ChildTag_Region ).NewChild();
-
-  Handle(HYDROData_Region) aNewRegion =
-    Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) );
-  AddRegion( aNewRegion );
-
-  return aNewRegion;
-}
-
diff --git a/src/HYDROData/HYDROData_Calculation.h b/src/HYDROData/HYDROData_Calculation.h
deleted file mode 100644 (file)
index 1590c25..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-#ifndef HYDROData_Calculation_HeaderFile
-#define HYDROData_Calculation_HeaderFile
-
-#include <HYDROData_Entity.h>
-
-class Handle(HYDROData_Object);
-class Handle(HYDROData_Region);
-class Handle(HYDROData_Zone);
-
-DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Entity)
-
-
-/**\class HYDROData_Calculation
- * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
- *
- */
-class HYDROData_Calculation : 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_GeometryObject,   ///< reference geometry objects
-    DataTag_Region            ///< reference regions
-  };
-
-  /**
-   * 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_Region      ///< child regions
-  };
-
-public:
-
-  DEFINE_STANDARD_RTTI(HYDROData_Calculation);
-
-  /**
-   * Returns the kind of this object. Must be redefined in all objects of known type.
-   */
-  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
-
-
-  /**
-   * Dump Calculation object to Python script representation.
-   */
-  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
-
-public:      
-  // Public methods to work with Calculation
-
-  /**
-   * Split reference geometry objects to non-intersected regions.
-   */
-  HYDRODATA_EXPORT virtual void SplitGeometryObjects();
-
-
-  /**
-   * Add new one reference geometry object for calculation case.
-   */
-  HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
-
-  /**
-   * Returns all reference geometry objects of calculation case.
-   */
-  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
-
-  /**
-   * Removes reference geometry object from calculation case.
-   */
-  HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
-
-  /**
-   * Removes all reference geometry objects from calculation case.
-   */
-  HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
-
-
-  /**
-   * Add new one child region for calculation case.
-   * The new region is added into the list of reference regions.
-   * The label of theZone is changed during this operation
-   * because of new region becomes the new parent for this zone.
-   */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
-
-
-  /**
-   * Add new one reference region for calculation case.
-   * The label of theRegion is changed in case if old parent is not this calculation.
-   */
-  HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
-
-  /**
-   * Returns all reference regions of calculation case.
-   */
-  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
-
-  /**
-   * Removes reference region from calculation case.
-   */
-  HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
-
-  /**
-   * Removes all reference regions from calculation case.
-   */
-  HYDRODATA_EXPORT virtual void RemoveRegions();
-
-private:
-
-  /**
-   * Add new one region for calculation case.
-   * The new region is added into the list of reference regions.
-   */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Region) addNewRegion();
-
-
-protected:
-
-  friend class HYDROData_Iterator;
-
-  /**
-   * Creates new object in the internal data structure. Use higher level objects 
-   * to create objects with real content.
-   */
-  HYDROData_Calculation();
-
-  /**
-   * Destructs properties of the object and object itself, removes it from the document.
-   */
-  ~HYDROData_Calculation();
-};
-
-#endif
diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx
new file mode 100644 (file)
index 0000000..b62bcb5
--- /dev/null
@@ -0,0 +1,241 @@
+
+#include "HYDROData_CalculationCase.h"
+
+#include "HYDROData_ArtificialObject.h"
+#include "HYDROData_Document.h"
+#include "HYDROData_Iterator.h"
+#include "HYDROData_NaturalObject.h"
+#include "HYDROData_SplitToZonesTool.h"
+#include "HYDROData_Region.h"
+#include "HYDROData_Tool.h"
+#include "HYDROData_Zone.h"
+
+#define PYTHON_CALCULATION_ID "KIND_CALCULATION"
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
+
+HYDROData_CalculationCase::HYDROData_CalculationCase()
+: HYDROData_Entity()
+{
+}
+
+HYDROData_CalculationCase::~HYDROData_CalculationCase()
+{
+}
+
+QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+  QStringList aResList;
+
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  if ( aDocument.IsNull() )
+    return aResList;
+                             
+  QString aDocName = aDocument->GetDocPyName();
+  QString aCalculName = GetName();
+
+  aResList << QString( "%1 = %2.CreateObject( %3 );" )
+              .arg( aCalculName ).arg( aDocName ).arg( PYTHON_CALCULATION_ID );
+  aResList << QString( "%1.SetName( \"%2\" );" )
+              .arg( aCalculName ).arg( aCalculName );
+  aResList << QString( "" );
+
+  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+  HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_Object) aRefGeomObj =
+      Handle(HYDROData_Object)::DownCast( anIter.Value() );
+    if ( !aRefGeomObj.IsNull() )
+      setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
+  }
+  aResList << QString( "" );
+
+  aResList << QString( "%1.SplitGeometryObjects();" ).arg( aCalculName );
+  aResList << QString( "" );
+
+  // Now we restore the regions and zones order
+  HYDROData_SequenceOfObjects aRegions = GetRegions();
+  anIter.Init( aRegions );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_Region) aRegion =
+      Handle(HYDROData_Region)::DownCast( anIter.Value() );
+    if ( aRegion.IsNull() )
+      continue;
+
+    QString aRegionName = aRegion->GetName();
+    // TODO
+  }
+
+  return aResList;
+}
+
+void HYDROData_CalculationCase::SplitGeometryObjects()
+{
+  // At first we remove previously created regions
+  RemoveRegions();
+
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  if ( aDocument.IsNull() )
+    return;
+
+  HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+  if ( aGeomObjects.IsEmpty() )
+    return;
+
+  HYDROData_SplitToZonesTool::SplitDataList aSplitedZones =
+    HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects );
+  if ( aSplitedZones.isEmpty() )
+    return;
+
+  // Create result regions for case, by default one zone for one region
+  HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitedZones );
+  while( anIter.hasNext() )
+  {
+    const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
+
+    // Create new region
+    Handle(HYDROData_Region) aRegion = addNewRegion();
+
+    QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
+    aRegion->SetName( aRegionName );
+
+    // Add the zone for region
+    Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone();
+
+    QString aZoneName = HYDROData_Tool::GenerateObjectName( aDocument, "Zone" );
+    aRegionZone->SetName( aZoneName );
+
+    aRegionZone->SetShape( aSplitData.Face() );
+
+    // Add the reference object for zone
+    for ( int i = 0, n = aSplitData.ObjectNames.length(); i < n; ++i )
+    {
+      const QString& anObjName = aSplitData.ObjectNames.at( i );
+      
+      Handle(HYDROData_Object) aRefObject = Handle(HYDROData_Object)::DownCast(
+        HYDROData_Tool::FindObjectByName( aDocument, anObjName ) );
+      if ( aRefObject.IsNull() )
+        continue;
+
+      aRegionZone->AddGeometryObject( aRefObject );
+    }
+  }
+}
+
+bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
+{
+  if ( theObject.IsNull() )
+    return false;
+  
+  if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
+       !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
+    return false; // Wrong type of object
+
+  if ( HasReference( theObject, DataTag_GeometryObject ) )
+    return false; // Object is already in reference list
+
+  AddReferenceObject( theObject, DataTag_GeometryObject );
+  return true;
+}
+
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryObjects() const
+{
+  return GetReferenceObjects( DataTag_GeometryObject );
+}
+
+void HYDROData_CalculationCase::RemoveGeometryObject( const Handle(HYDROData_Object)& theObject )
+{
+  if ( theObject.IsNull() )
+    return;
+
+  RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
+}
+
+void HYDROData_CalculationCase::RemoveGeometryObjects()
+{
+  ClearReferenceObjects( DataTag_GeometryObject );
+}
+
+Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
+{
+  Handle(HYDROData_Region) aNewRegion = addNewRegion();
+  if ( aNewRegion.IsNull() )
+    return aNewRegion;
+
+  // Generate new name for new region
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  if ( !aDocument.IsNull() )
+  {
+    QString aNewRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
+    aNewRegion->SetName( aNewRegionName );
+  }
+
+  aNewRegion->AddZone( theZone );
+
+  return aNewRegion;
+}
+
+bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion )
+{
+  if ( theRegion.IsNull() )
+    return false;
+  
+  if ( HasReference( theRegion, DataTag_Region ) )
+    return false; // Object is already in reference list
+
+  // Move the region from other calculation
+  Handle(HYDROData_CalculationCase) aFatherCalc = 
+    Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
+  if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
+  {
+    Handle(HYDROData_Region) aNewRegion = addNewRegion();
+    theRegion->CopyTo( aNewRegion );
+
+    aFatherCalc->RemoveRegion( theRegion );
+
+    theRegion->SetLabel( aNewRegion->Label() );
+  }
+
+  AddReferenceObject( theRegion, DataTag_Region );
+  return true;
+}
+
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions() const
+{
+  return GetReferenceObjects( DataTag_Region );
+}
+
+void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
+{
+  if ( theRegion.IsNull() )
+    return;
+
+  RemoveReferenceObject( theRegion->Label(), DataTag_Region );
+
+  // Remove region from data model
+  Handle(HYDROData_CalculationCase) aFatherCalc = 
+    Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
+  if ( !aFatherCalc.IsNull() && aFatherCalc->Label() == myLab )
+    theRegion->Remove();
+}
+
+void HYDROData_CalculationCase::RemoveRegions()
+{
+  ClearReferenceObjects( DataTag_Region );
+  myLab.FindChild( ChildTag_Region ).ForgetAllAttributes( true );
+}
+
+Handle(HYDROData_Region) HYDROData_CalculationCase::addNewRegion()
+{
+  TDF_Label aNewLab = myLab.FindChild( ChildTag_Region ).NewChild();
+
+  Handle(HYDROData_Region) aNewRegion =
+    Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) );
+  AddRegion( aNewRegion );
+
+  return aNewRegion;
+}
+
diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h
new file mode 100644 (file)
index 0000000..916057b
--- /dev/null
@@ -0,0 +1,143 @@
+
+
+#ifndef HYDROData_CalculationCase_HeaderFile
+#define HYDROData_CalculationCase_HeaderFile
+
+#include <HYDROData_Entity.h>
+
+class Handle(HYDROData_Object);
+class Handle(HYDROData_Region);
+class Handle(HYDROData_Zone);
+
+DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
+
+
+/**\class HYDROData_CalculationCase
+ * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
+ *
+ */
+class HYDROData_CalculationCase : 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_GeometryObject,   ///< reference geometry objects
+    DataTag_Region            ///< reference regions
+  };
+
+  /**
+   * 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_Region      ///< child regions
+  };
+
+public:
+
+  DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
+
+  /**
+   * Returns the kind of this object. Must be redefined in all objects of known type.
+   */
+  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
+
+
+  /**
+   * Dump Calculation object to Python script representation.
+   */
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+public:      
+  // Public methods to work with Calculation
+
+  /**
+   * Split reference geometry objects to non-intersected regions.
+   */
+  HYDRODATA_EXPORT virtual void SplitGeometryObjects();
+
+
+  /**
+   * Add new one reference geometry object for calculation case.
+   */
+  HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
+
+  /**
+   * Returns all reference geometry objects of calculation case.
+   */
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
+
+  /**
+   * Removes reference geometry object from calculation case.
+   */
+  HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
+
+  /**
+   * Removes all reference geometry objects from calculation case.
+   */
+  HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
+
+
+  /**
+   * Add new one child region for calculation case.
+   * The new region is added into the list of reference regions.
+   * The label of theZone is changed during this operation
+   * because of new region becomes the new parent for this zone.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
+
+
+  /**
+   * Add new one reference region for calculation case.
+   * The label of theRegion is changed in case if old parent is not this calculation.
+   */
+  HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
+
+  /**
+   * Returns all reference regions of calculation case.
+   */
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
+
+  /**
+   * Removes reference region from calculation case.
+   */
+  HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
+
+  /**
+   * Removes all reference regions from calculation case.
+   */
+  HYDRODATA_EXPORT virtual void RemoveRegions();
+
+private:
+
+  /**
+   * Add new one region for calculation case.
+   * The new region is added into the list of reference regions.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Region) addNewRegion();
+
+
+protected:
+
+  friend class HYDROData_Iterator;
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_CalculationCase();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_CalculationCase();
+};
+
+#endif
index 43ab980c2160ac02064a835ec6eaabb96588caa1..7af624e8165878f05b8732dd0869374196df33f0 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "HYDROData_AltitudeObject.h"
 #include "HYDROData_Bathymetry.h"
-#include "HYDROData_Calculation.h"
+#include "HYDROData_CalculationCase.h"
 #include "HYDROData_Image.h"
 #include "HYDROData_ImmersibleZone.h"
 #include "HYDROData_Polyline.h"
@@ -110,7 +110,7 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel )
       aResult = new HYDROData_ImmersibleZone();
       break;
     case KIND_CALCULATION:
-      aResult = new HYDROData_Calculation();
+      aResult = new HYDROData_CalculationCase();
       break;
     case KIND_REGION:
       aResult = new HYDROData_Region();
index 5a331837cceadc7ada01c70acf718112a62f3445..09c69de61d6d87dd0b8d82c83b9884a1f5898cd4 100644 (file)
@@ -81,7 +81,7 @@ protected:
 
 protected:
 
-  friend class HYDROData_Calculation;
+  friend class HYDROData_CalculationCase;
   friend class HYDROData_Iterator;
 
   /**
index 30292fac85e0e881ea3edd837a8a591e40e21740..733ab5d5e9c447789b8c911226832ef355ec8f9f 100644 (file)
@@ -203,7 +203,7 @@ QStringList HYDROGUI_CalculationDlg::getSelectedGeomObjects() const
   return aResList;
 }
 
-void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_Calculation) theCase )
+void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_CalculationCase) theCase )
 {
   myEditedObject = theCase;
 
index 0d46504f0bca589fa25daf96f4492408f4c8f8ba..55a98ca1cf9fccb1e3918cf651f9f2971de90e74 100644 (file)
@@ -24,7 +24,7 @@
 #define HYDROGUI_CALCULATIONDLG_H
 
 #include "HYDROGUI_Wizard.h"
-#include <HYDROData_Calculation.h>
+#include <HYDROData_CalculationCase.h>
 
 class HYDROGUI_ObjSelector;
 class QGroupBox;
@@ -46,7 +46,7 @@ public:
   void                       setObjectName( const QString& theName );
   QString                    getObjectName() const;
 
-  void                       setEditedObject( const Handle(HYDROData_Calculation) theCase );
+  void                       setEditedObject( const Handle(HYDROData_CalculationCase) theCase );
 
   void                       setGeomObjects( const QStringList& theObjects );
   void                       setSelectedGeomObjects( const QStringList& theObjects );
@@ -63,7 +63,7 @@ private:
   QListWidget*               myGeomObjects;
 
   HYDROGUI_DataBrowser*         myBrowser;
-  Handle(HYDROData_Calculation) myEditedObject;
+  Handle(HYDROData_CalculationCase) myEditedObject;
   QComboBox*                    myBathymetryChoice;
 };
 
index 145701827eb6f16b886db05a37c08c044c0d6b6c..621d9d755a6badbc11402614253e9f0ca8b6e174 100644 (file)
@@ -80,7 +80,7 @@ void HYDROGUI_CalculationOp::startOperation()
   myEditedObject.Nullify();
   if ( myIsEdit )
   {
-    myEditedObject = Handle(HYDROData_Calculation)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    myEditedObject = Handle(HYDROData_CalculationCase)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
     if ( !myEditedObject.IsNull() )
     {
       anObjectName = myEditedObject->GetName();
@@ -105,7 +105,7 @@ void HYDROGUI_CalculationOp::startOperation()
   else
   {
     myEditedObject =
-      Handle(HYDROData_Calculation)::DownCast( doc()->CreateObject( KIND_CALCULATION ) );
+      Handle(HYDROData_CalculationCase)::DownCast( doc()->CreateObject( KIND_CALCULATION ) );
     myEditedObject->SetName(anObjectName);
   }
 
@@ -169,8 +169,8 @@ bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
 
   //Handle(HYDROData_Document) aDocument = doc();
 
-  //Handle(HYDROData_Calculation) aCalculObj = myIsEdit ? myEditedObject :
-  //  Handle(HYDROData_Calculation)::DownCast( aDocument->CreateObject( KIND_CALCULATION ) );
+  //Handle(HYDROData_CalculationCase) aCalculObj = myIsEdit ? myEditedObject :
+  //  Handle(HYDROData_CalculationCase)::DownCast( aDocument->CreateObject( KIND_CALCULATION ) );
   //if ( aCalculObj.IsNull() )
   //  return false;
 
index 52ae693569549d6d9458ce12e3d79c218b4317d4..ecdd145d1c62a19f140ef6caa4c47dbba72690f7 100644 (file)
@@ -28,7 +28,7 @@
 #include "HYDROData_SplitToZonesTool.h"
 #include "HYDROGUI_Shape.h"
 
-#include <HYDROData_Calculation.h>
+#include <HYDROData_CalculationCase.h>
 #include <HYDROData_Region.h>
 
 class SUIT_ViewManager;
@@ -89,7 +89,7 @@ private:
 
 private:
   bool                            myIsEdit;
-  Handle(HYDROData_Calculation)   myEditedObject;
+  Handle(HYDROData_CalculationCase) myEditedObject;
 
   SUIT_ViewManager*               myActiveViewManager;
 
index 180b2dd861fae6d8588d44b9fadfc0099b57cc39..8196df50b23e9ef69649682a880defa81670a9f3 100644 (file)
@@ -27,7 +27,7 @@
 #include "HYDROGUI_Tool.h"
 
 #include <HYDROData_Bathymetry.h>
-#include <HYDROData_Calculation.h>
+#include <HYDROData_CalculationCase.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
 #include <HYDROData_ImmersibleZone.h>
@@ -271,8 +271,8 @@ void HYDROGUI_DataModel::update( const int theStudyId )
   anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION );
   for( ; anIterator.More(); anIterator.Next() )
   {
-    Handle(HYDROData_Calculation) aCalculObj =
-      Handle(HYDROData_Calculation)::DownCast( anIterator.Current() );
+    Handle(HYDROData_CalculationCase) aCalculObj =
+      Handle(HYDROData_CalculationCase)::DownCast( anIterator.Current() );
     if( !aCalculObj.IsNull() )
       createObject( aCalculRootObj, aCalculObj );
   }
@@ -591,8 +591,8 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
   }
   else if ( anObjectKind == KIND_CALCULATION )
   {
-    Handle(HYDROData_Calculation) aCaseObj =
-      Handle(HYDROData_Calculation)::DownCast( aDataObj );
+    Handle(HYDROData_CalculationCase) aCaseObj =
+      Handle(HYDROData_CalculationCase)::DownCast( aDataObj );
 
     LightApp_DataObject* aCaseRegionsSect = 
       createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );