include(../../CMake/Common.cmake)
-set(PROJECT_HEADERS
+set(PROJECT_HEADERS
HYDROData.h
HYDROData_Application.h
+ HYDROData_ArtificialObject.h
HYDROData_Bathymetry.h
+ HYDROData_BSplineOperation.h
HYDROData_Calculation.h
HYDROData_Document.h
- HYDROData_Domain.h
+ HYDROData_Entity.h
HYDROData_Image.h
+ HYDROData_ImmersibleZone.h
HYDROData_Iterator.h
HYDROData_Lambert93.h
+ HYDROData_NaturalObject.h
HYDROData_Object.h
+ HYDROData_OperationsFactory.h
HYDROData_Polyline.h
HYDROData_Region.h
+ HYDROData_SplitToZonesTool.h
HYDROData_Tool.h
HYDROData_VisualState.h
HYDROData_Zone.h
- HYDROOperations_BSpline.h
- HYDROOperations_Factory.h
)
set(PROJECT_SOURCES
HYDROData_Application.cxx
+ HYDROData_ArtificialObject.cxx
HYDROData_Bathymetry.cxx
+ HYDROData_BSplineOperation.cxx
HYDROData_Calculation.cxx
HYDROData_Document.cxx
- HYDROData_Domain.cxx
+ HYDROData_Entity.cxx
HYDROData_Image.cxx
+ HYDROData_ImmersibleZone.cxx
HYDROData_Iterator.cxx
HYDROData_Lambert93.cxx
+ HYDROData_NaturalObject.cxx
HYDROData_Object.cxx
+ HYDROData_OperationsFactory.cxx
HYDROData_Polyline.cxx
HYDROData_Region.cxx
+ HYDROData_SplitToZonesTool.cxx
HYDROData_Tool.cxx
HYDROData_VisualState.cxx
HYDROData_Zone.cxx
- HYDROOperations_BSpline.cxx
- HYDROOperations_Factory.cxx
)
add_definitions(
test_HYDROData_Polyline.h
test_HYDROData_Bathymetry.h
test_HYDROData_Calculation.h
- test_HYDROOperations_BSpline.h
- test_HYDROOperations_Factory.h
+ test_HYDROData_BSplineOperation.h
+ test_HYDROData_OperationsFactory.h
)
set(TEST_SOURCES
test_HYDROData_Polyline.cxx
test_HYDROData_Bathymetry.cxx
test_HYDROData_Calculation.cxx
- test_HYDROOperations_BSpline.cxx
- test_HYDROOperations_Factory.cxx
+ test_HYDROData_BSplineOperation.cxx
+ test_HYDROData_OperationsFactory.cxx
)
set(TEST_EXE test_HYDROData)
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="HYDROData"
ProjectGUID="{EB7B7816-4EA0-4E7D-A88A-1417DEB0FC1C}"
RootNamespace="HYDROData"
RelativePath=".\HYDROData_Application.cxx"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ArtificialObject.cxx"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Bathymetry.cxx"
>
>
</File>
<File
- RelativePath=".\HYDROData_Domain.cxx"
+ RelativePath=".\HYDROData_Entity.cxx"
>
</File>
<File
RelativePath=".\HYDROData_Image.cxx"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ImmersibleZone.cxx"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Iterator.cxx"
>
RelativePath=".\HYDROData_Lambert93.cxx"
>
</File>
+ <File
+ RelativePath=".\HYDROData_NaturalObject.cxx"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Object.cxx"
>
</File>
</Filter>
<Filter
- Name="Operations"
+ Name="Tools"
>
<File
- RelativePath=".\HYDROOperations_BSpline.cxx"
+ RelativePath=".\HYDROData_BSplineOperation.cxx"
+ >
+ </File>
+ <File
+ RelativePath=".\HYDROData_OperationsFactory.cxx"
>
</File>
<File
- RelativePath=".\HYDROOperations_Factory.cxx"
+ RelativePath=".\HYDROData_SplitToZonesTool.cxx"
>
</File>
</Filter>
RelativePath=".\HYDROData_Application.h"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ArtificialObject.h"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Bathymetry.h"
>
>
</File>
<File
- RelativePath=".\HYDROData_Domain.h"
+ RelativePath=".\HYDROData_Entity.h"
>
</File>
<File
RelativePath=".\HYDROData_Image.h"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ImmersibleZone.h"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Iterator.h"
>
RelativePath=".\HYDROData_Lambert93.h"
>
</File>
+ <File
+ RelativePath=".\HYDROData_NaturalObject.h"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Object.h"
>
>
</File>
<Filter
- Name="Operations"
+ Name="Tools"
>
<File
- RelativePath=".\HYDROOperations_BSpline.h"
+ RelativePath=".\HYDROData_BSplineOperation.h"
+ >
+ </File>
+ <File
+ RelativePath=".\HYDROData_OperationsFactory.h"
>
</File>
<File
- RelativePath=".\HYDROOperations_Factory.h"
+ RelativePath=".\HYDROData_SplitToZonesTool.h"
>
</File>
</Filter>
--- /dev/null
+
+#include "HYDROData_ArtificialObject.h"
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_ArtificialObject,HYDROData_Object)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ArtificialObject,HYDROData_Object)
+
+HYDROData_ArtificialObject::HYDROData_ArtificialObject()
+: HYDROData_Object()
+{
+}
+
+HYDROData_ArtificialObject::~HYDROData_ArtificialObject()
+{
+}
+
+
--- /dev/null
+
+#ifndef HYDROData_ArtificialObject_HeaderFile
+#define HYDROData_ArtificialObject_HeaderFile
+
+#include <HYDROData_Object.h>
+
+DEFINE_STANDARD_HANDLE(HYDROData_ArtificialObject, HYDROData_Object)
+
+
+/**\class HYDROData_ArtificialObject
+ * \brief The artificial objects are objects created or planned for creation by human.
+ *
+ */
+class HYDROData_ArtificialObject : 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
+ };
+
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_ArtificialObject);
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDRODATA_EXPORT HYDROData_ArtificialObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_ArtificialObject();
+};
+
+#endif
--- /dev/null
+#include<HYDROData_BSplineOperation.h>
+
+#include<TColgp_HArray1OfPnt.hxx>
+#include<GeomAPI_Interpolate.hxx>
+#include<GeomConvert_BSplineCurveToBezierCurve.hxx>
+#include<Geom_BezierCurve.hxx>
+
+HYDROData_BSplineOperation::HYDROData_BSplineOperation(
+ const QList<double>& thePoints,
+ const double theZValue,
+ const bool theIsClosed)
+{
+ // fill array for algorithm by the received coordinates
+ int aLen = thePoints.size() / 2;
+ Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen);
+ QList<double>::const_iterator aListIter = thePoints.begin();
+ for (int ind = 1; ind <= aLen; ind++) {
+ gp_Pnt aPnt(gp::Origin());
+ aPnt.SetX(*aListIter);
+ aListIter++;
+ aPnt.SetY(*aListIter);
+ aListIter++;
+ aPnt.SetZ(theZValue);
+ aHCurvePoints->SetValue(ind, aPnt);
+ }
+ // compute BSpline
+ GeomAPI_Interpolate aGBC(aHCurvePoints, theIsClosed, gp::Resolution());
+ aGBC.Perform();
+ if (aGBC.IsDone()) {
+ myCurve = aGBC.Curve();
+ }
+}
+
+QPainterPath HYDROData_BSplineOperation::ComputePath() const
+{
+ QPainterPath aResult;
+ if (myCurve.IsNull()) // returns an empty Path if original curve is invalid
+ return aResult;
+ GeomConvert_BSplineCurveToBezierCurve aConverter(myCurve);
+ int a, aNumArcs = aConverter.NbArcs();
+ for(a = 1; a <= aNumArcs; a++) {
+ Handle(Geom_BezierCurve) anArc = aConverter.Arc(a);
+ if (a == 1) { // set a start point
+ gp_Pnt aStart = anArc->StartPoint();
+ aResult.moveTo(aStart.X(), aStart.Y());
+ }
+ gp_Pnt anEnd = anArc->EndPoint();
+ if (anArc->NbPoles() == 3) { // quadric segment in the path (pole 1 is start, pole 3 is end)
+ gp_Pnt aPole = anArc->Pole(2);
+ aResult.quadTo(aPole.X(), aPole.Y(), anEnd.X(), anEnd.Y());
+ } else if (anArc->NbPoles() == 4) { // cubic segment (usually this is used)
+ gp_Pnt aPole1 = anArc->Pole(2);
+ gp_Pnt aPole2 = anArc->Pole(3);
+ aResult.cubicTo(
+ aPole1.X(), aPole1.Y(), aPole2.X(), aPole2.Y(), anEnd.X(), anEnd.Y());
+ } else { // error, another number of poles is not supported
+ return QPainterPath();
+ }
+ }
+ return aResult;
+}
--- /dev/null
+#ifndef HYDROData_BSplineOperation_HeaderFile
+#define HYDROData_BSplineOperation_HeaderFile
+
+#include <HYDROData.h>
+#include <QList>
+#include <QPainterPath>
+#include <Geom_BSplineCurve.hxx>
+
+/**\class HYDROData_BSplineOperation
+ *
+ * \brief Allows to work with splines: create, convert to Qt ToolPath.
+ *
+ * Uses GEOM module for creation of BSplines, OCCT algorithms for
+ * manipulation and conversion.
+ */
+
+class HYDRODATA_EXPORT HYDROData_BSplineOperation
+{
+public:
+
+ //! Creates a spline by list of coordinates: pairs X and Y
+ //! \param thePoints coordinates in format X1, Y1, X2, Y2, etc. must be even number of elements
+ //! \param theZValue constant value of the spline Z coordinate
+ //! \param theIsClosed flag indicating that the result spline should be closed
+ HYDROData_BSplineOperation(const QList<double>& thePoints,
+ const double theZValue,
+ const bool theIsClosed);
+
+ //! Returns the BSpline curve passing through the points
+ //! \returns Null if Computation of BSpline was failed
+ Handle(Geom_BSplineCurve) Curve() const {return myCurve;}
+
+ //! Performs conversion from BSpline curve to QPainterPath made from Bezier curves
+ //! \returns computed PainterPath, not stored in this class, so calling of this method is not fast
+ QPainterPath ComputePath() const;
+private:
+ Handle(Geom_BSplineCurve) myCurve; ///< resulting BSpline, null if something is wrong
+};
+
+#endif
#define PYTHON_BATHYMETRY_ID "KIND_BATHYMETRY"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_Entity)
HYDROData_Bathymetry::HYDROData_Bathymetry()
+: HYDROData_Entity()
{
}
#ifndef HYDROData_Bathymetry_HeaderFile
#define HYDROData_Bathymetry_HeaderFile
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
class gp_XY;
class gp_XYZ;
class QPointF;
class QFile;
-DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Object)
+DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Entity)
/**\class HYDROData_Bathymetry
*
* The Bathymetry represents measurement of the altitude of points on the terrain.
*/
-class HYDROData_Bathymetry : public HYDROData_Object
+class HYDROData_Bathymetry : public HYDROData_Entity
{
public:
*/
enum DataTag
{
- DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_AltitudePoints, ///< altitude points, array of reals
DataTag_FilePath ///< bathymetry imported file path
};
#include "HYDROData_Document.h"
#include "HYDROData_Iterator.h"
-#include "HYDROData_Polyline.h"
-#include "HYDROData_Zone.h"
+#include "HYDROData_Object.h"
+#include "HYDROData_SplitToZonesTool.h"
#include "HYDROData_Region.h"
-
-#include <TDataStd_ReferenceList.hxx>
+#include "HYDROData_Tool.h"
+#include "HYDROData_Zone.h"
#include <QStringList>
#define PYTHON_CALCULATION_ID "KIND_CALCULATION"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Calculation, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Calculation, HYDROData_Entity)
HYDROData_Calculation::HYDROData_Calculation()
+: HYDROData_Entity()
{
}
.arg( aCalculName ).arg( aCalculName );
aResList << QString( "" );
- Handle(HYDROData_Polyline) aBoundaryPolyline = GetBoundaryPolyline();
- setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
- aResList << QString( "" );
-
- HYDROData_SequenceOfObjects aZones = GetZones();
- HYDROData_SequenceOfObjects::Iterator anIter( aZones );
+ HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
for ( ; anIter.More(); anIter.Next() )
{
- Handle(HYDROData_Zone) aRefZone =
- Handle(HYDROData_Zone)::DownCast( anIter.Value() );
- if ( !aRefZone.IsNull() )
- setPythonReferenceObject( theTreatedObjects, aResList, aRefZone, "AddZone" );
+ Handle(HYDROData_Object) aRefGeomObj =
+ Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( !aRefGeomObj.IsNull() )
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
}
aResList << QString( "" );
- aZones = GetRegions();
- anIter.Init( aZones );
+ 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() )
- setPythonReferenceObject( theTreatedObjects, aResList, aRegion, "AddRegion" );
+ if ( aRegion.IsNull() )
+ continue;
+
+ QString aRegionName = aRegion->GetName();
+ // TODO
}
return aResList;
}
-void HYDROData_Calculation::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_Calculation::SplitGeometryObjects()
{
- SetReferenceObject( thePolyline, DataTag_BoundaryPolyline );
+ // At first we remove previously created regions
+ RemoveRegions();
+ RemoveChildRegions();
+
+ 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();
+ AddRegion( aRegion );
+
+ QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
+ aRegion->SetName( aRegionName );
+
+ // Add the zone for region
+ Handle(HYDROData_Zone) aRegionZone = aRegion->AddNewZone();
+ aRegion->AddZone( aRegionZone );
+
+ 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 );
+ }
+ }
}
-Handle(HYDROData_Polyline) HYDROData_Calculation::GetBoundaryPolyline() const
+int HYDROData_Calculation::NbGeometryObjects() const
{
- return Handle(HYDROData_Polyline)::DownCast(
- GetReferenceObject( DataTag_BoundaryPolyline ) );
+ return NbReferenceObjects( DataTag_GeometryObject );
}
-void HYDROData_Calculation::RemoveBoundaryPolyline()
+void HYDROData_Calculation::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
{
- ClearReferenceObjects( DataTag_BoundaryPolyline );
+ AddReferenceObject( theObject, DataTag_GeometryObject );
}
-int HYDROData_Calculation::NbZones() const
+void HYDROData_Calculation::SetGeometryObject( const int theIndex,
+ const Handle(HYDROData_Object)& theObject )
{
- return NbReferenceObjects( DataTag_Zone );
+ SetReferenceObject( theObject, DataTag_GeometryObject, theIndex );
}
-void HYDROData_Calculation::AddZone( const Handle(HYDROData_Zone)& theZone )
+void HYDROData_Calculation::SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects )
{
- AddReferenceObject( theZone, DataTag_Zone );
+ SetReferenceObjects( theObjects, DataTag_GeometryObject );
}
-void HYDROData_Calculation::SetZone( const int theIndex,
- const Handle(HYDROData_Zone)& theZone )
+Handle(HYDROData_Object) HYDROData_Calculation::GetGeometryObject( const int theIndex ) const
{
- SetReferenceObject( theZone, DataTag_Zone, theIndex );
+ return Handle(HYDROData_Object)::DownCast(
+ GetReferenceObject( DataTag_GeometryObject, theIndex ) );
}
-void HYDROData_Calculation::SetZones( const HYDROData_SequenceOfObjects& theZones )
+HYDROData_SequenceOfObjects HYDROData_Calculation::GetGeometryObjects() const
{
- SetReferenceObjects( theZones, DataTag_Zone );
+ return GetReferenceObjects( DataTag_GeometryObject );
}
-Handle(HYDROData_Zone) HYDROData_Calculation::GetZone( const int theIndex ) const
+void HYDROData_Calculation::RemoveGeometryObjects()
{
- return Handle(HYDROData_Zone)::DownCast(
- GetReferenceObject( DataTag_Zone, theIndex ) );
+ ClearReferenceObjects( DataTag_GeometryObject );
}
-HYDROData_SequenceOfObjects HYDROData_Calculation::GetZones() const
+Handle(HYDROData_Region) HYDROData_Calculation::AddNewRegion()
{
- return GetReferenceObjects( DataTag_Zone );
+ TDF_Label aNewLab = myLab.FindChild( ChildTag_Region ).NewChild();
+
+ return Handle(HYDROData_Region)::DownCast(
+ HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) );
}
-void HYDROData_Calculation::RemoveZones()
+void HYDROData_Calculation::RemoveChildRegions()
{
- ClearReferenceObjects( DataTag_Zone );
+ myLab.FindChild( ChildTag_Region ).ForgetAllAttributes( true );
}
int HYDROData_Calculation::NbRegions() const
SetReferenceObject( theRegion, DataTag_Region, theIndex );
}
+void HYDROData_Calculation::InsertRegion( const int theBeforeIndex,
+ const Handle(HYDROData_Region)& theRegion )
+{
+ InsertReferenceObject( theRegion, DataTag_Region, theBeforeIndex );
+}
+
void HYDROData_Calculation::SetRegions( const HYDROData_SequenceOfObjects& theRegions )
{
SetReferenceObjects( theRegions, DataTag_Region );
return GetReferenceObjects( DataTag_Region );
}
+void HYDROData_Calculation::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
+{
+ if ( theRegion.IsNull() )
+ return;
+
+ RemoveReferenceObject( theRegion->Label(), DataTag_Region );
+}
+
+void HYDROData_Calculation::RemoveRegion( const int theIndex )
+{
+ RemoveReferenceObject( DataTag_Region, theIndex );
+}
+
void HYDROData_Calculation::RemoveRegions()
{
ClearReferenceObjects( DataTag_Region );
}
-
-#ifndef HYDROData_HYDROData_Calculation
-#define HYDROData_HYDROData_Calculation
-#include <HYDROData_Object.h>
+#ifndef HYDROData_Calculation_HeaderFile
+#define HYDROData_Calculation_HeaderFile
-class gp_XY;
-class gp_XYZ;
-class QPointF;
-class QFile;
+#include <HYDROData_Entity.h>
-class Handle(HYDROData_Polyline);
-class Handle(HYDROData_Zone);
+class Handle(HYDROData_Object);
class Handle(HYDROData_Region);
-DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object)
+DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Entity)
/**\class HYDROData_Calculation
- * \brief Class that stores/retreives information about the Calculation case.
+ * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
*
- * Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
*/
-class HYDROData_Calculation : public HYDROData_Object
+class HYDROData_Calculation : public HYDROData_Entity
{
protected:
*/
enum DataTag
{
- DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
- DataTag_BoundaryPolyline, ///< reference boundary polyline
- DataTag_Zone, ///< reference zones
- DataTag_Region ///< reference regions
+ 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:
// Public methods to work with Calculation
/**
- * Sets boundary polyline for calculation case.
+ * Split reference geometry objects to non-intersected regions.
*/
- HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+ HYDRODATA_EXPORT virtual void SplitGeometryObjects();
+
/**
- * Returns boundary polyline of calculation case.
+ * Returns number of geometry objects for calculation case.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const;
+ HYDRODATA_EXPORT virtual int NbGeometryObjects() const;
/**
- * Removes boundary polyline of calculation case.
+ * Add new one geometry object for calculation case.
*/
- HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
-
+ HYDRODATA_EXPORT virtual void AddGeometryObject( const Handle(HYDROData_Object)& theObject );
/**
- * Returns number of refrence zones for calculation case.
+ * Replace the geometry object for calculation case.
*/
- HYDRODATA_EXPORT virtual int NbZones() const;
+ HYDRODATA_EXPORT virtual void SetGeometryObject( const int theIndex,
+ const Handle(HYDROData_Object)& theObject );
/**
- * Add new one refrence zone for calculation case.
+ * Sets the geometry object for calculation case.
*/
- HYDRODATA_EXPORT virtual void AddZone( const Handle(HYDROData_Zone)& theZone );
+ HYDRODATA_EXPORT virtual void SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects );
/**
- * Replace the refrence zone for calculation case.
+ * Returns geometry object of calculation case by index.
*/
- HYDRODATA_EXPORT virtual void SetZone( const int theIndex,
- const Handle(HYDROData_Zone)& theZone );
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Object) GetGeometryObject( const int theIndex ) const;
/**
- * Sets the refrence zones for calculation case.
+ * Returns all geometry objects of calculation case.
*/
- HYDRODATA_EXPORT virtual void SetZones( const HYDROData_SequenceOfObjects& theZones );
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
/**
- * Returns refrence zone of calculation case by index.
+ * Removes all geometry objects from calculation case.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZone( const int theIndex ) const;
+ HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
+
/**
- * Returns all refrence zone of calculation case.
+ * Add new one region for calculation case.
+ * The new region is not added into the list of reference regions.
*/
- HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetZones() const;
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion();
/**
- * Removes all refrence zone of calculation case.
+ * Removes all child regions from calculation case.
*/
- HYDRODATA_EXPORT virtual void RemoveZones();
+ HYDRODATA_EXPORT virtual void RemoveChildRegions();
/**
- * Returns number of regions for calculation case.
+ * Returns number of reference regions of calculation case.
*/
- HYDRODATA_EXPORT virtual int NbRegions() const;
+ int NbRegions() const;
/**
- * Add new one region for calculation case.
+ * Add new one reference region for calculation case.
*/
HYDRODATA_EXPORT virtual void AddRegion( const Handle(HYDROData_Region)& theRegion );
/**
- * Replace the region for calculation case.
+ * Replace the reference region for calculation case.
*/
HYDRODATA_EXPORT virtual void SetRegion( const int theIndex,
const Handle(HYDROData_Region)& theRegion );
/**
- * Sets the refrence region for calculation case.
+ * Inserts the reference region for calculation case before given index.
+ */
+ HYDRODATA_EXPORT virtual void InsertRegion( const int theBeforeIndex,
+ const Handle(HYDROData_Region)& theRegion );
+
+ /**
+ * Sets reference regions for calculation case.
*/
HYDRODATA_EXPORT virtual void SetRegions( const HYDROData_SequenceOfObjects& theRegions );
/**
- * Returns region of calculation case by index.
+ * Returns reference region of calculation case by index.
*/
HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegion( const int theIndex ) const;
/**
- * Returns all regions of calculation case.
+ * Returns all reference regions of calculation case.
*/
HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
/**
- * Removes all regions of calculation case.
+ * Removes reference region from calculation case.
+ */
+ HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
+
+ /**
+ * Removes reference region from calculation case by it index.
+ */
+ HYDRODATA_EXPORT virtual void RemoveRegion( const int theIndex );
+
+ /**
+ * Removes all reference regions from calculation case.
*/
HYDRODATA_EXPORT virtual void RemoveRegions();
}
Handle(HYDROData_Document) HYDROData_Document::Document(
- const Handle(HYDROData_Object)& theObject )
+ const Handle(HYDROData_Entity)& theObject )
{
Handle(HYDROData_Document) aResDoc;
if ( theObject.IsNull() )
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_IMAGE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_POLYLINE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_BATHYMETRY );
- aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_ZONE );
+ aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_IMMERSIBLE_ZONE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_CALCULATION );
return aRes;
HYDROData_Iterator anIterator( this, theObjectKind );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if ( anObject.IsNull() )
continue;
myTransactionsAfterSave++;
}
-Handle_HYDROData_Object HYDROData_Document::CreateObject(const ObjectKind theKind)
+Handle(HYDROData_Entity) HYDROData_Document::CreateObject(const ObjectKind theKind)
{
return HYDROData_Iterator::CreateObject(this, theKind);
}
#define HYDROData_Document_HeaderFile
#include <HYDROData.h>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <TDocStd_Document.hxx>
//! Returns the document by object
HYDRODATA_EXPORT static Handle(HYDROData_Document) Document(
- const Handle(HYDROData_Object)& theObject );
+ const Handle(HYDROData_Entity)& theObject );
//! Returns true if data model contains document for this study
HYDRODATA_EXPORT static bool HasDocument(const int theStudyID);
//! Creates and locates in the document a new object
//! \param theKind kind of the created object, can not be UNKNOWN
//! \returns the created object
- HYDRODATA_EXPORT Handle_HYDROData_Object CreateObject(const ObjectKind theKind);
+ HYDRODATA_EXPORT Handle(HYDROData_Entity) CreateObject(const ObjectKind theKind);
protected:
+++ /dev/null
-
-#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 );
-}
+++ /dev/null
-
-#ifndef HYDROData_Domain_HeaderFile
-#define HYDROData_Domain_HeaderFile
-
-#include <HYDROData_Object.h>
-
-#include <TopoDS_Face.hxx>
-
-#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();
-
- /**
- * Returns the shape of the the object.
- */
- HYDRODATA_EXPORT virtual TopoDS_Face Face() const = 0;
-
-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
--- /dev/null
+
+#include "HYDROData_Entity.h"
+
+#include "HYDROData_Iterator.h"
+
+#include <TDataStd_Name.hxx>
+#include <TDataStd_ByteArray.hxx>
+#include <TDataStd_UAttribute.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_BooleanArray.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TDataStd_ReferenceList.hxx>
+
+#include <TDF_CopyLabel.hxx>
+#include <TDF_ListIteratorOfLabelList.hxx>
+
+#include <QColor>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Entity,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Entity,MMgt_TShared)
+
+// is equal function for unique object mapping
+bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Handle_HYDROData_Entity& theObj2)
+{
+ if ( !theObj1.IsNull() && !theObj2.IsNull() )
+ return theObj1->ID() == theObj2->ID();
+ return false;
+}
+
+QString HYDROData_Entity::GetName() const
+{
+ Handle(TDataStd_Name) aName;
+ if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
+ TCollection_AsciiString aStr(aName->Get());
+ return QString(aStr.ToCString());
+ }
+ return QString();
+}
+
+void HYDROData_Entity::SetName(const QString& theName)
+{
+ TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
+}
+
+QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList anEmptyList;
+ return anEmptyList;
+}
+
+void HYDROData_Entity::Update( const bool theIsForce )
+{
+}
+
+QVariant HYDROData_Entity::GetDataVariant()
+{
+ return QVariant();
+}
+
+bool HYDROData_Entity::IsRemoved() const
+{
+ return !myLab.HasAttribute();
+}
+
+void HYDROData_Entity::Remove()
+{
+ return myLab.ForgetAllAttributes( true );
+}
+
+HYDROData_Entity::HYDROData_Entity()
+{
+}
+
+HYDROData_Entity::~HYDROData_Entity()
+{
+}
+
+void HYDROData_Entity::CopyTo(Handle_HYDROData_Entity theDestination) const
+{
+ TDF_CopyLabel aCopy(myLab, theDestination->Label());
+ aCopy.Perform();
+}
+
+void HYDROData_Entity::SetLabel(TDF_Label theLabel)
+{
+ myLab = theLabel;
+}
+
+void HYDROData_Entity::SaveByteArray(const int theTag,
+ const char* theData, const int theLen)
+{
+ TDF_Label aLab = theTag == 0 ? myLab : myLab.FindChild(theTag);
+ // array is empty, remove the attribute
+ if (theLen <= 0) {
+ aLab.ForgetAttribute(TDataStd_ByteArray::GetID());
+ return;
+ }
+ // store data of image in byte array
+ Handle(TDataStd_ByteArray) aData;
+ if (!aLab.FindAttribute(TDataStd_ByteArray::GetID(), aData)) {
+ aData = TDataStd_ByteArray::Set(aLab, 1, theLen);
+ }
+ // copy bytes one by one
+ if (aData->Length() != theLen) {
+ Handle(TColStd_HArray1OfByte) aNewData = new TColStd_HArray1OfByte(1, theLen);
+ for(int a = 0; a < theLen; a++)
+ aNewData->SetValue(a + 1, theData[a]);
+ aData->ChangeArray(aNewData);
+ } else {
+ for(int a = 0; a < theLen; a++)
+ aData->SetValue(a + 1, theData[a]);
+ }
+}
+
+const char* HYDROData_Entity::ByteArray(const int theTag, int& theLen) const
+{
+ TDF_Label aLab = theTag == 0 ? myLab : myLab.FindChild(theTag);
+ Handle(TDataStd_ByteArray) aData;
+ if (!aLab.FindAttribute(TDataStd_ByteArray::GetID(), aData))
+ return NULL; // return empty image if there is no array
+ theLen = aData->Length();
+ if (theLen)
+ return (const char*)(&(aData->InternalArray()->ChangeArray1().ChangeValue(1)));
+ return NULL;
+}
+
+int HYDROData_Entity::NbReferenceObjects( const int theTag ) const
+{
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+ return aRefs.IsNull() ? 0 : aRefs->Extent();
+}
+
+void HYDROData_Entity::AddReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag )
+{
+ if ( theObj.IsNull() )
+ return;
+
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true );
+ aRefs->Append( theObj->Label() );
+}
+
+void HYDROData_Entity::SetReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag,
+ const int theIndex )
+{
+ if ( theObj.IsNull() )
+ {
+ RemoveReferenceObject( theTag, theIndex );
+ return;
+ }
+
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true );
+
+ if ( theIndex >= aRefs->Extent() )
+ {
+ aRefs->Append( theObj->Label() );
+ }
+ else if ( theIndex < 0 )
+ {
+ aRefs->Prepend( theObj->Label() );
+ }
+ else
+ {
+ RemoveReferenceObject( theTag, theIndex );
+
+ Handle(HYDROData_Entity) aBeforeObj = GetReferenceObject( theTag, theIndex );
+
+ aRefs = getReferenceList( theTag, true ); // because reference list can be removed
+ if ( !aBeforeObj.IsNull() )
+ aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
+ else
+ aRefs->Append( theObj->Label() );
+ }
+}
+
+void HYDROData_Entity::InsertReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag,
+ const int theBeforeIndex )
+{
+ if ( theObj.IsNull() )
+ return;
+
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true );
+
+ if ( theBeforeIndex >= aRefs->Extent() )
+ {
+ aRefs->Append( theObj->Label() );
+ }
+ else if ( theBeforeIndex < 0 )
+ {
+ aRefs->Prepend( theObj->Label() );
+ }
+ else
+ {
+ Handle(HYDROData_Entity) aBeforeObj = GetReferenceObject( theTag, theBeforeIndex );
+ if ( !aBeforeObj.IsNull() )
+ aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
+ else
+ aRefs->Append( theObj->Label() );
+ }
+}
+
+void HYDROData_Entity::SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects,
+ const int theTag )
+{
+ ClearReferenceObjects( theTag );
+ if ( theObjects.IsEmpty() )
+ return;
+
+ HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
+ for ( ; anIter.More(); anIter.Next() )
+ AddReferenceObject( anIter.Value(), theTag );
+}
+
+Handle(HYDROData_Entity) HYDROData_Entity::GetReferenceObject( const int theTag,
+ const int theIndex ) const
+{
+ Handle(HYDROData_Entity) aRes;
+
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+ if ( aRefs.IsNull() || theIndex < 0 || theIndex >= aRefs->Extent() )
+ return aRes;
+
+ TDF_ListIteratorOfLabelList anIter( aRefs->List() );
+ for ( int anIndex = 0; anIndex != theIndex && anIter.More(); anIter.Next(), ++anIndex );
+
+ const TDF_Label& aRefLabel = anIter.Value();
+ aRes = HYDROData_Iterator::Object( aRefLabel );
+
+ return aRes;
+}
+
+HYDROData_SequenceOfObjects HYDROData_Entity::GetReferenceObjects( const int theTag ) const
+{
+ HYDROData_SequenceOfObjects aRes;
+
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+ if ( aRefs.IsNull() )
+ return aRes;
+
+ TDF_ListIteratorOfLabelList anIter( aRefs->List() );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ const TDF_Label& aRefLabel = anIter.Value();
+
+ Handle(HYDROData_Entity) aRefObject = HYDROData_Iterator::Object( aRefLabel );
+ if ( aRefObject.IsNull() )
+ continue;
+
+ aRes.Append( aRefObject );
+ }
+
+ return aRes;
+}
+
+void HYDROData_Entity::RemoveReferenceObject( const TDF_Label& theRefLabel,
+ const int theTag )
+{
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+ if ( aRefs.IsNull() )
+ return;
+
+ if ( aRefs->Extent() == 1 )
+ {
+ // remove all if only one
+ ClearReferenceObjects( theTag );
+ return;
+ }
+
+ aRefs->Remove( theRefLabel );
+}
+
+void HYDROData_Entity::RemoveReferenceObject( const int theTag,
+ const int theIndex )
+{
+ Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+ if ( aRefs.IsNull() )
+ return;
+
+ if ( aRefs->Extent() == 1 && theIndex == 0 )
+ {
+ // remove all if only one
+ ClearReferenceObjects( theTag );
+ return;
+ }
+
+ int anIndex = 0;
+ TDF_ListIteratorOfLabelList anIter( aRefs->List() );
+ for ( ; anIndex != theIndex && anIter.More(); anIter.Next(), ++anIndex );
+
+ if ( anIndex != theIndex || !anIter.More() )
+ return;
+
+ const TDF_Label& aRefLabel = anIter.Value();
+ aRefs->Remove( aRefLabel );
+}
+
+void HYDROData_Entity::ClearReferenceObjects( const int theTag )
+{
+ TDF_Label aSetLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
+ aSetLabel.ForgetAttribute( TDataStd_ReferenceList::GetID() );
+}
+
+Handle(TDataStd_ReferenceList) HYDROData_Entity::getReferenceList( const int theTag,
+ const bool theIsCreate ) const
+{
+ TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
+
+ Handle(TDataStd_ReferenceList) aRefs;
+ if ( !aLabel.FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ) && theIsCreate )
+ aRefs = TDataStd_ReferenceList::Set( aLabel );
+
+ return aRefs;
+}
+
+void HYDROData_Entity::SetColor( const QColor& theColor,
+ const int theTag )
+{
+ TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
+
+ Handle(TDataStd_IntegerArray) aColorArray;
+ if ( !aLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
+ aColorArray = TDataStd_IntegerArray::Set( aLabel, 1, 4 );
+
+ aColorArray->SetValue( 1, theColor.red() );
+ aColorArray->SetValue( 2, theColor.green() );
+ aColorArray->SetValue( 3, theColor.blue() );
+ aColorArray->SetValue( 4, theColor.alpha() );
+}
+
+QColor HYDROData_Entity::GetColor( const QColor& theDefColor,
+ const int theTag ) const
+{
+ QColor aResColor = theDefColor;
+
+ TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
+
+ Handle(TDataStd_IntegerArray) aColorArray;
+ if ( aLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
+ {
+ aResColor.setRed( aColorArray->Value( 1 ) );
+ aResColor.setGreen( aColorArray->Value( 2 ) );
+ aResColor.setBlue( aColorArray->Value( 3 ) );
+ aResColor.setAlpha( aColorArray->Value( 4 ) );
+ }
+
+ return aResColor;
+}
+
+void HYDROData_Entity::setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects,
+ QStringList& theScript,
+ const Handle(HYDROData_Entity)& theRefObject,
+ const QString& theMethod ) const
+{
+ if ( theRefObject.IsNull() )
+ return;
+
+ QString aRefObjName = theRefObject->GetName();
+ if ( aRefObjName.isEmpty() )
+ return;
+
+ bool anIsToSetObject = true;
+
+ // The definition of reference object must be dumped before this
+ if ( !theTreatedObjects.contains( aRefObjName ) )
+ {
+ // Write definition of reference polyline
+ QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects );
+ if ( ( anIsToSetObject = !aRefObjDump.isEmpty() ) )
+ {
+ QStringList aTmpList = theScript;
+ theScript = aRefObjDump;
+
+ theScript << QString( "" );
+ theScript << aTmpList;
+
+ theTreatedObjects.insert( aRefObjName, theRefObject );
+ }
+ }
+
+ if ( anIsToSetObject )
+ {
+ theScript << QString( "%1.%2( %3 );" )
+ .arg( GetName() ).arg( theMethod ).arg( aRefObjName );
+ }
+}
+
+
--- /dev/null
+
+#ifndef HYDROData_Entity_HeaderFile
+#define HYDROData_Entity_HeaderFile
+
+#include "HYDROData.h"
+
+#include <NCollection_Sequence.hxx>
+
+#include <TDF_Label.hxx>
+
+#include <QMap>
+
+class QColor;
+class QString;
+class QVariant;
+class QStringList;
+class Handle(TDataStd_ReferenceList);
+class Handle_HYDROData_Entity;
+
+///! Kind of an object in a document
+typedef int ObjectKind;
+
+const ObjectKind KIND_UNKNOWN = 0; ///! Unrecognized object
+const ObjectKind KIND_IMAGE = 1;
+const ObjectKind KIND_POLYLINE = 2;
+const ObjectKind KIND_BATHYMETRY = 3;
+const ObjectKind KIND_IMMERSIBLE_ZONE = 4;
+const ObjectKind KIND_GUIDE_LINE = 5;
+const ObjectKind KIND_PROFILE = 6;
+const ObjectKind KIND_CALCULATION = 7;
+const ObjectKind KIND_ZONE = 8;
+const ObjectKind KIND_REGION = 9;
+const ObjectKind KIND_VISUAL_STATE = 10;
+const ObjectKind KIND_LAST = KIND_VISUAL_STATE;
+
+DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
+
+typedef QMap<QString,Handle(Standard_Transient)> MapOfTreatedObjects;
+
+typedef NCollection_Sequence<Handle_HYDROData_Entity> HYDROData_SequenceOfObjects;
+
+
+/**\class HYDROData_Entity
+ * \brief Generic class of any object in the data model.
+ *
+ * Interface for getting access to the object that belong to the data model.
+ * Managed by Document. Provides access to the common properties:
+ * kind of an object, name.
+ */
+class HYDROData_Entity : public MMgt_TShared
+{
+
+protected:
+
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = 0 ///< first tag, to reserve
+ // ...
+ };
+
+ /**
+ * Enumeration of tags corresponding to the child sub-objects of object.
+ */
+ enum ChildTag
+ {
+ ChildTag_First = 0 ///< first tag, to reserve
+ // ...
+ };
+
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_Entity);
+
+ /**
+ * Returns the kind of this object. Must be redefined in all objects of known type.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_UNKNOWN; }
+
+ /**
+ * Returns the name of this object.
+ */
+ HYDRODATA_EXPORT QString GetName() const;
+
+ /**
+ * Updates the name of this object.
+ */
+ HYDRODATA_EXPORT void SetName(const QString& theName);
+
+ /**
+ * Dump object to Python script representation.
+ * Base implementation returns empty list,
+ * You should reimplement this function in your derived class if it
+ * has Python API and can be imported/exported from/to Python script.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+ /**
+ * Updates object state.
+ * Base implementation dose nothing.
+ * \param theIsForce force reupdating of data object
+ */
+ HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
+
+ /**
+ * Returns data of object wrapped to QVariant.
+ * Base implementation returns null value.
+ */
+ HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+
+ /**
+ * Checks is object exists in the data structure.
+ * \returns true is object is not exists in the data model
+ */
+ HYDRODATA_EXPORT bool IsRemoved() const;
+
+ /**
+ * Removes object and it child sub-objects from the data structure.
+ */
+ HYDRODATA_EXPORT virtual void Remove();
+
+ /**
+ * Returns unique integer identifier of the object (may be used for ordering of objects)
+ */
+ HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
+
+ /**
+ * Copies all properties of this to the destinated object.
+ * Objects must be the same type.
+ * \param theDestination initialized object (from any document) - target of copying
+ */
+ HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Entity theDestination) const;
+
+ /**
+ * Returns the label of this object.
+ */
+ HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
+
+protected:
+
+ friend class HYDROData_Iterator;
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDRODATA_EXPORT HYDROData_Entity();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_Entity();
+
+ /**
+ * Put the object to the label of the document.
+ * \param theLabel new label of the object
+ */
+ HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
+
+ /**
+ * Internal method that used to store the byte array attribute
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ * \param theData pointer to bytes array
+ * \param theLen number of bytes in byte array that must be stored
+ */
+ void SaveByteArray(const int theTag, const char* theData, const int theLen);
+
+ /**
+ * Internal method that used to retreive the content of byte array attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theLen number of bytes in byte array
+ * \returns pointer to the internal data structure wit harray content,
+ * or NULL if array size is zero
+ */
+ const char* ByteArray(const int theTag, int& theLen) const;
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ */
+ int NbReferenceObjects( const int theTag = 0 ) const;
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ */
+ void AddReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag = 0 );
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ - if more that len then just append it to the end of list
+ - if less than zero then prepend to the list
+ - indexing starts from 0
+ */
+ void SetReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag = 0,
+ const int theIndex = 0 );
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ * \param theBeforeIndex index in the list of references
+ - if more that len then just append it to the end of list
+ - if less than zero then prepend to the list
+ - indexing starts from 0
+ */
+ void InsertReferenceObject( const Handle_HYDROData_Entity& theObj,
+ const int theTag = 0,
+ const int theBeforeIndex = 0 );
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObjects sequence with pointers to reference objects
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ */
+ void SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects,
+ const int theTag = 0 );
+
+ /**
+ * Internal method that used to retreive the reference object(s) attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ * - indexing starts from 0
+ * \returns pointer to reference object or NULL if label is not set
+ */
+ Handle_HYDROData_Entity GetReferenceObject( const int theTag = 0,
+ const int theIndex = 0 ) const;
+
+ HYDROData_SequenceOfObjects GetReferenceObjects( const int theTag = 0 ) const;
+
+ /**
+ * Internal method that used to remove the reference object attribute
+ * \param theRefLabel reference object label to remove
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ */
+ void RemoveReferenceObject( const TDF_Label& theRefLabel, const int theTag = 0 );
+
+ /**
+ * Internal method that used to remove the reference object attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ * - indexing starts from 0
+ */
+ void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 );
+
+ /**
+ * Internal method that used to clear list of the reference objects attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ */
+ void ClearReferenceObjects( const int theTag = 0 );
+
+ /**
+ * Internal method that used to store the color attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theColor color to save
+ */
+ void SetColor( const QColor& theColor, const int theTag = 0 );
+
+ /**
+ * Internal method that used to retreive the color attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theDefColor default color to return if attribute has not been set before
+ */
+ QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const;
+
+
+protected:
+
+ void setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects,
+ QStringList& theScript,
+ const Handle(HYDROData_Entity)& theRefObject,
+ const QString& theMethod ) const;
+protected:
+
+ Handle(TDataStd_ReferenceList) getReferenceList( const int theTag,
+ const bool theIsCreate ) const;
+
+
+protected:
+ /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
+ TDF_Label myLab; ///< label of this object
+};
+
+///! Is Equal for HYDROData_Entity mapping
+HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Handle_HYDROData_Entity& theObj2);
+
+#endif
#include "HYDROData_Document.h"
#include "HYDROData_Tool.h"
-#include "HYDROOperations_Factory.h"
+#include "HYDROData_OperationsFactory.h"
#include <TDataStd_RealArray.hxx>
#include <TDataStd_ByteArray.hxx>
#define PYTHON_IMAGE_ID "KIND_IMAGE"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Entity)
HYDROData_Image::HYDROData_Image()
+: HYDROData_Entity()
{
}
aResList << QString( "%1.SetOperatorName( \"%2\" );" )
.arg( anImageName ).arg( anOperatorName );
- ImageComposer_Operator* anImageOp = HYDROOperations_Factory::Factory()->Operator( this );
+ ImageComposer_Operator* anImageOp = HYDROData_OperationsFactory::Factory()->Operator( this );
if ( anImageOp )
{
// Dump operation arguments
void HYDROData_Image::Update( const bool theIsForce )
{
- HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
+ HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
// Update image only if there is an operation
ImageComposer_Operator* anOp = aFactory->Operator( OperatorName() );
if ( aNbReferences > 0 )
{
// First referenced object
- Handle(HYDROData_Object) aRefObj = Reference( 0 );
+ Handle(HYDROData_Entity) aRefObj = Reference( 0 );
if ( !aRefObj.IsNull() )
{
anObj1 = aRefObj->GetDataVariant();
if ( aNbReferences > 1 )
{
// Second referenced object
- Handle(HYDROData_Object) aRefObj = Reference( 1 );
+ Handle(HYDROData_Entity) aRefObj = Reference( 1 );
if ( !aRefObj.IsNull() )
anObj2 = aRefObj->GetDataVariant();
}
return 0;
}
-void HYDROData_Image::AppendReference( const Handle(HYDROData_Object)& theReferenced )
+void HYDROData_Image::AppendReference( const Handle(HYDROData_Entity)& theReferenced )
{
AddReferenceObject( theReferenced, 0 );
}
return NbReferenceObjects( 0 );
}
-Handle(HYDROData_Object) HYDROData_Image::Reference( const int theIndex ) const
+Handle(HYDROData_Entity) HYDROData_Image::Reference( const int theIndex ) const
{
return GetReferenceObject( 0, theIndex );
}
void HYDROData_Image::ChangeReference(
- const int theIndex, Handle(HYDROData_Object) theReferenced)
+ const int theIndex, Handle(HYDROData_Entity) theReferenced)
{
SetReferenceObject( theReferenced, 0, theIndex );
}
+
#ifndef HYDROData_Image_HeaderFile
#define HYDROData_Image_HeaderFile
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <QImage>
#include <QTransform>
-DEFINE_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object)
+DEFINE_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity)
/**\class HYDROData_Image
* \brief Class that stores/retreives information about the image.
* Keeps image as binary array, transformation and other properties
* of image with correspondent API for forkind wit hthese properties.
*/
-class HYDROData_Image : public HYDROData_Object
+class HYDROData_Image : public HYDROData_Entity
{
protected:
/**
*/
enum DataTag
{
- DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_Operator, ///< name of the operator that must be executed for image update
DataTag_TrsfMode, ///< transformation mode (0 - Lambert93, 1 - Cartesian)
DataTag_TrsfPoints, ///< image transformation points (3 input + 3 output lambert + 3 output cartesian)
*/
HYDRODATA_EXPORT int TrsfMode() const;
- /**
- * Appends reference to other object (image or polyline).
- * \param theReferenced the object referenced by this
- */
- HYDRODATA_EXPORT void AppendReference( const Handle(HYDROData_Object)& theReferenced );
-
/**
* Returns the number of referenced objects
* \return zero if there is no references
*/
HYDRODATA_EXPORT int NbReferences() const;
+ /**
+ * Appends reference to other object (image or polyline).
+ * \param theReferenced the object referenced by this
+ */
+ HYDRODATA_EXPORT void AppendReference( const Handle(HYDROData_Entity)& theReferenced );
+
/**
* Returns reference by index.
* \param theIndex number of reference [0; NbReference)
* \returns the referenced object, or Null if index is invalid
*/
- HYDRODATA_EXPORT Handle(HYDROData_Object) Reference(const int theIndex) const;
+ HYDRODATA_EXPORT Handle(HYDROData_Entity) Reference(const int theIndex) const;
/**
* Updates reference by index. If index is one-bigger than \a NbReferences,
* \param theReferenced the object referenced by this
*/
HYDRODATA_EXPORT void ChangeReference(
- const int theIndex, Handle(HYDROData_Object) theReferenced);
+ const int theIndex, Handle(HYDROData_Entity) theReferenced);
/**
* Removes reference by index
--- /dev/null
+
+#include "HYDROData_ImmersibleZone.h"
+
+#include "HYDROData_Bathymetry.h"
+#include "HYDROData_Document.h"
+#include "HYDROData_Polyline.h"
+
+#include <BRepBuilderAPI_MakeFace.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+
+#include <QColor>
+#include <QStringList>
+
+#define PYTHON_IMMERSIBLE_ZONE_ID "KIND_IMMERSIBLE_ZONE"
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_ImmersibleZone,HYDROData_NaturalObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ImmersibleZone,HYDROData_NaturalObject)
+
+
+HYDROData_ImmersibleZone::HYDROData_ImmersibleZone()
+: HYDROData_NaturalObject()
+{
+}
+
+HYDROData_ImmersibleZone::~HYDROData_ImmersibleZone()
+{
+}
+
+QStringList HYDROData_ImmersibleZone::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( PYTHON_IMMERSIBLE_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( "" );
+
+ aResList << QString( "" );
+
+ Handle(HYDROData_Bathymetry) aRefBathymetry = GetBathymetry();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetBathymetry" );
+
+ Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
+
+ return aResList;
+}
+
+TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
+{
+ Handle(HYDROData_Polyline) aPolyline = GetPolyline();
+ if( !aPolyline.IsNull() )
+ {
+ TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolyline->GetTopShape() );
+ if( !aPolylineWire.IsNull() )
+ {
+ BRepBuilderAPI_MakeFace aMakeFace( aPolylineWire, Standard_True );
+ aMakeFace.Build();
+ if( aMakeFace.IsDone() )
+ return aMakeFace.Face();
+ }
+ }
+ return TopoDS_Face();
+}
+
+TopoDS_Shape HYDROData_ImmersibleZone::GetShape3D() const
+{
+ // TODO
+ return getTopShape();
+}
+
+QColor HYDROData_ImmersibleZone::DefaultFillingColor()
+{
+ return QColor( Qt::green );
+}
+
+void HYDROData_ImmersibleZone::SetFillingColor( const QColor& theColor )
+{
+ return SetColor( theColor, DataTag_FillingColor );
+}
+
+QColor HYDROData_ImmersibleZone::GetFillingColor() const
+{
+ return GetColor( DefaultFillingColor(), DataTag_FillingColor );
+}
+
+QColor HYDROData_ImmersibleZone::DefaultBorderColor()
+{
+ return QColor( Qt::transparent );
+}
+
+void HYDROData_ImmersibleZone::SetBorderColor( const QColor& theColor )
+{
+ return SetColor( theColor, DataTag_BorderColor );
+}
+
+QColor HYDROData_ImmersibleZone::GetBorderColor() const
+{
+ return GetColor( DefaultBorderColor(), DataTag_BorderColor );
+}
+
+void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+{
+ SetReferenceObject( thePolyline, DataTag_Polyline );
+}
+
+Handle(HYDROData_Polyline) HYDROData_ImmersibleZone::GetPolyline() const
+{
+ return Handle(HYDROData_Polyline)::DownCast(
+ GetReferenceObject( DataTag_Polyline ) );
+}
+
+void HYDROData_ImmersibleZone::RemovePolyline()
+{
+ ClearReferenceObjects( DataTag_Polyline );
+}
+
+void HYDROData_ImmersibleZone::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
+{
+ SetReferenceObject( theBathymetry, DataTag_Bathymetry );
+}
+
+Handle(HYDROData_Bathymetry) HYDROData_ImmersibleZone::GetBathymetry() const
+{
+ return Handle(HYDROData_Bathymetry)::DownCast(
+ GetReferenceObject( DataTag_Bathymetry ) );
+}
+
+void HYDROData_ImmersibleZone::RemoveBathymetry()
+{
+ ClearReferenceObjects( DataTag_Bathymetry );
+}
+
+
--- /dev/null
+
+#ifndef HYDROData_ImmersibleZone_HeaderFile
+#define HYDROData_ImmersibleZone_HeaderFile
+
+#include <HYDROData_NaturalObject.h>
+
+DEFINE_STANDARD_HANDLE(HYDROData_ImmersibleZone, HYDROData_NaturalObject)
+
+class Handle(HYDROData_Bathymetry);
+class Handle(HYDROData_Polyline);
+
+/**\class HYDROData_ImmersibleZone
+ * \brief
+ *
+ */
+class HYDROData_ImmersibleZone : public HYDROData_NaturalObject
+{
+protected:
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_FillingColor, ///< filling color of immersible zone
+ DataTag_BorderColor, ///< border color of immersible zone
+ DataTag_Polyline, ///< reference polyline
+ DataTag_Bathymetry, ///< reference bathymetry
+};
+
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_ImmersibleZone);
+
+ /**
+ * Returns the kind of this object. Must be redefined in all objects of known type.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_IMMERSIBLE_ZONE;}
+
+ /**
+ * Dump object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+ /**
+ * Returns the top shape of the object.
+ */
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
+
+ /**
+ * Returns the 3d shape of the object.
+ */
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() 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.
+ */
+ HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+
+ /**
+ * Returns reference polyline object of zone.
+ */
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetPolyline() const;
+
+ /**
+ * Remove reference polyline object of zone.
+ */
+ HYDRODATA_EXPORT virtual void RemovePolyline();
+
+
+ /**
+ * Set reference bathymetry object for zone.
+ */
+ HYDRODATA_EXPORT virtual void SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
+
+ /**
+ * Returns reference bathymetry object of zone.
+ */
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry() const;
+
+ /**
+ * Clear the bathymetry object for zone.
+ */
+ HYDRODATA_EXPORT virtual void RemoveBathymetry();
+
+protected:
+
+ friend class HYDROData_Iterator;
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDRODATA_EXPORT HYDROData_ImmersibleZone();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_ImmersibleZone();
+};
+
+#endif
-#include <HYDROData_Iterator.h>
-#include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
-#include <HYDROData_VisualState.h>
-#include <HYDROData_Bathymetry.h>
-#include <HYDROData_Calculation.h>
-#include <HYDROData_Zone.h>
-#include <HYDROData_Region.h>
+#include "HYDROData_Iterator.h"
+
+#include "HYDROData_Bathymetry.h"
+#include "HYDROData_Calculation.h"
+#include "HYDROData_Image.h"
+#include "HYDROData_ImmersibleZone.h"
+#include "HYDROData_Polyline.h"
+#include "HYDROData_VisualState.h"
+#include "HYDROData_Region.h"
+#include "HYDROData_Zone.h"
#include <TDataStd_Name.hxx>
+#include <TDataStd_NamedData.hxx>
+
#include <NCollection_DataMap.hxx>
//! Returns label by root objects kind and the kind of the object
{
myIter.Next();
// omit the properties iteration in case of UNKNOWN kind filtering
- while(myIter.More() && myIter.Value()->Label().Depth() != 4)
+ while ( myIter.More() && myIter.Value()->Label().Depth() < 4 )
myIter.Next();
}
return myIter.More();
}
-Handle(HYDROData_Object) HYDROData_Iterator::Current()
+Handle(HYDROData_Entity) HYDROData_Iterator::Current()
{
return Object(myIter.Value()->Label());
}
-Handle_HYDROData_Object HYDROData_Iterator::CreateObject(
- Handle(HYDROData_Document) theDoc, ObjectKind theKind)
+Handle(HYDROData_Entity) HYDROData_Iterator::CreateObject(
+ const Handle(HYDROData_Document)& theDoc,
+ const ObjectKind& theObjectKind )
+{
+ TDF_Label aNewLab =
+ GetLabelByKind( theDoc->LabelOfObjects(), theObjectKind ).FindChild( theDoc->NewID() );
+ return CreateObject( aNewLab, theObjectKind );
+}
+
+Handle(HYDROData_Entity) HYDROData_Iterator::CreateObject( TDF_Label& theNewLabel,
+ const ObjectKind& theObjectKind )
{
- TDF_Label aNewLab = GetLabelByKind(theDoc->LabelOfObjects(), theKind).
- FindChild(theDoc->NewID());
- // object exists if there is name attribute
- TDataStd_Name::Set(aNewLab, TCollection_ExtendedString(""));
- return Object(aNewLab);
+ // Object exists if there is a name attribute
+ TDataStd_Name::Set( theNewLabel, "" );
+
+ // Store the type of object in data label
+ TDataStd_NamedData::Set( theNewLabel );
+
+ Handle(TDataStd_NamedData) aNamedData;
+ theNewLabel.FindAttribute( TDataStd_NamedData::GetID(), aNamedData );
+ aNamedData->SetInteger( "ObjectKind", theObjectKind );
+
+ return Object( theNewLabel );
}
-Handle_HYDROData_Object HYDROData_Iterator::Object( const TDF_Label theLabel )
+Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label theLabel )
{
- ObjectKind aKind = theLabel.Father().Tag();
+ ObjectKind aKind = KIND_UNKNOWN;
+
+ // Retrieve the type of object from label
+ Handle(TDataStd_NamedData) aNamedData;
+ if ( theLabel.FindAttribute( TDataStd_NamedData::GetID(), aNamedData ) )
+ aKind = aNamedData->GetInteger( "ObjectKind" );
+
+ if ( aKind == KIND_UNKNOWN )
+ aKind = theLabel.Father().Tag(); // Try to get type from father label
- Handle(HYDROData_Object) aResult;
+ Handle(HYDROData_Entity) aResult;
switch( aKind )
{
- case KIND_IMAGE:
- aResult = new HYDROData_Image();
- break;
- case KIND_POLYLINE:
- aResult = new HYDROData_Polyline();
- break;
- case KIND_VISUAL_STATE:
- aResult = new HYDROData_VisualState();
- break;
- case KIND_BATHYMETRY:
- aResult = new HYDROData_Bathymetry();
- break;
- case KIND_CALCULATION:
- aResult = new HYDROData_Calculation();
- break;
- case KIND_ZONE:
- aResult = new HYDROData_Zone();
- break;
- case KIND_REGION:
- aResult = new HYDROData_Region();
- break;
+ case KIND_IMAGE:
+ aResult = new HYDROData_Image();
+ break;
+ case KIND_POLYLINE:
+ aResult = new HYDROData_Polyline();
+ break;
+ case KIND_BATHYMETRY:
+ aResult = new HYDROData_Bathymetry();
+ break;
+ case KIND_IMMERSIBLE_ZONE:
+ aResult = new HYDROData_ImmersibleZone();
+ break;
+ case KIND_CALCULATION:
+ aResult = new HYDROData_Calculation();
+ break;
+ case KIND_REGION:
+ aResult = new HYDROData_Region();
+ break;
+ case KIND_ZONE:
+ aResult = new HYDROData_Zone();
+ break;
+ case KIND_VISUAL_STATE:
+ aResult = new HYDROData_VisualState();
+ break;
+ default:
+ break;
}
if ( !aResult.IsNull() )
+
#ifndef HYDROData_Iterator_HeaderFile
#define HYDROData_Iterator_HeaderFile
-#include <HYDROData_Object.h>
-#include <HYDROData_Document.h>
+#include "HYDROData_Document.h"
#include <TDF_ChildIDIterator.hxx>
/**
* Returns the current object of the iterator.
*/
- HYDRODATA_EXPORT Handle(HYDROData_Object) Current();
+ HYDRODATA_EXPORT Handle(HYDROData_Entity) Current();
+
+public:
+
+ /**
+ * Creates object in the document on the given label
+ * \param theDoc document where object will be located
+ * \param theKind kind of the new object, can not be UNKNOWN
+ */
+ static Handle(HYDROData_Entity) CreateObject( TDF_Label& theNewLabel,
+ const ObjectKind& theObjectKind );
protected:
friend class HYDROData_Document;
- friend class HYDROData_Object;
+ friend class HYDROData_Entity;
/**
* Creates object in the document, call HYDROData_Document method to create
* \param theDoc document where object will be located
* \param theKind kind of the new object, can not be UNKNOWN
*/
- static Handle_HYDROData_Object CreateObject(
- Handle_HYDROData_Document theDoc, ObjectKind theKind);
+ static Handle(HYDROData_Entity) CreateObject(
+ const Handle(HYDROData_Document)& theDoc,
+ const ObjectKind& theObjectKind );
/**
* Returns object associated to the given label.
*/
- static Handle_HYDROData_Object Object(const TDF_Label theLabel);
+ static Handle(HYDROData_Entity) Object(const TDF_Label theLabel);
TDF_ChildIDIterator myIter; ///< iterator by the objects in the document
};
--- /dev/null
+
+#include "HYDROData_NaturalObject.h"
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_NaturalObject,HYDROData_Object)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_NaturalObject,HYDROData_Object)
+
+HYDROData_NaturalObject::HYDROData_NaturalObject()
+: HYDROData_Object()
+{
+}
+
+HYDROData_NaturalObject::~HYDROData_NaturalObject()
+{
+}
+
+
--- /dev/null
+
+#ifndef HYDROData_NaturalObject_HeaderFile
+#define HYDROData_NaturalObject_HeaderFile
+
+#include <HYDROData_Object.h>
+
+DEFINE_STANDARD_HANDLE(HYDROData_NaturalObject, HYDROData_Object)
+
+
+/**\class HYDROData_NaturalObject
+ * \brief The natural objects are objects of environment not created by human.
+ *
+ */
+class HYDROData_NaturalObject : 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
+ };
+
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_NaturalObject);
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDRODATA_EXPORT HYDROData_NaturalObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_NaturalObject();
+};
+
+#endif
#include "HYDROData_Object.h"
-#include "HYDROData_Iterator.h"
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDataStd_ByteArray.hxx>
-#include <TDataStd_UAttribute.hxx>
-#include <TDataStd_IntegerArray.hxx>
-#include <TDataStd_BooleanArray.hxx>
-#include <TDataStd_RealArray.hxx>
-#include <TDataStd_ReferenceList.hxx>
+#include <TopoDS_Shape.hxx>
-#include <TDF_CopyLabel.hxx>
-#include <TDF_ListIteratorOfLabelList.hxx>
-
-#include <QColor>
-#include <QString>
-#include <QStringList>
-#include <QVariant>
-
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,MMgt_TShared)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,MMgt_TShared)
-
-// is equal function for unique object mapping
-bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2)
-{
- return (theObj1->ID() == theObj2->ID());
-}
-
-QString HYDROData_Object::GetName() const
-{
- Handle(TDataStd_Name) aName;
- if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
- TCollection_AsciiString aStr(aName->Get());
- return QString(aStr.ToCString());
- }
- return QString();
-}
-
-void HYDROData_Object::SetName(const QString& theName)
-{
- TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
-}
-
-QStringList HYDROData_Object::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
-{
- QStringList anEmptyList;
- return anEmptyList;
-}
-
-void HYDROData_Object::Update( const bool theIsForce )
-{
-}
-
-QVariant HYDROData_Object::GetDataVariant()
-{
- return QVariant();
-}
-
-bool HYDROData_Object::IsRemoved() const
-{
- return !myLab.HasAttribute();
-}
-
-void HYDROData_Object::Remove()
-{
- return myLab.ForgetAllAttributes(Standard_True);
-}
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,HYDROData_Entity)
HYDROData_Object::HYDROData_Object()
+: HYDROData_Entity()
{
}
{
}
-void HYDROData_Object::CopyTo(Handle_HYDROData_Object theDestination) const
-{
- TDF_CopyLabel aCopy(myLab, theDestination->Label());
- aCopy.Perform();
-}
-
-void HYDROData_Object::SetLabel(TDF_Label theLabel)
-{
- myLab = theLabel;
-}
-
-void HYDROData_Object::SaveByteArray(const int theTag,
- const char* theData, const int theLen)
-{
- TDF_Label aLab = theTag == 0 ? myLab : myLab.FindChild(theTag);
- // array is empty, remove the attribute
- if (theLen <= 0) {
- aLab.ForgetAttribute(TDataStd_ByteArray::GetID());
- return;
- }
- // store data of image in byte array
- Handle(TDataStd_ByteArray) aData;
- if (!aLab.FindAttribute(TDataStd_ByteArray::GetID(), aData)) {
- aData = TDataStd_ByteArray::Set(aLab, 1, theLen);
- }
- // copy bytes one by one
- if (aData->Length() != theLen) {
- Handle(TColStd_HArray1OfByte) aNewData = new TColStd_HArray1OfByte(1, theLen);
- for(int a = 0; a < theLen; a++)
- aNewData->SetValue(a + 1, theData[a]);
- aData->ChangeArray(aNewData);
- } else {
- for(int a = 0; a < theLen; a++)
- aData->SetValue(a + 1, theData[a]);
- }
-}
-
-const char* HYDROData_Object::ByteArray(const int theTag, int& theLen) const
-{
- TDF_Label aLab = theTag == 0 ? myLab : myLab.FindChild(theTag);
- Handle(TDataStd_ByteArray) aData;
- if (!aLab.FindAttribute(TDataStd_ByteArray::GetID(), aData))
- return NULL; // return empty image if there is no array
- theLen = aData->Length();
- if (theLen)
- return (const char*)(&(aData->InternalArray()->ChangeArray1().ChangeValue(1)));
- return NULL;
-}
-
-int HYDROData_Object::NbReferenceObjects( const int theTag ) const
+void HYDROData_Object::SetTopShape( const TopoDS_Shape& theShape )
{
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
- return aRefs.IsNull() ? 0 : aRefs->Extent();
+ TNaming_Builder aBuilder( myLab.FindChild( DataTag_TopShape ) );
+ aBuilder.Generated( theShape );
}
-void HYDROData_Object::AddReferenceObject( const Handle_HYDROData_Object& theObj,
- const int theTag )
+void HYDROData_Object::SetShape3D( const TopoDS_Shape& theShape )
{
- if ( theObj.IsNull() )
- return;
-
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true );
- aRefs->Append( theObj->Label() );
+ TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape3D ) );
+ aBuilder.Generated( theShape );
}
-void HYDROData_Object::SetReferenceObject( const Handle_HYDROData_Object& theObj,
- const int theTag,
- const int theIndex )
+TopoDS_Shape HYDROData_Object::getTopShape() const
{
- if ( theObj.IsNull() )
- {
- RemoveReferenceObject( theTag, theIndex );
- return;
- }
-
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true );
-
- if ( theIndex >= aRefs->Extent() )
- {
- aRefs->Append( theObj->Label() );
- }
- else if ( theIndex < 0 )
- {
- aRefs->Prepend( theObj->Label() );
- }
- else
- {
- RemoveReferenceObject( theTag, theIndex );
-
- Handle(HYDROData_Object) aBeforeObj = GetReferenceObject( theTag, theIndex );
-
- aRefs = getReferenceList( theTag, true ); // because reference list can be removed
- if ( !aBeforeObj.IsNull() )
- aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
- else
- aRefs->Append( theObj->Label() );
- }
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( myLab.FindChild( DataTag_TopShape ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ return TopoDS_Shape();
}
-void HYDROData_Object::SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects,
- const int theTag )
+TopoDS_Shape HYDROData_Object::getShape3D() const
{
- ClearReferenceObjects( theTag );
- if ( theObjects.IsEmpty() )
- return;
-
- HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
- for ( ; anIter.More(); anIter.Next() )
- AddReferenceObject( anIter.Value(), theTag );
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( myLab.FindChild( DataTag_Shape3D ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ return TopoDS_Shape();
}
-Handle(HYDROData_Object) HYDROData_Object::GetReferenceObject( const int theTag,
- const int theIndex ) const
-{
- Handle(HYDROData_Object) aRes;
-
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
- if ( aRefs.IsNull() || theIndex < 0 || theIndex >= aRefs->Extent() )
- return aRes;
-
- TDF_ListIteratorOfLabelList anIter( aRefs->List() );
- for ( int anIndex = 0; anIndex != theIndex && anIter.More(); anIter.Next(), ++anIndex );
-
- const TDF_Label& aRefLabel = anIter.Value();
- aRes = HYDROData_Iterator::Object( aRefLabel );
-
- return aRes;
-}
-
-HYDROData_SequenceOfObjects HYDROData_Object::GetReferenceObjects( const int theTag ) const
-{
- HYDROData_SequenceOfObjects aRes;
-
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
- if ( aRefs.IsNull() )
- return aRes;
-
- TDF_ListIteratorOfLabelList anIter( aRefs->List() );
- for ( ; anIter.More(); anIter.Next() )
- {
- const TDF_Label& aRefLabel = anIter.Value();
-
- Handle(HYDROData_Object) aRefObject = HYDROData_Iterator::Object( aRefLabel );
- if ( aRefObject.IsNull() )
- continue;
-
- aRes.Append( aRefObject );
- }
-
- return aRes;
-}
-
-void HYDROData_Object::RemoveReferenceObject( const int theTag,
- const int theIndex )
-{
- Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
- if ( aRefs.IsNull() )
- return;
-
- if ( aRefs->Extent() == 1 && theIndex == 0 )
- {
- // remove all if only one
- ClearReferenceObjects( theTag );
- return;
- }
-
- int anIndex = 0;
- TDF_ListIteratorOfLabelList anIter( aRefs->List() );
- for ( ; anIndex != theIndex && anIter.More(); anIter.Next(), ++anIndex );
-
- if ( anIndex != theIndex )
- return;
-
- const TDF_Label& aRefLabel = anIter.Value();
- aRefs->Remove( aRefLabel );
-}
-
-void HYDROData_Object::ClearReferenceObjects( const int theTag )
-{
- TDF_Label aSetLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
- aSetLabel.ForgetAttribute( TDataStd_ReferenceList::GetID() );
-}
-
-Handle(TDataStd_ReferenceList) HYDROData_Object::getReferenceList( const int theTag,
- const bool theIsCreate ) const
-{
- TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
-
- Handle(TDataStd_ReferenceList) aRefs;
- if ( !aLabel.FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ) && theIsCreate )
- aRefs = TDataStd_ReferenceList::Set( aLabel );
-
- return aRefs;
-}
-
-void HYDROData_Object::SetColor( const QColor& theColor,
- const int theTag )
-{
- TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
-
- Handle(TDataStd_IntegerArray) aColorArray;
- if ( !aLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
- aColorArray = TDataStd_IntegerArray::Set( aLabel, 1, 4 );
-
- aColorArray->SetValue( 1, theColor.red() );
- aColorArray->SetValue( 2, theColor.green() );
- aColorArray->SetValue( 3, theColor.blue() );
- aColorArray->SetValue( 4, theColor.alpha() );
-}
-
-QColor HYDROData_Object::GetColor( const QColor& theDefColor,
- const int theTag ) const
-{
- QColor aResColor = theDefColor;
-
- TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
-
- Handle(TDataStd_IntegerArray) aColorArray;
- if ( aLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
- {
- aResColor.setRed( aColorArray->Value( 1 ) );
- aResColor.setGreen( aColorArray->Value( 2 ) );
- aResColor.setBlue( aColorArray->Value( 3 ) );
- aResColor.setAlpha( aColorArray->Value( 4 ) );
- }
-
- return aResColor;
-}
-
-void HYDROData_Object::setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects,
- QStringList& theScript,
- const Handle(HYDROData_Object)& theRefObject,
- const QString& theMethod ) const
-{
- if ( theRefObject.IsNull() )
- return;
-
- QString aRefObjName = theRefObject->GetName();
- if ( aRefObjName.isEmpty() )
- return;
-
- bool anIsToSetObject = true;
-
- // The definition of reference polyline must be dumped before this
- if ( !theTreatedObjects.contains( aRefObjName ) )
- {
- // Write definition of reference polyline
- QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects );
- if ( ( anIsToSetObject = !aRefObjDump.isEmpty() ) )
- {
- QStringList aTmpList = theScript;
- theScript = aRefObjDump;
-
- theScript << QString( "" );
- theScript << aTmpList;
-
- theTreatedObjects.insert( aRefObjName, theRefObject );
- }
- }
-
- if ( anIsToSetObject )
- {
- theScript << QString( "%1.%2( %3 );" )
- .arg( GetName() ).arg( theMethod ).arg( aRefObjName );
- }
-}
-
-
+
#ifndef HYDROData_Object_HeaderFile
#define HYDROData_Object_HeaderFile
-#include <HYDROData.h>
-
-#include <NCollection_Sequence.hxx>
-#include <TDF_Label.hxx>
-#include <QMap>
-
-class QColor;
-class QString;
-class QVariant;
-class QStringList;
-class Handle(TDataStd_ReferenceList);
-class Handle_HYDROData_Object;
-
-///! Kind of an object in a document
-typedef int ObjectKind;
-///! Unrecognized object
-const ObjectKind KIND_UNKNOWN = 0;
-const ObjectKind KIND_IMAGE = 1;
-const ObjectKind KIND_POLYLINE = 2;
-const ObjectKind KIND_VISUAL_STATE = 3;
-const ObjectKind KIND_BATHYMETRY = 4;
-const ObjectKind KIND_CALCULATION = 5;
-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_REGION = 10;
-const ObjectKind KIND_LAST = KIND_REGION;
-
-DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
+#include <HYDROData_Entity.h>
-typedef QMap<QString,Handle(Standard_Transient)> MapOfTreatedObjects;
+class TopoDS_Shape;
-typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
+DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity)
/**\class HYDROData_Object
- * \brief Generic class of any object in the data model.
+ * \brief The base class for all geometrical objects in the HYDRO module.
*
- * Interface for getting access to the object that belong to the data model.
- * Managed by Document. Provides access to the common properties:
- * kind of an object, name.
*/
-class HYDROData_Object : public MMgt_TShared
+class HYDROData_Object : public HYDROData_Entity
{
protected:
/**
*/
enum DataTag
{
- DataTag_First = 0 ///< first tag, to reserve
- // ...
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_TopShape,
+ DataTag_Shape3D,
};
-public:
- DEFINE_STANDARD_RTTI(HYDROData_Object);
-
- /**
- * Returns the kind of this object. Must be redefined in all objects of known type.
- */
- HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;}
-
- /**
- * Returns the name of this object.
- */
- HYDRODATA_EXPORT QString GetName() const;
-
/**
- * Updates the name of this object.
+ * Enumeration of tags corresponding to the child sub-objects of object.
*/
- HYDRODATA_EXPORT void SetName(const QString& theName);
-
- /**
- * Dump object to Python script representation.
- * Base implementation returns empty list,
- * You should reimplement this function in your derived class if it
- * has Python API and can be imported/exported from/to Python script.
- */
- HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
-
- /**
- * Updates object state.
- * Base implementation dose nothing.
- * \param theIsForce force reupdating of data object
- */
- HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
-
- /**
- * Returns data of object wrapped to QVariant.
- * Base implementation returns null value.
- */
- HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+ enum ChildTag
+ {
+ ChildTag_First = HYDROData_Entity::ChildTag_First + 100, ///< first tag, to reserve
+ };
- /**
- * Checks is object exists in the data structure.
- * \returns true is object is not exists in the data model
- */
- HYDRODATA_EXPORT bool IsRemoved() const;
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_Object);
/**
- * Removes object from the data structure.
+ * Sets the top(2d projection) shape of the object.
*/
- HYDRODATA_EXPORT void Remove();
+ HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
/**
- * Returns unique integer identifier of the object (may be used for ordering of objects)
+ * Returns the top shape of the object.
*/
- HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
/**
- * Copies all properties of this to the destinated object.
- * Objects must be the same type.
- * \param theDestination initialized object (from any document) - target of copying
+ * Sets the 3d shape of the object.
*/
- HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
+ HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
/**
- * Returns the label of this object.
+ * Returns the 3d shape of the object.
*/
- HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
protected:
- friend class HYDROData_Iterator;
-
/**
* Creates new object in the internal data structure. Use higher level objects
* to create objects with real content.
*/
virtual HYDRODATA_EXPORT ~HYDROData_Object();
- /**
- * Put the object to the label of the document.
- * \param theLabel new label of the object
- */
- HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
-
- /**
- * Internal method that used to store the byte array attribute
- * \param theTag tag of a label to store attribute (for 0 this is myLab)
- * \param theData pointer to bytes array
- * \param theLen number of bytes in byte array that must be stored
- */
- void SaveByteArray(const int theTag, const char* theData, const int theLen);
-
- /**
- * Internal method that used to retreive the content of byte array attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- * \param theLen number of bytes in byte array
- * \returns pointer to the internal data structure wit harray content,
- * or NULL if array size is zero
- */
- const char* ByteArray(const int theTag, int& theLen) const;
-
- /**
- * Internal method that used to store the reference object label attribute
- * \param theObj pointer to reference object
- * \param theTag tag of a label to store attribute (for 0 this is myLab)
- */
- int NbReferenceObjects( const int theTag = 0 ) const;
-
- /**
- * Internal method that used to store the reference object label attribute
- * \param theObj pointer to reference object
- * \param theTag tag of a label to store attribute (for 0 this is myLab)
- */
- void AddReferenceObject( const Handle_HYDROData_Object& theObj,
- const int theTag = 0 );
-
- /**
- * Internal method that used to store the reference object label attribute
- * \param theObj pointer to reference object
- * \param theTag tag of a label to store attribute (for 0 this is myLab)
- * \param theIndex index in the list of references
- - if more that len then just append it to the end of list
- - if less than zero then prepend to the list
- - indexing starts from 0
- */
- void SetReferenceObject( const Handle_HYDROData_Object& theObj,
- const int theTag = 0,
- const int theIndex = 0 );
-
- /**
- * Internal method that used to store the reference object label attribute
- * \param theObjects sequence with pointers to reference objects
- * \param theTag tag of a label to store attribute (for 0 this is myLab)
- */
- void SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects,
- const int theTag = 0 );
-
- /**
- * Internal method that used to retreive the reference object(s) attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- * \param theIndex index in the list of references
- * - indexing starts from 0
- * \returns pointer to reference object or NULL if label is not set
- */
- Handle_HYDROData_Object GetReferenceObject( const int theTag = 0,
- const int theIndex = 0 ) const;
-
- HYDROData_SequenceOfObjects GetReferenceObjects( const int theTag = 0 ) const;
-
- /**
- * Internal method that used to remove the reference object attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- * \param theIndex index in the list of references
- * - indexing starts from 0
- */
- void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 );
-
- /**
- * Internal method that used to clear list of the reference objects attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- */
- void ClearReferenceObjects( const int theTag = 0 );
+protected:
/**
- * Internal method that used to store the color attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- * \param theColor color to save
+ * Retrieve the top shape of the object from data label.
*/
- void SetColor( const QColor& theColor, const int theTag = 0 );
+ HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
/**
- * Internal method that used to retreive the color attribute
- * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
- * \param theDefColor default color to return if attribute has not been set before
+ * Retrieve the 3d shape of the object from data label.
*/
- QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const;
+ HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
-
-protected:
-
- void setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects,
- QStringList& theScript,
- const Handle(HYDROData_Object)& theRefObject,
- const QString& theMethod ) const;
-protected:
-
- Handle(TDataStd_ReferenceList) getReferenceList( const int theTag,
- const bool theIsCreate ) const;
-
-
-protected:
- /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
- TDF_Label myLab; ///< label of this object
};
-///! Is Equal for HYDROData_Object mapping
-HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);
-
#endif
--- /dev/null
+#include<HYDROData_OperationsFactory.h>
+
+#include<HYDROData_Document.h>
+#include<HYDROData_Iterator.h>
+
+#include<ImageComposer_ColorMaskOperator.h>
+#include<ImageComposer_CropOperator.h>
+#include<ImageComposer_CutOperator.h>
+#include<ImageComposer_FuseOperator.h>
+
+#include <typeinfo>
+
+// global instance
+HYDROData_OperationsFactory* FACTORY = 0;
+
+HYDROData_OperationsFactory* HYDROData_OperationsFactory::Factory()
+{
+ if (!FACTORY) {
+ FACTORY = new HYDROData_OperationsFactory;
+ // default operations
+ REGISTER_HYDRO_OPERATION(ImageComposer_ColorMaskOperator)
+ REGISTER_HYDRO_OPERATION(ImageComposer_CropOperator)
+ REGISTER_HYDRO_OPERATION(ImageComposer_CutOperator)
+ REGISTER_HYDRO_OPERATION(ImageComposer_FuseOperator)
+ }
+ return FACTORY;
+}
+
+void HYDROData_OperationsFactory::Register(
+ ImageComposer_Operator* theOperator)
+{
+ if ( !theOperator )
+ return;
+
+ FACTORY->myOps[ theOperator->name() ] = theOperator;
+}
+
+HYDROData_OperationsFactory::HYDROData_OperationsFactory()
+{
+}
+
+ImageComposer_Operator* HYDROData_OperationsFactory::Operator(
+ Handle(HYDROData_Image) theImage ) const
+{
+ // retreive operator instance by name
+ ImageComposer_Operator* anOp = Operator( theImage->OperatorName() );
+ if ( !anOp )
+ return anOp;
+
+ // fill arguments of the operator from theImage
+ anOp->setBinArgs( theImage->Args() );
+
+ return anOp;
+}
+
+ImageComposer_Operator* HYDROData_OperationsFactory::Operator(const QString theName) const
+{
+ return myOps.contains( theName ) ? myOps[ theName ] : NULL;
+}
+
+Handle(HYDROData_Image) HYDROData_OperationsFactory::CreateImage(
+ Handle(HYDROData_Document) theDoc, const ImageComposer_Operator* theOperator)
+{
+ // create an object
+ Handle(HYDROData_Image) anImage =
+ Handle(HYDROData_Image)::DownCast(theDoc->CreateObject(KIND_IMAGE));
+ // get data from operation
+ if (theOperator) {
+ anImage->SetOperatorName( theOperator->name() );
+ anImage->SetArgs( theOperator->getBinArgs() );
+ }
+ return anImage;
+}
--- /dev/null
+#ifndef HYDROData_OperationsFactory_HeaderFile
+#define HYDROData_OperationsFactory_HeaderFile
+
+#include <HYDROData.h>
+#include <HYDROData_Image.h>
+#include <QMap>
+
+class ImageComposer_Operator;
+class Handle_HYDROData_Document;
+
+/**\class HYDROData_OperationsFactory
+ *
+ * \brief This class provides the unified management of operations on images.
+ *
+ * Object is created as one global instance and allows to register and launch
+ * all registered operations in general way. To register a new operation just
+ * call REGISTER_HYDRO_OPERATION(operation_name) in some method implementation.
+ * This macro will call constructor of this operation (it must inherit
+ * ImageComposer_Operator) and factory will set up arguments and call this
+ * operator by demand.
+ */
+
+class HYDROData_OperationsFactory
+{
+public:
+
+ //! Returns the global factory
+ HYDRODATA_EXPORT static HYDROData_OperationsFactory* Factory();
+
+ /**
+ * Registers the operator by the name, used by REGISTER_HYDRO_OPERATION macro
+ * \param theOperator new instance of the operator that will be used for
+ * processing of operation with such kind
+ */
+ HYDRODATA_EXPORT static void Register(
+ ImageComposer_Operator* theOperator);
+
+ /**
+ * Creates a new Image object in the data structure by the operator data.
+ * \param theDoc document where it must be created
+ * \param theOperator base operator for this Image: will be used in "Update" to recompute the image
+ * \returns created object related to the data structure
+ */
+ HYDRODATA_EXPORT Handle(HYDROData_Image) CreateImage(
+ Handle_HYDROData_Document theDoc, const ImageComposer_Operator* theOperator);
+
+ /**
+ * Returns the operator, initialized by the properties of theImage
+ * \param theImage data structures object, that contains all arguments
+ * required for creation of operation
+ * \returns NULL if operator type is unknown
+ */
+ HYDRODATA_EXPORT ImageComposer_Operator* Operator(
+ Handle(HYDROData_Image) theImage) const;
+
+
+ /**
+ * Returns the appropriate operator by the name
+ * \param theName name of the operator, equals to the operation_name constructor
+ * \returns NULL if operator with such name is not registered yet
+ */
+ HYDRODATA_EXPORT ImageComposer_Operator* Operator(const QString theName) const;
+
+protected:
+
+ //! Not public constructor that creates only one, global instance of this factory.
+ HYDROData_OperationsFactory();
+
+private:
+ //! Map that stores all operators, isentified by strings
+ typedef QMap<QString, ImageComposer_Operator*> FactoryOperators;
+
+ FactoryOperators myOps; ///< all operators stored by a factory
+};
+
+/**
+ * Macro that is used for registered operators, see C++ of this class to see
+ * example of hte registration.
+ */
+#define REGISTER_HYDRO_OPERATION(operation_name) \
+ HYDROData_OperationsFactory::Factory()->Register(new operation_name);
+
+#endif
#include <HYDROData_Polyline.h>
#include <HYDROData_Iterator.h>
-#include <HYDROOperations_BSpline.h>
+#include <HYDROData_BSplineOperation.h>
#include <ImageComposer_MetaTypes.h>
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Polyline, HYDROData_Object)
HYDROData_Polyline::HYDROData_Polyline()
+: HYDROData_Object()
{
}
{
}
+TopoDS_Shape HYDROData_Polyline::GetTopShape() const
+{
+ // TODO
+ return getTopShape();
+}
+
+TopoDS_Shape HYDROData_Polyline::GetShape3D() const
+{
+ // TODO
+ return getTopShape();
+}
+
/**
* Dump object to Python script representation.
*/
aResList << QString( "" );
- int aDim = getDimension();
+ int aDim = GetDimension();
aResList << QString( "%1.setDimension( %2 );" )
.arg( aPolylineName ).arg( aDim );
// Set polilyne data
- PolylineData aPolylineData = getPolylineData();
+ PolylineData aPolylineData = GetPolylineData();
if ( !aPolylineData.isEmpty() )
{
QString aPolylineDataName = "polyline_data";
QVariant HYDROData_Polyline::GetDataVariant()
{
- QPainterPath aPath = painterPath();
+ QPainterPath aPath = GetPainterPath();
QVariant aVarData;
aVarData.setValue<QPainterPath>( aPath );
return aVarData;
}
-/**
- * Return polyline dimension
- * \return polyline dimension. 2 or 3 is valid. 0 is invalid.
- */
-int HYDROData_Polyline::getDimension() const
-{
- Handle(TDataStd_Integer) aDim;
- if(!myLab.FindAttribute(TDataStd_Integer::GetID(), aDim))
- return 0;
- return aDim->Get();
-}
-
-/**
- * Set polyline dimension. Should be 2 or 3.
- * \param theDimension the polyline dimension
- */
-void HYDROData_Polyline::setDimension( int theDimension )
-{
- removeAll();
- int aDim=0;
- if( theDimension == 2 || theDimension == 3){
- aDim = theDimension;
- }
- TDataStd_Integer::Set(myLab, aDim);
-}
-
/**
* Replace current polyline data by new sections list
* \param theSections the sections list
*/
-void HYDROData_Polyline::setPolylineData( const PolylineData& theSections )
+void HYDROData_Polyline::SetPolylineData( const PolylineData& theSections )
{
//Keep dimension
- int aDim = getDimension();
+ int aDim = GetDimension();
if( aDim == 0 )
return;
- removeAll();
- setDimension(aDim);
+ RemoveAll();
+ SetDimension(aDim);
if( theSections.size() == 0 )
return;
* Return polyline data
* \return polyline section list
*/
-HYDROData_Polyline::PolylineData HYDROData_Polyline::getPolylineData() const
+HYDROData_Polyline::PolylineData HYDROData_Polyline::GetPolylineData() const
{
int aSectCnt;
PolylineData aRes;
/**
* Returns true if polyline is closed
*/
-bool HYDROData_Polyline::isClosed() const
+bool HYDROData_Polyline::IsClosed() const
{
- int aDim = getDimension();
- PolylineData aPolylineData = getPolylineData();
+ int aDim = GetDimension();
+ PolylineData aPolylineData = GetPolylineData();
if ( aDim == 0 || aPolylineData.isEmpty() )
return false;
return true;
}
+/**
+ * Return polyline dimension
+ * \return polyline dimension. 2 or 3 is valid. 0 is invalid.
+ */
+int HYDROData_Polyline::GetDimension() const
+{
+ Handle(TDataStd_Integer) aDim;
+ if(!myLab.FindAttribute(TDataStd_Integer::GetID(), aDim))
+ return 0;
+ return aDim->Get();
+}
+
+/**
+ * Set polyline dimension. Should be 2 or 3.
+ * \param theDimension the polyline dimension
+ */
+void HYDROData_Polyline::SetDimension( int theDimension )
+{
+ RemoveAll();
+ int aDim=0;
+ if( theDimension == 2 || theDimension == 3){
+ aDim = theDimension;
+ }
+ TDataStd_Integer::Set(myLab, aDim);
+}
+
/**
* Remove all polyline attributes except dimension.
*/
-void HYDROData_Polyline::removeAll()
+void HYDROData_Polyline::RemoveAll()
{
//Remove only section data
TDF_Label aLab = myLab.FindChild( DataTag_SectionsSize );
* Note: currently only the first section of the polyline data is taken into account.
* \return polyline painter path.
*/
-QPainterPath HYDROData_Polyline::painterPath() const
+QPainterPath HYDROData_Polyline::GetPainterPath() const
{
QPainterPath aPath;
- int aDim = getDimension();
+ int aDim = GetDimension();
if( aDim != 2 && aDim != 3 )
return aPath;
- PolylineData aSects = getPolylineData();
+ PolylineData aSects = GetPolylineData();
if( aSects.isEmpty() )
return aPath;
int anIndex = i * aDim;
aPoints << aSection.myCoords[ anIndex ] << aSection.myCoords[ anIndex + 1 ];
}
- HYDROOperations_BSpline aBSpline( aPoints, 0, anIsSectionClosed );
+ HYDROData_BSplineOperation aBSpline( aPoints, 0, anIsSectionClosed );
aPath = aBSpline.ComputePath();
}
return aPath;
return 0;
}
-void HYDROData_Polyline::SetWire( const TopoDS_Wire& theWire )
-{
- TNaming_Builder aBuilder( myLab );
- aBuilder.Generated( theWire );
-}
-
-TopoDS_Wire HYDROData_Polyline::Wire() const
-{
- Handle(TNaming_NamedShape) aNamedShape;
- if( myLab.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
- return TopoDS::Wire( aNamedShape->Get() );
- return TopoDS_Wire();
-}
-
void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
{
BRepBuilderAPI_MakeWire aMakeWire;
- int aDim = getDimension();
+ int aDim = GetDimension();
double aZValue = ZValue();
aPoints << x << y;
}
- HYDROOperations_BSpline aBSpline( aPoints, aZValue, anIsSectionClosed );
+ HYDROData_BSplineOperation aBSpline( aPoints, aZValue, anIsSectionClosed );
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
aMakeSectionWire.Add( anEdge );
}
}
TopoDS_Wire aWire = aMakeWire.Wire();
- SetWire( aWire );
+ SetTopShape( aWire );
}
DataTag_SectionsClosed,
DataTag_SectionsSize,
DataTag_SectionsType,
- DataTag_Wire,
DataTag_ZValue
};
*/
HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
+ /**
+ * Returns the top shape of the object.
+ */
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
+
+ /**
+ * Returns the 3d shape of the object.
+ */
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
+
/**
* Dump object to Python script representation.
*/
* Replace current polyline data by new sections list
* \param theSections the sections list
*/
- HYDRODATA_EXPORT void setPolylineData( const PolylineData& theSections );
+ HYDRODATA_EXPORT void SetPolylineData( const PolylineData& theSections );
/**
* Return polyline data
* \return polyline section list
*/
- HYDRODATA_EXPORT PolylineData getPolylineData() const;
+ HYDRODATA_EXPORT PolylineData GetPolylineData() const;
/**
* Returns true if polyline is closed
*/
- HYDRODATA_EXPORT bool isClosed() const;
+ HYDRODATA_EXPORT bool IsClosed() const;
/**
* Return polyline dimension
* \return polyline dimension (2 or 3)
*/
- HYDRODATA_EXPORT int getDimension() const;
+ HYDRODATA_EXPORT int GetDimension() const;
/**
* Set polyline dimension (2 or 3)
* \param theDimension the polyline dimension
*/
- HYDRODATA_EXPORT void setDimension( int theDimension );
+ HYDRODATA_EXPORT void SetDimension( int theDimension );
/**
* Remove all sections from polyline
*/
- HYDRODATA_EXPORT void removeAll();
+ HYDRODATA_EXPORT void RemoveAll();
/**
* Returns the painter path.
* Note: currently only the first section of the polyline data is taken into account.
*/
- HYDRODATA_EXPORT QPainterPath painterPath() const;
+ HYDRODATA_EXPORT QPainterPath GetPainterPath() const;
- HYDRODATA_EXPORT void SetZValue( const double theZValue );
+ HYDRODATA_EXPORT void SetZValue( const double theZValue );
HYDRODATA_EXPORT double ZValue() const;
- /**
- * Sets the wire contour of the object.
- */
- HYDRODATA_EXPORT void SetWire( const TopoDS_Wire& theWire );
-
- /**
- * Returns the wire contour of the object.
- */
- HYDRODATA_EXPORT TopoDS_Wire Wire() const;
-
protected:
+
/**
* Update the wire contour on the basis of the polyline data.
*/
#include "HYDROData_Region.h"
-#include <TNaming_Builder.hxx>
-#include <TNaming_NamedShape.hxx>
-#include <TopoDS.hxx>
+#include "HYDROData_Document.h"
+#include "HYDROData_Iterator.h"
+#include "HYDROData_Zone.h"
-#include <QString>
+#include <QStringList>
#define PYTHON_REGION_ID "KIND_REGION"
-
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Region, HYDROData_Domain)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Domain)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Entity)
HYDROData_Region::HYDROData_Region()
{
}
-void HYDROData_Region::SetFace( const TopoDS_Face& theFace )
+QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList;
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+ if ( aDocument.IsNull() )
+ return aResList;
+
+ QString aDocName = aDocument->GetDocPyName();
+ QString aRegionName = GetName();
+
+ aResList << QString( "%1 = %2.CreateObject( %3 );" )
+ .arg( aRegionName ).arg( aDocName ).arg( PYTHON_REGION_ID );
+ aResList << QString( "%1.SetName( \"%2\" );" )
+ .arg( aRegionName ).arg( aRegionName );
+ aResList << QString( "" );
+
+ HYDROData_SequenceOfObjects aZones = GetZones();
+ HYDROData_SequenceOfObjects::Iterator anIter( aZones );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Zone) aRefZone =
+ Handle(HYDROData_Zone)::DownCast( anIter.Value() );
+ if ( !aRefZone.IsNull() )
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefZone, "AddZone" );
+ }
+ aResList << QString( "" );
+
+ return aResList;
+}
+
+Handle(HYDROData_Zone) HYDROData_Region::AddNewZone()
+{
+ TDF_Label aNewLab = myLab.FindChild( ChildTag_Zone ).NewChild();
+
+ return Handle(HYDROData_Zone)::DownCast(
+ HYDROData_Iterator::CreateObject( aNewLab, KIND_ZONE ) );
+}
+
+void HYDROData_Region::RemoveChildZones()
+{
+ myLab.FindChild( ChildTag_Zone ).ForgetAllAttributes( true );
+}
+
+int HYDROData_Region::NbZones() const
+{
+ return NbReferenceObjects( DataTag_Zone );
+}
+
+void HYDROData_Region::AddZone( const Handle(HYDROData_Zone)& theZone )
{
- TNaming_Builder aBuilder( myLab );
- aBuilder.Generated( theFace );
+ AddReferenceObject( theZone, DataTag_Zone );
}
-TopoDS_Face HYDROData_Region::Face() const
+void HYDROData_Region::SetZone( const int theIndex,
+ const Handle(HYDROData_Zone)& theZone )
{
- Handle(TNaming_NamedShape) aNamedShape;
- if( myLab.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
- return TopoDS::Face( aNamedShape->Get() );
- return TopoDS_Face();
+ SetReferenceObject( theZone, DataTag_Zone, theIndex );
}
-QString HYDROData_Region::getPythonKindId() const
+void HYDROData_Region::InsertZone( const int theBeforeIndex,
+ const Handle(HYDROData_Zone)& theZone )
{
- return QString( PYTHON_REGION_ID );
+ InsertReferenceObject( theZone, DataTag_Zone, theBeforeIndex );
}
+void HYDROData_Region::SetZones( const HYDROData_SequenceOfObjects& theZones )
+{
+ SetReferenceObjects( theZones, DataTag_Zone );
+}
+
+Handle(HYDROData_Zone) HYDROData_Region::GetZone( const int theIndex ) const
+{
+ return Handle(HYDROData_Zone)::DownCast(
+ GetReferenceObject( DataTag_Zone, theIndex ) );
+}
+
+HYDROData_SequenceOfObjects HYDROData_Region::GetZones() const
+{
+ return GetReferenceObjects( DataTag_Zone );
+}
+
+void HYDROData_Region::RemoveZone( const Handle(HYDROData_Zone)& theZone )
+{
+ if ( theZone.IsNull() )
+ return;
+
+ RemoveReferenceObject( theZone->Label(), DataTag_Zone );
+}
+
+void HYDROData_Region::RemoveZone( const int theIndex )
+{
+ RemoveReferenceObject( DataTag_Zone, theIndex );
+}
+
+void HYDROData_Region::RemoveZones()
+{
+ ClearReferenceObjects( DataTag_Zone );
+}
#ifndef HYDROData_Region_HeaderFile
#define HYDROData_Region_HeaderFile
-#include <HYDROData_Domain.h>
+#include "HYDROData_Entity.h"
-DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Domain)
+DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
+class Handle(HYDROData_Zone);
-/**\class HYDROData_Domain
- * \brief Class that stores/retreives information about the 2d surface.
+/**\class HYDROData_Region
+ * \brief Regions are groups (lists) of zones, they can include one or several zones.
*/
-class HYDROData_Region : public HYDROData_Domain
+class HYDROData_Region : public HYDROData_Entity
{
protected:
+
/**
* Enumeration of tags corresponding to the persistent object parameters.
*/
enum DataTag
{
- DataTag_First = HYDROData_Domain::DataTag_First + 100, ///< first tag, to reserve
- DataTag_Face
+ 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
};
public:
HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_REGION; }
/**
- * Sets the shape of the object.
+ * Dump object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+
+ /**
+ * 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.
+ */
+ HYDRODATA_EXPORT virtual void RemoveChildZones();
+
+
+ /**
+ * Returns number of reference zones of region.
+ */
+ int NbZones() 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 void SetFace( const TopoDS_Face& theFace );
+ HYDRODATA_EXPORT virtual void SetZone( const int theIndex,
+ const Handle(HYDROData_Zone)& theZone );
/**
- * Returns the shape of the the object (redefined method).
+ * Inserts the reference zone for region before given index.
*/
- HYDRODATA_EXPORT virtual TopoDS_Face Face() const;
+ 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.
+ */
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZone( const int theIndex ) const;
+
+ /**
+ * Returns all reference zone of region.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetZones() const;
+
+ /**
+ * Removes reference zone from region.
+ */
+ HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone );
+
+ /**
+ * Removes reference zone from region by it index.
+ */
+ HYDRODATA_EXPORT virtual void RemoveZone( const int theIndex );
+
+ /**
+ * Removes all reference zones from region.
+ */
+ HYDRODATA_EXPORT virtual void RemoveZones();
+
protected:
+ friend class HYDROData_Calculation;
friend class HYDROData_Iterator;
/**
* 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
--- /dev/null
+
+#include "HYDROData_SplitToZonesTool.h"
+
+#include "HYDROData_Object.h"
+
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Wire.hxx>
+
+TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const
+{
+ TopoDS_Face aResFace;
+
+ if( !Shape.IsNull() )
+ {
+ if ( Shape.ShapeType() == TopAbs_FACE )
+ {
+ aResFace = TopoDS::Face( Shape );
+ }
+ else if ( Shape.ShapeType() == TopAbs_WIRE )
+ {
+ BRepBuilderAPI_MakeFace aMakeFace( TopoDS::Wire( Shape ), Standard_True );
+ aMakeFace.Build();
+ if( aMakeFace.IsDone() )
+ aResFace = aMakeFace.Face();
+ }
+ }
+
+ return aResFace;
+}
+
+HYDROData_SplitToZonesTool::SplitDataList
+HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList )
+{
+ SplitDataList anOutputSplitDataList;
+
+ // Preparation. Collect the object shapes to split.
+ SplitDataList anInputSplitDataList;
+ for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
+ {
+ Handle(HYDROData_Object) aGeomObj =
+ Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) );
+ if( !aGeomObj.IsNull() )
+ {
+ SplitData aSplitData( aGeomObj->GetTopShape(), aGeomObj->GetName() );
+ anInputSplitDataList.append( aSplitData );
+ }
+ }
+
+ // Step 1. Split the paths.
+ SplitDataListIterator anInputIter( anInputSplitDataList );
+ while( anInputIter.hasNext() )
+ {
+ const SplitData& anInputSplitData = anInputIter.next();
+ if( anOutputSplitDataList.isEmpty() )
+ anOutputSplitDataList.append( anInputSplitData );
+ else
+ {
+ SplitDataList aSplitDataList;
+
+ SplitDataList aSrcSplitDataList;
+ aSrcSplitDataList.append( anInputSplitData );
+
+ SplitDataList aDestSplitDataList = anOutputSplitDataList;
+ anOutputSplitDataList.clear();
+
+ while( !aDestSplitDataList.isEmpty() )
+ {
+ SplitData aSrcSplitData = aSrcSplitDataList.last();
+
+ SplitData aDestSplitData = aDestSplitDataList.first();
+ aDestSplitDataList.pop_front();
+
+ SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
+ if( SplitTwoData( aSrcSplitData, aDestSplitData,
+ aData1Subtracted, aData2Subtracted, aDataIntersected ) )
+ anOutputSplitDataList.append( aDataIntersected );
+ anOutputSplitDataList.append( aData2Subtracted );
+ aSrcSplitDataList.append( aData1Subtracted );
+ }
+
+ if( !aSrcSplitDataList.isEmpty() )
+ anOutputSplitDataList.append( aSrcSplitDataList.last() );
+ }
+ }
+
+ // Step 2. Take into account the boundary polyline.
+ /*
+ if( !thePolyline.IsNull() )
+ {
+ TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetTopShape() );
+ if( !aWire.IsNull() )
+ {
+ BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
+ aMakeFace.Build();
+ if( aMakeFace.IsDone() )
+ {
+ SplitData aBoundarySplitData( aMakeFace.Face(), "" );
+
+ SplitDataList aCutSplitDataList;
+ SplitDataListIterator anOutputIter( anOutputSplitDataList );
+ while( anOutputIter.hasNext() )
+ {
+ const SplitData& anOutputSplitData = anOutputIter.next();
+
+ SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
+ if( SplitTwoData( anOutputSplitData, aBoundarySplitData,
+ aData1Subtracted, aData2Subtracted, aDataIntersected ) )
+ aCutSplitDataList.append( aDataIntersected );
+ }
+ anOutputSplitDataList = aCutSplitDataList;
+ }
+ }
+ }
+ */
+
+ // Step 3. Extract the separate regions.
+ SplitDataList anExtractedSplitDataList;
+ SplitDataListIterator anOutputIter( anOutputSplitDataList );
+ while( anOutputIter.hasNext() )
+ {
+ const SplitData& anOutputSplitData = anOutputIter.next();
+ anExtractedSplitDataList.append( ExtractSeparateData( anOutputSplitData ) );
+ }
+
+ return anExtractedSplitDataList;
+}
+
+bool HYDROData_SplitToZonesTool::SplitTwoData( const SplitData& theData1,
+ const SplitData& theData2,
+ SplitData& theData1Subtracted,
+ SplitData& theData2Subtracted,
+ SplitData& theDataIntersected )
+{
+ const TopoDS_Shape& aShape1 = theData1.Shape;
+ const TopoDS_Shape& aShape2 = theData2.Shape;
+
+ const QStringList& anObjectNames1 = theData1.ObjectNames;
+ const QStringList& anObjectNames2 = theData2.ObjectNames;
+
+ BRepAlgoAPI_Common aCommon( aShape1, aShape2 );
+ TopoDS_Shape aCommonShape = aCommon.Shape();
+ if( aCommonShape.IsNull() )
+ {
+ theData1Subtracted = theData1;
+ theData2Subtracted = theData2;
+ return false;
+ }
+
+ BRepAlgoAPI_Cut aCut1( aShape1, aShape2 );
+ TopoDS_Shape aCut1Shape = aCut1.Shape();
+
+ BRepAlgoAPI_Cut aCut2( aShape2, aShape1 );
+ TopoDS_Shape aCut2Shape = aCut2.Shape();
+
+ theData1Subtracted = SplitData( aCut1Shape, anObjectNames1 );
+ theData2Subtracted = SplitData( aCut2Shape, anObjectNames2 );
+ theDataIntersected = SplitData( aCommonShape, anObjectNames1 + anObjectNames2 );
+
+ return true;
+}
+
+HYDROData_SplitToZonesTool::SplitDataList
+HYDROData_SplitToZonesTool::ExtractSeparateData( const SplitData& theData )
+{
+ SplitDataList aSplitDataList;
+ TopExp_Explorer anExp( theData.Shape, TopAbs_FACE );
+ for( ; anExp.More(); anExp.Next() )
+ {
+ TopoDS_Shape aShape = anExp.Current();
+ if( aShape.ShapeType() == TopAbs_FACE )
+ {
+ TopoDS_Face aFace = TopoDS::Face( aShape );
+ if( !aFace.IsNull() )
+ {
+ SplitData aSplitData( aFace, theData.ObjectNames );
+ aSplitDataList.append( aSplitData );
+ }
+ }
+ }
+ return aSplitDataList;
+}
--- /dev/null
+
+#ifndef HYDROData_SplitToZonesTool_H
+#define HYDROData_SplitToZonesTool_H
+
+#include <HYDROData_Object.h>
+
+#include <TopoDS_Face.hxx>
+
+#include <QStringList>
+
+class Handle(HYDROData_Polyline);
+
+/**
+ * \class HYDROData_SplitToZonesTool
+ * \brief This class contains methods used for splitting geometry objects
+ * into non-intersected regions.
+ */
+class HYDRODATA_EXPORT HYDROData_SplitToZonesTool
+{
+public:
+ struct HYDRODATA_EXPORT SplitData
+ {
+ TopoDS_Shape Shape;
+ QStringList ObjectNames;
+
+ SplitData() {}
+
+ SplitData( const TopoDS_Shape& theShape,
+ const QStringList& theObjectNames ) :
+ Shape( theShape ), ObjectNames( theObjectNames ) {}
+
+ SplitData( const TopoDS_Shape& theShape,
+ const QString& theObjectNames ) :
+ Shape( theShape ), ObjectNames( theObjectNames ) {}
+
+ TopoDS_Face Face() const;
+ };
+
+ typedef QList <SplitData> SplitDataList;
+ typedef QListIterator<SplitData> SplitDataListIterator;
+
+public:
+
+ static SplitDataList SplitToZones( const HYDROData_SequenceOfObjects& theObjectList );
+
+private:
+
+ static bool SplitTwoData( const SplitData& theData1,
+ const SplitData& theData2,
+ SplitData& theData1Subtracted,
+ SplitData& theData2Subtracted,
+ SplitData& theDataIntersected );
+
+ static SplitDataList ExtractSeparateData( const SplitData& theData );
+
+};
+
+#endif
}
void HYDROData_Tool::SetMustBeUpdatedImages(
- Handle_HYDROData_Document theDoc)
+ const Handle(HYDROData_Document)& theDoc )
{
bool aChanged = true;
}
}
}
+
+QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
+ const QString& thePrefix,
+ const QStringList& theUsedNames )
+{
+ QStringList aNamesList( theUsedNames );
+
+ // Collect all used names in the document
+ HYDROData_Iterator anIter( theDoc );
+ for( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Entity) anObject = anIter.Current();
+ if( anObject.IsNull() )
+ continue;
+
+ QString anObjName = anObject->GetName();
+ if ( anObjName.isEmpty() )
+ continue;
+
+ aNamesList.append( anObjName );
+ }
+
+ QString aName;
+
+ int anId = 1;
+ while( anId < 1000 )
+ {
+ aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) );
+
+ // check that there are no other objects with the same name in the document
+ if ( !aNamesList.contains( aName ) )
+ break;
+ }
+
+ return aName;
+}
+
+Handle(HYDROData_Entity) HYDROData_Tool::FindObjectByName( const Handle(HYDROData_Document)& theDoc,
+ const QString& theName,
+ const ObjectKind theObjectKind )
+{
+ Handle(HYDROData_Entity) anObject;
+ if ( theName.isEmpty() || theDoc.IsNull() )
+ return anObject;
+
+ QStringList aNamesList;
+ aNamesList << theName;
+
+ HYDROData_SequenceOfObjects aSeqOfObjs = FindObjectsByNames( theDoc, aNamesList, theObjectKind );
+ if( aSeqOfObjs.IsEmpty() )
+ return anObject;
+
+ anObject = aSeqOfObjs.First();
+ return anObject;
+}
+
+HYDROData_SequenceOfObjects HYDROData_Tool::FindObjectsByNames( const Handle(HYDROData_Document)& theDoc,
+ const QStringList& theNames,
+ const ObjectKind theObjectKind )
+{
+ HYDROData_SequenceOfObjects aResSeq;
+ if( theDoc.IsNull() )
+ return aResSeq;
+
+ QStringList aNamesList = theNames;
+
+ HYDROData_Iterator anIter( theDoc, theObjectKind );
+ for( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Entity) anObject = anIter.Current();
+ if( anObject.IsNull() )
+ continue;
+
+ QString anObjName = anObject->GetName();
+ if ( anObjName.isEmpty() || !aNamesList.contains( anObjName ) )
+ continue;
+
+ aResSeq.Append( anObject );
+
+ aNamesList.removeAll( anObjName );
+ if ( aNamesList.isEmpty() )
+ break;
+ }
+
+ return aResSeq;
+}
+
#ifndef HYDROData_Tool_HeaderFile
#define HYDROData_Tool_HeaderFile
+#include "HYDROData.h"
+#include "HYDROData_Entity.h"
+
#include <Precision.hxx>
#include <QString>
+#include <QStringList>
class QFile;
-class QStringList;
-class Handle_HYDROData_Document;
+class Handle(HYDROData_Document);
-class HYDROData_Tool {
+class HYDRODATA_EXPORT HYDROData_Tool {
public:
* Enables "MustBeUpdated" flag for Images that are depended on "MustBeUpdated" images.
* \param theDoc document where this operation is performed
*/
- static void SetMustBeUpdatedImages( Handle_HYDROData_Document theDoc );
+ static void SetMustBeUpdatedImages( const Handle(HYDROData_Document)& theDoc );
+ /**
+ * \brief Generate name for new object.
+ * \param theModule module
+ * \param thePrefix name prefix
+ * \param theUsedNames list of already used names
+ * \return generated name
+ */
+ static QString GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
+ const QString& thePrefix,
+ const QStringList& theUsedNames = QStringList() );
+
+ /**
+ * \brief Find the data object with the specified name.
+ * \param theModule module
+ * \param theName name
+ * \param theObjectKind kind of object
+ * \return data object
+ */
+ static Handle(HYDROData_Entity) FindObjectByName( const Handle(HYDROData_Document)& theDoc,
+ const QString& theName,
+ const ObjectKind theObjectKind = KIND_UNKNOWN );
+
+ /**
+ * \brief Find the data objects with the specified names.
+ * \param theModule module
+ * \param theNames list of names
+ * \param theObjectKind kind of object
+ * \return list of data objects
+ */
+ static HYDROData_SequenceOfObjects FindObjectsByNames( const Handle(HYDROData_Document)& theDoc,
+ const QStringList& theNames,
+ const ObjectKind theObjectKind = KIND_UNKNOWN );
};
inline bool ValuesEquals( const double& theFirst, const double& theSecond )
+
#include <HYDROData_VisualState.h>
#include <TDataStd_AsciiString.hxx>
-IMPLEMENT_STANDARD_HANDLE(HYDROData_VisualState, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_VisualState, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_VisualState, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_VisualState, HYDROData_Entity)
HYDROData_VisualState::HYDROData_VisualState()
+: HYDROData_Entity()
{
}
+
#ifndef HYDROData_VisualState_HeaderFile
#define HYDROData_VisualState_HeaderFile
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <QString>
-DEFINE_STANDARD_HANDLE(HYDROData_VisualState, HYDROData_Object)
+DEFINE_STANDARD_HANDLE(HYDROData_VisualState, HYDROData_Entity)
/**\class HYDROData_VisualState
* \brief Class that stores/retreives information about the visual state.
*
* Keeps the visual state as encoded text string.
*/
-class HYDROData_VisualState : public HYDROData_Object
+class HYDROData_VisualState : public HYDROData_Entity
{
protected:
/**
*/
enum DataTag
{
- DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_State ///< encoded visual state
};
#include "HYDROData_Zone.h"
-#include "HYDROData_Bathymetry.h"
#include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
-#include "HYDROData_Iterator.h"
+#include "HYDROData_Object.h"
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <TDataStd_IntegerArray.hxx>
-#include <TopoDS_Wire.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
+#include <TopoDS_Shape.hxx>
-#include <QColor>
#include <QStringList>
#define PYTHON_ZONE_ID "KIND_ZONE"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Domain)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
+
HYDROData_Zone::HYDROData_Zone()
+: HYDROData_Entity()
{
}
QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
- QStringList aResList = HYDROData_Domain::DumpToPython( theTreatedObjects );
- if ( aResList.isEmpty() )
+ 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( PYTHON_ZONE_ID );
+ aResList << QString( "%1.SetName( \"%2\" );" )
+ .arg( aZoneName ).arg( aZoneName );
aResList << QString( "" );
- Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
- setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
+ HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
+ for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
+ {
+ Handle(HYDROData_Object) aRefGeomObj =
+ Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
+ if ( !aRefGeomObj.IsNull() )
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
+ }
+
+ // How can we get the shape? Mb Update() method to intersect the shapes of reference objects?
+ // TODO: TopoDS_Shape aRefShape = GetShape();
return aResList;
}
-void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_Zone::SetShape( const TopoDS_Shape& theShape )
{
- SetReferenceObject( thePolyline, DataTag_Polyline );
+ TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape ) );
+ aBuilder.Generated( theShape );
}
-Handle(HYDROData_Polyline) HYDROData_Zone::GetPolyline() const
+TopoDS_Shape HYDROData_Zone::GetShape() const
{
- return Handle(HYDROData_Polyline)::DownCast(
- GetReferenceObject( DataTag_Polyline ) );
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( myLab.FindChild( DataTag_Shape ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ return TopoDS_Shape();
}
-void HYDROData_Zone::RemovePolyline()
+int HYDROData_Zone::NbGeometryObjects() const
{
- ClearReferenceObjects( DataTag_Polyline );
+ return NbReferenceObjects( DataTag_GeometryObject );
}
-TopoDS_Face HYDROData_Zone::Face() const
+void HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
{
- Handle(HYDROData_Polyline) aPolyline = GetPolyline();
- if( !aPolyline.IsNull() )
- {
- TopoDS_Wire aWire = aPolyline->Wire();
- if( !aWire.IsNull() )
- {
- BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
- aMakeFace.Build();
- if( aMakeFace.IsDone() )
- return aMakeFace.Face();
- }
- }
- return TopoDS_Face();
+ AddReferenceObject( theObject, DataTag_GeometryObject );
+}
+
+void HYDROData_Zone::SetGeometryObject( const int theIndex,
+ const Handle(HYDROData_Object)& theObject )
+{
+ SetReferenceObject( theObject, DataTag_GeometryObject, theIndex );
+}
+
+void HYDROData_Zone::SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects )
+{
+ SetReferenceObjects( theObjects, DataTag_GeometryObject );
}
-QString HYDROData_Zone::getPythonKindId() const
+Handle(HYDROData_Object) HYDROData_Zone::GetGeometryObject( const int theIndex ) const
{
- return QString( PYTHON_ZONE_ID );
+ return Handle(HYDROData_Object)::DownCast(
+ GetReferenceObject( DataTag_GeometryObject, theIndex ) );
}
+HYDROData_SequenceOfObjects HYDROData_Zone::GetGeometryObjects() const
+{
+ return GetReferenceObjects( DataTag_GeometryObject );
+}
+
+void HYDROData_Zone::RemoveGeometryObjects()
+{
+ ClearReferenceObjects( DataTag_GeometryObject );
+}
+
+
#ifndef HYDROData_Zone_HeaderFile
#define HYDROData_Zone_HeaderFile
-#include <HYDROData_Domain.h>
+#include <HYDROData_Entity.h>
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_Object);
+class TopoDS_Shape;
-DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
+DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
/**\class HYDROData_Zone
* \brief Class that stores/retreives information about the 2d face.
*/
-class HYDROData_Zone : public HYDROData_Domain
+class HYDROData_Zone : public HYDROData_Entity
{
protected:
*/
enum DataTag
{
- DataTag_First = HYDROData_Domain::DataTag_First + 100, ///< first tag, to reserve
- DataTag_Polyline, ///< reference polyline
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_Shape, ///< reference shape
+ DataTag_GeometryObject, ///< reference geometry objects
};
public:
/**
- * Sets reference polyline object for zone.
+ * Sets the shape of the zone.
*/
- HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+ HYDRODATA_EXPORT virtual void SetShape( const TopoDS_Shape& theShape );
/**
- * Returns reference polyline object of zone.
+ * Returns the shape of the zone.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetPolyline() const;
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
+
+
+ /**
+ * Returns number of geometry objects for zone.
+ */
+ HYDRODATA_EXPORT virtual int NbGeometryObjects() const;
/**
- * Remove reference polyline object of zone.
+ * Add new one geometry object for zone.
*/
- HYDRODATA_EXPORT virtual void RemovePolyline();
+ HYDRODATA_EXPORT virtual void AddGeometryObject( const Handle(HYDROData_Object)& theObject );
+ /**
+ * Replace the geometry object for zone.
+ */
+ HYDRODATA_EXPORT virtual void SetGeometryObject( const int theIndex,
+ const Handle(HYDROData_Object)& theObject );
/**
- * Returns data of object wrapped to QVariant.
- * Reimplemented to wrap and return saved 2d polyline.
+ * Sets the geometry object for zone.
*/
- //HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+ HYDRODATA_EXPORT virtual void SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects );
/**
- * Returns the shape of the the object (redefined method).
+ * Returns geometry object of zone by index.
*/
- HYDRODATA_EXPORT TopoDS_Face Face() const;
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Object) GetGeometryObject( const int theIndex ) const;
+
+ /**
+ * Returns all geometry objects of zone.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
+
+ /**
+ * Removes all geometry objects from zone.
+ */
+ HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
+
protected:
+ friend class HYDROData_Region;
friend class HYDROData_Iterator;
/**
*/
~HYDROData_Zone();
- /**
- * Returns id for creation of object in python scripting.
- */
- virtual QString getPythonKindId() const;
};
#endif
+++ /dev/null
-#include<HYDROOperations_BSpline.h>
-
-#include<TColgp_HArray1OfPnt.hxx>
-#include<GeomAPI_Interpolate.hxx>
-#include<GeomConvert_BSplineCurveToBezierCurve.hxx>
-#include<Geom_BezierCurve.hxx>
-
-HYDROOperations_BSpline::HYDROOperations_BSpline(
- const QList<double>& thePoints,
- const double theZValue,
- const bool theIsClosed)
-{
- // fill array for algorithm by the received coordinates
- int aLen = thePoints.size() / 2;
- Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen);
- QList<double>::const_iterator aListIter = thePoints.begin();
- for (int ind = 1; ind <= aLen; ind++) {
- gp_Pnt aPnt(gp::Origin());
- aPnt.SetX(*aListIter);
- aListIter++;
- aPnt.SetY(*aListIter);
- aListIter++;
- aPnt.SetZ(theZValue);
- aHCurvePoints->SetValue(ind, aPnt);
- }
- // compute BSpline
- GeomAPI_Interpolate aGBC(aHCurvePoints, theIsClosed, gp::Resolution());
- aGBC.Perform();
- if (aGBC.IsDone()) {
- myCurve = aGBC.Curve();
- }
-}
-
-QPainterPath HYDROOperations_BSpline::ComputePath() const
-{
- QPainterPath aResult;
- if (myCurve.IsNull()) // returns an empty Path if original curve is invalid
- return aResult;
- GeomConvert_BSplineCurveToBezierCurve aConverter(myCurve);
- int a, aNumArcs = aConverter.NbArcs();
- for(a = 1; a <= aNumArcs; a++) {
- Handle(Geom_BezierCurve) anArc = aConverter.Arc(a);
- if (a == 1) { // set a start point
- gp_Pnt aStart = anArc->StartPoint();
- aResult.moveTo(aStart.X(), aStart.Y());
- }
- gp_Pnt anEnd = anArc->EndPoint();
- if (anArc->NbPoles() == 3) { // quadric segment in the path (pole 1 is start, pole 3 is end)
- gp_Pnt aPole = anArc->Pole(2);
- aResult.quadTo(aPole.X(), aPole.Y(), anEnd.X(), anEnd.Y());
- } else if (anArc->NbPoles() == 4) { // cubic segment (usually this is used)
- gp_Pnt aPole1 = anArc->Pole(2);
- gp_Pnt aPole2 = anArc->Pole(3);
- aResult.cubicTo(
- aPole1.X(), aPole1.Y(), aPole2.X(), aPole2.Y(), anEnd.X(), anEnd.Y());
- } else { // error, another number of poles is not supported
- return QPainterPath();
- }
- }
- return aResult;
-}
+++ /dev/null
-#ifndef HYDROOperations_BSpline_HeaderFile
-#define HYDROOperations_BSpline_HeaderFile
-
-#include <HYDROData.h>
-#include <QList>
-#include <QPainterPath>
-#include <Geom_BSplineCurve.hxx>
-
-/**\class HYDROOperations_BSpline
- *
- * \brief Allows to work with splines: create, convert to Qt ToolPath.
- *
- * Uses GEOM module for creation of BSplines, OCCT algorithms for
- * manipulation and conversion.
- */
-
-class HYDRODATA_EXPORT HYDROOperations_BSpline
-{
-public:
-
- //! Creates a spline by list of coordinates: pairs X and Y
- //! \param thePoints coordinates in format X1, Y1, X2, Y2, etc. must be even number of elements
- //! \param theZValue constant value of the spline Z coordinate
- //! \param theIsClosed flag indicating that the result spline should be closed
- HYDROOperations_BSpline(const QList<double>& thePoints,
- const double theZValue,
- const bool theIsClosed);
-
- //! Returns the BSpline curve passing through the points
- //! \returns Null if Computation of BSpline was failed
- Handle(Geom_BSplineCurve) Curve() const {return myCurve;}
-
- //! Performs conversion from BSpline curve to QPainterPath made from Bezier curves
- //! \returns computed PainterPath, not stored in this class, so calling of this method is not fast
- QPainterPath ComputePath() const;
-private:
- Handle(Geom_BSplineCurve) myCurve; ///< resulting BSpline, null if something is wrong
-};
-
-#endif
+++ /dev/null
-#include<HYDROOperations_Factory.h>
-
-#include<HYDROData_Document.h>
-#include<HYDROData_Iterator.h>
-
-#include<ImageComposer_ColorMaskOperator.h>
-#include<ImageComposer_CropOperator.h>
-#include<ImageComposer_CutOperator.h>
-#include<ImageComposer_FuseOperator.h>
-
-#include <typeinfo>
-
-// global instance
-HYDROOperations_Factory* FACTORY = 0;
-
-HYDROOperations_Factory* HYDROOperations_Factory::Factory()
-{
- if (!FACTORY) {
- FACTORY = new HYDROOperations_Factory;
- // default operations
- REGISTER_HYDRO_OPERATION(ImageComposer_ColorMaskOperator)
- REGISTER_HYDRO_OPERATION(ImageComposer_CropOperator)
- REGISTER_HYDRO_OPERATION(ImageComposer_CutOperator)
- REGISTER_HYDRO_OPERATION(ImageComposer_FuseOperator)
- }
- return FACTORY;
-}
-
-void HYDROOperations_Factory::Register(
- ImageComposer_Operator* theOperator)
-{
- if ( !theOperator )
- return;
-
- FACTORY->myOps[ theOperator->name() ] = theOperator;
-}
-
-HYDROOperations_Factory::HYDROOperations_Factory()
-{
-}
-
-ImageComposer_Operator* HYDROOperations_Factory::Operator(
- Handle(HYDROData_Image) theImage ) const
-{
- // retreive operator instance by name
- ImageComposer_Operator* anOp = Operator( theImage->OperatorName() );
- if ( !anOp )
- return anOp;
-
- // fill arguments of the operator from theImage
- anOp->setBinArgs( theImage->Args() );
-
- return anOp;
-}
-
-ImageComposer_Operator* HYDROOperations_Factory::Operator(const QString theName) const
-{
- return myOps.contains( theName ) ? myOps[ theName ] : NULL;
-}
-
-Handle(HYDROData_Image) HYDROOperations_Factory::CreateImage(
- Handle(HYDROData_Document) theDoc, const ImageComposer_Operator* theOperator)
-{
- // create an object
- Handle(HYDROData_Image) anImage =
- Handle(HYDROData_Image)::DownCast(theDoc->CreateObject(KIND_IMAGE));
- // get data from operation
- if (theOperator) {
- anImage->SetOperatorName( theOperator->name() );
- anImage->SetArgs( theOperator->getBinArgs() );
- }
- return anImage;
-}
+++ /dev/null
-#ifndef HYDROOperations_Factory_HeaderFile
-#define HYDROOperations_Factory_HeaderFile
-
-#include <HYDROData.h>
-#include <HYDROData_Image.h>
-#include <QMap>
-
-class ImageComposer_Operator;
-class Handle_HYDROData_Document;
-
-/**\class HYDROOperations_Factory
- *
- * \brief This class provides the unified management of operations on images.
- *
- * Object is created as one global instance and allows to register and launch
- * all registered operations in general way. To register a new operation just
- * call REGISTER_HYDRO_OPERATION(operation_name) in some method implementation.
- * This macro will call constructor of this operation (it must inherit
- * ImageComposer_Operator) and factory will set up arguments and call this
- * operator by demand.
- */
-
-class HYDROOperations_Factory
-{
-public:
-
- //! Returns the global factory
- HYDRODATA_EXPORT static HYDROOperations_Factory* Factory();
-
- /**
- * Registers the operator by the name, used by REGISTER_HYDRO_OPERATION macro
- * \param theOperator new instance of the operator that will be used for
- * processing of operation with such kind
- */
- HYDRODATA_EXPORT static void Register(
- ImageComposer_Operator* theOperator);
-
- /**
- * Creates a new Image object in the data structure by the operator data.
- * \param theDoc document where it must be created
- * \param theOperator base operator for this Image: will be used in "Update" to recompute the image
- * \returns created object related to the data structure
- */
- HYDRODATA_EXPORT Handle(HYDROData_Image) CreateImage(
- Handle_HYDROData_Document theDoc, const ImageComposer_Operator* theOperator);
-
- /**
- * Returns the operator, initialized by the properties of theImage
- * \param theImage data structures object, that contains all arguments
- * required for creation of operation
- * \returns NULL if operator type is unknown
- */
- HYDRODATA_EXPORT ImageComposer_Operator* Operator(
- Handle(HYDROData_Image) theImage) const;
-
-
- /**
- * Returns the appropriate operator by the name
- * \param theName name of the operator, equals to the operation_name constructor
- * \returns NULL if operator with such name is not registered yet
- */
- HYDRODATA_EXPORT ImageComposer_Operator* Operator(const QString theName) const;
-
-protected:
-
- //! Not public constructor that creates only one, global instance of this factory.
- HYDROOperations_Factory();
-
-private:
- //! Map that stores all operators, isentified by strings
- typedef QMap<QString, ImageComposer_Operator*> FactoryOperators;
-
- FactoryOperators myOps; ///< all operators stored by a factory
-};
-
-/**
- * Macro that is used for registered operators, see C++ of this class to see
- * example of hte registration.
- */
-#define REGISTER_HYDRO_OPERATION(operation_name) \
- HYDROOperations_Factory::Factory()->Register(new operation_name);
-
-#endif
--- /dev/null
+#include<test_HYDROData_BSplineOperation.h>
+
+#include <HYDROData_BSplineOperation.h>
+#include <gp_Pnt.hxx>
+#include <QTransform>
+
+void test_HYDROData_BSplineOperation::testCurve()
+{
+ // prepare points: function of sin(x)
+ QList<double> aPoints;
+ double x;
+ for(x = 0; x < 6.28; x += 0.1)
+ aPoints<<x<<sin(x);
+ // compute BSpline
+ HYDROData_BSplineOperation aBSpline(aPoints, 0, false);
+ Handle(Geom_BSplineCurve) aBS = aBSpline.Curve();
+ CPPUNIT_ASSERT(!aBS.IsNull());
+ CPPUNIT_ASSERT(!aBS->IsClosed());
+ CPPUNIT_ASSERT_EQUAL(aBS->Continuity(), GeomAbs_C2);
+ // check that values of BSpline are not far from original "sin" function
+ // in all points of the curve
+ for(x = 0; x < 6.29; x += 0.001) {
+ double aDiff = aBS->Value(x).Y() - sin(aBS->Value(x).X());
+ if (aDiff < 0) aDiff = -aDiff;
+ CPPUNIT_ASSERT(aDiff < 3.e-6); // this number is found manually
+ }
+}
+
+void test_HYDROData_BSplineOperation::testPath()
+{
+ // prepare points: function of sin(x)
+ static const double aScale = 10000000.;
+ QList<double> aPoints;
+ double x;
+ for(x = 0; x < 6.28; x += 0.1)
+ aPoints<<x*aScale<<sin(x) * aScale;
+ // convert to QPainterPath
+ HYDROData_BSplineOperation aBSpline(aPoints, 0, false);
+ CPPUNIT_ASSERT(!aBSpline.Curve().IsNull());
+ QPainterPath aPath = aBSpline.ComputePath();
+ CPPUNIT_ASSERT(!aPath.isEmpty());
+
+ /*
+ QImage aPic(1300, 600, QImage::Format_RGB32);
+ QPainter aPainter(&aPic);
+ aPainter.setBrush(QBrush(Qt::white));
+ aPainter.drawPath(aPath);
+ aPic.save("pic.bmp");
+ */
+
+ // check that values of Path are not far from original "sin" function
+ // in all points of the curve
+ QList<QPolygonF> aPolyF = aPath.toSubpathPolygons(QTransform());
+ QList<QPolygonF>::iterator aFIter = aPolyF.begin();
+ for(; aFIter != aPolyF.end();aFIter++) {
+ QPolygon aPoly = aFIter->toPolygon();
+ QPolygon::iterator aPoints = aPoly.begin();
+ for(; aPoints != aPoly.end(); aPoints++) {
+ double aDiff = aPoints->y() / aScale - sin(aPoints->x() / aScale);
+ if (aDiff < 0) aDiff = -aDiff;
+ CPPUNIT_ASSERT(aDiff < 4.e-6); // this number is found manually
+ }
+ }
+}
--- /dev/null
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_BSplineOperation : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(test_HYDROData_BSplineOperation);
+ CPPUNIT_TEST(testCurve);
+ CPPUNIT_TEST(testPath);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+ void setUp() {}
+
+ void tearDown() {}
+
+ // checks generation of BSpline curve by points
+ void testCurve();
+
+ // checks generation of QPainterPath
+ void testPath();
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_BSplineOperation);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_BSplineOperation, "HYDROData_BSplineOperation");
--- /dev/null
+#include <test_HYDROData_OperationsFactory.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Image.h>
+#include <HYDROData_Polyline.h>
+#include <HYDROData_OperationsFactory.h>
+
+#include <ImageComposer_CropOperator.h>
+
+#include <QPainter>
+
+void test_HYDROData_OperationsFactory::testCreate()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
+ CPPUNIT_ASSERT(aFactory);
+ Handle(HYDROData_Image) anImage = aFactory->CreateImage(aDoc, NULL);
+ CPPUNIT_ASSERT(!anImage.IsNull());
+ CPPUNIT_ASSERT(anImage->Image().isNull());
+
+ aDoc->Close();
+}
+
+static QImage TestImage() {
+ QImage aPic(50, 40, QImage::Format_RGB32);
+ aPic.fill(Qt::white);
+ QPainter aPainter(&aPic);
+ aPainter.drawEllipse(6, 7, 38, 30);
+ aPainter.drawLine(0, 40, 10, 0);
+ aPainter.drawLine(10, 0, 25, 35);
+ aPainter.drawLine(25, 35, 40, 0);
+ aPainter.drawLine(40, 0, 50, 40);
+ return aPic;
+}
+
+void test_HYDROData_OperationsFactory::testCrop()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+ HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
+
+ // prepare the original image and crop-path
+ Handle(HYDROData_Image) anOriImage =
+ Handle(HYDROData_Image)::DownCast( aDoc->CreateObject( KIND_IMAGE ) );
+
+ QImage aTestImage = TestImage();
+ anOriImage->SetImage( aTestImage );
+
+ Handle(HYDROData_Polyline) aCropPolyline =
+ Handle(HYDROData_Polyline)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) );
+
+ HYDROData_Polyline::PolylineData aPolylineData;
+
+ PolylineSection aPolylineSect;
+
+ aPolylineSect.myCoords << 25 << 0 << 0;
+ aPolylineSect.myCoords << 0 << 20 << 0;
+ aPolylineSect.myCoords << 25 << 40 << 0;
+ aPolylineSect.myCoords << 50 << 20 << 0;
+
+ aPolylineData << aPolylineSect;
+
+ aCropPolyline->setPolylineData( aPolylineData );
+
+ // prepare Composer Operation
+ ImageComposer_Operator* aCropOp =
+ aFactory->Operator( ImageComposer_CropOperator::Type() );
+
+ CPPUNIT_ASSERT( aCropOp );
+
+ aCropOp->setArgs( Qt::red );
+
+ // create crop - image
+ Handle(HYDROData_Image) aCropImage = aFactory->CreateImage( aDoc, aCropOp );
+ CPPUNIT_ASSERT( !aCropImage.IsNull() );
+
+ aCropImage->AppendReference( anOriImage );
+ aCropImage->AppendReference( aCropPolyline );
+ aCropImage->Update();
+
+ // check crop operation was performed
+ CPPUNIT_ASSERT( !aCropImage->Image().isNull() );
+ CPPUNIT_ASSERT( aCropImage->Image() != aTestImage );
+
+ aDoc->Close();
+}
--- /dev/null
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_OperationsFactory : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(test_HYDROData_OperationsFactory);
+ CPPUNIT_TEST(testCreate);
+ CPPUNIT_TEST(testCrop);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+ void setUp() {}
+
+ void tearDown() {}
+
+ // checks creation of images using null operators
+ void testCreate();
+
+ // checks creation of images using crop operator
+ void testCrop();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_OperationsFactory);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_OperationsFactory, "HYDROData_OperationsFactory");
+++ /dev/null
-#include<test_HYDROOperations_BSpline.h>
-
-#include <HYDROOperations_BSpline.h>
-#include <gp_Pnt.hxx>
-#include <QTransform>
-
-void test_HYDROOperations_BSpline::testCurve()
-{
- // prepare points: function of sin(x)
- QList<double> aPoints;
- double x;
- for(x = 0; x < 6.28; x += 0.1)
- aPoints<<x<<sin(x);
- // compute BSpline
- HYDROOperations_BSpline aBSpline(aPoints, 0, false);
- Handle(Geom_BSplineCurve) aBS = aBSpline.Curve();
- CPPUNIT_ASSERT(!aBS.IsNull());
- CPPUNIT_ASSERT(!aBS->IsClosed());
- CPPUNIT_ASSERT_EQUAL(aBS->Continuity(), GeomAbs_C2);
- // check that values of BSpline are not far from original "sin" function
- // in all points of the curve
- for(x = 0; x < 6.29; x += 0.001) {
- double aDiff = aBS->Value(x).Y() - sin(aBS->Value(x).X());
- if (aDiff < 0) aDiff = -aDiff;
- CPPUNIT_ASSERT(aDiff < 3.e-6); // this number is found manually
- }
-}
-
-void test_HYDROOperations_BSpline::testPath()
-{
- // prepare points: function of sin(x)
- static const double aScale = 10000000.;
- QList<double> aPoints;
- double x;
- for(x = 0; x < 6.28; x += 0.1)
- aPoints<<x*aScale<<sin(x) * aScale;
- // convert to QPainterPath
- HYDROOperations_BSpline aBSpline(aPoints, 0, false);
- CPPUNIT_ASSERT(!aBSpline.Curve().IsNull());
- QPainterPath aPath = aBSpline.ComputePath();
- CPPUNIT_ASSERT(!aPath.isEmpty());
-
- /*
- QImage aPic(1300, 600, QImage::Format_RGB32);
- QPainter aPainter(&aPic);
- aPainter.setBrush(QBrush(Qt::white));
- aPainter.drawPath(aPath);
- aPic.save("pic.bmp");
- */
-
- // check that values of Path are not far from original "sin" function
- // in all points of the curve
- QList<QPolygonF> aPolyF = aPath.toSubpathPolygons(QTransform());
- QList<QPolygonF>::iterator aFIter = aPolyF.begin();
- for(; aFIter != aPolyF.end();aFIter++) {
- QPolygon aPoly = aFIter->toPolygon();
- QPolygon::iterator aPoints = aPoly.begin();
- for(; aPoints != aPoly.end(); aPoints++) {
- double aDiff = aPoints->y() / aScale - sin(aPoints->x() / aScale);
- if (aDiff < 0) aDiff = -aDiff;
- CPPUNIT_ASSERT(aDiff < 4.e-6); // this number is found manually
- }
- }
-}
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROOperations_BSpline : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(test_HYDROOperations_BSpline);
- CPPUNIT_TEST(testCurve);
- CPPUNIT_TEST(testPath);
- CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
- void setUp() {}
-
- void tearDown() {}
-
- // checks generation of BSpline curve by points
- void testCurve();
-
- // checks generation of QPainterPath
- void testPath();
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROOperations_BSpline);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROOperations_BSpline, "HYDROOperations_BSpline");
+++ /dev/null
-#include <test_HYDROOperations_Factory.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
-#include <HYDROOperations_Factory.h>
-
-#include <ImageComposer_CropOperator.h>
-
-#include <QPainter>
-
-void test_HYDROOperations_Factory::testCreate()
-{
- Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
- HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
- CPPUNIT_ASSERT(aFactory);
- Handle(HYDROData_Image) anImage = aFactory->CreateImage(aDoc, NULL);
- CPPUNIT_ASSERT(!anImage.IsNull());
- CPPUNIT_ASSERT(anImage->Image().isNull());
-
- aDoc->Close();
-}
-
-static QImage TestImage() {
- QImage aPic(50, 40, QImage::Format_RGB32);
- aPic.fill(Qt::white);
- QPainter aPainter(&aPic);
- aPainter.drawEllipse(6, 7, 38, 30);
- aPainter.drawLine(0, 40, 10, 0);
- aPainter.drawLine(10, 0, 25, 35);
- aPainter.drawLine(25, 35, 40, 0);
- aPainter.drawLine(40, 0, 50, 40);
- return aPic;
-}
-
-void test_HYDROOperations_Factory::testCrop()
-{
- Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
- HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
-
- // prepare the original image and crop-path
- Handle(HYDROData_Image) anOriImage =
- Handle(HYDROData_Image)::DownCast( aDoc->CreateObject( KIND_IMAGE ) );
-
- QImage aTestImage = TestImage();
- anOriImage->SetImage( aTestImage );
-
- Handle(HYDROData_Polyline) aCropPolyline =
- Handle(HYDROData_Polyline)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) );
-
- HYDROData_Polyline::PolylineData aPolylineData;
-
- PolylineSection aPolylineSect;
-
- aPolylineSect.myCoords << 25 << 0 << 0;
- aPolylineSect.myCoords << 0 << 20 << 0;
- aPolylineSect.myCoords << 25 << 40 << 0;
- aPolylineSect.myCoords << 50 << 20 << 0;
-
- aPolylineData << aPolylineSect;
-
- aCropPolyline->setPolylineData( aPolylineData );
-
- // prepare Composer Operation
- ImageComposer_Operator* aCropOp =
- aFactory->Operator( ImageComposer_CropOperator::Type() );
-
- CPPUNIT_ASSERT( aCropOp );
-
- aCropOp->setArgs( Qt::red );
-
- // create crop - image
- Handle(HYDROData_Image) aCropImage = aFactory->CreateImage( aDoc, aCropOp );
- CPPUNIT_ASSERT( !aCropImage.IsNull() );
-
- aCropImage->AppendReference( anOriImage );
- aCropImage->AppendReference( aCropPolyline );
- aCropImage->Update();
-
- // check crop operation was performed
- CPPUNIT_ASSERT( !aCropImage->Image().isNull() );
- CPPUNIT_ASSERT( aCropImage->Image() != aTestImage );
-
- aDoc->Close();
-}
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROOperations_Factory : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(test_HYDROOperations_Factory);
- CPPUNIT_TEST(testCreate);
- CPPUNIT_TEST(testCrop);
- CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
- void setUp() {}
-
- void tearDown() {}
-
- // checks creation of images using null operators
- void testCreate();
-
- // checks creation of images using crop operator
- void testCrop();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROOperations_Factory);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROOperations_Factory, "HYDROOperations_Factory");
HYDROGUI_Displayer.h
HYDROGUI_ExportImageOp.h
HYDROGUI_GVSelector.h
+ HYDROGUI_ImmersibleZoneDlg.h
+ HYDROGUI_ImmersibleZoneOp.h
HYDROGUI_ImportBathymetryDlg.h
HYDROGUI_ImportBathymetryOp.h
HYDROGUI_ImportImageDlg.h
HYDROGUI_UpdateFlags.h
HYDROGUI_UpdateImageOp.h
HYDROGUI_VisualStateOp.h
- HYDROGUI_ZoneDlg.h
- HYDROGUI_ZoneOp.h
)
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_Displayer.cxx
HYDROGUI_ExportImageOp.cxx
HYDROGUI_GVSelector.cxx
+ HYDROGUI_ImmersibleZoneDlg.cxx
+ HYDROGUI_ImmersibleZoneOp.cxx
HYDROGUI_ImportBathymetryDlg.cxx
HYDROGUI_ImportBathymetryOp.cxx
HYDROGUI_ImportImageDlg.cxx
HYDROGUI_TwoImagesOp.cxx
HYDROGUI_UpdateImageOp.cxx
HYDROGUI_VisualStateOp.cxx
- HYDROGUI_ZoneDlg.cxx
- HYDROGUI_ZoneOp.cxx
)
add_definitions(
RelativePath=".\HYDROGUI_GVSelector.cxx"
>
</File>
+ <File
+ RelativePath=".\HYDROGUI_ImmersibleZoneDlg.cxx"
+ >
+ </File>
+ <File
+ RelativePath=".\HYDROGUI_ImmersibleZoneOp.cxx"
+ >
+ </File>
<File
RelativePath=".\HYDROGUI_ImportBathymetryDlg.cxx"
>
RelativePath=".\HYDROGUI_ShowHideOp.cxx"
>
</File>
- <File
- RelativePath=".\HYDROGUI_SplitZonesTool.cxx"
- >
- </File>
<File
RelativePath=".\HYDROGUI_Tool.cxx"
>
RelativePath=".\HYDROGUI_VisualStateOp.cxx"
>
</File>
- <File
- RelativePath=".\HYDROGUI_ZoneDlg.cxx"
- >
- </File>
- <File
- RelativePath=".\HYDROGUI_ZoneOp.cxx"
- >
- </File>
<Filter
Name="Link"
>
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath=".\HYDROGUI_ImmersibleZoneDlg.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating moc_$(InputName).cxx"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx
"
+ Outputs="moc/moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\HYDROGUI_ImmersibleZoneOp.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating moc_$(InputName).cxx"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx
"
+ Outputs="moc/moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath=".\HYDROGUI_ImportBathymetryDlg.h"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating moc_$(InputName).cxx"
- CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx
"
Outputs="moc/moc_$(InputName).cxx"
/>
</FileConfiguration>
/>
</FileConfiguration>
</File>
- <File
- RelativePath=".\HYDROGUI_SplitZonesTool.h"
- >
- </File>
<File
RelativePath=".\HYDROGUI_Tool.h"
>
/>
</FileConfiguration>
</File>
- <File
- RelativePath=".\HYDROGUI_ZoneDlg.h"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Generating moc_$(InputName).cxx"
- CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx
"
- Outputs="moc/moc_$(InputName).cxx"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\HYDROGUI_ZoneOp.h"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Generating moc_$(InputName).cxx"
- CommandLine="$(QTDIR)\bin\moc.exe $(InputPath) -o moc\moc_$(InputName).cxx
"
- Outputs="moc/moc_$(InputName).cxx"
- />
- </FileConfiguration>
- </File>
</Filter>
<Filter
Name="Resource Files"
RelativePath=".\moc\moc_HYDROGUI_GVSelector.cxx"
>
</File>
+ <File
+ RelativePath=".\moc\moc_HYDROGUI_ImmersibleZoneDlg.cxx"
+ >
+ </File>
+ <File
+ RelativePath=".\moc\moc_HYDROGUI_ImmersibleZoneOp.cxx"
+ >
+ </File>
<File
RelativePath=".\moc\moc_HYDROGUI_ImportBathymetryDlg.cxx"
>
RelativePath=".\moc\moc_HYDROGUI_VisualStateOp.cxx"
>
</File>
- <File
- RelativePath=".\moc\moc_HYDROGUI_ZoneDlg.cxx"
- >
- </File>
- <File
- RelativePath=".\moc\moc_HYDROGUI_ZoneOp.cxx"
- >
- </File>
</Filter>
</Files>
<Globals>
#include "HYDROGUI_AISCurve.h"
-#include <HYDROOperations_BSpline.h>
+#include <HYDROData_BSplineOperation.h>
#include <CurveCreator_Curve.hxx>
if( aSectSize > 1 )
{
- HYDROOperations_BSpline aBSpline( aPoints, 0, aSectIsClosed );
+ HYDROData_BSplineOperation aBSpline( aPoints, 0, aSectIsClosed );
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire();
aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
aNameLayout->addWidget( myObjectName );
-
- // Calculation boundary line
- QGroupBox* aBndGroup = new QGroupBox( tr( "CALCULATION_BOUNDARY" ), mainFrame() );
-
- myBndPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINE, aBndGroup );
-
- QBoxLayout* aBndLayout = new QHBoxLayout( aBndGroup );
- aBndLayout->setMargin( 5 );
- aBndLayout->setSpacing( 5 );
- aBndLayout->addWidget( new QLabel( tr( "BOUNDARY_POLYLINE" ), aBndGroup ) );
- aBndLayout->addWidget( myBndPolyline );
-
-
// Calculation zones
- QGroupBox* aZonesGroup = new QGroupBox( tr( "CALCULATION_ZONES" ), mainFrame() );
-
- myZones = new QListWidget( aZonesGroup );
- myZones->setSelectionMode( QListWidget::SingleSelection );
- myZones->setEditTriggers( QListWidget::NoEditTriggers );
- myZones->setViewMode( QListWidget::ListMode );
-
- myRegions = new QListWidget( aZonesGroup );
- myRegions->setSelectionMode( QListWidget::SingleSelection );
- myRegions->setEditTriggers( QListWidget::NoEditTriggers );
- myRegions->setViewMode( QListWidget::ListMode );
+ QFrame* anObjectsFrame = new QFrame( mainFrame() );
- mySplittedZonesPrefix = new QLineEdit( aZonesGroup );
+ myGeomObjects = new QListWidget( anObjectsFrame );
+ myGeomObjects->setSelectionMode( QListWidget::SingleSelection );
+ myGeomObjects->setEditTriggers( QListWidget::NoEditTriggers );
+ myGeomObjects->setViewMode( QListWidget::ListMode );
- QPushButton* aSplitBtn = new QPushButton( tr( "SPLIT_REFERENCE_ZONES" ), aZonesGroup );
-
- QGridLayout* aZonesLayout = new QGridLayout( aZonesGroup );
+ QGridLayout* aZonesLayout = new QGridLayout( anObjectsFrame );
aZonesLayout->setMargin( 5 );
aZonesLayout->setSpacing( 5 );
- aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REFERENCE_ZONES" ), aZonesGroup ), 0, 0, 1, 2 );
- aZonesLayout->addWidget( myZones, 1, 0, 1, 2 );
- aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REGIONS" ), aZonesGroup ), 2, 0, 1, 2 );
- aZonesLayout->addWidget( myRegions, 3, 0, 1, 2 );
- aZonesLayout->addWidget( new QLabel( tr( "PREFIX_REGIONS" ), aZonesGroup ), 4, 0 );
- aZonesLayout->addWidget( mySplittedZonesPrefix, 4, 1 );
- aZonesLayout->addWidget( aSplitBtn, 5, 0, 1, 2 );
+ aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REFERENCE_OBJECTS" ), myGeomObjects ), 0, 0 );
+ aZonesLayout->addWidget( myGeomObjects, 0, 1 );
// Common
addWidget( myObjectNameGroup );
- addWidget( aBndGroup );
- addWidget( aZonesGroup );
+ addWidget( anObjectsFrame );
addStretch();
-
-
- // Connect signals and slots
- connect( aSplitBtn, SIGNAL( clicked( bool ) ), this, SIGNAL( SplitZones() ) );
}
HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg()
{
myObjectName->clear();
- myBndPolyline->Clear();
-
- myZones->clear();
- myRegions->clear();
-
- setSplitZonesPrefix( tr( "DEFAULT_PREFIX_REGIONS" ) );
+ myGeomObjects->clear();
}
void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
return myObjectName->text();
}
-void HYDROGUI_CalculationDlg::setPolylineName( const QString& theName )
-{
- myBndPolyline->SetName( theName );
-}
-
-QString HYDROGUI_CalculationDlg::getPolylineName() const
-{
- return myBndPolyline->GetName();
-}
-
-void HYDROGUI_CalculationDlg::setZones( const QStringList& theZones )
-{
- myZones->clear();
-
- for ( int i = 0, n = theZones.length(); i < n; ++i )
- {
- QString aZoneName = theZones.at( i );
-
- QListWidgetItem* aListItem = new QListWidgetItem( aZoneName, myZones );
- aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable );
- aListItem->setCheckState( Qt::Unchecked );
- }
-}
-
-void HYDROGUI_CalculationDlg::setSelectedZones( const QStringList& theZones )
+void HYDROGUI_CalculationDlg::setGeomObjects( const QStringList& theObjects )
{
- for ( int i = 0, n = theZones.length(); i < n; ++i )
- {
- QString aZoneName = theZones.at( i );
-
- QList<QListWidgetItem *> anItems =
- myZones->findItems( aZoneName, Qt::MatchFixedString | Qt::MatchCaseSensitive );
- if ( anItems.isEmpty() )
- continue;
-
- QListWidgetItem* aListItem = anItems.first();
- if ( !aListItem )
- continue;
-
- aListItem->setCheckState( Qt::Checked );
- }
-}
-
-QStringList HYDROGUI_CalculationDlg::getSelectedZones() const
-{
- QStringList aResList;
-
- for ( int i = 0, n = myZones->count(); i < n; ++i )
- {
- QListWidgetItem* aListItem = myZones->item( i );
- if ( !aListItem || aListItem->checkState() != Qt::Checked )
- continue;
-
- QString aSelZoneName = aListItem->text();
- aResList.append( aSelZoneName );
- }
-
- return aResList;
}
-void HYDROGUI_CalculationDlg::setRegions( const QStringList& theRegions )
+void HYDROGUI_CalculationDlg::setSelectedGeomObjects( const QStringList& theObjects )
{
- myRegions->clear();
+ myGeomObjects->clear();
- for ( int i = 0, n = theRegions.length(); i < n; ++i )
+ for ( int i = 0, n = theObjects.length(); i < n; ++i )
{
- QString aRegionName = theRegions.at( i );
+ QString anObjName = theObjects.at( i );
- QListWidgetItem* aListItem = new QListWidgetItem( aRegionName, myRegions );
+ QListWidgetItem* aListItem = new QListWidgetItem( anObjName, myGeomObjects );
aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
}
}
-QStringList HYDROGUI_CalculationDlg::getRegions() const
+QStringList HYDROGUI_CalculationDlg::getSelectedGeomObjects() const
{
QStringList aResList;
- for ( int i = 0, n = myRegions->count(); i < n; ++i )
+ for ( int i = 0, n = myGeomObjects->count(); i < n; ++i )
{
- QListWidgetItem* aListItem = myRegions->item( i );
+ QListWidgetItem* aListItem = myGeomObjects->item( i );
if ( !aListItem )
continue;
- QString aRegionName = aListItem->text();
- aResList.append( aRegionName );
+ QString aSelObjName = aListItem->text();
+ aResList.append( aSelObjName );
}
return aResList;
}
-void HYDROGUI_CalculationDlg::setSplitZonesPrefix( const QString& theName )
-{
- mySplittedZonesPrefix->setText( theName );
-}
-
-QString HYDROGUI_CalculationDlg::getSplitZonesPrefix() const
-{
- QString aPrefix = mySplittedZonesPrefix->text();
- if ( aPrefix.isEmpty() )
- aPrefix = tr( "DEFAULT_PREFIX_REGIONS" );
- return aPrefix;
-}
void setObjectName( const QString& theName );
QString getObjectName() const;
- void setPolylineName( const QString& theName );
- QString getPolylineName() const;
-
- void setZones( const QStringList& theZones );
- void setSelectedZones( const QStringList& theZones );
- QStringList getSelectedZones() const;
-
- void setRegions( const QStringList& theRegions );
- QStringList getRegions() const;
-
- void setSplitZonesPrefix( const QString& theName );
- QString getSplitZonesPrefix() const;
-
-signals:
- void SplitZones();
+ void setGeomObjects( const QStringList& theObjects );
+ void setSelectedGeomObjects( const QStringList& theObjects );
+ QStringList getSelectedGeomObjects() const;
private:
QGroupBox* myObjectNameGroup;
QLineEdit* myObjectName;
- HYDROGUI_ObjSelector* myBndPolyline;
-
- QListWidget* myZones;
- QListWidget* myRegions;
- QLineEdit* mySplittedZonesPrefix;
+ QListWidget* myGeomObjects;
};
#endif
#include <HYDROData_Polyline.h>
#include <HYDROData_Iterator.h>
-#include <HYDROData_Zone.h>
+#include <HYDROData_ImmersibleZone.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewModel.h>
QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Case" );
- QStringList aSelectedZones, aRegions;
+ QStringList aSelectedObjects;
myEditedObject.Nullify();
if ( myIsEdit )
{
anObjectName = myEditedObject->GetName();
- Handle(HYDROData_Polyline) aBoundaryPolyline = myEditedObject->GetBoundaryPolyline();
- if ( !aBoundaryPolyline.IsNull() )
- {
- QString aPolylineName = aBoundaryPolyline->GetName();
- aPanel->setPolylineName( aPolylineName );
- }
-
- HYDROData_SequenceOfObjects aRefZones = myEditedObject->GetZones();
- HYDROData_SequenceOfObjects::Iterator anIter( aRefZones );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Zone) aRefZone =
- Handle(HYDROData_Zone)::DownCast( anIter.Value() );
- if ( aRefZone.IsNull() )
- continue;
-
- QString aRefZoneName = aRefZone->GetName();
- if ( aRefZoneName.isEmpty() )
- continue;
-
- aSelectedZones.append( aRefZoneName );
- }
-
- HYDROData_SequenceOfObjects aDataRegions = myEditedObject->GetRegions();
- anIter.Init( aDataRegions );
+ HYDROData_SequenceOfObjects aRefObjects = myEditedObject->GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
for ( ; anIter.More(); anIter.Next() )
{
- Handle(HYDROData_Region) aDataRegion =
- Handle(HYDROData_Region)::DownCast( anIter.Value() );
- if ( aDataRegion.IsNull() )
+ Handle(HYDROData_Object) aRefbject =
+ Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( aRefbject.IsNull() )
continue;
- QString aRegionName = aDataRegion->GetName();
- if ( aRegionName.isEmpty() )
+ QString aRefObjectName = aRefbject->GetName();
+ if ( aRefObjectName.isEmpty() )
continue;
- Region aRegion;
- aRegion.SplitData.Shape = aDataRegion->Face();
-
- aRegion.FillingColor = aDataRegion->GetFillingColor();
- aRegion.BorderColor = aDataRegion->GetBorderColor();
-
- aRegion.RegionName = aRegionName;
-
- aRegion.DataRegion = aDataRegion;
-
- myRegionsList.append( aRegion );
-
- aRegions.append( aRegionName );
+ aSelectedObjects.append( aRefObjectName );
}
}
}
- // collect information about existing zones
- QStringList aZones;
-
- HYDROData_Iterator anIter( doc(), KIND_ZONE );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Zone) aZoneObj =
- Handle(HYDROData_Zone)::DownCast( anIter.Current() );
- if ( aZoneObj.IsNull() )
- continue;
-
- QString aZoneName = aZoneObj->GetName();
- if ( aZoneName.isEmpty() )
- continue;
-
- aZones.append( aZoneName );
- }
-
aPanel->setObjectName( anObjectName );
-
- aPanel->setZones( aZones );
- aPanel->setSelectedZones( aSelectedZones );
- aPanel->setRegions( aRegions );
+ aPanel->setSelectedGeomObjects( aSelectedObjects );
createPreview();
}
HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName() );
// Connect signals and slots
- connect( aPanel, SIGNAL( SplitZones() ), this, SLOT( onSplitZones() ) );
return aPanel;
}
// check that there are no other objects with the same name in the document
if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
{
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
if ( !anObject.IsNull() )
{
theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
aCalculObj->SetName( anObjectName );
- QString aPolylineName = aPanel->getPolylineName();
- Handle(HYDROData_Polyline) aBndPolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
-
- aCalculObj->SetBoundaryPolyline( aBndPolyline );
-
- QStringList aRefZoneNames = aPanel->getSelectedZones();
- HYDROData_SequenceOfObjects aRefZones =
- HYDROGUI_Tool::FindObjectsByNames( module(), aRefZoneNames, KIND_ZONE );
-
- aCalculObj->SetZones( aRefZones );
-
- HYDROData_SequenceOfObjects aRegions;
-
- RegionsList::iterator anIter = myRegionsList.begin();
- for ( ; anIter != myRegionsList.end(); ++anIter )
- {
- const Region& aRegion = *anIter;
-
- if ( !aRegion.DataRegion.IsNull() )
- {
- //No need to create new but use old zone
- aRegions.Append( aRegion.DataRegion );
- continue;
- }
-
- Handle(HYDROData_Region) aDataRegion =
- Handle(HYDROData_Region)::DownCast( aDocument->CreateObject( KIND_REGION ) );
- if( aDataRegion.IsNull() )
- continue;
-
- // Fill the zone data
- aDataRegion->SetFace( aRegion.SplitData.Face() );
+ QStringList aRefObjectNames = aPanel->getSelectedGeomObjects();
+ HYDROData_SequenceOfObjects aGeomObjects =
+ HYDROGUI_Tool::FindObjectsByNames( module(), aRefObjectNames );
- aDataRegion->SetName( aRegion.RegionName );
- aDataRegion->SetBorderColor( aRegion.BorderColor );
- aDataRegion->SetFillingColor( aRegion.FillingColor );
-
- aRegions.Append( aDataRegion );
- }
-
- aCalculObj->SetRegions( aRegions );
+ aCalculObj->SetGeometryObjects( aGeomObjects );
theUpdateFlags = UF_Model;
QApplication::setOverrideCursor( Qt::WaitCursor );
- QString aPolylineName = aPanel->getPolylineName();
- Handle(HYDROData_Polyline) aBndPolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
-
- QStringList aZoneNames = aPanel->getSelectedZones();
- HYDROData_SequenceOfObjects aZones =
- HYDROGUI_Tool::FindObjectsByNames( module(), aZoneNames, KIND_ZONE );
+ QStringList aGeomObjectNames = aPanel->getSelectedGeomObjects();
+ HYDROData_SequenceOfObjects aGeomObjects =
+ HYDROGUI_Tool::FindObjectsByNames( module(), aGeomObjectNames );
QStringList aResSplittedZones;
- HYDROGUI_SplitZonesTool::SplitDataList aSplittedZones =
- HYDROGUI_SplitZonesTool::SplitZones( aZones, aBndPolyline );
+ HYDROData_SplitToZonesTool::SplitDataList aSplittedZones =
+ HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects );
- QString aSplitZonesPrefix = aPanel->getSplitZonesPrefix();
QStringList aUsedNames;
- HYDROGUI_SplitZonesTool::SplitDataListIterator anIter( aSplittedZones );
+ HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplittedZones );
while( anIter.hasNext() )
{
Region aRegion;
aRegion.SplitData = anIter.next();
- aRegion.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aRegion.SplitData.ZoneNames );
- aRegion.BorderColor = QColor( HYDROData_Zone::DefaultBorderColor() );
+ aRegion.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aRegion.SplitData.ObjectNames );
+ aRegion.BorderColor = QColor( HYDROData_ImmersibleZone::DefaultBorderColor() );
- aRegion.RegionName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix, aUsedNames );
+ aRegion.RegionName = HYDROGUI_Tool::GenerateObjectName( module(), "Region", aUsedNames );
aUsedNames.append( aRegion.RegionName );
myRegionsList.append( aRegion );
}
-
- aPanel->setRegions( aResSplittedZones );
createPreview();
#include "HYDROGUI_Operation.h"
-#include "HYDROGUI_SplitZonesTool.h"
+#include "HYDROData_SplitToZonesTool.h"
#include "HYDROGUI_Shape.h"
#include <HYDROData_Calculation.h>
QString RegionName;
QColor FillingColor;
QColor BorderColor;
- HYDROGUI_SplitZonesTool::SplitData SplitData;
+ HYDROData_SplitToZonesTool::SplitData SplitData;
HYDROGUI_Shape* Shape;
Handle(HYDROData_Region) DataRegion;
#include <HYDROData_Calculation.h>
#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
+#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Iterator.h>
#include <HYDROData_Polyline.h>
#include <HYDROData_VisualState.h>
createObject( aBathymetryRootObj, aBathymetryObj );
}
- LightApp_DataObject* aCalculRootObj = createObject( aRootObj, partitionName( KIND_CALCULATION ) );
-
- anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION );
- for( ; anIterator.More(); anIterator.Next() )
- {
- Handle(HYDROData_Calculation) aCalculObj =
- Handle(HYDROData_Calculation)::DownCast( anIterator.Current() );
- if( !aCalculObj.IsNull() )
- createObject( aCalculRootObj, aCalculObj );
- }
-
LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, partitionName( KIND_POLYLINE ) );
anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE );
createObject( aPolylineRootObj, aPolylineObj );
}
- LightApp_DataObject* aZonesRootObj = createObject( aRootObj, partitionName( KIND_ZONE ) );
+ LightApp_DataObject* aZonesRootObj = createObject( aRootObj, partitionName( KIND_IMMERSIBLE_ZONE ) );
- anIterator = HYDROData_Iterator( aDocument, KIND_ZONE );
+ anIterator = HYDROData_Iterator( aDocument, KIND_IMMERSIBLE_ZONE );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Zone) aZoneObj =
- Handle(HYDROData_Zone)::DownCast( anIterator.Current() );
+ Handle(HYDROData_ImmersibleZone) aZoneObj =
+ Handle(HYDROData_ImmersibleZone)::DownCast( anIterator.Current() );
if( !aZoneObj.IsNull() )
createObject( aZonesRootObj, aZoneObj );
}
+ LightApp_DataObject* aCalculRootObj = createObject( aRootObj, partitionName( KIND_CALCULATION ) );
+
+ anIterator = HYDROData_Iterator( aDocument, KIND_CALCULATION );
+ for( ; anIterator.More(); anIterator.Next() )
+ {
+ Handle(HYDROData_Calculation) aCalculObj =
+ Handle(HYDROData_Calculation)::DownCast( anIterator.Current() );
+ if( !aCalculObj.IsNull() )
+ createObject( aCalculRootObj, aCalculObj );
+ }
+
LightApp_DataObject* aVisualStateRootObj = createObject( aRootObj, partitionName( KIND_VISUAL_STATE ) );
anIterator = HYDROData_Iterator( aDocument, KIND_VISUAL_STATE );
}
}
-HYDROGUI_DataObject* HYDROGUI_DataModel::getDataObject( const Handle(HYDROData_Object)& theModelObject )
+HYDROGUI_DataObject* HYDROGUI_DataModel::getDataObject( const Handle(HYDROData_Entity)& theModelObject )
{
return NULL; // to do if necessary
}
update( aModule->getStudyId() );
}
-Handle(HYDROData_Object) HYDROGUI_DataModel::objectByEntry( const QString& theEntry,
+Handle(HYDROData_Entity) HYDROGUI_DataModel::objectByEntry( const QString& theEntry,
const ObjectKind theObjectKind )
{
QString anEntry = theEntry;
HYDROData_Iterator anIterator( aDocument, theObjectKind );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() )
{
QString anEntryRef = HYDROGUI_DataObject::dataObjectEntry( anObject );
if( aSeq.Length() != 1 )
return false;
- Handle(HYDROData_Object) anObject = aSeq.First();
+ Handle(HYDROData_Entity) anObject = aSeq.First();
if( anObject.IsNull() )
return false;
{
for( int anIndex = 1, aLength = myCopyingObjects.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = myCopyingObjects.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = myCopyingObjects.Value( anIndex );
if( !anObject.IsNull() && !anObject->IsRemoved() )
return true;
}
bool anIsChanged = false;
for( int anIndex = 1, aLength = myCopyingObjects.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = myCopyingObjects.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = myCopyingObjects.Value( anIndex );
if( !anObject.IsNull() && !anObject->IsRemoved() )
{
ObjectKind aKind = anObject->GetKind();
- Handle(HYDROData_Object) aClone = getDocument()->CreateObject( aKind );
+ Handle(HYDROData_Entity) aClone = getDocument()->CreateObject( aKind );
if( !aClone.IsNull() )
{
anObject->CopyTo( aClone );
{
switch( theObjectKind )
{
- case KIND_IMAGE: return "IMAGES";
- case KIND_POLYLINE: return "POLYLINES";
- case KIND_VISUAL_STATE: return "VISUAL_STATES";
- case KIND_BATHYMETRY: return "BATHYMETRIES";
- case KIND_CALCULATION: return "CALCULATION_CASES";
- case KIND_ZONE: return "ZONES";
+ case KIND_IMAGE: return "IMAGES";
+ case KIND_POLYLINE: return "POLYLINES";
+ case KIND_VISUAL_STATE: return "VISUAL_STATES";
+ case KIND_BATHYMETRY: return "BATHYMETRIES";
+ case KIND_CALCULATION: return "CALCULATION_CASES";
+ case KIND_IMMERSIBLE_ZONE: return "IMMERSIBLE_ZONES";
default: break;
}
return QString();
}
LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent,
- Handle(HYDROData_Object) theModelObject,
+ Handle(HYDROData_Entity) theModelObject,
const QString& theParentEntry,
const bool theIsBuildTree )
{
if ( !aGuiObj )
return;
- Handle(HYDROData_Object) aDataObj = aGuiObj->modelObject();
+ Handle(HYDROData_Entity) aDataObj = aGuiObj->modelObject();
if ( aDataObj.IsNull() )
return;
Handle(HYDROData_Image)::DownCast( aDataObj );
for ( int anIndex = 0, aNbRef = anImageObj->NbReferences(); anIndex < aNbRef; anIndex++ )
{
- Handle(HYDROData_Object) aRefObj = anImageObj->Reference( anIndex );
+ Handle(HYDROData_Entity) aRefObj = anImageObj->Reference( anIndex );
if ( !aRefObj.IsNull() && !aRefObj->IsRemoved() )
createObject( aGuiObj, aRefObj, aGuiObj->entry(), false );
}
}
- else if ( anObjectKind == KIND_ZONE )
+ else if ( anObjectKind == KIND_IMMERSIBLE_ZONE )
{
- Handle(HYDROData_Zone) aZoneObj =
- Handle(HYDROData_Zone)::DownCast( aDataObj );
+ Handle(HYDROData_ImmersibleZone) aZoneObj =
+ Handle(HYDROData_ImmersibleZone)::DownCast( aDataObj );
LightApp_DataObject* aPolylineSect =
createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
- LightApp_DataObject* aBathsSect =
- createObject( aGuiObj, tr( "ZONE_BATHYMETRIES" ), aGuiObj->entry() );
+ LightApp_DataObject* aBathSect =
+ createObject( aGuiObj, tr( "ZONE_BATHYMETRY" ), aGuiObj->entry() );
- HYDROData_SequenceOfObjects aZoneBaths = aZoneObj->GetBathymetries();
- HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths );
- for ( ; aBathsIter.More(); aBathsIter.Next() )
- {
- Handle(HYDROData_Bathymetry) aRefBath =
- Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() );
- if( !aRefBath.IsNull() && !aRefBath->IsRemoved() )
- createObject( aBathsSect, aRefBath, aGuiObj->entry(), false );
- }
+ Handle(HYDROData_Bathymetry) aBathymetry = aZoneObj->GetBathymetry();
+ if ( !aBathymetry.IsNull() && !aBathymetry->IsRemoved() )
+ createObject( aBathSect, aBathymetry, aGuiObj->entry(), false );
}
else if ( anObjectKind == KIND_CALCULATION )
{
Handle(HYDROData_Calculation) aCaseObj =
Handle(HYDROData_Calculation)::DownCast( aDataObj );
- LightApp_DataObject* aPolylineSect =
- createObject( aGuiObj, tr( "CASE_BND_POLYLINE" ), aGuiObj->entry() );
-
- Handle(HYDROData_Polyline) aPolyline = aCaseObj->GetBoundaryPolyline();
- if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
- createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
-
- LightApp_DataObject* aRefZonesSect =
- createObject( aGuiObj, tr( "CASE_REFERENCE_ZONES" ), aGuiObj->entry() );
-
- HYDROData_SequenceOfObjects aRefZones = aCaseObj->GetZones();
- HYDROData_SequenceOfObjects::Iterator anIter( aRefZones );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Zone) aRefZone =
- Handle(HYDROData_Zone)::DownCast( anIter.Value() );
- if( !aRefZone.IsNull() && !aRefZone->IsRemoved() )
- createObject( aRefZonesSect, aRefZone, aGuiObj->entry(), false );
- }
-
LightApp_DataObject* aCaseRegionsSect =
createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );
HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions();
- anIter.Init( aCaseRegions );
+ HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions );
for ( ; anIter.More(); anIter.Next() )
{
Handle(HYDROData_Region) aCaseRegion =
Handle(HYDROData_Region)::DownCast( anIter.Value() );
if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() )
- createObject( aCaseRegionsSect, aCaseRegion, aGuiObj->entry(), false );
+ createObject( aCaseRegionsSect, aCaseRegion, aGuiObj->entry(), true );
+ }
+ }
+ else if ( anObjectKind == KIND_REGION )
+ {
+ Handle(HYDROData_Region) aRegionObj =
+ Handle(HYDROData_Region)::DownCast( aDataObj );
+
+ HYDROData_SequenceOfObjects aRegionZones = aRegionObj->GetZones();
+ HYDROData_SequenceOfObjects::Iterator anIter( aRegionZones );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Zone) aRegionZone =
+ Handle(HYDROData_Zone)::DownCast( anIter.Value() );
+ if( !aRegionZone.IsNull() && !aRegionZone->IsRemoved() )
+ createObject( aGuiObj, aRegionZone, aGuiObj->entry(), true );
}
}
}
#define HYDROGUI_DATAMODEL_H
#include <HYDROData_Document.h>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <QMap>
#include <LightApp_DataModel.h>
* \param the data model object
* \return the only one object referenced to the given data model object, or null if not found
*/
- virtual HYDROGUI_DataObject* getDataObject( const Handle(HYDROData_Object)& theModelObject );
+ virtual HYDROGUI_DataObject* getDataObject( const Handle(HYDROData_Entity)& theModelObject );
/**
* Returns a data object referenced to the given data object.
/**
* Find a data object by the specified entry and kind
*/
- Handle(HYDROData_Object) objectByEntry( const QString& theEntry,
+ Handle(HYDROData_Entity) objectByEntry( const QString& theEntry,
const ObjectKind theObjectKind = KIND_UNKNOWN );
/**
* \param theParentEntry entry of parent object
*/
LightApp_DataObject* createObject( SUIT_DataObject* theParent,
- Handle(HYDROData_Object) theModelObject,
+ Handle(HYDROData_Entity) theModelObject,
const QString& theParentEntry = QString(),
const bool theIsBuildTree = true );
#include <TDF_Tool.hxx>
HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
- Handle(HYDROData_Object) theData,
+ Handle(HYDROData_Entity) theData,
const QString& theParentEntry )
: CAM_DataObject( theParent ),
LightApp_DataObject( theParent ),
return aFont;
}
-QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Object)& theObject,
+QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
const bool theWithPrefix )
{
QString aEntryStr = QString::null;
#ifndef HYDROGUI_DATAOBJECT_H
#define HYDROGUI_DATAOBJECT_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <LightApp_DataObject.h>
* \param theParentEntry entry of the parent data object (for reference objects)
*/
HYDROGUI_DataObject( SUIT_DataObject* theParent,
- Handle(HYDROData_Object) theData,
+ Handle(HYDROData_Entity) theData,
const QString& theParentEntry );
/**
/**
* Returns the model data object.
*/
- const Handle(HYDROData_Object)& modelObject() const { return myData; }
+ const Handle(HYDROData_Entity)& modelObject() const { return myData; }
/**
* Redefines the object.
*/
- void setObject( Handle(HYDROData_Object) theObject ) { myData = theObject; }
+ void setObject( const Handle(HYDROData_Entity)& theObject ) { myData = theObject; }
/**
* Returns the entry prefix for all HYDRO data objects.
/**
* Returns the full entry for the specified data object.
*/
- static QString dataObjectEntry( const Handle(HYDROData_Object)& theObject,
+ static QString dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
const bool theWithPrefix = true );
protected:
- Handle(HYDROData_Object) myData; ///< object from data model
+ Handle(HYDROData_Entity) myData; ///< object from data model
QString myParentEntry;
};
{
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
if( !anObject.IsNull() )
{
aFullSeq.Append( anObject );
startDocOperation();
for( Standard_Integer anIndex = 1, aLength = aFullSeq.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = aFullSeq.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = aFullSeq.Value( anIndex );
if( !anObject.IsNull() && !anObject->IsRemoved() )
anObject->Remove();
}
GraphicsView_ObjectList anObjectList = aViewPort->getObjects();
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- Handle(HYDROData_Object) anObj = theObjs.Value( i );
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
if( anObj.IsNull() )
continue;
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- const Handle(HYDROData_Object)& anObj = theObjs.Value( i );
+ const Handle(HYDROData_Entity)& anObj = theObjs.Value( i );
if( anObj.IsNull() )
anObjectsToErase.Append( anObj );
else
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
// the object may be null or dead
- const Handle(HYDROData_Object)& anObj = theObjs.Value( i );
+ const Handle(HYDROData_Entity)& anObj = theObjs.Value( i );
if( HYDROGUI_Prs* aPrs = HYDROGUI_Tool::GetPresentation( anObj, anObjectList ) )
{
aViewPort->removeItem( aPrs );
GraphicsView_ObjectList anObjectList = aViewPort->getObjects();
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- Handle(HYDROData_Object) anObj = theObjs.Value( i );
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
if( anObj.IsNull() )
continue;
{
if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
{
- Handle(HYDROData_Object) anObject = aPrs->getObject();
+ Handle(HYDROData_Entity) anObject = aPrs->getObject();
if( !anObject.IsNull() && anObject->IsRemoved() )
{
aViewPort->removeItem( aPrs );
}
}
-HYDROGUI_PrsDriver* HYDROGUI_Displayer::getDriver( const Handle(HYDROData_Object)& theObj )
+HYDROGUI_PrsDriver* HYDROGUI_Displayer::getDriver( const Handle(HYDROData_Entity)& theObj )
{
HYDROGUI_PrsDriver* aDriver = NULL;
ObjectKind aKind = theObj->GetKind();
#ifndef HYDROGUI_DISPLAYER_H
#define HYDROGUI_DISPLAYER_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <QMap>
* \brief Get the presentation driver for the specified data object.
* \param theObj data object
*/
- HYDROGUI_PrsDriver* getDriver( const Handle(HYDROData_Object)& theObj );
+ HYDROGUI_PrsDriver* getDriver( const Handle(HYDROData_Entity)& theObj );
private:
HYDROGUI_Module* myModule;
if ( anOwner )
{
QString anEntry = anOwner->entry();
- Handle(HYDROData_Object) aModelObject = aModel->objectByEntry( anEntry );
+ Handle(HYDROData_Entity) aModelObject = aModel->objectByEntry( anEntry );
if( !aModelObject.IsNull() )
{
if( HYDROGUI_Prs* aPrs = HYDROGUI_Tool::GetPresentation( aModelObject, anObjectList ) )
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+#include "HYDROGUI_ImmersibleZoneDlg.h"
+
+#include "HYDROGUI_ColorWidget.h"
+#include "HYDROGUI_Tool.h"
+
+#include <QComboBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QRadioButton>
+
+HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+ // Zone name
+ myObjectNameGroup = new QGroupBox( tr( "ZONE_NAME" ), mainFrame() );
+
+ myObjectName = new QLineEdit( myObjectNameGroup );
+
+ QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
+ aNameLayout->setMargin( 5 );
+ aNameLayout->setSpacing( 5 );
+ aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
+ aNameLayout->addWidget( myObjectName );
+
+
+ QGroupBox* aParamGroup = new QGroupBox( tr( "ZONE_PARAMETERS" ), mainFrame() );
+
+ QFrame* aPolylineFrame = new QFrame( aParamGroup );
+
+ myPolylines = new QComboBox( aPolylineFrame );
+ myPolylines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QBoxLayout* aPolyLayout = new QHBoxLayout( aPolylineFrame );
+ aPolyLayout->setMargin( 0 );
+ aPolyLayout->setSpacing( 5 );
+ aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
+ aPolyLayout->addWidget( myPolylines );
+
+
+ QFrame* aFillingFrame = new QFrame( aParamGroup );
+ QLabel* aFillingLabel = new QLabel( tr( "FILLING_COLOR" ), aFillingFrame );
+ myFillingTransparent = new QRadioButton( tr( "TRANSPARENT" ), aFillingFrame );
+ myFillingTransparent->setChecked( true );
+ myFillingColor = new QRadioButton( tr( "COLOR" ), aFillingFrame );
+ myFillingColorBox = new HYDROGUI_ColorWidget( aFillingFrame );
+
+ QGridLayout* aFillingLayout = new QGridLayout( aFillingFrame );
+ aFillingLayout->setMargin( 0 );
+ aFillingLayout->setSpacing( 5 );
+ aFillingLayout->addWidget( aFillingLabel, 0, 0, 2, 1 );
+ aFillingLayout->addWidget( myFillingTransparent, 0, 1 );
+ aFillingLayout->addWidget( myFillingColor, 1, 1 );
+ aFillingLayout->addWidget( myFillingColorBox, 1, 2 );
+
+
+ myBorderColorGroup = new QGroupBox( tr( "BORDER_COLOR" ), mainFrame() );
+ myBorderColorGroup->setCheckable( true );
+
+ myBorderColorBox = new HYDROGUI_ColorWidget( myBorderColorGroup );
+
+ QBoxLayout* aBorderColorLayout = new QHBoxLayout( myBorderColorGroup );
+ aBorderColorLayout->setMargin( 5 );
+ aBorderColorLayout->setSpacing( 5 );
+ aBorderColorLayout->addWidget( new QLabel( tr( "COLOR" ), myBorderColorGroup ) );
+ aBorderColorLayout->addWidget( myBorderColorBox );
+
+
+ QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
+ aParamLayout->setMargin( 5 );
+ aParamLayout->setSpacing( 5 );
+ aParamLayout->addWidget( aPolylineFrame );
+ aParamLayout->addWidget( aFillingFrame );
+ aParamLayout->addWidget( myBorderColorGroup );
+
+
+ QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRY" ), mainFrame() );
+
+ myBathymetries = new QComboBox( aPolylineFrame );
+ myBathymetries->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QBoxLayout* aBathLayout = new QHBoxLayout( aBathGroup );
+ aBathLayout->setMargin( 5 );
+ aBathLayout->setSpacing( 5 );
+ aBathLayout->addWidget( myBathymetries );
+
+
+ // Common
+ addWidget( myObjectNameGroup );
+ addWidget( aParamGroup );
+ addWidget( aBathGroup );
+
+ addStretch();
+
+
+ // Connect signals and slots
+ connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
+ connect( myFillingTransparent, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
+ connect( myFillingColor, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
+ connect( myFillingColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onFillingColorChanged() ) );
+ connect( myBorderColorGroup, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
+ connect( myBorderColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onZoneDefChanged() ) );
+}
+
+HYDROGUI_ImmersibleZoneDlg::~HYDROGUI_ImmersibleZoneDlg()
+{
+}
+
+void HYDROGUI_ImmersibleZoneDlg::reset()
+{
+ bool isBlocked = blockSignals( true );
+
+ myObjectName->clear();
+
+ myPolylines->clear();
+ myBathymetries->clear();
+
+ myFillingTransparent->setChecked( true );
+ myFillingColorBox->resetColor();
+
+ myBorderColorGroup->setChecked( false );
+ myBorderColorBox->resetColor();
+
+ blockSignals( isBlocked );
+
+ onZoneDefChanged();
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setObjectName( const QString& theName )
+{
+ myObjectName->setText( theName );
+}
+
+QString HYDROGUI_ImmersibleZoneDlg::getObjectName() const
+{
+ return myObjectName->text();
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setPolylineNames( const QStringList& thePolylines )
+{
+ bool isBlocked = blockSignals( true );
+
+ myPolylines->clear();
+ myPolylines->addItems( thePolylines );
+
+ blockSignals( isBlocked );
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setPolylineName( const QString& theName )
+{
+ int aNewIdx = myPolylines->findText( theName );
+ if ( aNewIdx != myPolylines->currentIndex() )
+ {
+ myPolylines->setCurrentIndex( aNewIdx );
+ }
+ else
+ {
+ onZoneDefChanged();
+ }
+}
+
+QString HYDROGUI_ImmersibleZoneDlg::getPolylineName() const
+{
+ return myPolylines->currentText();
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setBathymetryNames( const QStringList& theBathymetries )
+{
+ bool isBlocked = blockSignals( true );
+
+ myBathymetries->clear();
+ myBathymetries->addItems( theBathymetries );
+
+ blockSignals( isBlocked );
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setBathymetryName( const QString& theName )
+{
+ int aNewIdx = myBathymetries->findText( theName );
+ myBathymetries->setCurrentIndex( aNewIdx );
+}
+
+QString HYDROGUI_ImmersibleZoneDlg::getBathymetryName() const
+{
+ return myBathymetries->currentText();
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setFillingColor( const QColor& theColor )
+{
+ bool isBlocked = blockSignals( true );
+
+ if( theColor.alpha() == 0 ) // transparent
+ myFillingTransparent->setChecked( true );
+ else
+ myFillingColor->setChecked( true );
+
+ myFillingColorBox->setColor( theColor );
+
+ blockSignals( isBlocked );
+
+ onZoneDefChanged();
+}
+
+QColor HYDROGUI_ImmersibleZoneDlg::getFillingColor() const
+{
+ QColor aColor( 255, 255, 255, 0 ); // transparent
+ if( myFillingColor->isChecked() )
+ aColor = myFillingColorBox->color();
+ return aColor;
+}
+
+void HYDROGUI_ImmersibleZoneDlg::setBorderColor( const QColor& theColor )
+{
+ bool isBlocked = blockSignals( true );
+
+ bool isTransparent = theColor.alpha() == 0;
+ myBorderColorGroup->setChecked( !isTransparent );
+ myBorderColorBox->setColor( !isTransparent ? theColor : QColor( Qt::black ) );
+
+ blockSignals( isBlocked );
+
+ onZoneDefChanged();
+}
+
+QColor HYDROGUI_ImmersibleZoneDlg::getBorderColor() const
+{
+ QColor aColor( Qt::transparent ); // transparent
+ if( myBorderColorGroup->isChecked() )
+ aColor = myBorderColorBox->color();
+ return aColor;
+}
+
+void HYDROGUI_ImmersibleZoneDlg::onFillingColorChanged()
+{
+ if ( !myFillingColor->isChecked() )
+ return;
+
+ onZoneDefChanged();
+}
+
+void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
+{
+ if ( signalsBlocked() )
+ return;
+
+ QString aPolylineName = getPolylineName();
+ emit CreatePreview( aPolylineName );
+}
+
+
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+#ifndef HYDROGUI_ImmersibleZoneDlg_H
+#define HYDROGUI_ImmersibleZoneDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class HYDROGUI_ColorWidget;
+class QComboBox;
+class QGroupBox;
+class QLineEdit;
+class QListWidget;
+class QRadioButton;
+
+class HYDROGUI_ImmersibleZoneDlg : public HYDROGUI_InputPanel
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+ virtual ~HYDROGUI_ImmersibleZoneDlg();
+
+ void reset();
+
+ void setObjectName( const QString& theName );
+ QString getObjectName() const;
+
+ void setPolylineNames( const QStringList& thePolylines );
+ void setPolylineName( const QString& thePolyline );
+ QString getPolylineName() const;
+
+ void setBathymetryNames( const QStringList& theBathymetries );
+ void setBathymetryName( const QString& theBathymetry );
+ QString getBathymetryName() const;
+
+ void setFillingColor( const QColor& theColor );
+ QColor getFillingColor() const;
+
+ void setBorderColor( const QColor& theColor );
+ QColor getBorderColor() const;
+
+signals:
+ void CreatePreview( const QString& thePolylineName );
+
+private slots:
+ void onZoneDefChanged();
+ void onFillingColorChanged();
+
+private:
+
+ QGroupBox* myObjectNameGroup;
+ QLineEdit* myObjectName;
+
+ QComboBox* myPolylines;
+ QComboBox* myBathymetries;
+
+ QRadioButton* myFillingTransparent;
+ QRadioButton* myFillingColor;
+ HYDROGUI_ColorWidget* myFillingColorBox;
+
+ QGroupBox* myBorderColorGroup;
+ HYDROGUI_ColorWidget* myBorderColorBox;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+#include "HYDROGUI_ImmersibleZoneOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_ImmersibleZoneDlg.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Shape.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Bathymetry.h>
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Polyline.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_UpdateFlags.h>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Wire.hxx>
+
+HYDROGUI_ImmersibleZoneOp::HYDROGUI_ImmersibleZoneOp( HYDROGUI_Module* theModule,
+ const bool theIsEdit )
+: HYDROGUI_Operation( theModule ),
+ myIsEdit( theIsEdit ),
+ myViewManager( 0 ),
+ myPreviewPrs( 0 )
+{
+ setName( theIsEdit ? tr( "EDIT_IMMERSIBLE_ZONE" ) : tr( "CREATE_IMMERSIBLE_ZONE" ) );
+}
+
+HYDROGUI_ImmersibleZoneOp::~HYDROGUI_ImmersibleZoneOp()
+{
+ closePreview();
+}
+
+void HYDROGUI_ImmersibleZoneOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_ImmersibleZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ImmersibleZoneDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ aPanel->blockSignals( true );
+
+ aPanel->reset();
+
+ QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Zone" );
+
+ QColor aFillingColor( HYDROData_ImmersibleZone::DefaultFillingColor() );
+ QColor aBorderColor( HYDROData_ImmersibleZone::DefaultBorderColor() );
+ QString aSelectedPolyline, aSelectedBathymetry;
+ QStringList aSelectedBathymetries;
+
+ if ( myIsEdit )
+ {
+ myEditedObject = Handle(HYDROData_ImmersibleZone)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( !myEditedObject.IsNull() )
+ {
+ anObjectName = myEditedObject->GetName();
+
+ aFillingColor = myEditedObject->GetFillingColor();
+ aBorderColor = myEditedObject->GetBorderColor();
+
+ Handle(HYDROData_Polyline) aRefPolyline = myEditedObject->GetPolyline();
+ if ( !aRefPolyline.IsNull() )
+ aSelectedPolyline = aRefPolyline->GetName();
+
+ Handle(HYDROData_Bathymetry) aRefBathymetry = myEditedObject->GetBathymetry();
+ if ( !aRefBathymetry.IsNull() )
+ aSelectedBathymetry = aRefBathymetry->GetName();
+ }
+ }
+
+ // collect information about existing closed polylines
+ QStringList aPolylines;
+
+ HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Polyline) aPolylineObj =
+ Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+ if ( aPolylineObj.IsNull() || !aPolylineObj->IsClosed() )
+ continue;
+
+ QString aPolylineName = aPolylineObj->GetName();
+ if ( aPolylineName.isEmpty() )
+ continue;
+
+ aPolylines.append( aPolylineName );
+ }
+
+ // collect information about existing bathymetries
+ QStringList aBathymetries;
+
+ anIter = HYDROData_Iterator( doc(), KIND_BATHYMETRY );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Bathymetry) aBathymetryObj =
+ Handle(HYDROData_Bathymetry)::DownCast( anIter.Current() );
+ if ( aBathymetryObj.IsNull() )
+ continue;
+
+ QString aBathymetryName = aBathymetryObj->GetName();
+ if ( aBathymetryName.isEmpty() )
+ continue;
+
+ aBathymetries.append( aBathymetryName );
+ }
+
+ aPanel->setObjectName( anObjectName );
+
+ aPanel->setFillingColor( aFillingColor );
+ aPanel->setBorderColor( aBorderColor );
+
+ aPanel->setPolylineNames( aPolylines );
+ aPanel->setBathymetryNames( aBathymetries );
+
+ aPanel->blockSignals( false );
+
+ aPanel->setPolylineName( aSelectedPolyline );
+ aPanel->setBathymetryName( aSelectedBathymetry );
+}
+
+void HYDROGUI_ImmersibleZoneOp::abortOperation()
+{
+ closePreview();
+
+ HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_ImmersibleZoneOp::commitOperation()
+{
+ closePreview();
+
+ HYDROGUI_Operation::commitOperation();
+}
+
+HYDROGUI_InputPanel* HYDROGUI_ImmersibleZoneOp::createInputPanel() const
+{
+ HYDROGUI_ImmersibleZoneDlg* aPanel = new HYDROGUI_ImmersibleZoneDlg( module(), getName() );
+ connect( aPanel, SIGNAL( CreatePreview( const QString& ) ),
+ this, SLOT( onCreatePreview( const QString& ) ) );
+ return aPanel;
+}
+
+bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg )
+{
+ HYDROGUI_ImmersibleZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ImmersibleZoneDlg*>( inputPanel() );
+ if ( !aPanel )
+ return false;
+
+ QString anObjectName = aPanel->getObjectName().simplified();
+ if ( anObjectName.isEmpty() )
+ {
+ theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
+ return false;
+ }
+
+ if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
+ {
+ // check that there are no other objects with the same name in the document
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
+ if( !anObject.IsNull() )
+ {
+ theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
+ return false;
+ }
+ }
+
+ Handle(HYDROData_ImmersibleZone) aZoneObj = myIsEdit ? myEditedObject :
+ Handle(HYDROData_ImmersibleZone)::DownCast( doc()->CreateObject( KIND_IMMERSIBLE_ZONE ) );
+ if ( aZoneObj.IsNull() )
+ return false;
+
+ Handle(HYDROData_Polyline) aZonePolyline;
+ Handle(HYDROData_Bathymetry) aZoneBathymetry;
+
+ QString aPolylineName = aPanel->getPolylineName();
+ if ( !aPolylineName.isEmpty() )
+ {
+ aZonePolyline = Handle(HYDROData_Polyline)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
+ }
+
+ QString aBathymetryName = aPanel->getBathymetryName();
+ if ( !aBathymetryName.isEmpty() )
+ {
+ aZoneBathymetry = Handle(HYDROData_Bathymetry)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aBathymetryName, KIND_BATHYMETRY ) );
+ }
+
+ aZoneObj->SetName( anObjectName );
+
+ aZoneObj->SetFillingColor( aPanel->getFillingColor() );
+ aZoneObj->SetBorderColor( aPanel->getBorderColor() );
+
+ aZoneObj->SetPolyline( aZonePolyline );
+ aZoneObj->SetBathymetry( aZoneBathymetry );
+
+ closePreview();
+
+ if( !myIsEdit )
+ module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aZoneObj, true );
+
+ theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+
+ return true;
+}
+
+void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName )
+{
+ HYDROGUI_ImmersibleZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ImmersibleZoneDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ TopoDS_Wire aWire;
+
+ Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
+ if ( !aPolyline.IsNull() )
+ {
+ aWire = TopoDS::Wire( aPolyline->GetTopShape() );
+ }
+
+ LightApp_Application* anApp = module()->getApp();
+ if ( !myViewManager )
+ myViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
+ anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
+
+ if ( myViewManager && !myPreviewPrs )
+ {
+ if ( OCCViewer_Viewer* aViewer = myViewManager->getOCCViewer() )
+ {
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if ( !aCtx.IsNull() )
+ myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL );
+ }
+ }
+
+ if ( !myViewManager || !myPreviewPrs )
+ return;
+
+ myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false, false );
+ myPreviewPrs->setBorderColor( aPanel->getBorderColor(), false, false );
+ myPreviewPrs->setFace( aWire );
+}
+
+void HYDROGUI_ImmersibleZoneOp::closePreview()
+{
+ if( myPreviewPrs )
+ {
+ delete myPreviewPrs;
+ myPreviewPrs = 0;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+#ifndef HYDROGUI_ImmersibleZoneOp_H
+#define HYDROGUI_ImmersibleZoneOp_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_ImmersibleZone.h>
+
+class OCCViewer_ViewManager;
+
+class HYDROGUI_Shape;
+
+class HYDROGUI_ImmersibleZoneOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ImmersibleZoneOp( HYDROGUI_Module* theModule, const bool theIsEdit );
+ virtual ~HYDROGUI_ImmersibleZoneOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+ virtual void commitOperation();
+
+ virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+
+protected slots:
+ void onCreatePreview( const QString& thePolylineName );
+
+private:
+ void closePreview();
+
+private:
+ bool myIsEdit;
+ Handle(HYDROData_ImmersibleZone) myEditedObject;
+
+ OCCViewer_ViewManager* myViewManager;
+
+ HYDROGUI_Shape* myPreviewPrs;
+};
+
+#endif
}
// check that there are no other objects with the same name in the document
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
if ( !anObject.IsNull() )
{
theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
#include <HYDROData_Iterator.h>
#include <HYDROData_Lambert93.h>
-#include <HYDROOperations_Factory.h>
+#include <HYDROData_OperationsFactory.h>
#include <GraphicsView_ViewManager.h>
#include <GraphicsView_ViewPort.h>
Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( anIterator.Current() );
if( !anImageObj.IsNull() )
{
- if( myIsEdit && HYDROGUI_Tool::IsEqual( anImageObj, myEditedObject ) )
+ if( myIsEdit && IsEqual( anImageObj, myEditedObject ) )
continue;
QPoint aPointA1, aPointB1, aPointC1;
if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anImageName ) )
{
// check that there are no other objects with the same name in the document
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anImageName );
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anImageName );
if( !anObject.IsNull() )
{
theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anImageName );
#include <HYDROData_Image.h>
#include <HYDROData_Lambert93.h>
-#include <HYDROOperations_Factory.h>
+#include <HYDROData_OperationsFactory.h>
#include <GraphicsView_ViewFrame.h>
#include <GraphicsView_ViewManager.h>
bool anIsMustBeUpdatedImage = false;
bool anIsPolyline = false;
bool anIsCalculation = false;
- bool anIsZone = false;
+ bool anIsImmersibleZone = false;
bool anIsVisualState = false;
// check the selected data model objects
HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
if( !anObject.IsNull() )
{
anIsSelectedDataObjects = true;
{
anIsImportedImage = anImage->HasTrsfPoints() && !anImage->IsSelfSplitted();
anIsCompositeImage = anImage->NbReferences() > 0;
- if( HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory() )
+ if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
{
if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) )
{
anIsPolyline = true;
else if( anObject->GetKind() == KIND_CALCULATION )
anIsCalculation = true;
- else if( anObject->GetKind() == KIND_ZONE )
- anIsZone = true;
+ else if( anObject->GetKind() == KIND_IMMERSIBLE_ZONE )
+ anIsImmersibleZone = true;
else if( anObject->GetKind() == KIND_VISUAL_STATE )
anIsVisualState = true;
}
case KIND_CALCULATION:
theMenu->addAction( action( CreateCalculationId ) );
break;
- case KIND_ZONE:
- theMenu->addAction( action( CreateZoneId ) );
+ case KIND_IMMERSIBLE_ZONE:
+ theMenu->addAction( action( CreateImmersibleZoneId ) );
break;
}
theMenu->addSeparator();
theMenu->addAction( action( EditCalculationId ) );
theMenu->addSeparator();
}
- else if( anIsZone )
+ else if( anIsImmersibleZone )
{
- theMenu->addAction( action( EditZoneId ) );
+ theMenu->addAction( action( EditImmersibleZoneId ) );
theMenu->addSeparator();
}
else if( anIsVisualState && anIsObjectBrowser )
theMenu->addSeparator();
}
- if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsZone ) )
+ if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsImmersibleZone ) )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
}
bool HYDROGUI_Module::isObjectVisible( const int theViewId,
- const Handle(HYDROData_Object)& theObject ) const
+ const Handle(HYDROData_Entity)& theObject ) const
{
if( theObject.IsNull() )
return false;
}
void HYDROGUI_Module::setObjectVisible( const int theViewId,
- const Handle(HYDROData_Object)& theObject,
+ const Handle(HYDROData_Entity)& theObject,
const bool theState )
{
if( !theObject.IsNull() )
}
HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject ) const
+ const Handle(HYDROData_Entity)& theObject ) const
{
HYDROGUI_Shape* aResShape = NULL;
if( theObject.IsNull() )
}
void HYDROGUI_Module::setObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject,
+ const Handle(HYDROData_Entity)& theObject,
HYDROGUI_Shape* theShape )
{
if( theObject.IsNull() )
}
void HYDROGUI_Module::removeObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject )
+ const Handle(HYDROData_Entity)& theObject )
{
if ( !myShapesMap.contains( theViewId ) )
return;
#ifndef HYDROGUI_MODULE_H
#define HYDROGUI_MODULE_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <LightApp_Module.h>
const ViewManagerRole theRole );
bool isObjectVisible( const int theViewId,
- const Handle(HYDROData_Object)& theObject ) const;
+ const Handle(HYDROData_Entity)& theObject ) const;
void setObjectVisible( const int theViewId,
- const Handle(HYDROData_Object)& theObject,
+ const Handle(HYDROData_Entity)& theObject,
const bool theState );
HYDROGUI_Shape* getObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject ) const;
+ const Handle(HYDROData_Entity)& theObject ) const;
void setObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject,
+ const Handle(HYDROData_Entity)& theObject,
HYDROGUI_Shape* theShape );
void removeViewShapes( const int theViewId );
void removeObjectShape( const int theViewId,
- const Handle(HYDROData_Object)& theObject );
+ const Handle(HYDROData_Entity)& theObject );
protected:
CAM_DataModel* createDataModel();
for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- Handle(HYDROData_Object) anObj = theObjs.Value( i );
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
if( anObj.IsNull() )
continue;
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- const Handle(HYDROData_Object)& anObj = theObjs.Value( i );
+ const Handle(HYDROData_Entity)& anObj = theObjs.Value( i );
if( anObj.IsNull() )
anObjectsToErase.Append( anObj );
else
for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- Handle(HYDROData_Object) anObj = theObjs.Value( i );
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
if( anObj.IsNull() )
continue;
HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int theViewerId,
const Handle(AIS_InteractiveContext)& theContext,
- const Handle(HYDROData_Object)& theObject )
+ const Handle(HYDROData_Entity)& theObject )
{
HYDROGUI_Shape* aResShape = NULL;
if ( theContext.IsNull() || theObject.IsNull() )
ObjectKind anObjectKind = theObject->GetKind();
if ( anObjectKind != KIND_IMAGE &&
anObjectKind != KIND_POLYLINE &&
+ anObjectKind != KIND_IMMERSIBLE_ZONE &&
+ anObjectKind != KIND_REGION &&
anObjectKind != KIND_ZONE )
return aResShape;
for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
- Handle(HYDROData_Object) anObj = theObjs.Value( i );
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
if ( anObj.IsNull() || anObj->IsRemoved() )
continue;
if ( aPrsObj.IsNull() )
continue;
- Handle(HYDROData_Object) anOwnerObj =
- Handle(HYDROData_Object)::DownCast( aPrsObj->GetOwner() );
+ Handle(HYDROData_Entity) anOwnerObj =
+ Handle(HYDROData_Entity)::DownCast( aPrsObj->GetOwner() );
if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() )
myModule->removeObjectShape( (size_t)aViewer, anOwnerObj );
}
#ifndef HYDROGUI_OCCDISPLAYER_H
#define HYDROGUI_OCCDISPLAYER_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
class HYDROGUI_Module;
class HYDROGUI_Shape;
*/
HYDROGUI_Shape* createShape( const int theViewerId,
const Handle(AIS_InteractiveContext)& theContext,
- const Handle(HYDROData_Object)& theObject );
+ const Handle(HYDROData_Entity)& theObject );
private:
HYDROGUI_Module* myModule;
if ( anAIS.IsNull() || !anAIS->HasOwner() )
return aRes;
- Handle(HYDROData_Object) anObj =
- Handle(HYDROData_Object)::DownCast( anAIS->GetOwner() );
+ Handle(HYDROData_Entity) anObj =
+ Handle(HYDROData_Entity)::DownCast( anAIS->GetOwner() );
if ( !anObj.IsNull() )
aRes = HYDROGUI_DataObject::dataObjectEntry( anObj );
return;
QString anObjName;
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
if( !anObject.IsNull() )
if( myObjectKind == KIND_UNKNOWN || myObjectKind == anObject->GetKind() )
anObjName = anObject->GetName();
#include "HYDROGUI_ObserveImageOp.h"
#include "HYDROGUI_PolylineOp.h"
#include "HYDROGUI_ShowHideOp.h"
-#include "HYDROGUI_SplitZonesTool.h"
+#include "HYDROData_SplitToZonesTool.h"
#include "HYDROGUI_TwoImagesOp.h"
#include "HYDROGUI_UpdateFlags.h"
#include "HYDROGUI_UpdateImageOp.h"
#include "HYDROGUI_VisualStateOp.h"
-#include "HYDROGUI_ZoneOp.h"
+#include "HYDROGUI_ImmersibleZoneOp.h"
#include <CAM_Application.h>
createAction( ImportBathymetryId, "IMPORT_BATHYMETRY", "", Qt::CTRL + Qt::Key_B );
- createAction( CreateZoneId, "CREATE_ZONE" );
- createAction( EditZoneId, "EDIT_ZONE" );
+ createAction( CreateImmersibleZoneId, "CREATE_IMMERSIBLE_ZONE" );
+ createAction( EditImmersibleZoneId, "EDIT_ZONE" );
createAction( CreateCalculationId, "CREATE_CALCULATION" );
createAction( EditCalculationId, "EDIT_CALCULATION" );
createMenu( ImportImageId, aHydroId, -1, -1 );
createMenu( ImportBathymetryId, aHydroId, -1, -1 );
createMenu( CreatePolylineId, aHydroId, -1, -1 );
- createMenu( CreateZoneId, aHydroId, -1, -1 );
+ createMenu( CreateImmersibleZoneId, aHydroId, -1, -1 );
createMenu( CreateCalculationId, aHydroId, -1, -1 );
createMenu( separator(), aHydroId );
createMenu( FuseImagesId, aHydroId, -1, -1 );
case ImportBathymetryId:
anOp = new HYDROGUI_ImportBathymetryOp( aModule );
break;
- case CreateZoneId:
- case EditZoneId:
- anOp = new HYDROGUI_ZoneOp( aModule, theId == EditZoneId );
+ case CreateImmersibleZoneId:
+ case EditImmersibleZoneId:
+ anOp = new HYDROGUI_ImmersibleZoneOp( aModule, theId == EditImmersibleZoneId );
break;
case CreateCalculationId:
case EditCalculationId:
ImportBathymetryId,
EditImportedBathymetryId,
- CreateZoneId,
- EditZoneId,
+ CreateImmersibleZoneId,
+ EditImmersibleZoneId,
CreateCalculationId,
EditCalculationId,
myEditedObject = Handle(HYDROData_Polyline)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
if( !myEditedObject.IsNull() )
{
- int anIntDim = myEditedObject->getDimension();
+ int anIntDim = myEditedObject->GetDimension();
CurveCreator::Dimension aDim = CurveCreator::Dim3d;
if( anIntDim == 2 )
aDim = CurveCreator::Dim2d;
myCurve = new CurveCreator_Curve(aDim);
- QList<PolylineSection> aPolylineData = myEditedObject->getPolylineData();
+ QList<PolylineSection> aPolylineData = myEditedObject->GetPolylineData();
CurveCreator_CurveEditor* anEdit = new CurveCreator_CurveEditor(myCurve);
for( int i = 0 ; i < aPolylineData.size() ; i++ ){
int aDimInt = 3;
if( myCurve->getDimension() == CurveCreator::Dim2d )
aDimInt = 2;
- aPolylineObj->setDimension(aDimInt);
+ aPolylineObj->SetDimension(aDimInt);
QList<PolylineSection> aPolylineData;
for( int i=0 ; i < myCurve->getNbSections() ; i++ ){
PolylineSection aSect;
}
aPolylineData << aSect;
}
- aPolylineObj->setPolylineData(aPolylineData);
+ aPolylineObj->SetPolylineData(aPolylineData);
theUpdateFlags = UF_Model;
module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), aPolylineObj, true );
// name : HYDROGUI_Prs
// Purpose : Constructor
//=======================================================================
-HYDROGUI_Prs::HYDROGUI_Prs( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_Prs::HYDROGUI_Prs( const Handle(HYDROData_Entity)& theObject )
: GraphicsView_Object(),
myObject( theObject ),
myIsToUpdate( false )
#ifndef HYDROGUI_PRS_H
#define HYDROGUI_PRS_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <GraphicsView_Object.h>
class HYDROGUI_Prs : public GraphicsView_Object
{
public:
- HYDROGUI_Prs( const Handle(HYDROData_Object)& theObject );
+ HYDROGUI_Prs( const Handle(HYDROData_Entity)& theObject );
virtual ~HYDROGUI_Prs();
public:
- Handle(HYDROData_Object) getObject() const { return myObject; }
+ Handle(HYDROData_Entity) getObject() const { return myObject; }
bool getIsToUpdate() const { return myIsToUpdate; }
void setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
QCursor* getHighlightCursor() const { return myHighlightCursor; }
private:
- Handle(HYDROData_Object) myObject;
+ Handle(HYDROData_Entity) myObject;
bool myIsToUpdate;
private:
{
}
-bool HYDROGUI_PrsDriver::Update( const Handle(HYDROData_Object)& theObj,
+bool HYDROGUI_PrsDriver::Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs )
{
if ( thePrs )
#ifndef HYDROGUI_PRSDRIVER_H
#define HYDROGUI_PRSDRIVER_H
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
class HYDROGUI_Prs;
* \param thePrs presentation
* \return status of the operation
*/
- virtual bool Update( const Handle(HYDROData_Object)& theObj,
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs );
};
// name : HYDROGUI_PrsImage
// Purpose : Constructor
//=======================================================================
-HYDROGUI_PrsImage::HYDROGUI_PrsImage( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_PrsImage::HYDROGUI_PrsImage( const Handle(HYDROData_Entity)& theObject )
: HYDROGUI_Prs( theObject ),
myPixmapItem( 0 ),
myCaptionItem( 0 ),
typedef QMapIterator< int, TransformationPoint > TransformationPointMapIterator;
public:
- HYDROGUI_PrsImage( const Handle(HYDROData_Object)& theObject );
+ HYDROGUI_PrsImage( const Handle(HYDROData_Entity)& theObject );
virtual ~HYDROGUI_PrsImage();
public:
{
}
-bool HYDROGUI_PrsImageDriver::Update( const Handle(HYDROData_Object)& theObj,
+bool HYDROGUI_PrsImageDriver::Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs )
{
HYDROGUI_PrsDriver::Update( theObj, thePrs );
* \param thePrs presentation
* \return status of the operation
*/
- virtual bool Update( const Handle(HYDROData_Object)& theObj,
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs );
};
// name : HYDROGUI_PrsPolyline
// Purpose : Constructor
//=======================================================================
-HYDROGUI_PrsPolyline::HYDROGUI_PrsPolyline( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_PrsPolyline::HYDROGUI_PrsPolyline( const Handle(HYDROData_Entity)& theObject )
: HYDROGUI_Prs( theObject ),
myPolylineItem( 0 )
{
class HYDROGUI_PrsPolyline : public HYDROGUI_Prs
{
public:
- HYDROGUI_PrsPolyline( const Handle(HYDROData_Object)& theObject );
+ HYDROGUI_PrsPolyline( const Handle(HYDROData_Entity)& theObject );
virtual ~HYDROGUI_PrsPolyline();
public:
{
}
-bool HYDROGUI_PrsPolylineDriver::Update( const Handle(HYDROData_Object)& theObj,
+bool HYDROGUI_PrsPolylineDriver::Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs )
{
HYDROGUI_PrsDriver::Update( theObj, thePrs );
HYDROGUI_PrsPolyline* aPrsPolyline = (HYDROGUI_PrsPolyline*)thePrs;
aPrsPolyline->setName( aPolyline->GetName() );
- aPrsPolyline->setPath( aPolyline->painterPath() );
+ aPrsPolyline->setPath( aPolyline->GetPainterPath() );
aPrsPolyline->compute();
* \param thePrs presentation
* \return status of the operation
*/
- virtual bool Update( const Handle(HYDROData_Object)& theObj,
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs );
};
// name : HYDROGUI_PrsZone
// Purpose : Constructor
//=======================================================================
-HYDROGUI_PrsZone::HYDROGUI_PrsZone( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_PrsZone::HYDROGUI_PrsZone( const Handle(HYDROData_Entity)& theObject )
: HYDROGUI_Prs( theObject ),
myZoneItem( 0 ),
myFillingColor( Qt::transparent ),
class HYDROGUI_PrsZone : public HYDROGUI_Prs
{
public:
- HYDROGUI_PrsZone( const Handle(HYDROData_Object)& theObject );
+ HYDROGUI_PrsZone( const Handle(HYDROData_Entity)& theObject );
virtual ~HYDROGUI_PrsZone();
public:
#include "HYDROGUI_PrsZone.h"
-#include <HYDROData_Zone.h>
+#include <HYDROData_ImmersibleZone.h>
HYDROGUI_PrsZoneDriver::HYDROGUI_PrsZoneDriver()
:HYDROGUI_PrsDriver()
{
}
-bool HYDROGUI_PrsZoneDriver::Update( const Handle(HYDROData_Object)& theObj,
+bool HYDROGUI_PrsZoneDriver::Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs )
{
HYDROGUI_PrsDriver::Update( theObj, thePrs );
if ( theObj.IsNull() )
return false;
- Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( theObj );
+ Handle(HYDROData_ImmersibleZone) aZone =
+ Handle(HYDROData_ImmersibleZone)::DownCast( theObj );
if ( aZone.IsNull() )
return false;
* \param thePrs presentation
* \return status of the operation
*/
- virtual bool Update( const Handle(HYDROData_Object)& theObj,
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
HYDROGUI_Prs*& thePrs );
};
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_MaterialAspect.hxx>
-#include <HYDROData_Domain.h>
+#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
+#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Polyline.h>
+#include <HYDROData_Region.h>
+#include <HYDROData_Zone.h>
+#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <QFile>
HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
- const Handle(HYDROData_Object)& theObject )
+ const Handle(HYDROData_Entity)& theObject )
: myContext( theContext ),
myObject( theObject ),
myIsHighlight( false ),
// Try to retrieve information from object
if ( !myObject.IsNull() )
{
- if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Domain) ) )
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myObject );
+
+ if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) )
{
- Handle(HYDROData_Domain) aDomainObj =
- Handle(HYDROData_Domain)::DownCast( myObject );
+ Handle(HYDROData_ImmersibleZone) aZoneObj =
+ Handle(HYDROData_ImmersibleZone)::DownCast( myObject );
- QColor aFillingColor = aDomainObj->GetFillingColor();
- QColor aBorderColor = aDomainObj->GetBorderColor();
- TopoDS_Face aDomainFace = aDomainObj->Face();
+ QColor aFillingColor = aZoneObj->GetFillingColor();
+ QColor aBorderColor = aZoneObj->GetBorderColor();
+ TopoDS_Face aZoneFace = TopoDS::Face( aZoneObj->GetTopShape() );
setFillingColor( aFillingColor, false, false );
setBorderColor( aBorderColor, false, false );
- setFace( aDomainFace, false, false );
+ setFace( aZoneFace, false, false );
}
else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) )
{
Handle(HYDROData_Polyline) aPolyline =
Handle(HYDROData_Polyline)::DownCast( myObject );
- TopoDS_Wire aPolylineWire = aPolyline->Wire();
+ TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolyline->GetTopShape() );
setWire( aPolylineWire, false, false );
}
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Region) ) )
+ {
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( myObject );
+ }
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
+ {
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( myObject );
+
+ TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
+
+ // Generate the filling color for zone
+ QStringList aGeomObjectsNames;
+
+ HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Object) aRefbject =
+ Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( aRefbject.IsNull() )
+ continue;
+
+ QString aRefObjectName = aRefbject->GetName();
+ if ( aRefObjectName.isEmpty() )
+ continue;
+
+ aGeomObjectsNames.append( aRefObjectName );
+ }
+
+ setFace( aZoneFace, false, false );
+ setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
+ }
else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Image) ) )
{
Handle(HYDROData_Image) anImageObj =
}
}
-QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Object)& theImageObj )
+QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj )
{
QString aResult;
if( !theImageObj.IsNull() )
#include <AIS_InteractiveContext.hxx>
#include <AIS_TexturedShape.hxx>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <QColor>
#include <QImage>
{
public:
HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
- const Handle(HYDROData_Object)& theObject );
+ const Handle(HYDROData_Entity)& theObject );
~HYDROGUI_Shape();
public:
virtual void highlight( bool theIsHighlight );
virtual bool isHighlighted() const;
- Handle(HYDROData_Object) getObject() const { return myObject; }
+ Handle(HYDROData_Entity) getObject() const { return myObject; }
virtual void update( const bool theIsUpdateViewer = true );
static double getQuantityColorVal( const int theColorVal );
void colorShapeBorder( const QColor& theColor );
- static QString generateTextureFileName( const Handle(HYDROData_Object)& theImageObj );
+ static QString generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj );
void removeTextureFile() const;
static QImage reduceTexture( const QImage& theImage, const int theSizeLimit );
private:
Handle(AIS_InteractiveContext) myContext;
- Handle(HYDROData_Object) myObject;
+ Handle(HYDROData_Entity) myObject;
Handle(AIS_TexturedShape) myShape;
bool myIsToUpdate;
#include "HYDROGUI_UpdateFlags.h"
#include <HYDROData_Iterator.h>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
#include <LightApp_Application.h>
HYDROData_Iterator anIterator( doc() );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() )
module()->setObjectVisible( aViewId, anObject, aVisibility );
}
bool aVisibility = myId == ShowId || myId == ShowOnlyId;
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
if( !anObject.IsNull() )
module()->setObjectVisible( aViewId, anObject, aVisibility );
}
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#include "HYDROGUI_SplitZonesTool.h"
-
-#include <HYDROData_Polyline.h>
-#include <HYDROData_Zone.h>
-
-#include <BRepAlgoAPI_Common.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Wire.hxx>
-
-TopoDS_Face HYDROGUI_SplitZonesTool::SplitData::Face() const
-{
- if( !Shape.IsNull() && Shape.ShapeType() == TopAbs_FACE )
- return TopoDS::Face( Shape );
- return TopoDS_Face();
-}
-
-HYDROGUI_SplitZonesTool::SplitDataList
-HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneList,
- const Handle(HYDROData_Polyline)& thePolyline )
-{
- SplitDataList anOutputSplitDataList;
-
- // Preparation. Collect the zone paths to split.
- SplitDataList anInputSplitDataList;
- for( int anIndex = 1, aLength = theZoneList.Length(); anIndex <= aLength; anIndex++ )
- {
- Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( theZoneList.Value( anIndex ) );
- if( !aZone.IsNull() )
- {
- SplitData aSplitData( aZone->Face(), aZone->GetName() );
- anInputSplitDataList.append( aSplitData );
- }
- }
-
- // Step 1. Split the paths.
- SplitDataListIterator anInputIter( anInputSplitDataList );
- while( anInputIter.hasNext() )
- {
- const SplitData& anInputSplitData = anInputIter.next();
- if( anOutputSplitDataList.isEmpty() )
- anOutputSplitDataList.append( anInputSplitData );
- else
- {
- SplitDataList aSplitDataList;
-
- SplitDataList aSrcSplitDataList;
- aSrcSplitDataList.append( anInputSplitData );
-
- SplitDataList aDestSplitDataList = anOutputSplitDataList;
- anOutputSplitDataList.clear();
-
- while( !aDestSplitDataList.isEmpty() )
- {
- SplitData aSrcSplitData = aSrcSplitDataList.last();
-
- SplitData aDestSplitData = aDestSplitDataList.first();
- aDestSplitDataList.pop_front();
-
- SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
- if( SplitTwoData( aSrcSplitData, aDestSplitData,
- aData1Subtracted, aData2Subtracted, aDataIntersected ) )
- anOutputSplitDataList.append( aDataIntersected );
- anOutputSplitDataList.append( aData2Subtracted );
- aSrcSplitDataList.append( aData1Subtracted );
- }
-
- if( !aSrcSplitDataList.isEmpty() )
- anOutputSplitDataList.append( aSrcSplitDataList.last() );
- }
- }
-
- // Step 2. Take into account the boundary polyline.
- if( !thePolyline.IsNull() )
- {
- const TopoDS_Wire& aWire = thePolyline->Wire();
- if( !aWire.IsNull() )
- {
- BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
- aMakeFace.Build();
- if( aMakeFace.IsDone() )
- {
- SplitData aBoundarySplitData( aMakeFace.Face(), "" );
-
- SplitDataList aCutSplitDataList;
- SplitDataListIterator anOutputIter( anOutputSplitDataList );
- while( anOutputIter.hasNext() )
- {
- const SplitData& anOutputSplitData = anOutputIter.next();
-
- SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
- if( SplitTwoData( anOutputSplitData, aBoundarySplitData,
- aData1Subtracted, aData2Subtracted, aDataIntersected ) )
- aCutSplitDataList.append( aDataIntersected );
- }
- anOutputSplitDataList = aCutSplitDataList;
- }
- }
- }
-
- // Step 3. Extract the separate regions.
- SplitDataList anExtractedSplitDataList;
- SplitDataListIterator anOutputIter( anOutputSplitDataList );
- while( anOutputIter.hasNext() )
- {
- const SplitData& anOutputSplitData = anOutputIter.next();
- anExtractedSplitDataList.append( ExtractSeparateData( anOutputSplitData ) );
- }
- return anExtractedSplitDataList;
-}
-
-bool HYDROGUI_SplitZonesTool::SplitTwoData( const SplitData& theData1,
- const SplitData& theData2,
- SplitData& theData1Subtracted,
- SplitData& theData2Subtracted,
- SplitData& theDataIntersected )
-{
- const TopoDS_Shape& aShape1 = theData1.Shape;
- const TopoDS_Shape& aShape2 = theData2.Shape;
-
- const QStringList& aZoneNames1 = theData1.ZoneNames;
- const QStringList& aZoneNames2 = theData2.ZoneNames;
-
- BRepAlgoAPI_Common aCommon( aShape1, aShape2 );
- TopoDS_Shape aCommonShape = aCommon.Shape();
- if( aCommonShape.IsNull() )
- {
- theData1Subtracted = theData1;
- theData2Subtracted = theData2;
- return false;
- }
-
- BRepAlgoAPI_Cut aCut1( aShape1, aShape2 );
- TopoDS_Shape aCut1Shape = aCut1.Shape();
-
- BRepAlgoAPI_Cut aCut2( aShape2, aShape1 );
- TopoDS_Shape aCut2Shape = aCut2.Shape();
-
- theData1Subtracted = SplitData( aCut1Shape, aZoneNames1 );
- theData2Subtracted = SplitData( aCut2Shape, aZoneNames2 );
- theDataIntersected = SplitData( aCommonShape, aZoneNames1 + aZoneNames2 );
-
- return true;
-}
-
-HYDROGUI_SplitZonesTool::SplitDataList
-HYDROGUI_SplitZonesTool::ExtractSeparateData( const SplitData& theData )
-{
- SplitDataList aSplitDataList;
- TopExp_Explorer anExp( theData.Shape, TopAbs_FACE );
- for( ; anExp.More(); anExp.Next() )
- {
- TopoDS_Shape aShape = anExp.Current();
- if( aShape.ShapeType() == TopAbs_FACE )
- {
- TopoDS_Face aFace = TopoDS::Face( aShape );
- if( !aFace.IsNull() )
- {
- SplitData aSplitData( aFace, theData.ZoneNames );
- aSplitDataList.append( aSplitData );
- }
- }
- }
- return aSplitDataList;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef HYDROGUI_SPLITZONESTOOL_H
-#define HYDROGUI_SPLITZONESTOOL_H
-
-#include <HYDROData_Object.h>
-
-#include <TopoDS_Face.hxx>
-
-#include <QStringList>
-
-class Handle(HYDROData_Polyline);
-
-/**
- * \class HYDROGUI_SplitZonesTool
- * \brief This class contains methods used for splitting zones
- * into non-intersected regions.
- */
-class HYDROGUI_SplitZonesTool
-{
-public:
- struct SplitData
- {
- TopoDS_Shape Shape;
- QStringList ZoneNames;
-
- SplitData() {}
-
- SplitData( const TopoDS_Shape& theShape,
- const QStringList& theZoneNames ) :
- Shape( theShape ), ZoneNames( theZoneNames ) {}
-
- SplitData( const TopoDS_Shape& theShape,
- const QString& theZoneName ) :
- Shape( theShape ), ZoneNames( theZoneName ) {}
-
- TopoDS_Face Face() const;
- };
-
- typedef QList <SplitData> SplitDataList;
- typedef QListIterator<SplitData> SplitDataListIterator;
-
-public:
- static SplitDataList SplitZones( const HYDROData_SequenceOfObjects& theZoneList,
- const Handle(HYDROData_Polyline)& thePolyline );
-
-private:
- static bool SplitTwoData( const SplitData& theData1,
- const SplitData& theData2,
- SplitData& theData1Subtracted,
- SplitData& theData2Subtracted,
- SplitData& theDataIntersected );
-
- static SplitDataList ExtractSeparateData( const SplitData& theData );
-};
-
-#endif
#include <HYDROData_Document.h>
#include <HYDROData_Iterator.h>
-#include <HYDROData_Zone.h>
+#include <HYDROData_ImmersibleZone.h>
+#include <HYDROData_Tool.h>
#include <GraphicsView_Viewer.h>
return aRes;
}
-bool HYDROGUI_Tool::IsEqual( const Handle(HYDROData_Object)& theObj1,
- const Handle(HYDROData_Object)& theObj2 )
-{
- if( !theObj1.IsNull() && !theObj2.IsNull() )
- return theObj1->Label() == theObj2->Label(); //ouv: check that the names can be used here
- return false;
-}
-
void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
SUIT_ViewManager* theViewManager )
{
HYDROData_Iterator anIterator( aDocument, KIND_IMAGE );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() )
theSeq.Append( anObject );
}
anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() )
theSeq.Append( anObject );
}
- anIterator = HYDROData_Iterator( aDocument, KIND_ZONE );
+ anIterator = HYDROData_Iterator( aDocument, KIND_IMMERSIBLE_ZONE );
for( ; anIterator.More(); anIterator.Next() )
{
- Handle(HYDROData_Object) anObject = anIterator.Current();
+ Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() )
theSeq.Append( anObject );
}
}
-HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Object)& theObj,
+HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Entity)& theObj,
const GraphicsView_ObjectList& theObjects )
{
if( !theObj.IsNull() )
{
if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
{
- Handle(HYDROData_Object) anObj = aPrs->getObject();
+ Handle(HYDROData_Entity) anObj = aPrs->getObject();
if( IsEqual( anObj, theObj ) )
return aPrs;
}
{
if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
{
- Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
+ Handle(HYDROData_Entity) anObject = aModel->objectByEntry( anOwner->entry() );
if( !anObject.IsNull() )
{
QString aName = anObject->GetName();
return aSeq;
}
-Handle(HYDROData_Object) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule )
+Handle(HYDROData_Entity) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule )
{
HYDROData_SequenceOfObjects aSeq = GetSelectedObjects( theModule );
if( !aSeq.IsEmpty() )
return KIND_UNKNOWN;
}
-Handle(HYDROData_Object) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theModule,
+Handle(HYDROData_Entity) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theModule,
const QString& theName,
const ObjectKind theObjectKind )
{
- Handle(HYDROData_Object) anObject;
- if ( theName.isEmpty() )
- return anObject;
-
- QStringList aNamesList;
- aNamesList << theName;
-
- HYDROData_SequenceOfObjects aSeqOfObjs = FindObjectsByNames( theModule, aNamesList, theObjectKind );
- if( aSeqOfObjs.IsEmpty() )
- return anObject;
-
- anObject = aSeqOfObjs.First();
- return anObject;
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
+ return HYDROData_Tool::FindObjectByName( aDocument, theName, theObjectKind );
}
HYDROData_SequenceOfObjects HYDROGUI_Tool::FindObjectsByNames( HYDROGUI_Module* theModule,
const QStringList& theNames,
const ObjectKind theObjectKind )
{
- HYDROData_SequenceOfObjects aResSeq;
- if ( theNames.isEmpty() )
- return aResSeq;
-
Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
- if( aDocument.IsNull() )
- return aResSeq;
-
- QStringList aNamesList = theNames;
-
- HYDROData_Iterator anIter( aDocument, theObjectKind );
- for( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Object) anObjectRef = anIter.Current();
- if( anObjectRef.IsNull() )
- continue;
-
- QString anObjName = anObjectRef->GetName();
- if ( anObjName.isEmpty() || !aNamesList.contains( anObjName ) )
- continue;
-
- aResSeq.Append( anObjectRef );
-
- aNamesList.removeAll( anObjName );
- if ( aNamesList.isEmpty() )
- break;
- }
-
- return aResSeq;
+ return HYDROData_Tool::FindObjectsByNames( aDocument, theNames, theObjectKind );
}
QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule,
const QString& thePrefix,
const QStringList& theUsedNames )
{
- QString aName;
- int anId = 1;
- while( anId < 100 )
- {
- aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) );
-
- if ( theUsedNames.contains( aName ) )
- continue;
-
- // check that there are no other objects with the same name in the document
- Handle(HYDROData_Object) anObject = FindObjectByName( theModule, aName, KIND_UNKNOWN );
- if( anObject.IsNull() )
- break;
- }
- return aName;
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
+ return HYDROData_Tool::GenerateObjectName( aDocument, thePrefix, theUsedNames );
}
size_t HYDROGUI_Tool::GetActiveViewId( HYDROGUI_Module* theModule,
for( int anIndex = 0, aNbRef = theImage->NbReferences(); anIndex < aNbRef; anIndex++ )
{
- Handle(HYDROData_Object) aRefObj = theImage->Reference( anIndex );
+ Handle(HYDROData_Entity) aRefObj = theImage->Reference( anIndex );
if( !aRefObj.IsNull() && !aRefObj->IsRemoved() )
{
QString aName = aRefObj->GetName();
}
void HYDROGUI_Tool::GetObjectBackReferences( HYDROGUI_Module* theModule,
- const Handle(HYDROData_Object)& theObj,
+ const Handle(HYDROData_Entity)& theObj,
HYDROData_SequenceOfObjects& theBackRefObjects,
QStringList& theBackRefNames )
{
QColor HYDROGUI_Tool::GenerateFillingColor( HYDROGUI_Module* theModule,
const QStringList& theZoneNames )
{
- QColor aFillingColor( HYDROData_Zone::DefaultFillingColor() );
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
+ return GenerateFillingColor( aDocument, theZoneNames );
+}
+
+QColor HYDROGUI_Tool::GenerateFillingColor( const Handle(HYDROData_Document)& theDoc,
+ const QStringList& theZoneNames )
+{
+ QColor aFillingColor( HYDROData_ImmersibleZone::DefaultFillingColor() );
int aCounter = 0;
int aR = 0, aG = 0, aB = 0;
while( aZoneNameIter.hasNext() )
{
const QString& aZoneName = aZoneNameIter.next();
- Handle(HYDROData_Zone) aRefZone = Handle(HYDROData_Zone)::DownCast(
- FindObjectByName( theModule, aZoneName, KIND_ZONE ) );
+ Handle(HYDROData_ImmersibleZone) aRefZone =
+ Handle(HYDROData_ImmersibleZone)::DownCast(
+ HYDROData_Tool::FindObjectByName( theDoc, aZoneName, KIND_IMMERSIBLE_ZONE ) );
if( !aRefZone.IsNull() )
{
QColor aRefColor = aRefZone->GetFillingColor();
class HYDROGUI_Prs;
class QDockWidget;
+class Handle(HYDROData_Document);
/**
* \class HYDROGUI_Tool
*/
static QString GetTempDir( const bool theToCreate );
- /**
- * \brief Check that the specified objects are equal.
- * \param theObj1 first object
- * \param theObj2 second object
- */
- static bool IsEqual( const Handle(HYDROData_Object)& theObj1,
- const Handle(HYDROData_Object)& theObj2 );
-
/**
* \brief Set the specified view manager to be active on the desktop.
* \param theModule module
* \param theObjects list of existing presentations
* \return presentation
*/
- static HYDROGUI_Prs* GetPresentation( const Handle(HYDROData_Object)& theObj,
+ static HYDROGUI_Prs* GetPresentation( const Handle(HYDROData_Entity)& theObj,
const GraphicsView_ObjectList& theObjects );
/**
* \param theModule module
* \return selected data object
*/
- static Handle(HYDROData_Object) GetSelectedObject( HYDROGUI_Module* theModule );
+ static Handle(HYDROData_Entity) GetSelectedObject( HYDROGUI_Module* theModule );
/**
* \brief Get kind of objects the selected partition contains.
* \param theObjectKind kind of object
* \return data object
*/
- static Handle(HYDROData_Object) FindObjectByName( HYDROGUI_Module* theModule,
+ static Handle(HYDROData_Entity) FindObjectByName( HYDROGUI_Module* theModule,
const QString& theName,
const ObjectKind theObjectKind = KIND_UNKNOWN );
* \param theBackRefNames list of back-reference object names
*/
static void GetObjectBackReferences( HYDROGUI_Module* theModule,
- const Handle(HYDROData_Object)& theObj,
+ const Handle(HYDROData_Entity)& theObj,
HYDROData_SequenceOfObjects& theBackRefObjects,
QStringList& theBackRefNames );
static QColor GenerateFillingColor( HYDROGUI_Module* theModule,
const QStringList& theZoneNames );
+ /*
+ * \brief Generates the filling color for intersected zone
+ * \param theDoc model document
+ * \param theZoneNames list of intersected zones
+ * \return result color
+ */
+ static QColor GenerateFillingColor( const Handle(HYDROData_Document)& theDoc,
+ const QStringList& theZoneNames );
+
};
#endif
#include <HYDROData_Image.h>
#include <HYDROData_Polyline.h>
-#include <HYDROOperations_Factory.h>
+#include <HYDROData_OperationsFactory.h>
#include <ImageComposer_CutOperator.h>
#include <ImageComposer_CropOperator.h>
{
if( myEditedObject->NbReferences() > 0 )
{
- Handle(HYDROData_Object) anObject1 = myEditedObject->Reference( 0 );
+ Handle(HYDROData_Entity) anObject1 = myEditedObject->Reference( 0 );
if( !anObject1.IsNull() )
aSelectedName1 = anObject1->GetName();
}
if( myEditedObject->NbReferences() > 1 )
{
- Handle(HYDROData_Object) anObject2 = myEditedObject->Reference( 1 );
+ Handle(HYDROData_Entity) anObject2 = myEditedObject->Reference( 1 );
if( !anObject2.IsNull() )
aSelectedName2 = anObject2->GetName();
}
aPanel->setSelectedObjects( aSelectedName1, aSelectedName2 );
- HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
+ HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
if( ImageComposer_Operator* anOperator = aFactory->Operator( myEditedObject ) )
{
QColor aColor;
( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anImageName ) ) )
{
// check that there are no other objects with the same name in the document
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anImageName );
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anImageName );
if( !anObject.IsNull() )
{
theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anImageName );
}
}
- Handle(HYDROData_Object) anObject1 = Handle(HYDROData_Object)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aSelectedName1, KIND_UNKNOWN ) );
- Handle(HYDROData_Object) anObject2 = Handle(HYDROData_Object)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aSelectedName2, KIND_UNKNOWN ) );
+ Handle(HYDROData_Entity) anObject1 =
+ HYDROGUI_Tool::FindObjectByName( module(), aSelectedName1, KIND_UNKNOWN ) ;
+ Handle(HYDROData_Entity) anObject2 =
+ HYDROGUI_Tool::FindObjectByName( module(), aSelectedName2, KIND_UNKNOWN );
if( anObject1.IsNull() || anObject2.IsNull() )
return false;
- HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
+ HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
Handle(HYDROData_Image) aResult;
ImageComposer_Operator* anOperator = 0;
for( int anObjIndex = 1, aLength = aSeq.Length(); anObjIndex <= aLength; anObjIndex++ )
{
- Handle(HYDROData_Object) anObject = aSeq.Value( anObjIndex );
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anObjIndex );
if( !anObject.IsNull() )
{
// Format: "Name|Visibility[|CoordX|CoordY]"
for( int anObjIndex = 1, aLength = aSeq.Length(); anObjIndex <= aLength; anObjIndex++ )
{
- Handle(HYDROData_Object) anObject = aSeq.Value( anObjIndex );
+ Handle(HYDROData_Entity) anObject = aSeq.Value( anObjIndex );
if( !anObject.IsNull() )
{
QString aName = anObject->GetName();
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#include "HYDROGUI_ZoneDlg.h"
-
-#include "HYDROGUI_ColorWidget.h"
-#include "HYDROGUI_Tool.h"
-
-#include <QComboBox>
-#include <QGroupBox>
-#include <QLabel>
-#include <QLayout>
-#include <QLineEdit>
-#include <QListWidget>
-#include <QRadioButton>
-
-HYDROGUI_ZoneDlg::HYDROGUI_ZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_InputPanel( theModule, theTitle )
-{
- // Zone name
- myObjectNameGroup = new QGroupBox( tr( "ZONE_NAME" ), mainFrame() );
-
- myObjectName = new QLineEdit( myObjectNameGroup );
-
- QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
- aNameLayout->setMargin( 5 );
- aNameLayout->setSpacing( 5 );
- aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
- aNameLayout->addWidget( myObjectName );
-
-
- QGroupBox* aParamGroup = new QGroupBox( tr( "ZONE_PARAMETERS" ), mainFrame() );
-
- QFrame* aPolylineFrame = new QFrame( aParamGroup );
-
- myPolylines = new QComboBox( aPolylineFrame );
- myPolylines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- QBoxLayout* aPolyLayout = new QHBoxLayout( aPolylineFrame );
- aPolyLayout->setMargin( 0 );
- aPolyLayout->setSpacing( 5 );
- aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
- aPolyLayout->addWidget( myPolylines );
-
-
- QFrame* aFillingFrame = new QFrame( aParamGroup );
- QLabel* aFillingLabel = new QLabel( tr( "FILLING_COLOR" ), aFillingFrame );
- myFillingTransparent = new QRadioButton( tr( "TRANSPARENT" ), aFillingFrame );
- myFillingTransparent->setChecked( true );
- myFillingColor = new QRadioButton( tr( "COLOR" ), aFillingFrame );
- myFillingColorBox = new HYDROGUI_ColorWidget( aFillingFrame );
-
- QGridLayout* aFillingLayout = new QGridLayout( aFillingFrame );
- aFillingLayout->setMargin( 0 );
- aFillingLayout->setSpacing( 5 );
- aFillingLayout->addWidget( aFillingLabel, 0, 0, 2, 1 );
- aFillingLayout->addWidget( myFillingTransparent, 0, 1 );
- aFillingLayout->addWidget( myFillingColor, 1, 1 );
- aFillingLayout->addWidget( myFillingColorBox, 1, 2 );
-
-
- myBorderColorGroup = new QGroupBox( tr( "BORDER_COLOR" ), mainFrame() );
- myBorderColorGroup->setCheckable( true );
-
- myBorderColorBox = new HYDROGUI_ColorWidget( myBorderColorGroup );
-
- QBoxLayout* aBorderColorLayout = new QHBoxLayout( myBorderColorGroup );
- aBorderColorLayout->setMargin( 5 );
- aBorderColorLayout->setSpacing( 5 );
- aBorderColorLayout->addWidget( new QLabel( tr( "COLOR" ), myBorderColorGroup ) );
- aBorderColorLayout->addWidget( myBorderColorBox );
-
-
- QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
- aParamLayout->setMargin( 5 );
- aParamLayout->setSpacing( 5 );
- aParamLayout->addWidget( aPolylineFrame );
- aParamLayout->addWidget( aFillingFrame );
- aParamLayout->addWidget( myBorderColorGroup );
-
-
- QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRIES" ), mainFrame() );
-
- myBathymetries = new QListWidget( aBathGroup );
- myBathymetries->setSelectionMode( QListWidget::SingleSelection );
- myBathymetries->setEditTriggers( QListWidget::NoEditTriggers );
- myBathymetries->setViewMode( QListWidget::ListMode );
-
- QBoxLayout* aBathLayout = new QHBoxLayout( aBathGroup );
- aBathLayout->setMargin( 5 );
- aBathLayout->setSpacing( 5 );
- aBathLayout->addWidget( myBathymetries );
-
-
- // Common
- addWidget( myObjectNameGroup );
- addWidget( aParamGroup );
- addWidget( aBathGroup );
-
- addStretch();
-
-
- // Connect signals and slots
- connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myFillingTransparent, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myFillingColor, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myFillingColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onFillingColorChanged() ) );
- connect( myBorderColorGroup, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myBorderColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onZoneDefChanged() ) );
-}
-
-HYDROGUI_ZoneDlg::~HYDROGUI_ZoneDlg()
-{
-}
-
-void HYDROGUI_ZoneDlg::reset()
-{
- bool isBlocked = blockSignals( true );
-
- myObjectName->clear();
-
- myPolylines->clear();
- myBathymetries->clear();
-
- myFillingTransparent->setChecked( true );
- myFillingColorBox->resetColor();
-
- myBorderColorGroup->setChecked( false );
- myBorderColorBox->resetColor();
-
- blockSignals( isBlocked );
-
- onZoneDefChanged();
-}
-
-void HYDROGUI_ZoneDlg::setObjectName( const QString& theName )
-{
- myObjectName->setText( theName );
-}
-
-QString HYDROGUI_ZoneDlg::getObjectName() const
-{
- return myObjectName->text();
-}
-
-void HYDROGUI_ZoneDlg::setPolylineNames( const QStringList& thePolylines )
-{
- bool isBlocked = blockSignals( true );
-
- myPolylines->clear();
- myPolylines->addItems( thePolylines );
-
- blockSignals( isBlocked );
-}
-
-void HYDROGUI_ZoneDlg::setPolylineName( const QString& theName )
-{
- int aNewIdx = myPolylines->findText( theName );
- if ( aNewIdx != myPolylines->currentIndex() )
- {
- myPolylines->setCurrentIndex( aNewIdx );
- }
- else
- {
- onZoneDefChanged();
- }
-}
-
-QString HYDROGUI_ZoneDlg::getPolylineName() const
-{
- return myPolylines->currentText();
-}
-
-void HYDROGUI_ZoneDlg::setBathymetries( const QStringList& theBathymetries )
-{
- myBathymetries->clear();
-
- for ( int i = 0, n = theBathymetries.length(); i < n; ++i )
- {
- QString aBathymetryName = theBathymetries.at( i );
-
- QListWidgetItem* aListItem = new QListWidgetItem( aBathymetryName, myBathymetries );
- aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable );
- aListItem->setCheckState( Qt::Unchecked );
- }
-}
-
-void HYDROGUI_ZoneDlg::setSelectedBathymetries( const QStringList& theBathymetries )
-{
- for ( int i = 0, n = theBathymetries.length(); i < n; ++i )
- {
- QString aBathymetryName = theBathymetries.at( i );
-
- QList<QListWidgetItem *> anItems =
- myBathymetries->findItems( aBathymetryName, Qt::MatchFixedString | Qt::MatchCaseSensitive );
- if ( anItems.isEmpty() )
- continue;
-
- QListWidgetItem* aListItem = anItems.first();
- if ( !aListItem )
- continue;
-
- aListItem->setCheckState( Qt::Checked );
- }
-}
-
-QStringList HYDROGUI_ZoneDlg::getSelectedBathymetries() const
-{
- QStringList aResList;
-
- for ( int i = 0, n = myBathymetries->count(); i < n; ++i )
- {
- QListWidgetItem* aListItem = myBathymetries->item( i );
- if ( !aListItem || aListItem->checkState() != Qt::Checked )
- continue;
-
- QString aSelBathName = aListItem->text();
- aResList.append( aSelBathName );
- }
-
- return aResList;
-}
-
-void HYDROGUI_ZoneDlg::setFillingColor( const QColor& theColor )
-{
- bool isBlocked = blockSignals( true );
-
- if( theColor.alpha() == 0 ) // transparent
- myFillingTransparent->setChecked( true );
- else
- myFillingColor->setChecked( true );
-
- myFillingColorBox->setColor( theColor );
-
- blockSignals( isBlocked );
-
- onZoneDefChanged();
-}
-
-QColor HYDROGUI_ZoneDlg::getFillingColor() const
-{
- QColor aColor( 255, 255, 255, 0 ); // transparent
- if( myFillingColor->isChecked() )
- aColor = myFillingColorBox->color();
- return aColor;
-}
-
-void HYDROGUI_ZoneDlg::setBorderColor( const QColor& theColor )
-{
- bool isBlocked = blockSignals( true );
-
- bool isTransparent = theColor.alpha() == 0;
- myBorderColorGroup->setChecked( !isTransparent );
- myBorderColorBox->setColor( !isTransparent ? theColor : QColor( Qt::black ) );
-
- blockSignals( isBlocked );
-
- onZoneDefChanged();
-}
-
-QColor HYDROGUI_ZoneDlg::getBorderColor() const
-{
- QColor aColor( Qt::transparent ); // transparent
- if( myBorderColorGroup->isChecked() )
- aColor = myBorderColorBox->color();
- return aColor;
-}
-
-void HYDROGUI_ZoneDlg::onFillingColorChanged()
-{
- if ( !myFillingColor->isChecked() )
- return;
-
- onZoneDefChanged();
-}
-
-void HYDROGUI_ZoneDlg::onZoneDefChanged()
-{
- if ( signalsBlocked() )
- return;
-
- QString aPolylineName = getPolylineName();
- emit CreatePreview( aPolylineName );
-}
-
-
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef HYDROGUI_ZONEDLG_H
-#define HYDROGUI_ZONEDLG_H
-
-#include "HYDROGUI_InputPanel.h"
-
-class HYDROGUI_ColorWidget;
-class QComboBox;
-class QGroupBox;
-class QLineEdit;
-class QListWidget;
-class QRadioButton;
-
-class HYDROGUI_ZoneDlg : public HYDROGUI_InputPanel
-{
- Q_OBJECT
-
-public:
- HYDROGUI_ZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle );
- virtual ~HYDROGUI_ZoneDlg();
-
- void reset();
-
- void setObjectName( const QString& theName );
- QString getObjectName() const;
-
- void setPolylineNames( const QStringList& thePolylines );
- void setPolylineName( const QString& thePolyline );
- QString getPolylineName() const;
-
- void setBathymetries( const QStringList& theBathymetries );
- void setSelectedBathymetries( const QStringList& theBathymetries );
- QStringList getSelectedBathymetries() const;
-
- void setFillingColor( const QColor& theColor );
- QColor getFillingColor() const;
-
- void setBorderColor( const QColor& theColor );
- QColor getBorderColor() const;
-
-signals:
- void CreatePreview( const QString& thePolylineName );
-
-private slots:
- void onZoneDefChanged();
- void onFillingColorChanged();
-
-private:
-
- QGroupBox* myObjectNameGroup;
- QLineEdit* myObjectName;
-
- QComboBox* myPolylines;
- QListWidget* myBathymetries;
-
- QRadioButton* myFillingTransparent;
- QRadioButton* myFillingColor;
- HYDROGUI_ColorWidget* myFillingColorBox;
-
- QGroupBox* myBorderColorGroup;
- HYDROGUI_ColorWidget* myBorderColorBox;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#include "HYDROGUI_ZoneOp.h"
-
-#include "HYDROGUI_DataModel.h"
-#include "HYDROGUI_ZoneDlg.h"
-#include "HYDROGUI_Module.h"
-#include "HYDROGUI_Shape.h"
-#include "HYDROGUI_Tool.h"
-#include "HYDROGUI_UpdateFlags.h"
-
-#include <HYDROData_Bathymetry.h>
-#include <HYDROData_Iterator.h>
-#include <HYDROData_Polyline.h>
-
-#include <OCCViewer_ViewManager.h>
-#include <OCCViewer_ViewModel.h>
-
-#include <LightApp_Application.h>
-#include <LightApp_UpdateFlags.h>
-
-#include <TopoDS_Wire.hxx>
-
-HYDROGUI_ZoneOp::HYDROGUI_ZoneOp( HYDROGUI_Module* theModule,
- const bool theIsEdit )
-: HYDROGUI_Operation( theModule ),
- myIsEdit( theIsEdit ),
- myViewManager( 0 ),
- myPreviewPrs( 0 )
-{
- setName( theIsEdit ? tr( "EDIT_ZONE" ) : tr( "CREATE_ZONE" ) );
-}
-
-HYDROGUI_ZoneOp::~HYDROGUI_ZoneOp()
-{
- closePreview();
-}
-
-void HYDROGUI_ZoneOp::startOperation()
-{
- HYDROGUI_Operation::startOperation();
-
- HYDROGUI_ZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ZoneDlg*>( inputPanel() );
- if ( !aPanel )
- return;
-
- aPanel->blockSignals( true );
-
- aPanel->reset();
-
- QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Zone" );
-
- QColor aFillingColor( HYDROData_Zone::DefaultFillingColor() );
- QColor aBorderColor( HYDROData_Zone::DefaultBorderColor() );
- QString aSelectedPolyline;
- QStringList aSelectedBathymetries;
-
- if ( myIsEdit )
- {
- myEditedObject = Handle(HYDROData_Zone)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
- if( !myEditedObject.IsNull() )
- {
- anObjectName = myEditedObject->GetName();
-
- aFillingColor = myEditedObject->GetFillingColor();
- aBorderColor = myEditedObject->GetBorderColor();
-
- Handle(HYDROData_Polyline) aRefPolyline = myEditedObject->GetPolyline();
- if ( !aRefPolyline.IsNull() )
- aSelectedPolyline = aRefPolyline->GetName();
-
- HYDROData_SequenceOfObjects aRefBathymetries = myEditedObject->GetBathymetries();
- HYDROData_SequenceOfObjects::Iterator anIter( aRefBathymetries );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Bathymetry) aRefBathymetry =
- Handle(HYDROData_Bathymetry)::DownCast( anIter.Value() );
- if ( aRefBathymetry.IsNull() )
- continue;
-
- QString aRefBathymetryName = aRefBathymetry->GetName();
- if ( aRefBathymetryName.isEmpty() )
- continue;
-
- aSelectedBathymetries.append( aRefBathymetryName );
- }
- }
- }
-
- // collect information about existing closed polylines
- QStringList aPolylines;
-
- HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Polyline) aPolylineObj =
- Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
- if ( aPolylineObj.IsNull() || !aPolylineObj->isClosed() )
- continue;
-
- QString aPolylineName = aPolylineObj->GetName();
- if ( aPolylineName.isEmpty() )
- continue;
-
- aPolylines.append( aPolylineName );
- }
-
- // collect information about existing bathymetries
- QStringList aBathymetries;
-
- anIter = HYDROData_Iterator( doc(), KIND_BATHYMETRY );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(HYDROData_Bathymetry) aBathymetryObj =
- Handle(HYDROData_Bathymetry)::DownCast( anIter.Current() );
- if ( aBathymetryObj.IsNull() )
- continue;
-
- QString aBathymetryName = aBathymetryObj->GetName();
- if ( aBathymetryName.isEmpty() )
- continue;
-
- aBathymetries.append( aBathymetryName );
- }
-
- aPanel->setObjectName( anObjectName );
-
- aPanel->setFillingColor( aFillingColor );
- aPanel->setBorderColor( aBorderColor );
-
- aPanel->setPolylineNames( aPolylines );
-
- aPanel->setBathymetries( aBathymetries );
- aPanel->setSelectedBathymetries( aSelectedBathymetries );
-
- aPanel->blockSignals( false );
-
- aPanel->setPolylineName( aSelectedPolyline );
-
-}
-
-void HYDROGUI_ZoneOp::abortOperation()
-{
- closePreview();
-
- HYDROGUI_Operation::abortOperation();
-}
-
-void HYDROGUI_ZoneOp::commitOperation()
-{
- closePreview();
-
- HYDROGUI_Operation::commitOperation();
-}
-
-HYDROGUI_InputPanel* HYDROGUI_ZoneOp::createInputPanel() const
-{
- HYDROGUI_ZoneDlg* aPanel = new HYDROGUI_ZoneDlg( module(), getName() );
- connect( aPanel, SIGNAL( CreatePreview( const QString& ) ),
- this, SLOT( onCreatePreview( const QString& ) ) );
- return aPanel;
-}
-
-bool HYDROGUI_ZoneOp::processApply( int& theUpdateFlags,
- QString& theErrorMsg )
-{
- HYDROGUI_ZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ZoneDlg*>( inputPanel() );
- if ( !aPanel )
- return false;
-
- QString anObjectName = aPanel->getObjectName().simplified();
- if ( anObjectName.isEmpty() )
- {
- theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
- return false;
- }
-
- if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
- {
- // check that there are no other objects with the same name in the document
- Handle(HYDROData_Object) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
- if( !anObject.IsNull() )
- {
- theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
- return false;
- }
- }
-
- Handle(HYDROData_Zone) aZoneObj = myIsEdit ? myEditedObject :
- Handle(HYDROData_Zone)::DownCast( doc()->CreateObject( KIND_ZONE ) );
- if ( aZoneObj.IsNull() )
- return false;
-
- aZoneObj->SetName( anObjectName );
-
- aZoneObj->SetFillingColor( aPanel->getFillingColor() );
- aZoneObj->SetBorderColor( aPanel->getBorderColor() );
-
- Handle(HYDROData_Polyline) aZonePolyline;
-
- QString aPolylineName = aPanel->getPolylineName();
- if ( !aPolylineName.isEmpty() )
- {
- aZonePolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
- }
-
- aZoneObj->SetPolyline( aZonePolyline );
-
-
- aZoneObj->RemoveBathymetries();
-
- QStringList aBathymetries = aPanel->getSelectedBathymetries();
- for ( int i = 0; i < aBathymetries.length(); ++i )
- {
- const QString& aBathymetryName = aBathymetries.at( i );
- if ( aBathymetryName.isEmpty() )
- continue;
-
- Handle(HYDROData_Bathymetry) aBathymetry = Handle(HYDROData_Bathymetry)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aBathymetryName, KIND_BATHYMETRY ) );
- if ( aBathymetry.IsNull() )
- continue;
-
- aZoneObj->AddBathymetry( aBathymetry );
- }
-
- closePreview();
-
- if( !myIsEdit )
- module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aZoneObj, true );
-
- theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
-
- return true;
-}
-
-void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName )
-{
- HYDROGUI_ZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ZoneDlg*>( inputPanel() );
- if ( !aPanel )
- return;
-
- TopoDS_Wire aWire;
-
- Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
- if ( !aPolyline.IsNull() )
- {
- aWire = aPolyline->Wire();
- }
-
- LightApp_Application* anApp = module()->getApp();
- if ( !myViewManager )
- myViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
- anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
-
- if ( myViewManager && !myPreviewPrs )
- {
- if ( OCCViewer_Viewer* aViewer = myViewManager->getOCCViewer() )
- {
- Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
- if ( !aCtx.IsNull() )
- myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL );
- }
- }
-
- if ( !myViewManager || !myPreviewPrs )
- return;
-
- myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false, false );
- myPreviewPrs->setBorderColor( aPanel->getBorderColor(), false, false );
- myPreviewPrs->setFace( aWire );
-}
-
-void HYDROGUI_ZoneOp::closePreview()
-{
- if( myPreviewPrs )
- {
- delete myPreviewPrs;
- myPreviewPrs = 0;
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef HYDROGUI_ZONEOP_H
-#define HYDROGUI_ZONEOP_H
-
-#include "HYDROGUI_Operation.h"
-
-#include <HYDROData_Zone.h>
-
-class OCCViewer_ViewManager;
-
-class HYDROGUI_Shape;
-
-class HYDROGUI_ZoneOp : public HYDROGUI_Operation
-{
- Q_OBJECT
-
-public:
- HYDROGUI_ZoneOp( HYDROGUI_Module* theModule, const bool theIsEdit );
- virtual ~HYDROGUI_ZoneOp();
-
-protected:
- virtual void startOperation();
- virtual void abortOperation();
- virtual void commitOperation();
-
- virtual HYDROGUI_InputPanel* createInputPanel() const;
-
- virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
-
-protected slots:
- void onCreatePreview( const QString& thePolylineName );
-
-private:
- void closePreview();
-
-private:
- bool myIsEdit;
- Handle(HYDROData_Zone) myEditedObject;
-
- OCCViewer_ViewManager* myViewManager;
-
- HYDROGUI_Shape* myPreviewPrs;
-};
-
-#endif
<source>BATHYMETRY_FILTER</source>
<translation>Bathymetry files (*.xyz);;All files (*.* *)</translation>
</message>
- <message>
- <source>CASE_BND_POLYLINE</source>
- <translation>Boundary polyline</translation>
- </message>
<message>
<source>CASE_REFERENCE_ZONES</source>
<translation>Reference zones</translation>
<translation>Polyline</translation>
</message>
<message>
- <source>ZONE_BATHYMETRIES</source>
- <translation>Bathymetries</translation>
+ <source>ZONE_BATHYMETRY</source>
+ <translation>Bathymetry</translation>
</message>
</context>
<context>
<name>HYDROGUI_CalculationDlg</name>
- <message>
- <source>BOUNDARY_POLYLINE</source>
- <translation>Polyline</translation>
- </message>
- <message>
- <source>CALCULATION_BOUNDARY</source>
- <translation>Domain of calculation case</translation>
- </message>
<message>
<source>CALCULATION_NAME</source>
<translation>Calculation case name</translation>
</message>
<message>
- <source>CALCULATION_REFERENCE_ZONES</source>
- <translation>Reference zones</translation>
- </message>
- <message>
- <source>CALCULATION_REGIONS</source>
- <translation>Regions</translation>
- </message>
- <message>
- <source>CALCULATION_ZONES</source>
- <translation>Case zones</translation>
- </message>
- <message>
- <source>DEFAULT_PREFIX_REGIONS</source>
- <translation>Region</translation>
+ <source>CALCULATION_REFERENCE_OBJECTS</source>
+ <translation>Objects</translation>
</message>
<message>
<source>NAME</source>
<translation>Name</translation>
</message>
- <message>
- <source>PREFIX_REGIONS</source>
- <translation>Prefix for regions</translation>
- </message>
- <message>
- <source>SPLIT_REFERENCE_ZONES</source>
- <translation>Split zones</translation>
- </message>
</context>
<context>
<translation>Create polyline</translation>
</message>
<message>
- <source>DSK_CREATE_ZONE</source>
- <translation>Create zone</translation>
+ <source>DSK_CREATE_IMMERSIBLE_ZONE</source>
+ <translation>Create immersible zone</translation>
</message>
<message>
- <source>DSK_EDIT_ZONE</source>
- <translation>Edit zone</translation>
+ <source>DSK_EDIT_IMMERSIBLE_ZONE</source>
+ <translation>Edit immersible zone</translation>
</message>
<message>
<source>DSK_COPY</source>
<translation>Create zone</translation>
</message>
<message>
- <source>MEN_EDIT_ZONE</source>
- <translation>Edit zone</translation>
+ <source>MEN_CREATE_IMMERSIBLE_ZONE</source>
+ <translation>Create immersible zone</translation>
</message>
<message>
- <source>MEN_COPY</source>
- <translation>Copy</translation>
+ <source>MEN_EDIT_IMMERSIBLE_ZONE</source>
+ <translation>Edit immersible zone</translation>
</message>
<message>
<source>MEN_CUT_IMAGES</source>
<translation>Create polyline</translation>
</message>
<message>
- <source>STB_CREATE_ZONE</source>
- <translation>Create zone</translation>
+ <source>STB_CREATE_IMMERSIBLE_ZONE</source>
+ <translation>Create immersible zone</translation>
</message>
<message>
- <source>STB_EDIT_ZONE</source>
- <translation>Edit zone</translation>
+ <source>STB_EDIT_IMMERSIBLE_ZONE</source>
+ <translation>Edit immersible zone</translation>
</message>
<message>
<source>STB_COPY</source>
</context>
<context>
- <name>HYDROGUI_ZoneDlg</name>
+ <name>HYDROGUI_ImmersibleZoneDlg</name>
<message>
<source>BORDER_COLOR</source>
<translation>Border</translation>
<translation>Transparent</translation>
</message>
<message>
- <source>ZONE_BATHYMETRIES</source>
- <translation>Bathymetries</translation>
+ <source>ZONE_BATHYMETRY</source>
+ <translation>Bathymetry</translation>
</message>
<message>
<source>ZONE_NAME</source>
</context>
<context>
- <name>HYDROGUI_ZoneOp</name>
+ <name>HYDROGUI_ImmersibleZoneOp</name>
<message>
- <source>CREATE_ZONE</source>
- <translation>Create zone</translation>
+ <source>CREATE_IMMERSIBLE_ZONE</source>
+ <translation>Create immersible zone</translation>
</message>
<message>
- <source>EDIT_ZONE</source>
- <translation>Edit zone</translation>
+ <source>EDIT_IMMERSIBLE_ZONE</source>
+ <translation>Edit immersible zone</translation>
</message>
</context>
%Import QtGui/QtGuimod.sip
+%Include HYDROData_Entity.sip
%Include HYDROData_Object.sip
+%Include HYDROData_ArtificialObject.sip
+%Include HYDROData_NaturalObject.sip
%Include HYDROData_Image.sip
%Include HYDROData_Polyline.sip
%Include HYDROData_Bathymetry.sip
-%Include HYDROData_Domain.sip
+%Include HYDROData_ImmersibleZone.sip
%Include HYDROData_Zone.sip
%Include HYDROData_Region.sip
%Include HYDROData_Calculation.sip
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+
+%ExportedHeaderCode
+#include <HYDROData_ArtificialObject.h>
+%End
+
+class HYDROData_ArtificialObject : HYDROData_Object /Abstract/
+{
+%TypeHeaderCode
+#include <HYDROData_ArtificialObject.h>
+%End
+
+%ConvertToSubClassCode
+ // HYDROData_ArtificialObject sub-classes provide a unique kind ID.
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_UNKNOWN:
+ sipClass = sipClass_HYDROData_ArtificialObject;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_ArtificialObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual ~HYDROData_ArtificialObject();
+
+};
%End
-class HYDROData_Bathymetry : HYDROData_Object
+class HYDROData_Bathymetry : HYDROData_Entity
{
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Bathymetry)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Bathymetry;
- else
- sipClass = NULL;
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_BATHYMETRY:
+ sipClass = sipClass_HYDROData_Bathymetry;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
%End
%TypeHeaderCode
%End
-
-public:
-
- const ObjectKind GetKind() const;
-
-
public:
// Public methods to work with Bathymetry altitudes.
%End
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Calculation)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Calculation;
- else
- sipClass = NULL;
-%End
-
-public:
-
- const ObjectKind GetKind() const;
-
-public:
-
- /**
- * Sets boundary polyline for calculation case.
- */
- void SetBoundaryPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)];
- %MethodCode
-
- Handle(HYDROData_Polyline) aRefPolyline =
- Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) );
- if ( !aRefPolyline.IsNull() )
+ switch ( sipCpp->GetKind() )
{
- Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetBoundaryPolyline( aRefPolyline ) :
- sipCpp->SetBoundaryPolyline( aRefPolyline );
- Py_END_ALLOW_THREADS
- }
-
- %End
+ case KIND_CALCULATION:
+ sipClass = sipClass_HYDROData_Calculation;
+ break;
- /**
- * Returns boundary polyline of calculation case.
- */
- HYDROData_Polyline GetBoundaryPolyline() const [Handle_HYDROData_Polyline ()];
- %MethodCode
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
- Handle(HYDROData_Polyline) aRefPolyline;
-
- Py_BEGIN_ALLOW_THREADS
- aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetBoundaryPolyline() :
- sipCpp->GetBoundaryPolyline();
- Py_END_ALLOW_THREADS
-
- sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline );
-
- %End
+public:
/**
- * Removes boundary polyline of calculation case.
+ * Split reference geometry objects to non-intersected regions.
*/
- void RemoveBoundaryPolyline();
-
-
+ void SplitGeometryObjects();
/**
- * Returns number of refrence zones for calculation case.
+ * Returns number of geometry objects for calculation case.
*/
- int NbZones() const;
+ int NbGeometryObjects() const;
/**
- * Add new one refrence zone for calculation case.
+ * dd new one geometry object for calculation case.
*/
- void AddZone( HYDROData_Zone theZone ) [void (const Handle_HYDROData_Zone&)];
+ void AddGeometryObject( HYDROData_Object theRegion ) [void (const Handle_HYDROData_Object&)];
%MethodCode
- Handle(HYDROData_Zone) aRefZone =
- Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
- if ( !aRefZone.IsNull() )
+ Handle(HYDROData_Object) aGeomObj =
+ Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
+ if ( !aGeomObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Calculation::AddZone( aRefZone ) :
- sipCpp->AddZone( aRefZone );
+ sipSelfWasArg ? sipCpp->HYDROData_Calculation::AddGeometryObject( aGeomObj ) :
+ sipCpp->AddGeometryObject( aGeomObj );
Py_END_ALLOW_THREADS
}
%End
/**
- * Replace the refrence zone for calculation case.
+ * Replace the geometry object for calculation case.
*/
- void SetZone( const int theIndex,
- HYDROData_Zone theZone ) [void (const int, const Handle_HYDROData_Zone&)];
+ void SetGeometryObject( const int theIndex,
+ HYDROData_Object theObject ) [void (const int, const Handle_HYDROData_Object&)];
%MethodCode
- Handle(HYDROData_Zone) aRefZone =
- Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) );
- if ( !aRefZone.IsNull() )
+ Handle(HYDROData_Object) aGeomObj =
+ Handle(HYDROData_Object)::DownCast( createHandle( a1 ) );
+ if ( !aGeomObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetZone( a0, aRefZone ) :
- sipCpp->SetZone( a0, aRefZone );
+ sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetGeometryObject( a0, aGeomObj ) :
+ sipCpp->SetGeometryObject( a0, aGeomObj );
Py_END_ALLOW_THREADS
}
%End
/**
- * Sets the refrence zones for calculation case.
+ * Sets the geometry object for calculation case.
*/
- //void SetZones( const HYDROData_SequenceOfObjects& theZones );
+ //void SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects );
/**
- * Returns refrence zone of calculation case by index.
+ * Returns geometry object of calculation case by index.
*/
- HYDROData_Zone GetZone( const int theIndex ) const [Handle_HYDROData_Zone (const int)];
+ HYDROData_Object GetGeometryObject( const int theIndex ) const [Handle_HYDROData_Object (const int)];
%MethodCode
- Handle(HYDROData_Zone) aRefZone;
+ Handle(HYDROData_Object) aGeomObj;
Py_BEGIN_ALLOW_THREADS
- aRefZone = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetZone( a0 ) :
- sipCpp->GetZone( a0 );
+ aGeomObj = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetGeometryObject( a0 ) :
+ sipCpp->GetGeometryObject( a0 );
Py_END_ALLOW_THREADS
- sipRes = (HYDROData_Zone*)createPointer( aRefZone );
+ sipRes = (HYDROData_Object*)createPointer( aGeomObj );
%End
/**
- * Returns all refrence zone of calculation case.
+ * Returns all geometry objects of calculation case.
*/
- //HYDROData_SequenceOfObjects GetZones() const;
+ //HYDROData_SequenceOfObjects GetGeometryObjects() const;
/**
- * Removes all refrence zone of calculation case.
+ * Removes all geometry objects from calculation case.
*/
- void RemoveZones();
+ void RemoveGeometryObjects();
+
+
+ /**
+ * Add new one region for calculation case.
+ * The new region is not added into the list of reference regions.
+ */
+ HYDROData_Region AddNewRegion() [Handle_HYDROData_Region ()];
+ %MethodCode
+
+ Handle(HYDROData_Region) aNewRegion;
+
+ Py_BEGIN_ALLOW_THREADS
+ aNewRegion = sipSelfWasArg ? sipCpp->HYDROData_Calculation::AddNewRegion() :
+ sipCpp->AddNewRegion();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Region*)createPointer( aNewRegion );
+ %End
+
+ /**
+ * Removes all child regions from calculation case.
+ */
+ void RemoveChildRegions();
/**
- * Returns number of regions for calculation case.
+ * Returns number of reference regions for calculation case.
*/
int NbRegions() const;
/**
- * Add new one region for calculation case.
+ * Add new one reference region for calculation case.
*/
void AddRegion( HYDROData_Region theRegion ) [void (const Handle_HYDROData_Region&)];
%MethodCode
%End
/**
- * Replace the region for calculation case.
+ * Replace the reference region for calculation case.
*/
void SetRegion( const int theIndex,
HYDROData_Region theRegion ) [void (const int, const Handle_HYDROData_Region&)];
%End
/**
- * Sets the refrence region for calculation case.
+ * Inserts the reference region for calculation case before given index.
+ */
+ void InsertRegion( const int theBeforeIndex,
+ HYDROData_Region theRegion ) [void (const int, const Handle_HYDROData_Region&)];
+ %MethodCode
+
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( createHandle( a1 ) );
+ if ( !aRegion.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Calculation::InsertRegion( a0, aRegion ) :
+ sipCpp->InsertRegion( a0, aRegion );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Sets reference regions for calculation case.
*/
//void SetRegions( const HYDROData_SequenceOfObjects& theRegions );
/**
- * Returns region of calculation case by index.
+ * Returns reference region of calculation case by index.
*/
HYDROData_Region GetRegion( const int theIndex ) const [Handle_HYDROData_Region (const int)];
%MethodCode
- Handle(HYDROData_Region) aRegion;
+ Handle(HYDROData_Region) aRefRegion;
Py_BEGIN_ALLOW_THREADS
- aRegion = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetRegion( a0 ) :
- sipCpp->GetRegion( a0 );
+ aRefRegion = sipSelfWasArg ? sipCpp->HYDROData_Region::GetRegion( a0 ) :
+ sipCpp->GetRegion( a0 );
Py_END_ALLOW_THREADS
- sipRes = (HYDROData_Region*)createPointer( aRegion );
+ sipRes = (HYDROData_Region*)createPointer( aRefRegion );
%End
/**
- * Returns all regions of calculation case.
+ * Returns all reference regions of calculation case.
+ */
+ //void HYDROData_SequenceOfObjects GetRegions() const;
+
+ /**
+ * Removes reference region from calculation case.
+ */
+ void RemoveRegion( HYDROData_Region theRegion ) const [void (const Handle_HYDROData_Region&)];
+ %MethodCode
+
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
+ if ( !aRegion.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Calculation::RemoveRegion( aRegion ) :
+ sipCpp->RemoveRegion( aRegion );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Removes region from calculation case by it index.
*/
- //HYDROData_SequenceOfObjects GetRegions() const;
+ void RemoveRegion( const int theIndex );
/**
- * Removes all regions of calculation case.
+ * Removes all reference regions from calculation case.
*/
void RemoveRegions();
%End
%ModuleHeaderCode
-HYDROData_Object* copyObject( HYDROData_Object* theObject );
-Handle(HYDROData_Object) createHandle( HYDROData_Object* theObject );
-HYDROData_Object* createPointer( const Handle(HYDROData_Object)& theObject );
+HYDROData_Entity* copyObject( HYDROData_Entity* theObject );
+Handle(HYDROData_Entity) createHandle( HYDROData_Entity* theObject );
+HYDROData_Entity* createPointer( const Handle(HYDROData_Entity)& theObject );
%End
enum Data_DocError {
%TypeCode
- HYDROData_Object* copyObject( HYDROData_Object* theObject )
+ HYDROData_Entity* copyObject( HYDROData_Entity* theObject )
{
- HYDROData_Object* aRes = NULL;
+ HYDROData_Entity* aRes = NULL;
if ( theObject == NULL )
return aRes;
aRes = new HYDROData_Bathymetry( *dynamic_cast<HYDROData_Bathymetry*>( theObject ) );
break;
}
- case KIND_CALCULATION:
+ case KIND_IMMERSIBLE_ZONE:
{
- aRes = new HYDROData_Calculation( *dynamic_cast<HYDROData_Calculation*>( theObject ) );
+ aRes = new HYDROData_ImmersibleZone( *dynamic_cast<HYDROData_ImmersibleZone*>( theObject ) );
break;
}
- case KIND_ZONE:
+ case KIND_CALCULATION:
{
- aRes = new HYDROData_Zone( *dynamic_cast<HYDROData_Zone*>( theObject ) );
+ aRes = new HYDROData_Calculation( *dynamic_cast<HYDROData_Calculation*>( theObject ) );
break;
}
case KIND_REGION:
aRes = new HYDROData_Region( *dynamic_cast<HYDROData_Region*>( theObject ) );
break;
}
+ case KIND_ZONE:
+ {
+ aRes = new HYDROData_Zone( *dynamic_cast<HYDROData_Zone*>( theObject ) );
+ break;
+ }
}
return aRes;
}
- Handle(HYDROData_Object) createHandle( HYDROData_Object* theObject )
+ Handle(HYDROData_Entity) createHandle( HYDROData_Entity* theObject )
{
- Handle(HYDROData_Object) aRes = copyObject( theObject );
+ Handle(HYDROData_Entity) aRes = copyObject( theObject );
return aRes;
}
- HYDROData_Object* createPointer( const Handle(HYDROData_Object)& theObject )
+ HYDROData_Entity* createPointer( const Handle(HYDROData_Entity)& theObject )
{
- HYDROData_Object* aRes = NULL;
+ HYDROData_Entity* aRes = NULL;
if ( !theObject.IsNull() )
aRes = copyObject( theObject.operator->() );
//! Creates and locates in the document a new object
//! \param theKind kind of the created object, can not be UNKNOWN
//! \returns the created object
- HYDROData_Object CreateObject( const ObjectKind theKind ) [Handle_HYDROData_Object (const ObjectKind)] ;
+ HYDROData_Entity CreateObject( const ObjectKind theKind ) [Handle_HYDROData_Entity (const ObjectKind)] ;
%MethodCode
- Handle(HYDROData_Object) anObject;
+ Handle(HYDROData_Entity) anObject;
Py_BEGIN_ALLOW_THREADS
anObject = sipSelfWasArg ? sipCpp->HYDROData_Document::CreateObject( a0 ) :
sipCpp->CreateObject( a0 );
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-%ExportedHeaderCode
-#include <HYDROData_Domain.h>
-%End
-
-class HYDROData_Domain : HYDROData_Object /Abstract/
-{
-
-%TypeHeaderCode
-#include <HYDROData_Domain.h>
-%End
-
-%ConvertToSubClassCode
- // HYDROData_Object sub-classes provide a unique kind ID.
- switch ( sipCpp->GetKind() )
- {
- case KIND_REGION:
- sipClass = sipClass_HYDROData_Region;
- break;
-
- case KIND_ZONE:
- sipClass = sipClass_HYDROData_Zone;
- break;
-
- case KIND_UNKNOWN:
- sipClass = sipClass_HYDROData_Object;
- break;
-
- default:
- // We don't recognise the type.
- sipClass = NULL;
- }
-%End
-
-public:
-
- /**
- * Sets filling color for zone.
- */
- void SetFillingColor( const QColor& theColor );
-
- /**
- * Returns filling color of zone.
- */
- QColor GetFillingColor() const;
-
- /**
- * Sets border color for zone.
- */
- void SetBorderColor( const QColor& theColor );
-
- /**
- * Returns border color of zone.
- */
- QColor GetBorderColor() const;
-
- /**
- * Returns number of bathymetry objects for zone.
- */
- int NbBathymetries() const;
-
- /**
- * Add reference bathymetry object for zone.
- */
- void AddBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)];
- %MethodCode
-
- Handle(HYDROData_Bathymetry) aRefBath =
- Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) );
- if ( !aRefBath.IsNull() )
- {
- Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Domain::AddBathymetry( aRefBath ) :
- sipCpp->AddBathymetry( aRefBath );
- Py_END_ALLOW_THREADS
- }
-
- %End
-
- /**
- * Change reference bathymetry object with given index for zone.
- */
- void SetBathymetry( const int theIndex,
- HYDROData_Bathymetry theBathymetry ) [void (const int, const Handle_HYDROData_Bathymetry&)];
- %MethodCode
-
- Handle(HYDROData_Bathymetry) aRefBath =
- Handle(HYDROData_Bathymetry)::DownCast( createHandle( a1 ) );
- if ( !aRefBath.IsNull() )
- {
- Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Domain::SetBathymetry( a0, aRefBath ) :
- sipCpp->SetBathymetry( a0, aRefBath );
- Py_END_ALLOW_THREADS
- }
-
- %End
-
- /**
- * Returns reference bathymetry object of zone by it index.
- */
- HYDROData_Bathymetry GetBathymetry( const int theIndex ) const [Handle_HYDROData_Bathymetry (const int)];
- %MethodCode
-
- Handle(HYDROData_Bathymetry) aRefBath;
-
- Py_BEGIN_ALLOW_THREADS
- aRefBath = sipSelfWasArg ? sipCpp->HYDROData_Domain::GetBathymetry( a0 ) :
- sipCpp->GetBathymetry( a0 );
- Py_END_ALLOW_THREADS
-
- sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath );
-
- %End
-
- /**
- * Returns list of all reference bathymetry objects of zone.
- */
- //HYDROData_SequenceOfObjects GetBathymetries() const;
-
- /**
- * Clear list of bathymetry objects of zone.
- */
- void RemoveBathymetries();
-
-protected:
-
- /**
- * 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();
-};
-
-
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+
+%ExportedHeaderCode
+#include <HYDROData_Entity.h>
+%End
+
+typedef int ObjectKind;
+
+const ObjectKind KIND_UNKNOWN;
+const ObjectKind KIND_IMAGE;
+const ObjectKind KIND_POLYLINE;
+const ObjectKind KIND_BATHYMETRY;
+const ObjectKind KIND_IMMERSIBLE_ZONE;
+const ObjectKind KIND_CALCULATION;
+const ObjectKind KIND_ZONE;
+const ObjectKind KIND_REGION;
+
+class HYDROData_Entity
+{
+%TypeHeaderCode
+#include <HYDROData_Entity.h>
+%End
+
+%ConvertToSubClassCode
+ // HYDROData_Entity sub-classes provide a unique kind ID.
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_IMAGE:
+ sipClass = sipClass_HYDROData_Image;
+ break;
+
+ case KIND_POLYLINE:
+ sipClass = sipClass_HYDROData_Polyline;
+ break;
+
+ case KIND_BATHYMETRY:
+ sipClass = sipClass_HYDROData_Bathymetry;
+ break;
+
+ case KIND_IMMERSIBLE_ZONE:
+ sipClass = sipClass_HYDROData_ImmersibleZone;
+ break;
+
+ case KIND_CALCULATION:
+ sipClass = sipClass_HYDROData_Calculation;
+ break;
+
+ case KIND_REGION:
+ sipClass = sipClass_HYDROData_Region;
+ break;
+
+ case KIND_ZONE:
+ sipClass = sipClass_HYDROData_Zone;
+ break;
+
+ case KIND_UNKNOWN:
+ sipClass = sipClass_HYDROData_Entity;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+ /**
+ * Returns the kind of this object. Must be redefined in all objects of known type.
+ */
+ const ObjectKind GetKind() const;
+
+ /**
+ * Returns the name of this object.
+ */
+ QString GetName() const;
+
+ /**
+ * Updates the name of this object.
+ */
+ void SetName(const QString& theName);
+
+ /**
+ * Updates object state.
+ * \param theIsForce force reupdating of data object
+ */
+ void Update(const bool theIsForce);
+
+ /**
+ * Checks is object exists in the data structure.
+ * \returns true is object is not exists in the data model
+ */
+ bool IsRemoved() const;
+
+ /**
+ * Removes object from the data structure.
+ */
+ void Remove();
+
+ /**
+ * Returns unique integer identifier of the object (may be used for ordering of objects)
+ */
+ int ID() const;
+
+ /**
+ * Copies all properties of this to the destinated object.
+ * Objects must be the same type.
+ * \param theDestination initialized object (from any document) - target of copying
+ */
+ /*
+ void CopyTo( HYDROData_Entity theDestination ) const;
+ */
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_Entity();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual ~HYDROData_Entity();
+
+};
#include <HYDROData_Image.h>
%End
-class HYDROData_Image : HYDROData_Object
+class HYDROData_Image : HYDROData_Entity
{
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Image)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Image;
- else
- sipClass = NULL;
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_IMAGE:
+ sipClass = sipClass_HYDROData_Image;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
%End
%TypeHeaderCode
#include <HYDROData_Image.h>
%End
-public:
-
- const ObjectKind GetKind() const;
-
public:
/**
QPointF& thePointBOut,
QPointF& thePointCOut );
+ /**
+ * Returns the number of referenced images
+ * \return zero if there is no references
+ */
+ int NbReferences();
+
/**
* Appends reference to other image.
* \param theReferenced the image referenced by this
*/
- void AppendReference( HYDROData_Object theReferenced ) [void (Handle_HYDROData_Object)];
+ void AppendReference( HYDROData_Entity theReferenced ) [void (Handle_HYDROData_Entity)];
%MethodCode
- Handle(HYDROData_Object) aRefObj = createHandle( a0 );
+ Handle(HYDROData_Entity) aRefObj = createHandle( a0 );
if ( !aRefObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
%End
- /**
- * Returns the number of referenced images
- * \return zero if there is no references
- */
- int NbReferences();
-
/**
* Returns reference by index.
* \param theIndex number of reference [0; NbReference)
* \returns the referenced image, or Null if index is invalid
*/
- HYDROData_Object Reference( const int theIndex ) const [Handle_HYDROData_Object (const int)];
+ HYDROData_Entity Reference( const int theIndex ) const [Handle_HYDROData_Entity (const int)];
%MethodCode
- Handle(HYDROData_Object) aRefObj;
+ Handle(HYDROData_Entity) aRefObj;
Py_BEGIN_ALLOW_THREADS
aRefObj = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) :
* \param theIndex number of reference [0; NbReference]
* \param theReferenced the image referenced by this
*/
- void ChangeReference( const int theIndex, HYDROData_Object theReferenced ) [void (const int, Handle_HYDROData_Object)];
+ void ChangeReference( const int theIndex, HYDROData_Entity theReferenced ) [void (const int, Handle_HYDROData_Entity)];
%MethodCode
- Handle(HYDROData_Object) aRefObj = createHandle( a1 );
+ Handle(HYDROData_Entity) aRefObj = createHandle( a1 );
if ( !aRefObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+%ExportedHeaderCode
+#include <HYDROData_ImmersibleZone.h>
+%End
+
+class HYDROData_ImmersibleZone : HYDROData_NaturalObject
+{
+
+%TypeHeaderCode
+#include <HYDROData_ImmersibleZone.h>
+%End
+
+%ConvertToSubClassCode
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_IMMERSIBLE_ZONE:
+ sipClass = sipClass_HYDROData_ImmersibleZone;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+ /**
+ * Sets filling color for zone.
+ */
+ void SetFillingColor( const QColor& theColor );
+
+ /**
+ * Returns filling color of zone.
+ */
+ QColor GetFillingColor() const;
+
+ /**
+ * Sets border color for zone.
+ */
+ void SetBorderColor( const QColor& theColor );
+
+ /**
+ * Returns border color of zone.
+ */
+ QColor GetBorderColor() const;
+
+ /**
+ * Sets reference polyline object for zone.
+ */
+ void SetPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)];
+ %MethodCode
+
+ Handle(HYDROData_Polyline) aRefPolyline =
+ Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) );
+ if ( !aRefPolyline.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::SetPolyline( aRefPolyline ) :
+ sipCpp->SetPolyline( aRefPolyline );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Returns reference polyline object of zone.
+ */
+ HYDROData_Polyline GetPolyline() const [Handle_HYDROData_Polyline ()];
+ %MethodCode
+
+ Handle(HYDROData_Polyline) aRefPolyline;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetPolyline() :
+ sipCpp->GetPolyline();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline );
+
+ %End
+
+ /**
+ * Remove reference polyline object of zone.
+ */
+ void RemovePolyline();
+
+ /**
+ * Set reference bathymetry object for zone.
+ */
+ void SetBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)];
+ %MethodCode
+
+ Handle(HYDROData_Bathymetry) aRefBath =
+ Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) );
+ if ( !aRefBath.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::SetBathymetry( aRefBath ) :
+ sipCpp->SetBathymetry( aRefBath );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Returns reference bathymetry object of zone.
+ */
+ HYDROData_Bathymetry GetBathymetry() const [Handle_HYDROData_Bathymetry ()];
+ %MethodCode
+
+ Handle(HYDROData_Bathymetry) aRefBath;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRefBath = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetBathymetry() :
+ sipCpp->GetBathymetry();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath );
+
+ %End
+
+ /**
+ * Clear the bathymetry object for zone.
+ */
+ void RemoveBathymetry();
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_ImmersibleZone();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_ImmersibleZone();
+};
+
+
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+
+%ExportedHeaderCode
+#include <HYDROData_NaturalObject.h>
+%End
+
+class HYDROData_NaturalObject : HYDROData_Object /Abstract/
+{
+%TypeHeaderCode
+#include <HYDROData_NaturalObject.h>
+%End
+
+%ConvertToSubClassCode
+ // HYDROData_NaturalObject sub-classes provide a unique kind ID.
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_IMMERSIBLE_ZONE:
+ sipClass = sipClass_HYDROData_ImmersibleZone;
+ break;
+
+ case KIND_UNKNOWN:
+ sipClass = sipClass_HYDROData_NaturalObject;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_NaturalObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual ~HYDROData_NaturalObject();
+
+};
#include <HYDROData_Object.h>
%End
-typedef int ObjectKind;
-
-const ObjectKind KIND_UNKNOWN;
-const ObjectKind KIND_IMAGE;
-const ObjectKind KIND_POLYLINE;
-const ObjectKind KIND_VISUAL_STATE;
-const ObjectKind KIND_BATHYMETRY;
-const ObjectKind KIND_CALCULATION;
-const ObjectKind KIND_ZONE;
-const ObjectKind KIND_REGION;
-
-class HYDROData_Object
+class HYDROData_Object : HYDROData_Entity /Abstract/
{
%TypeHeaderCode
#include <HYDROData_Object.h>
%End
%ConvertToSubClassCode
- // HYDROData_Object sub-classes provide a unique kind ID.
- switch ( sipCpp->GetKind() )
+ if ( !Handle(HYDROData_ArtificialObject)::DownCast( sipCpp ).IsNull() )
+ sipClass = sipClass_HYDROData_ArtificialObject;
+ else if ( !Handle(HYDROData_NaturalObject)::DownCast( sipCpp ).IsNull() )
+ sipClass = sipClass_HYDROData_NaturalObject;
+ else
{
- case KIND_IMAGE:
- sipClass = sipClass_HYDROData_Image;
- break;
-
- case KIND_POLYLINE:
- sipClass = sipClass_HYDROData_Polyline;
- break;
-
- case KIND_BATHYMETRY:
- sipClass = sipClass_HYDROData_Bathymetry;
- break;
-
- case KIND_CALCULATION:
- sipClass = sipClass_HYDROData_Calculation;
- break;
-
- case KIND_ZONE:
- sipClass = sipClass_HYDROData_Zone;
- break;
-
- case KIND_REGION:
- sipClass = sipClass_HYDROData_Region;
- break;
-
- case KIND_UNKNOWN:
- sipClass = sipClass_HYDROData_Object;
- break;
-
- default:
- // We don't recognise the type.
- sipClass = NULL;
+ // HYDROData_Object sub-classes provide a unique kind ID.
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_POLYLINE:
+ sipClass = sipClass_HYDROData_Polyline;
+ break;
+
+ case KIND_UNKNOWN:
+ sipClass = sipClass_HYDROData_Object;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
}
%End
public:
- /**
- * Returns the kind of this object. Must be redefined in all objects of known type.
- */
- const ObjectKind GetKind() const;
-
- /**
- * Returns the name of this object.
- */
- QString GetName() const;
-
- /**
- * Updates the name of this object.
- */
- void SetName(const QString& theName);
-
- /**
- * Updates object state.
- * \param theIsForce force reupdating of data object
- */
- void Update(const bool theIsForce);
-
- /**
- * Checks is object exists in the data structure.
- * \returns true is object is not exists in the data model
- */
- bool IsRemoved() const;
-
- /**
- * Removes object from the data structure.
- */
- void Remove();
-
- /**
- * Returns unique integer identifier of the object (may be used for ordering of objects)
- */
- int ID() const;
-
- /**
- * Copies all properties of this to the destinated object.
- * Objects must be the same type.
- * \param theDestination initialized object (from any document) - target of copying
- */
- /*
- void CopyTo( HYDROData_Object theDestination ) const;
- */
protected:
{
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Polyline)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Polyline;
- else
- sipClass = NULL;
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_POLYLINE:
+ sipClass = sipClass_HYDROData_Polyline;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
%End
public:
typedef QList<PolylineSection> PolylineData;
-public:
-
- const ObjectKind GetKind() const;
-
public:
/**
* Replace current polyline data by new sections list
* \param theSections the sections list
*/
- void setPolylineData( const PolylineData& theSections );
+ void SetPolylineData( const PolylineData& theSections );
/**
* Return polyline data
* \return polyline section list
*/
- PolylineData getPolylineData();
+ PolylineData GetPolylineData();
/**
* Return polyline dimension
* \return polyline dimension (2 or 3)
*/
- int getDimension() const;
+ int GetDimension() const;
/**
* Set polyline dimension (2 or 3)
* \param theDimension the polyline dimension
*/
- void setDimension( int theDimension );
+ void SetDimension( int theDimension );
/**
* Remove all sections from polyline
*/
- void removeAll();
+ void RemoveAll();
/**
* Returns the painter path. The painter path is construct by lines
*/
- QPainterPath painterPath();
+ QPainterPath GetPainterPath();
+
+
+ /**
+ * Sets the z value for polyline.
+ */
+ void SetZValue( const double theZValue );
+
+ /**
+ * Returns the z value for polyline.
+ */
+ double ZValue() const;
protected:
#include <HYDROData_Region.h>
%End
-class HYDROData_Region : HYDROData_Domain
+class HYDROData_Region : HYDROData_Entity
{
%TypeHeaderCode
%End
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Region)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Region;
- else
- sipClass = NULL;
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_REGION:
+ sipClass = sipClass_HYDROData_Region;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
%End
-public:
+public:
+
+ /**
+ * Create new one reference zone for region on child label.
+ * The new zone is not added into the list of reference zones.
+ */
+ HYDROData_Zone AddNewZone() [Handle_HYDROData_Zone ()];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aNewZone;
+
+ Py_BEGIN_ALLOW_THREADS
+ aNewZone = sipSelfWasArg ? sipCpp->HYDROData_Region::AddNewZone() :
+ sipCpp->AddNewZone();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Zone*)createPointer( aNewZone );
+
+ %End
+
+ /**
+ * Removes all child zones from region.
+ */
+ void RemoveChildZones();
+
+
+ /**
+ * Returns number of reference zones of region.
+ */
+ int NbZones() const;
+
+ /**
+ * Add new one reference zone for region.
+ */
+ void AddZone( HYDROData_Zone theZone ) [void (const Handle_HYDROData_Zone&)];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
+ if ( !aZone.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Region::AddZone( aZone ) :
+ sipCpp->AddZone( aZone );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Replace the reference zone for region.
+ */
+ void SetZone( const int theIndex,
+ HYDROData_Zone theZone ) [void (const int, const Handle_HYDROData_Zone&)];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) );
+ if ( !aZone.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Region::SetZone( a0, aZone ) :
+ sipCpp->SetZone( a0, aZone );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Inserts the reference zone for region before given index.
+ */
+ void InsertZone( const int theBeforeIndex,
+ HYDROData_Zone theZone ) [void (const int, const Handle_HYDROData_Zone&)];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) );
+ if ( !aZone.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Region::InsertZone( a0, aZone ) :
+ sipCpp->InsertZone( a0, aZone );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Sets reference zones for calculation region.
+ */
+ //void SetZones( const HYDROData_SequenceOfObjects& theZones );
+
+ /**
+ * Returns reference zone of region by index.
+ */
+ HYDROData_Zone GetZone( const int theIndex ) const [Handle_HYDROData_Zone (const int)];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aRefZone;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRefZone = sipSelfWasArg ? sipCpp->HYDROData_Region::GetZone( a0 ) :
+ sipCpp->GetZone( a0 );
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_Zone*)createPointer( aRefZone );
+
+ %End
+
+ /**
+ * Returns all reference zone of region.
+ */
+ //void HYDROData_SequenceOfObjects GetZones() const;
+
+ /**
+ * Removes reference zone from region.
+ */
+ void RemoveZone( HYDROData_Zone theZone ) const [void (const Handle_HYDROData_Zone&)];
+ %MethodCode
+
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
+ if ( !aZone.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Region::RemoveZone( aZone ) :
+ sipCpp->RemoveZone( aZone );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Removes reference zone from region by it index.
+ */
+ void RemoveZone( const int theIndex );
+
+ /**
+ * Removes all reference zones from region.
+ */
+ void RemoveZones();
- const ObjectKind GetKind() const;
protected:
#include <HYDROData_Zone.h>
%End
-class HYDROData_Zone : HYDROData_Domain
+class HYDROData_Zone : HYDROData_Entity
{
%TypeHeaderCode
%End
%ConvertToSubClassCode
- if ( !Handle(HYDROData_Zone)::DownCast( sipCpp ).IsNull() )
- sipClass = sipClass_HYDROData_Zone;
- else
- sipClass = NULL;
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_ZONE:
+ sipClass = sipClass_HYDROData_Zone;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
%End
-public:
+public:
- const ObjectKind GetKind() const;
+ /**
+ * Returns number of geometry objects for zone.
+ */
+ int NbGeometryObjects() const;
-public:
+ /**
+ * dd new one geometry object for zone.
+ */
+ void AddGeometryObject( HYDROData_Object theRegion ) [void (const Handle_HYDROData_Object&)];
+ %MethodCode
+
+ Handle(HYDROData_Object) aGeomObj =
+ Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
+ if ( !aGeomObj.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::AddGeometryObject( aGeomObj ) :
+ sipCpp->AddGeometryObject( aGeomObj );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
/**
- * Sets reference polyline object for zone.
+ * Replace the geometry object for zone.
*/
- void SetPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)];
+ void SetGeometryObject( const int theIndex,
+ HYDROData_Object theObject ) [void (const int, const Handle_HYDROData_Object&)];
%MethodCode
- Handle(HYDROData_Polyline) aRefPolyline =
- Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) );
- if ( !aRefPolyline.IsNull() )
+ Handle(HYDROData_Object) aGeomObj =
+ Handle(HYDROData_Object)::DownCast( createHandle( a1 ) );
+ if ( !aGeomObj.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
- sipSelfWasArg ? sipCpp->HYDROData_Zone::SetPolyline( aRefPolyline ) :
- sipCpp->SetPolyline( aRefPolyline );
+ sipSelfWasArg ? sipCpp->HYDROData_Zone::SetGeometryObject( a0, aGeomObj ) :
+ sipCpp->SetGeometryObject( a0, aGeomObj );
Py_END_ALLOW_THREADS
}
%End
/**
- * Returns reference polyline object of zone.
+ * Sets the geometry object for zone.
+ */
+ //void SetGeometryObjects( const HYDROData_SequenceOfObjects& theObjects );
+
+ /**
+ * Returns geometry object of zone by index.
*/
- HYDROData_Polyline GetPolyline() const [Handle_HYDROData_Polyline ()];
+ HYDROData_Object GetGeometryObject( const int theIndex ) const [Handle_HYDROData_Object (const int)];
%MethodCode
- Handle(HYDROData_Polyline) aRefPolyline;
+ Handle(HYDROData_Object) aGeomObj;
Py_BEGIN_ALLOW_THREADS
- aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetPolyline() :
- sipCpp->GetPolyline();
+ aGeomObj = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetGeometryObject( a0 ) :
+ sipCpp->GetGeometryObject( a0 );
Py_END_ALLOW_THREADS
- sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline );
+ sipRes = (HYDROData_Object*)createPointer( aGeomObj );
%End
/**
- * Remove reference polyline object of zone.
+ * Returns all geometry objects of zone.
*/
- void RemovePolyline();
+ //HYDROData_SequenceOfObjects GetGeometryObjects() const;
/**
- * Returns the painter path. The painter path is construct by polyline
+ * Removes all geometry objects from zone.
*/
- QPainterPath GetPainterPath() const;
+ void RemoveGeometryObjects();
protected:
RelativePath=".\HYDROData.sip"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ArtificialObject.sip"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Bathymetry.sip"
>
>
</File>
<File
- RelativePath=".\HYDROData_Domain.sip"
+ RelativePath=".\HYDROData_Entity.sip"
>
</File>
<File
RelativePath=".\HYDROData_Image.sip"
>
</File>
+ <File
+ RelativePath=".\HYDROData_ImmersibleZone.sip"
+ >
+ </File>
+ <File
+ RelativePath=".\HYDROData_NaturalObject.sip"
+ >
+ </File>
<File
RelativePath=".\HYDROData_Object.sip"
>