From a23fa81dd76041264b4ddd65883ea9bfb7cc67bd Mon Sep 17 00:00:00 2001 From: akl Date: Wed, 20 Nov 2013 11:13:41 +0000 Subject: [PATCH] Add a new functions: 'removeSeveralPoints' and 'setSeveralPoints' to remove or move several points at once. --- src/HYDROCurveCreator/CurveCreator_Curve.cxx | 14 +++++++++++++- src/HYDROCurveCreator/CurveCreator_Curve.hxx | 6 ++++++ src/HYDROCurveCreator/CurveCreator_ICurve.hxx | 10 ++++++++++ src/HYDROData/HYDROData_PolylineXY.cxx | 12 ++++++++++++ src/HYDROData/HYDROData_PolylineXY.h | 6 ++++++ src/HYDROData/HYDROData_ProfileUZ.cxx | 12 ++++++++++++ src/HYDROData/HYDROData_ProfileUZ.h | 6 ++++++ 7 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/HYDROCurveCreator/CurveCreator_Curve.cxx b/src/HYDROCurveCreator/CurveCreator_Curve.cxx index f27cfb2e..f056b034 100644 --- a/src/HYDROCurveCreator/CurveCreator_Curve.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Curve.cxx @@ -860,6 +860,12 @@ bool CurveCreator_Curve::setPoint( const int theISection, return res; } +//! Set coordinates of specified points from different sections +bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) +{ + return false; +} + //! For internal use only! Undo/Redo are not used here. bool CurveCreator_Curve::removePointsInternal( const std::vector &theISections, const std::vector &theIPnts ) @@ -904,7 +910,13 @@ bool CurveCreator_Curve::removePoint( const int theISection, const int theIPnt ) return res; } -//======================================================================= +//! Remove several points from different sections with given ids +bool CurveCreator_Curve::removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) +{ + return false; +} + + //======================================================================= // function: getCoordinates // purpose: //======================================================================= diff --git a/src/HYDROCurveCreator/CurveCreator_Curve.hxx b/src/HYDROCurveCreator/CurveCreator_Curve.hxx index f9e41588..bb29e889 100644 --- a/src/HYDROCurveCreator/CurveCreator_Curve.hxx +++ b/src/HYDROCurveCreator/CurveCreator_Curve.hxx @@ -232,12 +232,18 @@ public: const int theIPnt, const CurveCreator::Coordinates& theNewCoords ); + //! Set coordinates of specified points from different sections + virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords); + //! For internal use only! Undo/Redo are not used here. virtual bool removePointsInternal( const std::vector &theISections, const std::vector &theIPnts ); /** Remove point with given id */ virtual bool removePoint( const int theISection, const int theIPnt = -1 ); + //! Remove several points from different sections with given ids + virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs); + //! Get coordinates of specified point virtual CurveCreator::Coordinates getPoint( const int theISection, const int theIPnt ) const; diff --git a/src/HYDROCurveCreator/CurveCreator_ICurve.hxx b/src/HYDROCurveCreator/CurveCreator_ICurve.hxx index fd5e63d5..a36ebe92 100644 --- a/src/HYDROCurveCreator/CurveCreator_ICurve.hxx +++ b/src/HYDROCurveCreator/CurveCreator_ICurve.hxx @@ -59,6 +59,11 @@ class CURVECREATOR_EXPORT CurveCreator_ICurve public: typedef std::vector ListAISObjects; + typedef std::pair SectionToPoint; + typedef std::deque SectionToPointList; + + typedef std::deque>> SectionToPointCoordsList; + public: /***********************************************/ /*** Undo/Redo methods ***/ @@ -146,9 +151,14 @@ public: virtual bool setPoint( const int theISection, const int theIPnt, const std::deque& theNewCoords ) = 0; + + //! Set coordinates of specified points from different sections + virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) = 0; //! Remove point with given id virtual bool removePoint( const int theISection, const int theIPnt = -1 ) = 0; + //! Remove several points from different sections + virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0; //! Get coordinates of specified point virtual std::deque getPoint( const int theISection, diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index d2f99794..b97af6d5 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -575,6 +575,12 @@ bool HYDROData_PolylineXY::setPoint( const int theISectio return true; } +//! Set coordinates of specified points from different sections +bool HYDROData_PolylineXY::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) +{ + return false; +} + bool HYDROData_PolylineXY::removePoint( const int theISection, const int theIPnt ) { @@ -621,6 +627,12 @@ bool HYDROData_PolylineXY::removePoint( const int theISection, return true; } +//! Remove several points from different sections with given ids +bool HYDROData_PolylineXY::removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) +{ + return false; +} + CurveCreator::Coordinates HYDROData_PolylineXY::getPoints( const int theISection ) const { CurveCreator::Coordinates aResList; diff --git a/src/HYDROData/HYDROData_PolylineXY.h b/src/HYDROData/HYDROData_PolylineXY.h index 93caac61..943f4d8f 100644 --- a/src/HYDROData/HYDROData_PolylineXY.h +++ b/src/HYDROData/HYDROData_PolylineXY.h @@ -112,9 +112,15 @@ public: const int theIPnt, const CurveCreator::Coordinates& theCoords ); + //! Set coordinates of specified points from different sections + HYDRODATA_EXPORT virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords); + //! Remove point with given id HYDRODATA_EXPORT virtual bool removePoint( const int theISection, const int theIPnt = -1 ); + //! Remove several points from different sections with given ids + HYDRODATA_EXPORT virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs); + /** * Get points of a section (the total points in Curve if theISection is equal to -1).. */ diff --git a/src/HYDROData/HYDROData_ProfileUZ.cxx b/src/HYDROData/HYDROData_ProfileUZ.cxx index 98abdc82..014288dc 100755 --- a/src/HYDROData/HYDROData_ProfileUZ.cxx +++ b/src/HYDROData/HYDROData_ProfileUZ.cxx @@ -233,6 +233,12 @@ bool HYDROData_ProfileUZ::removePoint( const int /*theISection*/, return true; } +//! Remove several points from different sections with given ids +bool HYDROData_ProfileUZ::removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) +{ + return false; +} + bool HYDROData_ProfileUZ::setPoint( const int /*theISection*/, const int theIPoint, const CurveCreator::Coordinates& theNewCoords ) @@ -253,6 +259,12 @@ bool HYDROData_ProfileUZ::setPoint( const int /*theISecti return aRes; } +//! Set coordinates of specified points from different sections +bool HYDROData_ProfileUZ::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) +{ + return false; +} + CurveCreator::Coordinates HYDROData_ProfileUZ::getPoints( const int /*theISection*/ ) const { CurveCreator::Coordinates aResList; diff --git a/src/HYDROData/HYDROData_ProfileUZ.h b/src/HYDROData/HYDROData_ProfileUZ.h index fbb7eb0a..608b6953 100644 --- a/src/HYDROData/HYDROData_ProfileUZ.h +++ b/src/HYDROData/HYDROData_ProfileUZ.h @@ -112,9 +112,15 @@ public: const int theIPnt, const CurveCreator::Coordinates& theCoords ); + //! Set coordinates of specified points from different sections + HYDRODATA_EXPORT virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords); + //! Remove point with given id HYDRODATA_EXPORT virtual bool removePoint( const int theISection, const int theIPnt = -1 ); + //! Remove several points from different sections with given ids + HYDRODATA_EXPORT virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs); + /** * Get points of a section (the total points in Curve if theISection is equal to -1).. */ -- 2.39.2