HYDROData_Object.h
HYDROData_Obstacle.h
HYDROData_OperationsFactory.h
- HYDROData_Polyline.h
+# HYDROData_Polyline.h
HYDROData_PolylineXY.h
HYDROData_Profile.h
HYDROData_ProfileUZ.h
HYDROData_Object.cxx
HYDROData_Obstacle.cxx
HYDROData_OperationsFactory.cxx
- HYDROData_Polyline.cxx
+# HYDROData_Polyline.cxx
HYDROData_PolylineXY.cxx
HYDROData_Profile.cxx
HYDROData_ProfileUZ.cxx
test_HYDROData_Image.h
test_HYDROData_Iterator.h
test_HYDROData_OperationsFactory.h
- test_HYDROData_Polyline.h
+ test_HYDROData_PolylineXY.h
)
set(TEST_SOURCES
test_HYDROData_Image.cxx
test_HYDROData_Iterator.cxx
test_HYDROData_OperationsFactory.cxx
- test_HYDROData_Polyline.cxx
+ test_HYDROData_PolylineXY.cxx
)
set(TEST_EXE test_HYDROData)
#include "HYDROData_Document.h"
#include "HYDROData_Iterator.h"
#include "HYDROData_NaturalObject.h"
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
#include "HYDROData_SplitToZonesTool.h"
#include "HYDROData_Region.h"
#include "HYDROData_Tool.h"
if ( aDocument.IsNull() )
return;
- Handle(HYDROData_Polyline) aBoundaryPolyline = GetBoundaryPolyline();
+ Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
if ( aGeomObjects.IsEmpty() )
return;
SetToUpdate( true );
}
-void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
{
- Handle(HYDROData_Polyline) aPrevPolyline = GetBoundaryPolyline();
+ Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
SetReferenceObject( thePolyline, DataTag_Polyline );
SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
}
-Handle(HYDROData_Polyline) HYDROData_CalculationCase::GetBoundaryPolyline() const
+Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
{
- return Handle(HYDROData_Polyline)::DownCast(
+ return Handle(HYDROData_PolylineXY)::DownCast(
GetReferenceObject( DataTag_Polyline ) );
}
void HYDROData_CalculationCase::RemoveBoundaryPolyline()
{
- Handle(HYDROData_Polyline) aPrevPolyline = GetBoundaryPolyline();
+ Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
ClearReferenceObjects( DataTag_Polyline );
class Handle(HYDROData_Object);
class Handle(HYDROData_Region);
class Handle(HYDROData_Zone);
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
/**
* Sets reference boundary polyline object for calculation case.
*/
- HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+ HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
/**
* Returns reference boundary polyline object of calculation case.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const;
+ HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
/**
* Remove reference boundary polyline object from calculation case.
#include <gp_XY.hxx>
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_IntegerList.hxx>
#include <TDataStd_RealList.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
IMPLEMENT_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity)
return GetPoints( theSectionIndex ).Length();
}
+TopoDS_Shape HYDROData_IPolyline::getPolylineShape() const
+{
+ TDF_Label aShapeLabel = myLab.FindChild( DataTag_PolylineShape, false );
+ if ( !aShapeLabel.IsNull() )
+ {
+ Handle(TNaming_NamedShape) aNamedShape;
+ if ( aShapeLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ }
+ return TopoDS_Shape();
+}
+
+void HYDROData_IPolyline::setPolylineShape( const TopoDS_Shape& theShape )
+{
+ TNaming_Builder aBuilder( myLab.FindChild( DataTag_PolylineShape ) );
+ aBuilder.Generated( theShape );
+}
+
+void HYDROData_IPolyline::removePolylineShape()
+{
+ TDF_Label aShapeLabel = myLab.FindChild( DataTag_PolylineShape, false );
+ if ( !aShapeLabel.IsNull() )
+ aShapeLabel.ForgetAllAttributes();
+}
+
+void HYDROData_IPolyline::getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
+ Handle(TDataStd_IntegerList)& theTypesList,
+ Handle(TDataStd_BooleanList)& theClosuresList,
+ const bool theIsCreate ) const
+{
+ theNamesList.Nullify();
+ theTypesList.Nullify();
+ theClosuresList.Nullify();
+
+ TDF_Label aSectLabel = myLab.FindChild( DataTag_Sections, theIsCreate );
+ if ( aSectLabel.IsNull() )
+ return;
+
+ if ( !aSectLabel.FindAttribute( TDataStd_ExtStringList::GetID(), theNamesList ) && theIsCreate )
+ theNamesList = TDataStd_ExtStringList::Set( aSectLabel );
+
+ if ( !aSectLabel.FindAttribute( TDataStd_IntegerList::GetID(), theTypesList ) && theIsCreate )
+ theTypesList = TDataStd_IntegerList::Set( aSectLabel );
+
+ if ( !aSectLabel.FindAttribute( TDataStd_BooleanList::GetID(), theClosuresList ) && theIsCreate )
+ theClosuresList = TDataStd_BooleanList::Set( aSectLabel );
+}
+
+void HYDROData_IPolyline::removeSectionsLists()
+{
+ TDF_Label aSectsLabel = myLab.FindChild( DataTag_Sections, false );
+ if ( !aSectsLabel.IsNull() )
+ aSectsLabel.ForgetAllAttributes();
+}
+
void HYDROData_IPolyline::getPointsLists( const int theSectionIndex,
Handle(TDataStd_RealList)& theListX,
Handle(TDataStd_RealList)& theListY,
if ( aLabel.IsNull() )
return;
- TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
- if ( !aSectLabel.IsNull() )
- aSectLabel.ForgetAllAttributes();
+ if ( theSectionIndex < 0 )
+ {
+ aLabel.ForgetAllAttributes();
+ }
+ else
+ {
+ TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
+ if ( !aSectLabel.IsNull() )
+ aSectLabel.ForgetAllAttributes();
+ }
}
DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
class gp_XY;
-class TopoDS_Wire;
+class TopoDS_Shape;
class Handle(TDataStd_RealList);
+class Handle(TDataStd_ExtStringList);
+class Handle(TDataStd_BooleanList);
+class Handle(TDataStd_IntegerList);
+
/**\class HYDROData_IPolyline
* \brief Base class that stores/retreives information about the 2D points.
{
public:
+ enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
+
typedef gp_XY Point;
typedef NCollection_Sequence<Point> PointsList;
{
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_Points,
+ DataTag_Sections,
+ DataTag_PolylineShape,
};
public:
/**
* Returns the 3D presentation of all points.
*/
- HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const = 0;
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() = 0;
/**
/**
* Adds new one section.
- * \param theIsClosed flag indicates type of polyline
+ * \param theSectName name of the section
+ * \param theSectionType type of section
+ * \param theIsClosed flag indicates closures of section
+ */
+ HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
+ const SectionType theSectionType,
+ const bool theIsClosed ) = 0;
+
+ /**
+ * Returns name of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
+
+ /**
+ * Set name for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionName new section name
+ */
+ HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
+ const TCollection_AsciiString& theSectionName ) = 0;
+
+ /**
+ * Returns type of section with given index.
+ * \param theSectionIndex index of section
*/
- HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed ) = 0;
+ HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
+
+ /**
+ * Set type for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionType new section type
+ */
+ HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
+ const SectionType theSectionType ) = 0;
/**
* Returns true if section with given index is closed.
*/
HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
+ /**
+ * Set closed flag for section with given index.
+ * \param theSectionIndex index of section
+ * \param theIsClosed new closures state
+ */
+ HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed ) = 0;
+
/**
* Removes section with given index.
* \param theSectionIndex index of section
/**
* Replaces point for section with index "theSectionIndex".
* \param theSectionIndex index of section
- * \param thePointIndex index of point to replace
* \param thePoint new point
+ * \param thePointIndex index of point to replace
*/
HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
- const int thePointIndex,
- const Point& thePoint ) = 0;
+ const Point& thePoint,
+ const int thePointIndex ) = 0;
/**
* Removes point from section with index "theSectionIndex".
protected:
+ TopoDS_Shape getPolylineShape() const;
+
+ void setPolylineShape( const TopoDS_Shape& theShape );
+
+ void removePolylineShape();
+
+
+ void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
+ Handle(TDataStd_IntegerList)& theTypesList,
+ Handle(TDataStd_BooleanList)& theClosuresList,
+ const bool theIsCreate = true ) const;
+
+ void removeSectionsLists();
+
void getPointsLists( const int theSectionIndex,
Handle(TDataStd_RealList)& theListX,
Handle(TDataStd_RealList)& theListY,
const bool theIsCreate = true ) const;
- void removePointsLists( const int theSectionIndex ) const;
+ void removePointsLists( const int theSectionIndex = -1 ) const;
protected:
* Creates new object in the internal data structure. Use higher level objects
* to create objects with real content.
*/
- HYDROData_IPolyline();
+ HYDRODATA_EXPORT HYDROData_IPolyline();
/**
* Destructs properties of the object and object itself, removes it from the document.
*/
- ~HYDROData_IPolyline();
+ HYDRODATA_EXPORT ~HYDROData_IPolyline();
};
#endif
#include "HYDROData_Bathymetry.h"
#include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
#include <BRepBuilderAPI_MakeFace.hxx>
Handle(HYDROData_Bathymetry) aRefBathymetry = GetBathymetry();
setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetBathymetry" );
- Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
+ Handle(HYDROData_PolylineXY) aRefPolyline = GetPolyline();
setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
return aResList;
{
TopoDS_Shape aResShape = TopoDS_Face();
- Handle(HYDROData_Polyline) aPolyline = GetPolyline();
+ Handle(HYDROData_PolylineXY) aPolyline = GetPolyline();
if( !aPolyline.IsNull() )
{
- TopoDS_Shape aPolylineShape = aPolyline->GetTopShape();
+ TopoDS_Shape aPolylineShape = aPolyline->GetShape();
TopTools_ListOfShape aWiresList;
if ( !aPolylineShape.IsNull() &&
return QColor( Qt::transparent );
}
-void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
{
SetReferenceObject( thePolyline, DataTag_Polyline );
}
-Handle(HYDROData_Polyline) HYDROData_ImmersibleZone::GetPolyline() const
+Handle(HYDROData_PolylineXY) HYDROData_ImmersibleZone::GetPolyline() const
{
- return Handle(HYDROData_Polyline)::DownCast(
+ return Handle(HYDROData_PolylineXY)::DownCast(
GetReferenceObject( DataTag_Polyline ) );
}
DEFINE_STANDARD_HANDLE(HYDROData_ImmersibleZone, HYDROData_NaturalObject)
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
/**\class HYDROData_ImmersibleZone
* \brief
/**
* Sets reference polyline object for zone.
*/
- HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+ HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
/**
* Returns reference polyline object of zone.
*/
- HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetPolyline() const;
+ HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetPolyline() const;
/**
* Remove reference polyline object of zone.
#include "HYDROData_Image.h"
#include "HYDROData_ImmersibleZone.h"
#include "HYDROData_Obstacle.h"
-#include "HYDROData_Polyline.h"
#include "HYDROData_PolylineXY.h"
#include "HYDROData_Profile.h"
#include "HYDROData_ProfileUZ.h"
case KIND_IMAGE:
aResult = new HYDROData_Image();
break;
- case KIND_POLYLINE:
- aResult = new HYDROData_Polyline();
- break;
+ //case KIND_POLYLINE:
+ //aResult = new HYDROData_Polyline();
+ //break;
case KIND_BATHYMETRY:
aResult = new HYDROData_Bathymetry();
break;
#include <QStringList>
-// tage of the child of my label that contains information about the operator
-static const Standard_GUID GUID_MUST_BE_UPDATED("6647e1f7-1971-4c5a-86c7-11ff0291452d");
-
#define PYTHON_POLYLINE_ID "KIND_POLYLINE"
IMPLEMENT_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
#include "HYDROData_PolylineXY.h"
+#include "HYDROData_BSplineOperation.h"
+#include "HYDROData_Document.h"
#include "HYDROData_Tool.h"
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+
+#include <ImageComposer_MetaTypes.h>
+
+#include <gp_Pnt.hxx>
#include <gp_XY.hxx>
+#include <NCollection_Map.hxx>
+
+#include <TCollection_ExtendedString.hxx>
+
+#include <TDataStd_ListIteratorOfListOfByte.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_IntegerList.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TDataStd_RealList.hxx>
-#include <TopoDS_Wire.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <QPainterPath>
+#include <QVariant>
+#define PYTHON_POLYLINEXY_ID "KIND_POLYLINEXY"
IMPLEMENT_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_PolylineXY, HYDROData_IPolyline)
{
}
-TopoDS_Wire HYDROData_PolylineXY::GetWire() const
+QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
- // TODO
- return TopoDS_Wire();
+ QStringList aResList;
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if ( aDocument.IsNull() )
+ return aResList;
+
+ QString aDocName = aDocument->GetDocPyName();
+ QString aPolylineName = GetName();
+
+ aResList << QString( "%1 = %2.CreateObject( %3 );" )
+ .arg( aPolylineName ).arg( aDocName ).arg( PYTHON_POLYLINEXY_ID );
+ aResList << QString( "%1.SetName( \"%1\" );" ).arg( aPolylineName );
+
+ // Set polilyne data
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ GetSections( aSectNames, aSectTypes, aSectClosures );
+
+ for ( int i = 1, n = aSectNames.Size(); i <= n; ++i )
+ {
+ const TCollection_AsciiString& aSectName = aSectNames.Value( i );
+ const SectionType& aSectType = aSectTypes.Value( i );
+ bool aSectClosure = aSectClosures.Value( i );
+
+ aResList << QString( "%1.AddSection( \"%2\", %3, %4 );" ).arg( aPolylineName )
+ .arg( aSectName.ToCString() ).arg( aSectType ).arg( aSectClosure );
+
+ HYDROData_PolylineXY::PointsList aSectPointsList = GetPoints( i );
+ for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+ {
+ const HYDROData_PolylineXY::Point& aSectPoint = aSectPointsList.Value( k );
+
+ aResList << QString( "%1.AddPoint( %2, QPointF( %3, %4 ) );" ).arg( aPolylineName )
+ .arg( i - 1 ).arg( aSectPoint.X() ).arg( aSectPoint.Y() );
+ }
+ }
+
+ return aResList;
}
-int HYDROData_PolylineXY::NbSections() const
+QVariant HYDROData_PolylineXY::GetDataVariant()
{
- return 1;
+ QPainterPath aPath = GetPainterPath();
+
+ QVariant aVarData;
+ aVarData.setValue<QPainterPath>( aPath );
+
+ return aVarData;
}
-void HYDROData_PolylineXY::AddSection( const bool /*theIsClosed*/ )
+TopoDS_Shape HYDROData_PolylineXY::GetShape()
{
+ return getPolylineShape();
}
-bool HYDROData_PolylineXY::IsClosedSection( const int /*theSectionIndex*/ ) const
+void HYDROData_PolylineXY::Update()
{
- return false;
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ GetSections( aSectNames, aSectTypes, aSectClosures );
+
+ BRepBuilderAPI_MakeWire aMakeWire;
+
+ TopTools_ListOfShape aSectionWiresList;
+
+ for ( int aSectionId = 1, aNbSects = aSectNames.Size(); aSectionId <= aNbSects; aSectionId++ )
+ {
+ TCollection_AsciiString aSectName = aSectNames.Value( aSectionId );
+ SectionType aSectionType = aSectTypes.Value( aSectionId );
+ bool anIsSectionClosed = aSectClosures.Value( aSectionId );
+
+ PointsList aSectPointsList = GetPoints( aSectionId - 1 );
+ if ( aSectPointsList.IsEmpty() )
+ continue;
+
+ BRepBuilderAPI_MakeWire aMakeSectionWire;
+ if( aSectionType == SECTION_POLYLINE )
+ {
+ for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+ {
+ const Point& aFirstPoint = aSectPointsList.Value( i );
+
+ Point aLastPoint;
+ if ( i == n )
+ {
+ if( anIsSectionClosed )
+ aLastPoint = aSectPointsList.Value( 1 );
+ else
+ break;
+ }
+ else
+ {
+ aLastPoint = aSectPointsList.Value( i + 1 );
+ }
+
+ gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0.0 );
+ gp_Pnt aPnt2( aLastPoint.X(), aLastPoint.Y(), 0.0 );
+
+ TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
+ aMakeSectionWire.Add( anEdge );
+ }
+ }
+ else //if( aSectionType == PolylineSection::SECTION_SPLINE )
+ {
+ QList<double> aPoints;
+ for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+ {
+ const Point& aSectPoint = aSectPointsList.Value( i );
+ aPoints << aSectPoint.X() << aSectPoint.Y();
+ }
+
+ HYDROData_BSplineOperation aBSpline( aPoints, 0.0, anIsSectionClosed );
+
+ TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
+ aMakeSectionWire.Add( anEdge );
+ }
+
+ TopoDS_Wire aSectionWire = aMakeSectionWire.Wire();
+ aSectionWiresList.Append( aSectionWire );
+ aMakeWire.Add( aSectionWire );
+ }
+
+ TopoDS_Shape aShape;
+
+ if ( aMakeWire.IsDone() )
+ {
+ aShape = aMakeWire.Shape();
+ }
+ else if ( !aSectionWiresList.IsEmpty() )
+ {
+ // build compound
+ TopoDS_Compound aCompound;
+
+ BRep_Builder aBuilder;
+ aBuilder.MakeCompound( aCompound );
+
+ TopTools_ListIteratorOfListOfShape anIter( aSectionWiresList );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ aBuilder.Add( aCompound, anIter.Value() );
+ }
+
+ aShape = aCompound;
+ }
+
+ setPolylineShape( aShape );
}
-void HYDROData_PolylineXY::RemoveSection( const int /*theSectionIndex*/ )
+/**
+ * Returns true if polyline is closed
+ */
+bool HYDROData_PolylineXY::IsClosed() const
{
- RemoveSections();
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ GetSections( aSectNames, aSectTypes, aSectClosures );
+ if( aSectNames.IsEmpty() )
+ return false;
+
+ bool anIsClosed = true;
+ for( int i = 1, n = aSectClosures.Size(); i <= n && anIsClosed; ++i )
+ anIsClosed = anIsClosed && aSectClosures.Value( i );
+
+ return anIsClosed;
}
-void HYDROData_PolylineXY::RemoveSections()
+int HYDROData_PolylineXY::NbSections() const
{
- removePointsLists( 0 );
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+
+ return !aClosuresList.IsNull() ? aClosuresList->Extent() : 0;
}
-void HYDROData_PolylineXY::AddPoint( const int /*theSectionIndex*/,
- const Point& thePoint,
- const int thePointIndex )
+TCollection_ExtendedString getUniqueSectionName( const Handle(TDataStd_ExtStringList)& theNamesList )
{
- double aNewCoordU = thePoint.X();
- double aNewCoordZ = thePoint.Y();
+ NCollection_Map<TCollection_ExtendedString> aNamesMap;
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( theNamesList->List() );
+ for ( ; aNamesIter.More(); aNamesIter.Next() )
+ aNamesMap.Add( aNamesIter.Value() );
- Handle(TDataStd_RealList) aListU, aListZ;
- getPointsLists( 0, aListU, aListZ );
+ TCollection_ExtendedString aResName;
- if ( aListU->IsEmpty() || aNewCoordU > aListU->Last() )
+ int aPrefIdx = 1;
+ do
{
- aListU->Append( aNewCoordU );
- aListZ->Append( aNewCoordZ );
- return;
+ aResName = "Section_" + aPrefIdx;
+ ++aPrefIdx;
}
- else if ( aNewCoordU < aListU->First() )
+ while ( aNamesMap.Contains( aResName ) );
+
+ return aResName;
+}
+
+void HYDROData_PolylineXY::AddSection( const TCollection_AsciiString& theSectName,
+ const SectionType theSectionType,
+ const bool theIsClosed )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList );
+
+ TCollection_ExtendedString aSectName( theSectName );
+ if ( aSectName.Length() <= 0 )
+ aSectName = getUniqueSectionName( aNamesList );
+
+ aNamesList->Append( aSectName );
+ aTypesList->Append( theSectionType );
+ aClosuresList->Append( theIsClosed );
+}
+
+TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
+{
+ TCollection_AsciiString aResName;
+
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+ return aResName;
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ for ( int i = 0; aNamesIter.More() && i != theSectionIndex; aNamesIter.Next(), ++i );
+
+ if ( aNamesIter.More() )
+ aResName = aNamesIter.Value();
+
+ return aResName;
+}
+
+void HYDROData_PolylineXY::SetSectionName( const int theSectionIndex,
+ const TCollection_AsciiString& theSectionName )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
+ return;
+
+ TDataStd_ListOfExtendedString anOldNamesList;
+ anOldNamesList = aNamesList->List();
+
+ // Refill the existing list
+ aNamesList->Clear();
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
+ aNamesList->Append( i == theSectionIndex ? theSectionName : aNamesIter.Value() );
+}
+
+HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+ return SECTION_POLYLINE;
+
+ TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+ for ( int i = 0; aTypesIter.More() && i != theSectionIndex; aTypesIter.Next(), ++i );
+
+ return aTypesIter.More() ? (SectionType)aTypesIter.Value() : SECTION_POLYLINE;
+}
+
+void HYDROData_PolylineXY::SetSectionType( const int theSectionIndex,
+ const SectionType theSectionType )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aTypesList.IsNull() || theSectionIndex >= aTypesList->Extent() )
+ return;
+
+ TColStd_ListOfInteger anOldTypesList;
+ anOldTypesList = aTypesList->List();
+
+ // Refill the existing list
+ aTypesList->Clear();
+
+ TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
+ for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
+ aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
+}
+
+bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+ return false;
+
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+ for ( int i = 0; aClosuresIter.More() && i != theSectionIndex; aClosuresIter.Next(), ++i );
+
+ return aClosuresIter.More() ? (bool)aClosuresIter.Value() : false;
+}
+
+void HYDROData_PolylineXY::SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aClosuresList.IsNull() || theSectionIndex >= aClosuresList->Extent() )
+ return;
+
+ TDataStd_ListOfByte anOldClosuresList;
+ anOldClosuresList = aClosuresList->List();
+
+ // Refill the existing list
+ aClosuresList->Clear();
+
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
+ for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
+ aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
+}
+
+void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
+ NCollection_Sequence<SectionType>& theSectTypes,
+ NCollection_Sequence<bool>& theSectClosures ) const
+{
+ theSectNames.Clear();
+ theSectTypes.Clear();
+ theSectClosures.Clear();
+
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || aTypesList.IsNull() || aClosuresList.IsNull() )
+ return;
+
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( aNamesList->List() );
+ TColStd_ListIteratorOfListOfInteger aTypesIter( aTypesList->List() );
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( aClosuresList->List() );
+ for ( ; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
+ aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next() )
{
- aListU->Prepend( aNewCoordU );
- aListZ->Prepend( aNewCoordZ );
+ const TCollection_ExtendedString& aSectName = aNamesIter.Value();
+ SectionType aSectType = (SectionType)aTypesIter.Value();
+ bool aSectClosures = aClosuresIter.Value();
+
+ theSectNames.Append( aSectName );
+ theSectTypes.Append( aSectType );
+ theSectClosures.Append( aSectClosures );
+ }
+}
+
+void HYDROData_PolylineXY::RemoveSection( const int theSectionIndex )
+{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aNamesList.IsNull() || theSectionIndex >= aNamesList->Extent() )
return;
+
+ if ( aNamesList->Extent() == 1 )
+ {
+ removeSectionsLists();
+ removePointsLists();
}
+ else
+ {
+ TDataStd_ListOfExtendedString anOldNamesList;
+ anOldNamesList = aNamesList->List();
- TColStd_ListOfReal anOldListU;
- anOldListU = aListU->List();
+ TColStd_ListOfInteger anOldTypesList;
+ anOldTypesList = aTypesList->List();
- TColStd_ListOfReal anOldListZ;
- anOldListZ = aListZ->List();
+ TDataStd_ListOfByte anOldClosuresList;
+ anOldClosuresList = aClosuresList->List();
- // Crsat new lists
- removePointsLists( 0 );
- getPointsLists( 0, aListU, aListZ );
+ // Refill the existing lists
+ aNamesList->Clear();
+ aTypesList->Clear();
+ aClosuresList->Clear();
- bool anIsInserted = false;
- TColStd_ListIteratorOfListOfReal anIterU( anOldListU );
- TColStd_ListIteratorOfListOfReal anIterZ( anOldListZ );
- for ( ; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next() )
+ TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
+ TColStd_ListIteratorOfListOfInteger aTypesIter( anOldTypesList );
+ TDataStd_ListIteratorOfListOfByte aClosuresIter( anOldClosuresList );
+ for ( int i = 0; aNamesIter.More() && aTypesIter.More() && aClosuresIter.More();
+ aNamesIter.Next(), aTypesIter.Next(), aClosuresIter.Next(), ++i )
+ {
+ if ( i == theSectionIndex )
+ continue; // skip index to remove
+
+ aNamesList->Append( aNamesIter.Value() );
+ aTypesList->Append( aTypesIter.Value() );
+ aClosuresList->Append( (bool)aClosuresIter.Value() );
+ }
+
+ // Remove points that belongs to removed section
+ removePointsLists( theSectionIndex );
+ }
+}
+
+void HYDROData_PolylineXY::RemoveSections()
+{
+ removeSectionsLists();
+ removePointsLists();
+}
+
+void HYDROData_PolylineXY::AddPoint( const int theSectionIndex,
+ const Point& thePoint,
+ const int thePointIndex )
+{
+ Handle(TDataStd_RealList) aListX, aListY;
+ getPointsLists( theSectionIndex, aListX, aListY );
+
+ if ( thePointIndex < 0 || thePointIndex >= aListX->Extent() )
+ {
+ aListX->Append( thePoint.X() );
+ aListY->Append( thePoint.Y() );
+ }
+ else
{
- double aCoordU = anIterU.Value();
- double aCoordZ = anIterZ.Value();
+ TColStd_ListOfReal anOldListX;
+ anOldListX = aListX->List();
+
+ TColStd_ListOfReal anOldListY;
+ anOldListY = aListY->List();
+
+ // Refill the existing lists
+ aListX->Clear();
+ aListY->Clear();
- if ( !anIsInserted )
+ TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+ TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+ for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
{
- if ( ValuesEquals( aNewCoordU, aCoordU ) )
- {
- // Just update Z value
- aCoordZ = aNewCoordZ;
- anIsInserted = true;
- }
- else if ( aNewCoordU < aCoordU )
+ double aCoordX = anIterX.Value();
+ double aCoordY = anIterY.Value();
+
+ if ( i == thePointIndex )
{
- // Insert new point
- aListU->Append( aNewCoordU );
- aListZ->Append( aNewCoordZ );
- anIsInserted = true;
+ // Insert our new point
+ aListX->Append( thePoint.X() );
+ aListY->Append( thePoint.Y() );
}
- }
- aListU->Append( aCoordU );
- aListZ->Append( aCoordZ );
+ aListX->Append( aCoordX );
+ aListY->Append( aCoordY );
+ }
}
}
void HYDROData_PolylineXY::SetPoint( const int theSectionIndex,
- const int /*thePointIndex*/,
- const Point& thePoint )
+ const Point& thePoint,
+ const int thePointIndex )
{
- AddPoint( theSectionIndex, thePoint );
+ Handle(TDataStd_RealList) aListX, aListY;
+ getPointsLists( theSectionIndex, aListX, aListY );
+
+ if ( thePointIndex < 0 )
+ {
+ aListX->Prepend( thePoint.X() );
+ aListY->Prepend( thePoint.Y() );
+ }
+ else if ( thePointIndex >= aListX->Extent() )
+ {
+ aListX->Append( thePoint.X() );
+ aListY->Append( thePoint.Y() );
+ }
+ else
+ {
+ TColStd_ListOfReal anOldListX;
+ anOldListX = aListX->List();
+
+ TColStd_ListOfReal anOldListY;
+ anOldListY = aListY->List();
+
+ // Refill the existing lists
+ aListX->Clear();
+ aListY->Clear();
+
+ TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+ TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+ for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
+ {
+ double aCoordX = anIterX.Value();
+ double aCoordY = anIterY.Value();
+
+ if ( i == thePointIndex )
+ {
+ // Insert our new point instead of old one
+ aCoordX = thePoint.X();
+ aCoordY = thePoint.Y();
+ }
+
+ aListX->Append( aCoordX );
+ aListY->Append( aCoordY );
+ }
+ }
}
-void HYDROData_PolylineXY::RemovePoint( const int /*theSectionIndex*/,
- const int thePointIndex )
+void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex,
+ const int thePointIndex )
{
- Handle(TDataStd_RealList) aListU, aListZ;
- getPointsLists( 0, aListU, aListZ, false );
- if ( aListU.IsNull() || aListZ.IsNull() || aListU->IsEmpty() )
+ Handle(TDataStd_RealList) aListX, aListY;
+ getPointsLists( theSectionIndex, aListX, aListY, false );
+ if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
return;
- TColStd_ListOfReal anOldListU;
- anOldListU = aListU->List();
+ if ( aListX->Extent() == 1 )
+ {
+ removePointsLists( theSectionIndex );
+ }
+ else
+ {
+ TColStd_ListOfReal anOldListX;
+ anOldListX = aListX->List();
- TColStd_ListOfReal anOldListZ;
- anOldListZ = aListZ->List();
+ TColStd_ListOfReal anOldListY;
+ anOldListY = aListY->List();
- // Creat new lists
- removePointsLists( 0 );
- getPointsLists( 0, aListU, aListZ );
+ // Refill the existing lists
+ aListX->Clear();
+ aListY->Clear();
- bool anIsInserted = false;
- TColStd_ListIteratorOfListOfReal anIterU( anOldListU );
- TColStd_ListIteratorOfListOfReal anIterZ( anOldListZ );
- for ( int i = 0; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next(), ++i )
- {
- if ( i == thePointIndex )
- continue; // skip index to remove
+ TColStd_ListIteratorOfListOfReal anIterX( anOldListX );
+ TColStd_ListIteratorOfListOfReal anIterY( anOldListY );
+ for ( int i = 0; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next(), ++i )
+ {
+ if ( i == thePointIndex )
+ continue; // skip index to remove
- aListU->Append( anIterU.Value() );
- aListZ->Append( anIterZ.Value() );
+ aListX->Append( anIterX.Value() );
+ aListY->Append( anIterY.Value() );
+ }
}
}
-HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int /*theSectionIndex*/ ) const
+HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex ) const
{
PointsList aResList;
- Handle(TDataStd_RealList) aListU, aListZ;
- getPointsLists( 0, aListU, aListZ, false );
- if ( aListU.IsNull() || aListZ.IsNull() )
+ Handle(TDataStd_RealList) aListX, aListY;
+ getPointsLists( theSectionIndex, aListX, aListY, false );
+ if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
return aResList;
- TColStd_ListIteratorOfListOfReal anIterU( aListU->List() );
- TColStd_ListIteratorOfListOfReal anIterZ( aListZ->List() );
- for ( ; anIterU.More() && anIterZ.More(); anIterU.Next(), anIterZ.Next() )
+ TColStd_ListIteratorOfListOfReal anIterX( aListX->List() );
+ TColStd_ListIteratorOfListOfReal anIterY( aListY->List() );
+ for ( ; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next() )
{
- Point aPoint( anIterU.Value(), anIterZ.Value() );
+ Point aPoint( anIterX.Value(), anIterY.Value() );
aResList.Append( aPoint );
}
return aResList;
}
+QPainterPath HYDROData_PolylineXY::GetPainterPath() const
+{
+ QPainterPath aPath;
+
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ GetSections( aSectNames, aSectTypes, aSectClosures );
+ if( aSectNames.IsEmpty() )
+ return aPath;
+
+ PointsList aSectPointsList = GetPoints( 0 );
+ if( aSectPointsList.IsEmpty() )
+ return aPath;
+
+ SectionType aSectionType = aSectTypes.Value( 1 );
+ bool anIsSectionClosed = aSectClosures.Value( 1 );
+
+ if ( aSectionType == SECTION_POLYLINE )
+ {
+ aPath.moveTo( aSectPointsList.Value( 1 ).X(), aSectPointsList.Value( 1 ).Y() );
+
+ for( int i = 2, n = aSectPointsList.Size(); i <= n; ++i )
+ {
+ const Point& aSectPoint = aSectPointsList.Value( i );
+
+ aPath.lineTo( aSectPoint.X(), aSectPoint.Y() );
+ }
+
+ if( anIsSectionClosed )
+ aPath.closeSubpath();
+ }
+ else
+ {
+ QList<double> aPoints;
+ for( int i = 1, n = aSectPointsList.Size(); i <= n; ++i )
+ {
+ const Point& aSectPoint = aSectPointsList.Value( i );
+ aPoints << aSectPoint.X() << aSectPoint.Y();
+ }
+
+ HYDROData_BSplineOperation aBSpline( aPoints, 0, anIsSectionClosed );
+ aPath = aBSpline.ComputePath();
+ }
+
+ return aPath;
+}
+
DEFINE_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
+class QPainterPath;
+
/**\class HYDROData_PolylineXY
* \brief Class that stores/retreives information about the
* parametric profile points.
*/
HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINEXY;}
+ /**
+ * Dump object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+ /**
+ * Returns data of object wrapped to QVariant.
+ * Reimplemented to wrap and return saved path.
+ */
+ HYDRODATA_EXPORT virtual QVariant GetDataVariant();
public:
/**
* Returns the 3D presentation of all points.
*/
- HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const;
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
+ /**
+ * Update the wire contour on the basis of the polyline data.
+ * Call this method whenever you made changes for polyline data.
+ */
+ HYDRODATA_EXPORT virtual void Update();
+
+
+ /**
+ * Returns true if polyline is closed
+ */
+ HYDRODATA_EXPORT bool IsClosed() const;
+
/**
* Returns number of sections.
*/
/**
* Adds new one section.
- * \param theIsClosed flag indicates type of polyline
+ * \param theSectName name of the section
+ * \param theSectionType type of section
+ * \param theIsClosed flag indicates closures of section
*/
- HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed );
+ HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
+ const SectionType theSectionType,
+ const bool theIsClosed );
+
+ /**
+ * Returns name of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
+
+ /**
+ * Set name for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionName new section name
+ */
+ HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
+ const TCollection_AsciiString& theSectionName );
+
+ /**
+ * Returns type of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
+
+ /**
+ * Set type for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionType new section type
+ */
+ HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
+ const SectionType theSectionType );
/**
* Returns true if section with given index is closed.
*/
HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
+ /**
+ * Set closed flag for section with given index.
+ * \param theSectionIndex index of section
+ * \param theIsClosed new closures state
+ */
+ HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed );
+
+ /**
+ * Adds new one section.
+ * \param theSectName name of the section
+ * \param theSectionType type of section
+ * \param theIsClosed flag indicates closures of section
+ */
+ HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
+ NCollection_Sequence<SectionType>& theSectTypes,
+ NCollection_Sequence<bool>& theSectClosures ) const;
+
/**
* Removes section with given index.
* \param theSectionIndex index of section
/**
* Replaces point for section with index "theSectionIndex".
* \param theSectionIndex index of section
- * \param thePointIndex index of point to replace
* \param thePoint new point
+ * \param thePointIndex index of point to replace
*/
HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
- const int thePointIndex,
- const Point& thePoint );
+ const Point& thePoint,
+ const int thePointIndex );
/**
* Removes point from section with index "theSectionIndex".
*/
HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
+
+ /**
+ * Returns the painter path.
+ * Note: currently only the first section of the polyline data is taken into account.
+ * \return polyline painter path.
+ */
+ HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
+
+
protected:
friend class HYDROData_Profile;
#include <TDataStd_RealList.hxx>
-#include <TopoDS_Wire.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_HANDLE(HYDROData_ProfileUZ, HYDROData_IPolyline)
{
}
-TopoDS_Wire HYDROData_ProfileUZ::GetWire() const
+TopoDS_Shape HYDROData_ProfileUZ::GetShape()
{
// TODO
- return TopoDS_Wire();
+ return TopoDS_Shape();
}
int HYDROData_ProfileUZ::NbSections() const
return 1;
}
-void HYDROData_ProfileUZ::AddSection( const bool /*theIsClosed*/ )
+void HYDROData_ProfileUZ::AddSection( const TCollection_AsciiString& /*theSectName*/,
+ const SectionType /*theSectionType*/,
+ const bool /*theIsClosed*/ )
+{
+}
+
+TCollection_AsciiString HYDROData_ProfileUZ::GetSectionName( const int /*theSectionIndex*/ ) const
+{
+ return "Section_1";
+}
+
+void HYDROData_ProfileUZ::SetSectionName( const int /*theSectionIndex*/,
+ const TCollection_AsciiString& /*theSectionName*/ )
+{
+}
+
+HYDROData_ProfileUZ::SectionType HYDROData_ProfileUZ::GetSectionType( const int /*theSectionIndex*/ ) const
+{
+ return SECTION_POLYLINE;
+}
+
+void HYDROData_ProfileUZ::SetSectionType( const int /*theSectionIndex*/,
+ const SectionType /*theSectionType*/ )
{
}
return false;
}
+void HYDROData_ProfileUZ::SetSectionClosed( const int /*theSectionIndex*/,
+ const bool /*theIsClosed*/ )
+{
+}
+
void HYDROData_ProfileUZ::RemoveSection( const int /*theSectionIndex*/ )
{
RemoveSections();
}
void HYDROData_ProfileUZ::SetPoint( const int theSectionIndex,
- const int /*thePointIndex*/,
- const Point& thePoint )
+ const Point& thePoint,
+ const int /*thePointIndex*/ )
{
AddPoint( theSectionIndex, thePoint );
}
/**
* Returns the 3D presentation of all points.
*/
- HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const;
+ HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
/**
/**
* Adds new one section.
- * \param theIsClosed flag indicates type of polyline
+ * \param theSectName name of the section
+ * \param theSectionType type of section
+ * \param theIsClosed flag indicates closures of section
*/
- HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed );
+ HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
+ const SectionType theSectionType,
+ const bool theIsClosed );
+
+ /**
+ * Returns name of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
+
+ /**
+ * Set name for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionName new section name
+ */
+ HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
+ const TCollection_AsciiString& theSectionName );
+
+ /**
+ * Returns type of section with given index.
+ * \param theSectionIndex index of section
+ */
+ HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
+
+ /**
+ * Set type for section with given index.
+ * \param theSectionIndex index of section
+ * \param theSectionType new section type
+ */
+ HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
+ const SectionType theSectionType );
/**
* Returns true if section with given index is closed.
*/
HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
+ /**
+ * Set closed flag for section with given index.
+ * \param theSectionIndex index of section
+ * \param theIsClosed new closures state
+ */
+ HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
+ const bool theIsClosed );
+
/**
* Removes section with given index.
* \param theSectionIndex index of section
/**
* Replaces point for section with index "theSectionIndex".
* \param theSectionIndex index of section
- * \param thePointIndex index of point to replace
* \param thePoint new point
+ * \param thePointIndex index of point to replace
*/
HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
- const int thePointIndex,
- const Point& thePoint );
+ const Point& thePoint,
+ const int thePointIndex );
/**
* Removes point from section with index "theSectionIndex".
#include "HYDROData_SplitToZonesTool.h"
-#include "HYDROData_Polyline.h"
+#include "HYDROData_PolylineXY.h"
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
HYDROData_SplitToZonesTool::SplitDataList
HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList,
- const Handle(HYDROData_Polyline)& thePolyline )
+ const Handle(HYDROData_PolylineXY)& thePolyline )
{
SplitDataList anOutputSplitDataList;
// Step 2. Take into account the boundary polyline.
if( !thePolyline.IsNull() )
{
- TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetTopShape() );
+ TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetShape() );
if( !aWire.IsNull() )
{
BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
#include <QStringList>
-class Handle(HYDROData_Polyline);
+class Handle(HYDROData_PolylineXY);
/**
* \class HYDROData_SplitToZonesTool
public:
static SplitDataList SplitToZones( const HYDROData_SequenceOfObjects& theObjectList,
- const Handle(HYDROData_Polyline)& thePolyline );
+ const Handle(HYDROData_PolylineXY)& thePolyline );
private:
#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_OperationsFactory.h>
#include <ImageComposer_CropOperator.h>
+#include <gp_XY.hxx>
+
#include <QPainter>
void test_HYDROData_OperationsFactory::testCreate()
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;
+ Handle(HYDROData_PolylineXY) aCropPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
- aPolylineData << aPolylineSect;
+ aCropPolyline->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, true );
- aCropPolyline->SetPolylineData( aPolylineData );
+ aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 0 ) );
+ aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 0, 20 ) );
+ aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 40 ) );
+ aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 50, 20 ) );
// prepare Composer Operation
ImageComposer_Operator* aCropOp =
+++ /dev/null
-#include<test_HYDROData_Polyline.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Polyline.h>
-
-#include <QList>
-#include <QPointF>
-
-void test_HYDROData_Polyline::testPolyline()
-{
- Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
- Handle(HYDROData_Polyline) aPolyline =
- Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
- // empty image
-
- int aDim = aPolyline->GetDimension();
- CPPUNIT_ASSERT(aDim == 0 );
-
- aPolyline->SetDimension(2);
- aDim = aPolyline->GetDimension();
- CPPUNIT_ASSERT( aDim == 2 );
-
- aPolyline->SetDimension(3);
- aDim = aPolyline->GetDimension();
- CPPUNIT_ASSERT( aDim == 3 );
-
- PolylineSection aSect1;
- aSect1.mySectionName = "Section_1";
- aSect1.myType = PolylineSection::SECTION_POLYLINE;
- aSect1.myIsClosed = false;
-
- QList<PolylineSection> aSections;
- aSections << aSect1;
-
- PolylineSection aSect2;
- aSect1.mySectionName = "Section_2";
- aSect1.myType = PolylineSection::SECTION_SPLINE;
- aSect1.myIsClosed = true;
- aSections << aSect2;
-
- aPolyline->SetPolylineData( aSections );
- QList<PolylineSection> aRestoredSect = aPolyline->GetPolylineData();
- int aRestSize = aRestoredSect.size();
- CPPUNIT_ASSERT( aRestSize == 2 );
-
-// printf("Sect1.Name=%s RestName=%s\n", aSect1.mySectionName, aRestoredSect[0].mySectionName );
- CPPUNIT_ASSERT( aRestoredSect[0].myType == PolylineSection::SECTION_POLYLINE );
- CPPUNIT_ASSERT( aRestoredSect[0].myIsClosed == false );
- CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsLess( aSect1.mySectionName ) == false );
- CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsGreater( aSect1.mySectionName ) == false );
- CPPUNIT_ASSERT( aRestoredSect[0].myCoords.size() == 0 );
-
- CPPUNIT_ASSERT( aRestoredSect[1].myType == PolylineSection::SECTION_SPLINE );
- CPPUNIT_ASSERT( aRestoredSect[1].myIsClosed == true );
- CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsLess( aSect2.mySectionName ) == false );
- CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsGreater( aSect2.mySectionName ) == false );
- CPPUNIT_ASSERT( aRestoredSect[1].myCoords.size() == 0 );
-
- aDoc->Close();
-}
-
-
-void test_HYDROData_Polyline::testCopy()
-{
- Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
- Handle(HYDROData_Polyline) aPolyline1 =
- Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
-
-
-// aPolyline1->setPoints(aPoints);
-
- Handle(HYDROData_Polyline) aPolyline2 =
- Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
-
- aPolyline1->CopyTo(aPolyline2);
-
-
- aDoc->Close();
-}
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Polyline : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(test_HYDROData_Polyline);
- CPPUNIT_TEST(testPolyline);
- CPPUNIT_TEST(testCopy);
- CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
- void setUp() {}
-
- void tearDown() {}
-
- // checks save/restore QImages information
- void testPolyline();
-
- // checks the image properties copy/paste
- void testCopy();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Polyline);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Polyline, "HYDROData_Polyline");
--- /dev/null
+#include<test_HYDROData_PolylineXY.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_PolylineXY.h>
+
+#include <QList>
+#include <QPointF>
+
+void test_HYDROData_PolylineXY::testPolyline()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+ Handle(HYDROData_PolylineXY) aPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+ aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
+ aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
+
+ int aNbSections = aPolyline->NbSections();
+ CPPUNIT_ASSERT( aNbSections == 2 );
+
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
+
+ CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
+ CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
+ CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
+
+ CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
+ CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
+ CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
+
+ aDoc->Close();
+}
+
+
+void test_HYDROData_PolylineXY::testCopy()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+ Handle(HYDROData_PolylineXY) aPolyline1 =
+ Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+
+// aPolyline1->setPoints(aPoints);
+
+ Handle(HYDROData_PolylineXY) aPolyline2 =
+ Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+ aPolyline1->CopyTo(aPolyline2);
+
+
+ aDoc->Close();
+}
--- /dev/null
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_PolylineXY : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(test_HYDROData_PolylineXY);
+ CPPUNIT_TEST(testPolyline);
+ CPPUNIT_TEST(testCopy);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+ void setUp() {}
+
+ void tearDown() {}
+
+ // checks save/restore QImages information
+ void testPolyline();
+
+ // checks the image properties copy/paste
+ void testCopy();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_PolylineXY, "HYDROData_PolylineXY");
#include "HYDROGUI_Zone.h"
#include "HYDROGUI_Region.h"
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Object.h>
// Get all polylines
aList.clear();
anEntryList.clear();
- HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
- Handle(HYDROData_Polyline) aPolylineObj;
+ HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
+ Handle(HYDROData_PolylineXY) aPolylineObj;
QString aPolylineName;
for ( ; anIter.More(); anIter.Next() )
{
- aPolylineObj = Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+ aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
if ( !aPolylineObj.IsNull() && aPolylineObj->IsClosed() )
{
// Check the polyline shape
- TopoDS_Shape aPolylineShape = aPolylineObj->GetTopShape();
+ TopoDS_Shape aPolylineShape = aPolylineObj->GetShape();
if ( !aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE ) {
aPolylineName = aPolylineObj->GetName();
if ( !aPolylineName.isEmpty() )
void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
{
// Set the selected boundary polyline to the calculation case
- Handle(HYDROData_Polyline) anObject;
+ Handle(HYDROData_PolylineXY) anObject;
Handle(AIS_InteractiveContext) aCtx;
if ( myPreviewViewManager )
{
else
{
Handle(HYDROData_Entity) anEntity =
- HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINE );
+ HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY );
if ( !anEntity.IsNull() )
{
- anObject = Handle(HYDROData_Polyline)::DownCast( anEntity );
+ anObject = Handle(HYDROData_PolylineXY)::DownCast( anEntity );
if ( !anObject.IsNull() )
{
myEditedObject->SetBoundaryPolyline( anObject );
#include <HYDROData_Image.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Iterator.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_Profile.h>
#include <HYDROData_VisualState.h>
#include <HYDROData_Region.h>
LightApp_DataObject* aCalculRootObj = createObject( aRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) );
// POLYLINES
- LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) );
+ LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINEXY ).toAscii() ) );
// PROFILES
LightApp_DataObject* aProfileRootObj = createObject( aRootObj, tr( partitionName( KIND_PROFILE ).toAscii() ) );
break;
}
- case KIND_POLYLINE:
+ case KIND_POLYLINEXY:
{
- Handle(HYDROData_Polyline) aPolylineObj =
- Handle(HYDROData_Polyline)::DownCast( anObj );
+ Handle(HYDROData_PolylineXY) aPolylineObj =
+ Handle(HYDROData_PolylineXY)::DownCast( anObj );
if( !aPolylineObj.IsNull() ) {
createObject( aPolylineRootObj, aPolylineObj );
}
switch( theObjectKind )
{
case KIND_IMAGE: return "IMAGES";
- case KIND_POLYLINE: return "POLYLINES";
+ case KIND_POLYLINEXY: return "POLYLINES";
case KIND_PROFILE: return "PROFILES";
case KIND_VISUAL_STATE: return "VISUAL_STATES";
case KIND_BATHYMETRY: return "BATHYMETRIES";
LightApp_DataObject* aPolylineSect =
createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
- Handle(HYDROData_Polyline) aPolyline = aZoneObj->GetPolyline();
+ Handle(HYDROData_PolylineXY) aPolyline = aZoneObj->GetPolyline();
if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
// collect the back-references
ObjectKind aKind = anObject->GetKind();
- if( aKind == KIND_IMAGE || aKind == KIND_POLYLINE )
+ if( aKind == KIND_IMAGE || aKind == KIND_POLYLINEXY )
{
HYDROData_SequenceOfObjects anObjects;
QStringList aNames;
case KIND_IMAGE:
aDriver = new HYDROGUI_PrsImageDriver();
break;
- case KIND_POLYLINE:
+ case KIND_POLYLINEXY:
aDriver = new HYDROGUI_PrsPolylineDriver();
break;
case KIND_ZONE:
#include <HYDROData_Bathymetry.h>
#include <HYDROData_Iterator.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewModel.h>
aFillingColor = myEditedObject->GetFillingColor();
aBorderColor = myEditedObject->GetBorderColor();
- Handle(HYDROData_Polyline) aRefPolyline = myEditedObject->GetPolyline();
+ Handle(HYDROData_PolylineXY) aRefPolyline = myEditedObject->GetPolyline();
if ( !aRefPolyline.IsNull() )
aSelectedPolyline = aRefPolyline->GetName();
// collect information about existing closed polylines
QStringList aPolylines;
- HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
+ HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
for ( ; anIter.More(); anIter.Next() )
{
- Handle(HYDROData_Polyline) aPolylineObj =
- Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+ Handle(HYDROData_PolylineXY) aPolylineObj =
+ Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
if ( aPolylineObj.IsNull() || !aPolylineObj->IsClosed() )
continue;
if ( aZoneObj.IsNull() )
return false;
- Handle(HYDROData_Polyline) aZonePolyline;
+ Handle(HYDROData_PolylineXY) aZonePolyline;
Handle(HYDROData_Bathymetry) aZoneBathymetry;
QString aPolylineName = aPanel->getPolylineName();
if ( !aPolylineName.isEmpty() )
{
- aZonePolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
+ aZonePolyline = Handle(HYDROData_PolylineXY)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINEXY ) );
}
QString aBathymetryName = aPanel->getBathymetryName();
TopoDS_Wire aWire;
TopoDS_Shape aShape;
- Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
+ Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINEXY ) );
if ( !aPolyline.IsNull() )
{
- aShape = aPolyline->GetTopShape();
+ aShape = aPolyline->GetShape();
if ( aShape.ShapeType() == TopAbs_WIRE ) {
aWire = TopoDS::Wire( aShape );
}
}
}
}
- else if( anObject->GetKind() == KIND_POLYLINE )
+ else if( anObject->GetKind() == KIND_POLYLINEXY )
anIsPolyline = true;
else if( anObject->GetKind() == KIND_PROFILE )
anIsProfile = true;
case KIND_IMAGE:
theMenu->addAction( action( ImportImageId ) );
break;
- case KIND_POLYLINE:
+ case KIND_POLYLINEXY:
theMenu->addAction( action( CreatePolylineId ) );
break;
case KIND_PROFILE:
ObjectKind anObjectKind = theObject->GetKind();
if ( anObjectKind != KIND_IMAGE &&
- anObjectKind != KIND_POLYLINE &&
+ anObjectKind != KIND_POLYLINEXY &&
anObjectKind != KIND_IMMERSIBLE_ZONE &&
anObjectKind != KIND_REGION &&
anObjectKind != KIND_ZONE &&
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "HYDROGUI_Module.h"
+
#include "HYDROGUI_PolylineOp.h"
+
+#include "HYDROGUI_Module.h"
#include "HYDROGUI_PolylineDlg.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
-#include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
-#include "CurveCreator_Curve.hxx"
-#include "CurveCreator_Displayer.h"
+#include <HYDROData_Document.h>
+
+#include <CurveCreator_Curve.hxx>
+#include <CurveCreator_Displayer.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
//static int ZValueIncrement = 0;
HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool theIsEdit )
-: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myCurve(NULL),
- myViewManager(NULL)
+: HYDROGUI_Operation( theModule ),
+ myIsEdit( theIsEdit ),
+ myCurve( NULL ),
+ myViewManager( NULL )
{
setName( theIsEdit ? tr( "EDIT_POLYLINE" ) : tr( "CREATE_POLYLINE" ) );
}
void HYDROGUI_PolylineOp::startOperation()
{
if( myCurve )
- {
delete myCurve;
- myCurve = 0;
- }
+
+ myCurve = new CurveCreator_Curve( CurveCreator::Dim2d );
HYDROGUI_Operation::startOperation();
aPanel->setOCCViewer( myViewManager ? myViewManager->getOCCViewer() : 0 );
if( myIsEdit )
- myEditedObject = Handle(HYDROData_Polyline)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ myEditedObject = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+
+ QString aPolylineName;
if( !myEditedObject.IsNull() )
{
- 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();
-
- for( int i = 0 ; i < aPolylineData.size() ; i++ ){
- std::string aName = HYDROGUI_Tool::ToQString(aPolylineData[i].mySectionName).toStdString();
- bool isClosed = aPolylineData[i].myIsClosed;
- CurveCreator::SectionType aType = CurveCreator::Polyline;
- if( aPolylineData[i].myType == PolylineSection::SECTION_SPLINE ){
- aType = CurveCreator::Spline;
- }
- CurveCreator::Coordinates aCoords;
- for( int j = 0 ; j < aPolylineData[i].myCoords.size() ; j++ ){
- aCoords.push_back(aPolylineData[i].myCoords[j]);
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ myEditedObject->GetSections( aSectNames, aSectTypes, aSectClosures );
+
+ for ( int i = 1, n = aSectNames.Size(); i <= n; ++i )
+ {
+ QString aSectName = HYDROGUI_Tool::ToQString( aSectNames.Value( i ) );
+ HYDROData_PolylineXY::SectionType aSectType = aSectTypes.Value( i );
+ bool aSectClosure = aSectClosures.Value( i );
+
+ CurveCreator::SectionType aCurveType = CurveCreator::Polyline;
+ if( aSectType == HYDROData_PolylineXY::SECTION_SPLINE )
+ aCurveType = CurveCreator::Spline;
+
+ CurveCreator::Coordinates aCurveCoords;
+
+ HYDROData_PolylineXY::PointsList aSectPointsList = myEditedObject->GetPoints( i - 1 );
+ for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+ {
+ const HYDROData_PolylineXY::Point& aSectPoint = aSectPointsList.Value( k );
+ aCurveCoords.push_back( aSectPoint.X() );
+ aCurveCoords.push_back( aSectPoint.Y() );
}
- myCurve->addSectionInternal( aName, aType, isClosed, aCoords );
+
+ myCurve->addSectionInternal( aSectName.toStdString(), aCurveType, aSectClosure, aCurveCoords );
}
- aPanel->setPolylineName( myEditedObject->GetName() );
+ aPolylineName = myEditedObject->GetName();
}
- else{
- myCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
- //aPanel->setCurve(myCurve);
- QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_POLYLINE_NAME" ) );
- aPanel->setPolylineName(aNewName);
+ else
+ {
+ aPolylineName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_POLYLINE_NAME" ) );
}
- aPanel->setCurve(myCurve);
+
+ aPanel->setPolylineName( aPolylineName );
+ aPanel->setCurve( myCurve );
displayPreview();
}
if( aDocument.IsNull() )
return false;
- Handle(HYDROData_Polyline) aPolylineObj;
- if( myIsEdit ){
+ Handle(HYDROData_PolylineXY) aPolylineObj;
+ if( myIsEdit )
+ {
aPolylineObj = myEditedObject;
+ aPolylineObj->RemoveSections();
}
else{
- aPolylineObj = Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) );
+ aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( aDocument->CreateObject( KIND_POLYLINEXY ) );
//double aZValue = double( ++ZValueIncrement ) * 1e-2; // empiric value, to be revised
//aPolylineObj->SetZValue( aZValue );
QString aPolylineName = aPanel->getPolylineName();
aPolylineObj->SetName(aPolylineName);
- int aDimInt = 3;
- if( myCurve->getDimension() == CurveCreator::Dim2d )
- aDimInt = 2;
- aPolylineObj->SetDimension(aDimInt);
- QList<PolylineSection> aPolylineData;
- for( int i=0 ; i < myCurve->getNbSections() ; i++ ){
- PolylineSection aSect;
- aSect.mySectionName = HYDROGUI_Tool::ToExtString( QString::fromLocal8Bit(myCurve->getSectionName(i).c_str()));
- aSect.myIsClosed = myCurve->isClosed(i);
- aSect.myType = PolylineSection::SECTION_POLYLINE;
- if( myCurve->getSectionType(i) == CurveCreator::Spline ){
- aSect.myType = PolylineSection::SECTION_SPLINE;
- }
- CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
- for( int j = 0 ; j < aCoords.size() ; j++ ){
- aSect.myCoords << aCoords.at(j);
+
+ for ( int i = 0 ; i < myCurve->getNbSections() ; i++ )
+ {
+ TCollection_AsciiString aSectName = HYDROGUI_Tool::ToAsciiString( myCurve->getSectionName( i ).c_str() );
+ CurveCreator::SectionType aCurveType = myCurve->getSectionType( i );
+ bool aSectClosure = myCurve->isClosed( i );
+
+ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+
+ if ( aCurveType == CurveCreator::Spline )
+ aSectType = HYDROData_PolylineXY::SECTION_SPLINE;
+
+ aPolylineObj->AddSection( aSectName, aSectType, aSectClosure );
+
+ // Add the points fro section
+ CurveCreator::Coordinates aCurveCoords = myCurve->getPoints( i );
+ for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
+ {
+ HYDROData_PolylineXY::Point aSectPoint;
+
+ aSectPoint.SetX( aCurveCoords.at( k ) );
+ k++;
+ aSectPoint.SetY( aCurveCoords.at( k ) );
+
+ aPolylineObj->AddPoint( i, aSectPoint );
}
- aPolylineData << aSect;
}
- aPolylineObj->SetPolylineData(aPolylineData);
+
+ // Update the wire of polyline
+ aPolylineObj->Update();
// the viewer should be release from the widget before the module update it
// because it has an opened local context and updated presentation should not be displayed in it
if ( aPanel )
aPanel->setOCCViewer( 0 );
- if( !myIsEdit )
- module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aPolylineObj, true );
+ theUpdateFlags = UF_Model;
+
+ size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+ if ( anActiveViewId != 0 )
+ {
+ theUpdateFlags |= UF_Viewer | UF_GV_Forced;
+ }
+ else
+ {
+ anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+ theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced;
+ }
- theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+ if( !myIsEdit )
+ {
+ module()->setObjectVisible( anActiveViewId, aPolylineObj, true );
+ }
return true;
}
#include "HYDROGUI_Operation.h"
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
class OCCViewer_ViewManager;
class CurveCreator_Curve;
void erasePreview();
private:
- OCCViewer_ViewManager* myViewManager;
+ OCCViewer_ViewManager* myViewManager;
- bool myIsEdit;
- Handle(HYDROData_Polyline) myEditedObject;
- CurveCreator_Curve* myCurve;
+ bool myIsEdit;
+ Handle(HYDROData_PolylineXY) myEditedObject;
+ CurveCreator_Curve* myCurve;
};
#endif
#include "HYDROGUI_PrsPolyline.h"
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
HYDROGUI_PrsPolylineDriver::HYDROGUI_PrsPolylineDriver()
:HYDROGUI_PrsDriver()
if( theObj.IsNull() )
return false;
- Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast( theObj );
+ Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( theObj );
if( aPolyline.IsNull() )
return false;
#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
#include <HYDROData_ImmersibleZone.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_Region.h>
#include <HYDROData_Zone.h>
#include <HYDROData_Obstacle.h>
setFillingColor( aFillingColor, false, false );
setBorderColor( aBorderColor, false, false );
}
- else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) )
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) ) )
{
- Handle(HYDROData_Polyline) aPolyline =
- Handle(HYDROData_Polyline)::DownCast( myObject );
+ Handle(HYDROData_PolylineXY) aPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( myObject );
- TopoDS_Shape aPolylineShape = aPolyline->GetTopShape();
+ TopoDS_Shape aPolylineShape = aPolyline->GetShape();
if ( !aPolylineShape.IsNull() ) {
if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
Handle(HYDROData_Entity) anObject = anIterator.Current();
if( !anObject.IsNull() && (
( anObject->GetKind() == KIND_IMAGE ) ||
- ( anObject->GetKind() == KIND_POLYLINE ) ||
+ ( anObject->GetKind() == KIND_POLYLINEXY ) ||
( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
( anObject->GetKind() == KIND_REGION ) ||
( anObject->GetKind() == KIND_BATHYMETRY ) ||
myImage2 = new HYDROGUI_ObjSelector( theModule, KIND_IMAGE, aParamGroup );
myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
- myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINE, aParamGroup );
+ myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
QFrame* aBackgroundFrame = new QFrame( aParamGroup );
QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame );
#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
#include <HYDROData_OperationsFactory.h>
SET(_sip_files2
HYDROData_Entity.sip
HYDROData_Object.sip
+ HYDROData_IPolyline.sip
+ HYDROData_ProfileUZ.sip
+ HYDROData_PolylineXY.sip
HYDROData_ArtificialObject.sip
HYDROData_NaturalObject.sip
HYDROData_Image.sip
- HYDROData_Polyline.sip
HYDROData_Bathymetry.sip
HYDROData_ImmersibleZone.sip
HYDROData_Zone.sip
%Include HYDROData_Entity.sip
%Include HYDROData_Object.sip
+%Include HYDROData_IPolyline.sip
+%Include HYDROData_ProfileUZ.sip
+%Include HYDROData_PolylineXY.sip
%Include HYDROData_ArtificialObject.sip
%Include HYDROData_NaturalObject.sip
%Include HYDROData_Image.sip
-%Include HYDROData_Polyline.sip
+%Include HYDROData_PolylineXY.sip
%Include HYDROData_Bathymetry.sip
%Include HYDROData_ImmersibleZone.sip
%Include HYDROData_Zone.sip
aRes = new HYDROData_Image( *dynamic_cast<HYDROData_Image*>( theObject ) );
break;
}
- case KIND_POLYLINE:
- {
- aRes = new HYDROData_Polyline( *dynamic_cast<HYDROData_Polyline*>( theObject ) );
- break;
- }
case KIND_BATHYMETRY:
{
aRes = new HYDROData_Bathymetry( *dynamic_cast<HYDROData_Bathymetry*>( theObject ) );
aRes = new HYDROData_ImmersibleZone( *dynamic_cast<HYDROData_ImmersibleZone*>( theObject ) );
break;
}
+ case KIND_PROFILEUZ:
+ {
+ aRes = new HYDROData_ProfileUZ( *dynamic_cast<HYDROData_ProfileUZ*>( theObject ) );
+ break;
+ }
+ case KIND_POLYLINEXY:
+ {
+ aRes = new HYDROData_PolylineXY( *dynamic_cast<HYDROData_PolylineXY*>( theObject ) );
+ break;
+ }
case KIND_CALCULATION:
{
aRes = new HYDROData_CalculationCase( *dynamic_cast<HYDROData_CalculationCase*>( theObject ) );
const ObjectKind KIND_IMAGE;
const ObjectKind KIND_POLYLINE;
const ObjectKind KIND_BATHYMETRY;
+const ObjectKind KIND_ALTITUDE;
const ObjectKind KIND_IMMERSIBLE_ZONE;
+const ObjectKind KIND_RIVER;
+const ObjectKind KIND_STREAM;
+const ObjectKind KIND_CONFLUENCE;
+const ObjectKind KIND_CHANNEL;
+const ObjectKind KIND_OBSTACLE;
+const ObjectKind KIND_DIGUE;
+const ObjectKind KIND_PROFILE;
+const ObjectKind KIND_PROFILEUZ;
+const ObjectKind KIND_POLYLINEXY;
const ObjectKind KIND_CALCULATION;
const ObjectKind KIND_ZONE;
const ObjectKind KIND_REGION;
sipClass = sipClass_HYDROData_Image;
break;
- case KIND_POLYLINE:
- sipClass = sipClass_HYDROData_Polyline;
+ case KIND_POLYLINEXY:
+ sipClass = sipClass_HYDROData_PolylineXY;
break;
case KIND_BATHYMETRY:
--- /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_IPolyline.h>
+%End
+
+class HYDROData_IPolyline : HYDROData_Entity /Abstract/
+{
+
+%TypeHeaderCode
+#include <HYDROData_IPolyline.h>
+%End
+
+%ConvertToSubClassCode
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_POLYLINEXY:
+ sipClass = sipClass_HYDROData_PolylineXY;
+ break;
+
+ case KIND_PROFILEUZ:
+ sipClass = sipClass_HYDROData_ProfileUZ;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+ enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
+
+public:
+
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_IPolyline();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_IPolyline();
+};
+
+
/**
* Sets reference polyline object for zone.
*/
- void SetPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)];
+ void SetPolyline( HYDROData_PolylineXY thePolyline ) [void (const Handle_HYDROData_PolylineXY&)];
%MethodCode
- Handle(HYDROData_Polyline) aRefPolyline =
- Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) );
+ Handle(HYDROData_PolylineXY) aRefPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
if ( !aRefPolyline.IsNull() )
{
Py_BEGIN_ALLOW_THREADS
/**
* Returns reference polyline object of zone.
*/
- HYDROData_Polyline GetPolyline() const [Handle_HYDROData_Polyline ()];
+ HYDROData_PolylineXY GetPolyline() const [Handle_HYDROData_PolylineXY ()];
%MethodCode
- Handle(HYDROData_Polyline) aRefPolyline;
+ Handle(HYDROData_PolylineXY) aRefPolyline;
Py_BEGIN_ALLOW_THREADS
aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetPolyline() :
sipCpp->GetPolyline();
Py_END_ALLOW_THREADS
- sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline );
+ sipRes = (HYDROData_PolylineXY*)createPointer( aRefPolyline );
%End
// 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;
+++ /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_Polyline.h>
-%End
-
-class HYDROData_Polyline : HYDROData_Object
-{
-
-%TypeHeaderCode
-#include <HYDROData_Polyline.h>
-%End
-
-%ConvertToSubClassCode
- switch ( sipCpp->GetKind() )
- {
- case KIND_POLYLINE:
- sipClass = sipClass_HYDROData_Polyline;
- break;
-
- default:
- // We don't recognise the type.
- sipClass = NULL;
- }
-%End
-
-public:
-
- /**
- * Return polyline dimension
- * \return polyline dimension (2 or 3)
- */
- int GetDimension() const;
-
- /**
- * Set polyline dimension (2 or 3)
- * \param theDimension the polyline dimension
- */
- void SetDimension( int theDimension );
-
- /**
- * Remove all sections from polyline
- */
- void RemoveAll();
-
-
- /**
- * Returns the painter path. The painter path is construct by lines
- */
- QPainterPath GetPainterPath();
-
-
- /**
- * Sets the z value for polyline.
- */
- void SetZValue( const double theZValue );
-
- /**
- * Returns the z value for polyline.
- */
- double ZValue() const;
-
-protected:
-
- /**
- * Creates new object in the internal data structure. Use higher level objects
- * to create objects with real content.
- */
- HYDROData_Polyline();
-
- /**
- * Destructs properties of the object and object itself, removes it from the document.
- */
- ~HYDROData_Polyline();
-};
-
-
--- /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_PolylineXY.h>
+%End
+
+class HYDROData_PolylineXY : HYDROData_IPolyline
+{
+
+%TypeHeaderCode
+#include <HYDROData_PolylineXY.h>
+%End
+
+%ConvertToSubClassCode
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_POLYLINEXY:
+ sipClass = sipClass_HYDROData_PolylineXY;
+ 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_PolylineXY();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_PolylineXY();
+};
+
+
--- /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_ProfileUZ.h>
+%End
+
+class HYDROData_ProfileUZ : HYDROData_IPolyline
+{
+
+%TypeHeaderCode
+#include <HYDROData_ProfileUZ.h>
+%End
+
+%ConvertToSubClassCode
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_PROFILEUZ:
+ sipClass = sipClass_HYDROData_ProfileUZ;
+ 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_ProfileUZ();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_ProfileUZ();
+};
+
+