From bf8682daf1506c4d974f3b68c41678b60bdbf3b2 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 12 Oct 2015 11:41:03 +0300 Subject: [PATCH] refs #527, #577: using double for coordinates --- src/CurveCreator/CurveCreator.hxx | 2 +- src/CurveCreator/CurveCreator_ICurve.hxx | 11 ++++++----- src/CurveCreator/CurveCreator_Widget.cxx | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/CurveCreator/CurveCreator.hxx b/src/CurveCreator/CurveCreator.hxx index f7e8d33ee..e95749664 100644 --- a/src/CurveCreator/CurveCreator.hxx +++ b/src/CurveCreator/CurveCreator.hxx @@ -33,7 +33,7 @@ struct CurveCreator_PosPoint; namespace CurveCreator { //! Points coordinates - typedef float TypeCoord; + typedef double TypeCoord; /** List of coordinates in format depends on section dimension: * 2D: [x1, y1, x2, y2, x3, y3, ..] diff --git a/src/CurveCreator/CurveCreator_ICurve.hxx b/src/CurveCreator/CurveCreator_ICurve.hxx index 5b5d5eae3..20f8508e8 100644 --- a/src/CurveCreator/CurveCreator_ICurve.hxx +++ b/src/CurveCreator/CurveCreator_ICurve.hxx @@ -23,6 +23,7 @@ #ifndef _CurveCreator_ICurve_HeaderFile #define _CurveCreator_ICurve_HeaderFile +#include "CurveCreator.hxx" #include "CurveCreator_Macro.hxx" #include @@ -76,7 +77,7 @@ public: typedef std::pair SectionToPoint; typedef std::deque SectionToPointList; - typedef std::deque< std::pair< SectionToPoint,std::deque< float > > > SectionToPointCoordsList; + typedef std::deque< std::pair< SectionToPoint, CurveCreator::Coordinates > > SectionToPointCoordsList; public: /***********************************************/ @@ -167,14 +168,14 @@ public: * Insert one or several points to the specified section starting from the given theIPnt index * (or add these at the end of section points if \a theIPnt is -1). */ - virtual bool addPoints( const std::deque& theCoords, + virtual bool addPoints( const CurveCreator::Coordinates& theCoords, const int theISection, const int theIPnt = -1 ) = 0; //! Set coordinates of specified point virtual bool setPoint( const int theISection, const int theIPnt, - const std::deque& theNewCoords ) = 0; + const CurveCreator::Coordinates& theNewCoords ) = 0; //! Set coordinates of specified points from different sections virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords, @@ -186,13 +187,13 @@ public: virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0; //! Get coordinates of specified point - virtual std::deque getPoint( const int theISection, + virtual CurveCreator::Coordinates getPoint( const int theISection, const int theIPnt ) const = 0; /** * Get points of a section (the total points in Curve if theISection is equal to -1).. */ - virtual std::deque getPoints( const int theISection = -1 ) const = 0; + virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0; /** * Get number of points in specified section or (the total number of points diff --git a/src/CurveCreator/CurveCreator_Widget.cxx b/src/CurveCreator/CurveCreator_Widget.cxx index 393fa49dc..df9c6b710 100644 --- a/src/CurveCreator/CurveCreator_Widget.cxx +++ b/src/CurveCreator/CurveCreator_Widget.cxx @@ -1059,7 +1059,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven if ( myDragStarted ) { bool isDragged = myDragged; CurveCreator_ICurve::SectionToPointList aDraggedPoints; - QMap > anInitialDragPointsCoords; + QMap anInitialDragPointsCoords; if ( myDragged ) { aDraggedPoints = myDragPoints; anInitialDragPointsCoords = myInitialDragPointsCoords; @@ -1105,7 +1105,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven for ( ; anIt != aLast; anIt++ ) { int aSectionId = anIt->first; int aPointId = anIt->second; - std::deque aPos = myCurve->getPoint( aSectionId, aPointId ); + CurveCreator::Coordinates aPos = myCurve->getPoint( aSectionId, aPointId ); aCoordList.push_back( std::make_pair( std::make_pair( aSectionId, aPointId ), aPos ) ); @@ -1195,7 +1195,7 @@ void CurveCreator_Widget::onCellChanged( int theRow, int theColumn ) double aX = myLocalPointView->item( theRow, 2 )->data( Qt::UserRole ).toDouble(); double anY = myLocalPointView->item( theRow, 3 )->data( Qt::UserRole ).toDouble(); - std::deque aChangedPos; + CurveCreator::Coordinates aChangedPos; aChangedPos.push_back( aX ); aChangedPos.push_back( anY ); myCurve->setPoint( aCurrSect, aPntIndex, aChangedPos ); @@ -1338,7 +1338,7 @@ void CurveCreator_Widget::moveSelectedPoints( const int theXPosition, double anYDelta = aStartPnt.Y() - anEndPnt.Y(); CurveCreator_ICurve::SectionToPointCoordsList aCoordList; - std::deque aChangedPos; + CurveCreator::Coordinates aChangedPos; CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myDragPoints.begin(), aLast = myDragPoints.end(); for ( ; anIt != aLast; anIt++ ) { -- 2.39.2