]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
The region object has been added for HYDRO data model.
authoradv <adv@opencascade.com>
Mon, 23 Sep 2013 12:52:29 +0000 (12:52 +0000)
committeradv <adv@opencascade.com>
Mon, 23 Sep 2013 12:52:29 +0000 (12:52 +0000)
12 files changed:
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData.vcproj
src/HYDROData/HYDROData_Calculation.cxx
src/HYDROData/HYDROData_Calculation.h
src/HYDROData/HYDROData_Domain.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_Domain.h [new file with mode: 0644]
src/HYDROData/HYDROData_Iterator.cxx
src/HYDROData/HYDROData_Object.h
src/HYDROData/HYDROData_Region.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_Region.h [new file with mode: 0644]
src/HYDROData/HYDROData_Zone.cxx
src/HYDROData/HYDROData_Zone.h

index 8928c59c359530f228001eadf5517d2e7d4fec1e..fb5bb5eb5a4a466082a917ac62260b461a5b3c8e 100644 (file)
@@ -6,12 +6,14 @@ set(PROJECT_HEADERS
     HYDROData_Bathymetry.h
     HYDROData_Calculation.h
     HYDROData_Document.h
+    HYDROData_Domain.h
     HYDROData_Lambert93.h
     HYDROData_Image.h
     HYDROData_Iterator.h
     HYDROData_Object.h
     HYDROData_Polyline.h
     HYDROData_VisualState.h
+    HYDROData_Region.h
     HYDROData_Tool.h
     HYDROData_Zone.h
     HYDROOperations_Factory.h
@@ -23,12 +25,14 @@ set(PROJECT_SOURCES
     HYDROData_Bathymetry.cxx
     HYDROData_Calculation.cxx
     HYDROData_Document.cxx
+    HYDROData_Domain.cxx
     HYDROData_Image.cxx
     HYDROData_Iterator.cxx
     HYDROData_Lambert93.cxx
     HYDROData_Object.cxx
     HYDROData_Polyline.cxx
     HYDROData_VisualState.cxx
+    HYDROData_Region.cxx
     HYDROData_Tool.cxx
     HYDROData_Zone.cxx
     HYDROOperations_Factory.cxx
index bacb345f878f8978c7c276e8ceb2413097b91a6c..9c90a8ab3de4072d2957d065d4663ad80080c79e 100644 (file)
                                RelativePath=".\HYDROData_Document.cxx"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Domain.cxx"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Image.cxx"
                                >
                                RelativePath=".\HYDROData_Polyline.cxx"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Region.cxx"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Tool.cxx"
                                >
                                RelativePath=".\HYDROData_Document.h"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Domain.h"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Image.h"
                                >
                                RelativePath=".\HYDROData_Polyline.h"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Region.h"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Tool.h"
                                >
index 766077e1ef24bde31c30ab60cb41754fe1cd9e56..f11513cc9b4f5965f2722919ca708a4f15312019 100644 (file)
@@ -5,6 +5,7 @@
 #include "HYDROData_Iterator.h"
 #include "HYDROData_Polyline.h"
 #include "HYDROData_Zone.h"
+#include "HYDROData_Region.h"
 
 #include <TDataStd_ReferenceList.hxx>
 
@@ -55,14 +56,14 @@ QStringList HYDROData_Calculation::DumpToPython( MapOfTreatedObjects& theTreated
   }
   aResList << QString( "" );
 
-  aZones = GetSplittedZones();
+  aZones = GetRegions();
   anIter.Init( aZones );
   for ( ; anIter.More(); anIter.Next() )
   {
     Handle(HYDROData_Zone) aSplittedZone =
       Handle(HYDROData_Zone)::DownCast( anIter.Value() );
     if ( !aSplittedZone.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aSplittedZone, "AddSplittedZone" );
+      setPythonReferenceObject( theTreatedObjects, aResList, aSplittedZone, "AddRegion" );
   }
 
   return aResList;
@@ -121,40 +122,40 @@ void HYDROData_Calculation::RemoveZones()
   ClearReferenceObjects( DataTag_Zone );
 }
 
-int HYDROData_Calculation::NbSplittedZones() const
+int HYDROData_Calculation::NbRegions() const
 {
-  return NbReferenceObjects( DataTag_SplittedZone );
+  return NbReferenceObjects( DataTag_Region );
 }
 
-void HYDROData_Calculation::AddSplittedZone( const Handle(HYDROData_Zone)& theZone )
+void HYDROData_Calculation::AddRegion( const Handle(HYDROData_Region)& theRegion )
 {
-  AddReferenceObject( theZone, DataTag_SplittedZone );
+  AddReferenceObject( theRegion, DataTag_Region );
 }
 
-void HYDROData_Calculation::SetSplittedZone( const int                     theIndex,
-                                             const Handle(HYDROData_Zone)& theZone )
+void HYDROData_Calculation::SetRegion( const int                       theIndex,
+                                       const Handle(HYDROData_Region)& theRegion )
 {
-  SetReferenceObject( theZone, DataTag_SplittedZone, theIndex );
+  SetReferenceObject( theRegion, DataTag_Region, theIndex );
 }
 
-void HYDROData_Calculation::SetSplittedZones( const HYDROData_SequenceOfObjects& theZones )
+void HYDROData_Calculation::SetRegions( const HYDROData_SequenceOfObjects& theRegions )
 {
-  SetReferenceObjects( theZones, DataTag_SplittedZone );
+  SetReferenceObjects( theRegions, DataTag_Region );
 }
 
-Handle(HYDROData_Zone) HYDROData_Calculation::GetSplittedZone( const int theIndex ) const
+Handle(HYDROData_Region) HYDROData_Calculation::GetRegion( const int theIndex ) const
 {
-  return Handle(HYDROData_Zone)::DownCast( 
-           GetReferenceObject( DataTag_SplittedZone, theIndex ) );
+  return Handle(HYDROData_Region)::DownCast( 
+           GetReferenceObject( DataTag_Region, theIndex ) );
 }
 
-HYDROData_SequenceOfObjects HYDROData_Calculation::GetSplittedZones() const
+HYDROData_SequenceOfObjects HYDROData_Calculation::GetRegions() const
 {
-  return GetReferenceObjects( DataTag_SplittedZone );
+  return GetReferenceObjects( DataTag_Region );
 }
 
-void HYDROData_Calculation::RemoveSplittedZones()
+void HYDROData_Calculation::RemoveRegions()
 {
-  ClearReferenceObjects( DataTag_SplittedZone );
+  ClearReferenceObjects( DataTag_Region );
 }
   
index 64de389ef9fb2ba4488e217b34493f30b5505e57..a5b72c0fdc91155acb03244d23f4ef9bd4b04bde 100644 (file)
@@ -11,6 +11,7 @@ class QFile;
 
 class Handle(HYDROData_Polyline);
 class Handle(HYDROData_Zone);
+class Handle(HYDROData_Region);
 
 DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object)
 
@@ -33,7 +34,7 @@ protected:
     DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
     DataTag_BoundaryPolyline,    ///< reference boundary polyline
     DataTag_Zone,                ///< reference zones
-    DataTag_SplittedZone         ///< reference splitted zones
+    DataTag_Region               ///< reference regions
   };
 
 public:
@@ -84,7 +85,7 @@ public:
    * Replace the refrence zone for calculation case.
    */
   HYDRODATA_EXPORT virtual void SetZone( const int                     theIndex,
-                                         const Handle(HYDROData_Zone)& theBathymetry );
+                                         const Handle(HYDROData_Zone)& theZone );
 
   /**
    * Sets the refrence zones for calculation case.
@@ -108,40 +109,40 @@ public:
 
 
   /**
-   * Returns number of splitted zones for calculation case.
+   * Returns number of regions for calculation case.
    */
-  HYDRODATA_EXPORT virtual int NbSplittedZones() const;
+  HYDRODATA_EXPORT virtual int NbRegions() const;
 
   /**
-   * Add new one splitted zone for calculation case.
+   * Add new one region for calculation case.
    */
-  HYDRODATA_EXPORT virtual void AddSplittedZone( const Handle(HYDROData_Zone)& theZone );
+  HYDRODATA_EXPORT virtual void AddRegion( const Handle(HYDROData_Region)& theRegion );
 
   /**
-   * Replace the splitted zone for calculation case.
+   * Replace the region for calculation case.
    */
-  HYDRODATA_EXPORT virtual void SetSplittedZone( const int                     theIndex,
-                                                 const Handle(HYDROData_Zone)& theBathymetry );
+  HYDRODATA_EXPORT virtual void SetRegion( const int                       theIndex,
+                                           const Handle(HYDROData_Region)& theRegion );
 
   /**
-   * Sets the refrence zones for calculation case.
+   * Sets the refrence region for calculation case.
    */
-  HYDRODATA_EXPORT virtual void SetSplittedZones( const HYDROData_SequenceOfObjects& theZones );
+  HYDRODATA_EXPORT virtual void SetRegions( const HYDROData_SequenceOfObjects& theRegions );
 
   /**
-   * Returns splitted zone of calculation case by index.
+   * Returns region of calculation case by index.
    */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetSplittedZone( const int theIndex ) const;
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegion( const int theIndex ) const;
 
   /**
-   * Returns all splitted zone of calculation case.
+   * Returns all regions of calculation case.
    */
-  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedZones() const;
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
 
   /**
-   * Removes all splitted refrence zone of calculation case.
+   * Removes all regions of calculation case.
    */
-  HYDRODATA_EXPORT virtual void RemoveSplittedZones();
+  HYDRODATA_EXPORT virtual void RemoveRegions();
 
 protected:
 
diff --git a/src/HYDROData/HYDROData_Domain.cxx b/src/HYDROData/HYDROData_Domain.cxx
new file mode 100644 (file)
index 0000000..8491c19
--- /dev/null
@@ -0,0 +1,128 @@
+
+#include "HYDROData_Domain.h"
+
+#include "HYDROData_Bathymetry.h"
+#include "HYDROData_Document.h"
+#include "HYDROData_Iterator.h"
+
+#include <TDataStd_IntegerArray.hxx>
+
+#include <QColor>
+#include <QStringList>
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Domain, HYDROData_Object)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Domain, HYDROData_Object)
+
+HYDROData_Domain::HYDROData_Domain()
+{
+}
+
+HYDROData_Domain::~HYDROData_Domain()
+{
+}
+
+QStringList HYDROData_Domain::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+  QStringList aResList;
+
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  if ( aDocument.IsNull() )
+    return aResList;
+
+  QString aDocName = aDocument->GetDocPyName();
+  QString aZoneName = GetName();
+
+  aResList << QString( "%1 = %2.CreateObject( %3 );" )
+              .arg( aZoneName ).arg( aDocName ).arg( getPythonKindId() );
+  aResList << QString( "%1.SetName( \"%2\" );" )
+              .arg( aZoneName ).arg( aZoneName );
+  aResList << QString( "" );
+
+  QColor aFillingColor = GetFillingColor();
+  aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
+              .arg( aFillingColor.red()  ).arg( aFillingColor.green() )
+              .arg( aFillingColor.blue() ).arg( aFillingColor.alpha() );
+  aResList << QString( "%1.SetFillingColor( filling_color );" ).arg( aZoneName );
+  aResList << QString( "" );
+
+  QColor aBorderColor = GetBorderColor();
+  aResList << QString( "border_color = QColor( %1, %2, %3, %4 );" )
+              .arg( aBorderColor.red()  ).arg( aBorderColor.green() )
+              .arg( aBorderColor.blue() ).arg( aBorderColor.alpha() );
+  aResList << QString( "%1.SetBorderColor( border_color );" ).arg( aZoneName );
+  aResList << QString( "" );
+
+  HYDROData_SequenceOfObjects aZoneBaths = GetBathymetries();
+  HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths );
+  for ( ; aBathsIter.More(); aBathsIter.Next() )
+  {
+    Handle(HYDROData_Bathymetry) aRefBath =
+      Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() );
+    if ( !aRefBath.IsNull() )
+      setPythonReferenceObject( theTreatedObjects, aResList, aRefBath, "AddBathymetry" );
+  }
+
+  return aResList;
+}
+
+QColor HYDROData_Domain::DefaultFillingColor()
+{
+  return QColor( Qt::green );
+}
+
+void HYDROData_Domain::SetFillingColor( const QColor& theColor )
+{
+  return SetColor( theColor, DataTag_FillingColor );
+}
+
+QColor HYDROData_Domain::GetFillingColor() const
+{
+  return GetColor( DefaultFillingColor(), DataTag_FillingColor );
+}
+
+QColor HYDROData_Domain::DefaultBorderColor()
+{
+  return QColor( Qt::transparent );
+}
+
+void HYDROData_Domain::SetBorderColor( const QColor& theColor )
+{
+  return SetColor( theColor, DataTag_BorderColor );
+}
+
+QColor HYDROData_Domain::GetBorderColor() const
+{
+  return GetColor( DefaultBorderColor(), DataTag_BorderColor );
+}
+
+int HYDROData_Domain::NbBathymetries() const
+{
+  return NbReferenceObjects( DataTag_Bathymetry );
+}
+
+void HYDROData_Domain::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
+{
+  AddReferenceObject( theBathymetry, DataTag_Bathymetry );
+}
+
+void HYDROData_Domain::SetBathymetry( const int                           theIndex,
+                                    const Handle(HYDROData_Bathymetry)& theBathymetry )
+{
+  SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex );
+}
+
+Handle(HYDROData_Bathymetry) HYDROData_Domain::GetBathymetry( const int theIndex ) const
+{
+  return Handle(HYDROData_Bathymetry)::DownCast( 
+           GetReferenceObject( DataTag_Bathymetry, theIndex ) );
+}
+
+HYDROData_SequenceOfObjects HYDROData_Domain::GetBathymetries() const
+{
+  return GetReferenceObjects( DataTag_Bathymetry );
+}
+
+void HYDROData_Domain::RemoveBathymetries()
+{
+  ClearReferenceObjects( DataTag_Bathymetry );
+}
diff --git a/src/HYDROData/HYDROData_Domain.h b/src/HYDROData/HYDROData_Domain.h
new file mode 100644 (file)
index 0000000..00c2490
--- /dev/null
@@ -0,0 +1,137 @@
+
+#ifndef HYDROData_Domain_HeaderFile
+#define HYDROData_Domain_HeaderFile
+
+#include <HYDROData_Object.h>
+
+#include <QPointF>
+#include <QList>
+
+class Handle(HYDROData_Bathymetry);
+
+DEFINE_STANDARD_HANDLE(HYDROData_Domain, HYDROData_Object)
+
+
+/**\class HYDROData_Domain
+ * \brief Class that stores/retreives information about the 2d surface.
+ */
+class HYDROData_Domain : public HYDROData_Object
+{
+
+protected:
+  /**
+   * Enumeration of tags corresponding to the persistent object parameters.
+   */
+  enum DataTag
+  {
+    DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
+    DataTag_Bathymetry,   ///< reference bathymetries
+    DataTag_FillingColor, ///< filling color of zone
+    DataTag_BorderColor,  ///< border color of zone
+  };
+
+public:
+  DEFINE_STANDARD_RTTI(HYDROData_Domain);
+
+  /**
+   * Returns the kind of this object. Must be redefined in all objects of known type.
+   */
+  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const = 0;
+
+  /**
+   * Dump object to Python script representation.
+   */
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+
+  /**
+   * Returns default filling color for new zone.
+   */
+  HYDRODATA_EXPORT static QColor DefaultFillingColor();
+
+  /**
+   * Sets filling color for zone.
+   */
+  HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
+
+  /**
+   * Returns filling color of zone.
+   */
+  HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
+
+
+  /**
+   * Returns default border color for new zone.
+   */
+  HYDRODATA_EXPORT static QColor DefaultBorderColor();
+
+  /**
+   * Sets border color for zone.
+   */
+  HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
+
+  /**
+   * Returns border color of zone.
+   */
+  HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
+
+
+  /**
+   * Returns number of bathymetry objects for zone.
+   */
+  HYDRODATA_EXPORT virtual int NbBathymetries() const;
+
+  /**
+   * Add reference bathymetry object for zone.
+   */
+  HYDRODATA_EXPORT virtual void AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
+
+  /**
+   * Change reference bathymetry object with given index for zone.
+   */
+  HYDRODATA_EXPORT virtual void SetBathymetry( const int                           theIndex,
+                                               const Handle(HYDROData_Bathymetry)& theBathymetry );
+
+  /**
+   * Returns reference bathymetry object of zone by it index.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry( const int theIndex ) const;
+
+  /**
+   * Returns list of all reference bathymetry objects of zone.
+   */
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects  GetBathymetries() const;
+
+  /**
+   * Clear list of bathymetry objects of zone.
+   */
+  HYDRODATA_EXPORT virtual void RemoveBathymetries();
+
+  /**
+   * Returns data of object wrapped to QVariant.
+   * Reimplemented to wrap and return saved 2d polyline.
+   */
+  //HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+
+protected:
+
+  friend class HYDROData_Iterator;
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_Domain();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_Domain();
+
+  /**
+   * Returns id for creation of object in python scripting.
+   */
+  virtual QString getPythonKindId() const = 0;
+};
+
+#endif
index 401b54d40f10751a3c382aa1dbd36fb4d74df715..254c530a395517aa1bee745d274ecc4667eadb1b 100644 (file)
@@ -6,6 +6,7 @@
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_Calculation.h>
 #include <HYDROData_Zone.h>
+#include <HYDROData_Region.h>
 
 #include <TDataStd_Name.hxx>
 #include <NCollection_DataMap.hxx>
@@ -76,6 +77,9 @@ Handle_HYDROData_Object HYDROData_Iterator::Object( const TDF_Label theLabel )
   case KIND_ZONE:
     aResult = new HYDROData_Zone();
     break;
+  case KIND_REGION:
+    aResult = new HYDROData_Region();
+    break;
   }
 
   if ( !aResult.IsNull() )
index 8ddb494891ce7a03e23bead3680ac495415aa438..e8669db7fecd44428e47d65c15836e6156acc8d2 100644 (file)
@@ -27,7 +27,8 @@ const ObjectKind KIND_PROFILE        = 6;
 const ObjectKind KIND_PROFILES_GROUP = 7;
 const ObjectKind KIND_GUIDE_LINE     = 8;
 const ObjectKind KIND_ZONE           = 9;
-const ObjectKind KIND_LAST           = KIND_ZONE;
+const ObjectKind KIND_REGION         = 10;
+const ObjectKind KIND_LAST           = KIND_REGION;
 
 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
 
diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx
new file mode 100644 (file)
index 0000000..2550de1
--- /dev/null
@@ -0,0 +1,27 @@
+
+#include "HYDROData_Region.h"
+
+#include <QString>
+
+#define PYTHON_REGION_ID "KIND_REGION"
+
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Region, HYDROData_Domain)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Domain)
+
+
+HYDROData_Region::HYDROData_Region()
+{
+}
+
+HYDROData_Region::~HYDROData_Region()
+{
+}
+
+QString HYDROData_Region::getPythonKindId() const
+{
+  return QString( PYTHON_REGION_ID );
+}
+
+
+
diff --git a/src/HYDROData/HYDROData_Region.h b/src/HYDROData/HYDROData_Region.h
new file mode 100644 (file)
index 0000000..2cc3f0e
--- /dev/null
@@ -0,0 +1,55 @@
+
+#ifndef HYDROData_Region_HeaderFile
+#define HYDROData_Region_HeaderFile
+
+#include <HYDROData_Domain.h>
+
+
+DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Domain)
+
+
+/**\class HYDROData_Domain
+ * \brief Class that stores/retreives information about the 2d surface.
+ */
+class HYDROData_Region : public HYDROData_Domain
+{
+
+protected:
+  /**
+   * Enumeration of tags corresponding to the persistent object parameters.
+   */
+  enum DataTag
+  {
+    DataTag_First = HYDROData_Domain::DataTag_First + 100, ///< first tag, to reserve
+  };
+
+public:
+  DEFINE_STANDARD_RTTI(HYDROData_Region);
+
+  /**
+   * Returns the kind of this object. Must be redefined in all objects of known type.
+   */
+  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_REGION; }
+
+protected:
+
+  friend class HYDROData_Iterator;
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_Region();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_Region();
+
+  /**
+   * Returns id for creation of object in python scripting.
+   */
+  virtual QString getPythonKindId() const;
+};
+
+#endif
index 91765f5f79dbe4ad8f98cb05426a17dda04609cc..15246161d2b3710adeebe6801dff6cd379787a02 100644 (file)
@@ -13,8 +13,8 @@
 
 #define PYTHON_ZONE_ID "KIND_ZONE"
 
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Domain)
 
 HYDROData_Zone::HYDROData_Zone()
 {
@@ -26,82 +26,18 @@ HYDROData_Zone::~HYDROData_Zone()
 
 QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
-  if ( aDocument.IsNull() )
+  QStringList aResList = HYDROData_Domain::DumpToPython( theTreatedObjects );
+  if ( aResList.isEmpty() )
     return aResList;
 
-  QString aDocName = aDocument->GetDocPyName();
-  QString aZoneName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aZoneName ).arg( aDocName ).arg( PYTHON_ZONE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aZoneName ).arg( aZoneName );
-  aResList << QString( "" );
-
-  QColor aFillingColor = GetFillingColor();
-  aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
-              .arg( aFillingColor.red()  ).arg( aFillingColor.green() )
-              .arg( aFillingColor.blue() ).arg( aFillingColor.alpha() );
-  aResList << QString( "%1.SetFillingColor( filling_color );" ).arg( aZoneName );
-  aResList << QString( "" );
-
-  QColor aBorderColor = GetBorderColor();
-  aResList << QString( "border_color = QColor( %1, %2, %3, %4 );" )
-              .arg( aBorderColor.red()  ).arg( aBorderColor.green() )
-              .arg( aBorderColor.blue() ).arg( aBorderColor.alpha() );
-  aResList << QString( "%1.SetBorderColor( border_color );" ).arg( aZoneName );
   aResList << QString( "" );
 
   Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
   setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
-  aResList << QString( "" );
-
-  HYDROData_SequenceOfObjects aZoneBaths = GetBathymetries();
-  HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths );
-  for ( ; aBathsIter.More(); aBathsIter.Next() )
-  {
-    Handle(HYDROData_Bathymetry) aRefBath =
-      Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() );
-    if ( !aRefBath.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aRefBath, "AddBathymetry" );
-  }
 
   return aResList;
 }
 
-QColor HYDROData_Zone::DefaultFillingColor()
-{
-  return QColor( Qt::green );
-}
-
-void HYDROData_Zone::SetFillingColor( const QColor& theColor )
-{
-  return SetColor( theColor, DataTag_FillingColor );
-}
-
-QColor HYDROData_Zone::GetFillingColor() const
-{
-  return GetColor( DefaultFillingColor(), DataTag_FillingColor );
-}
-
-QColor HYDROData_Zone::DefaultBorderColor()
-{
-  return QColor( Qt::transparent );
-}
-
-void HYDROData_Zone::SetBorderColor( const QColor& theColor )
-{
-  return SetColor( theColor, DataTag_BorderColor );
-}
-
-QColor HYDROData_Zone::GetBorderColor() const
-{
-  return GetColor( DefaultBorderColor(), DataTag_BorderColor );
-}
-
 void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
 {
   SetReferenceObject( thePolyline, DataTag_Polyline );
@@ -118,38 +54,6 @@ void HYDROData_Zone::RemovePolyline()
   ClearReferenceObjects( DataTag_Polyline );
 }
 
-int HYDROData_Zone::NbBathymetries() const
-{
-  return NbReferenceObjects( DataTag_Bathymetry );
-}
-
-void HYDROData_Zone::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
-{
-  AddReferenceObject( theBathymetry, DataTag_Bathymetry );
-}
-
-void HYDROData_Zone::SetBathymetry( const int                           theIndex,
-                                    const Handle(HYDROData_Bathymetry)& theBathymetry )
-{
-  SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex );
-}
-
-Handle(HYDROData_Bathymetry) HYDROData_Zone::GetBathymetry( const int theIndex ) const
-{
-  return Handle(HYDROData_Bathymetry)::DownCast( 
-           GetReferenceObject( DataTag_Bathymetry, theIndex ) );
-}
-
-HYDROData_SequenceOfObjects HYDROData_Zone::GetBathymetries() const
-{
-  return GetReferenceObjects( DataTag_Bathymetry );
-}
-
-void HYDROData_Zone::RemoveBathymetries()
-{
-  ClearReferenceObjects( DataTag_Bathymetry );
-}
-
 QPainterPath HYDROData_Zone::GetPainterPath() const
 {
   QPainterPath aPath;
@@ -163,3 +67,10 @@ QPainterPath HYDROData_Zone::GetPainterPath() const
   return aPath;
 }
 
+QString HYDROData_Zone::getPythonKindId() const
+{
+  return QString( PYTHON_ZONE_ID );
+}
+
+
+
index 5b277a13095b3474265b17b2176acffb320674d8..4bbe43b5b173e9b8ab1d45cf905a04beacb8aff8 100644 (file)
@@ -2,22 +2,18 @@
 #ifndef HYDROData_Zone_HeaderFile
 #define HYDROData_Zone_HeaderFile
 
-#include <HYDROData_Object.h>
+#include <HYDROData_Domain.h>
 
-#include <QPointF>
 #include <QPainterPath>
-#include <QList>
-
-class Handle(HYDROData_Bathymetry);
 class Handle(HYDROData_Polyline);
 
-DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object)
+DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
 
 
 /**\class HYDROData_Zone
  * \brief Class that stores/retreives information about the 2d face.
  */
-class HYDROData_Zone : public HYDROData_Object
+class HYDROData_Zone : public HYDROData_Domain
 {
 
 protected:
@@ -26,11 +22,8 @@ protected:
    */
   enum DataTag
   {
-    DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
-    DataTag_Bathymetry,   ///< reference bathymetries
+    DataTag_First = HYDROData_Domain::DataTag_First + 100, ///< first tag, to reserve
     DataTag_Polyline,     ///< reference polyline
-    DataTag_FillingColor, ///< filling color of zone
-    DataTag_BorderColor,  ///< border color of zone
   };
 
 public:
@@ -39,7 +32,7 @@ public:
   /**
    * Returns the kind of this object. Must be redefined in all objects of known type.
    */
-  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_ZONE;}
+  HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_ZONE; }
 
   /**
    * Dump object to Python script representation.
@@ -47,38 +40,6 @@ public:
   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
 
 
-  /**
-   * Returns default filling color for new zone.
-   */
-  HYDRODATA_EXPORT static QColor DefaultFillingColor();
-
-  /**
-   * Sets filling color for zone.
-   */
-  HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
-
-  /**
-   * Returns filling color of zone.
-   */
-  HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
-
-
-  /**
-   * Returns default border color for new zone.
-   */
-  HYDRODATA_EXPORT static QColor DefaultBorderColor();
-
-  /**
-   * Sets border color for zone.
-   */
-  HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
-
-  /**
-   * Returns border color of zone.
-   */
-  HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
-
-
   /**
    * Sets reference polyline object for zone.
    */
@@ -95,37 +56,6 @@ public:
   HYDRODATA_EXPORT virtual void RemovePolyline();
 
 
-  /**
-   * Returns number of bathymetry objects for zone.
-   */
-  HYDRODATA_EXPORT virtual int NbBathymetries() const;
-
-  /**
-   * Add reference bathymetry object for zone.
-   */
-  HYDRODATA_EXPORT virtual void AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
-
-  /**
-   * Change reference bathymetry object with given index for zone.
-   */
-  HYDRODATA_EXPORT virtual void SetBathymetry( const int                           theIndex,
-                                               const Handle(HYDROData_Bathymetry)& theBathymetry );
-
-  /**
-   * Returns reference bathymetry object of zone by it index.
-   */
-  HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry( const int theIndex ) const;
-
-  /**
-   * Returns list of all reference bathymetry objects of zone.
-   */
-  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects  GetBathymetries() const;
-
-  /**
-   * Clear list of bathymetry objects of zone.
-   */
-  HYDRODATA_EXPORT virtual void RemoveBathymetries();
-
   /**
    * Returns data of object wrapped to QVariant.
    * Reimplemented to wrap and return saved 2d polyline.
@@ -152,6 +82,11 @@ protected:
    * Destructs properties of the object and object itself, removes it from the document.
    */
   ~HYDROData_Zone();
+
+  /**
+   * Returns id for creation of object in python scripting.
+   */
+  virtual QString getPythonKindId() const;
 };
 
 #endif