refs #527, #577: using double for coordinates

This commit is contained in:
asl 2015-10-12 11:41:03 +03:00
parent 21a4549edd
commit bf8682daf1
3 changed files with 11 additions and 10 deletions

View File

@ -33,7 +33,7 @@ struct CurveCreator_PosPoint;
namespace CurveCreator namespace CurveCreator
{ {
//! Points coordinates //! Points coordinates
typedef float TypeCoord; typedef double TypeCoord;
/** List of coordinates in format depends on section dimension: /** List of coordinates in format depends on section dimension:
* 2D: [x1, y1, x2, y2, x3, y3, ..] * 2D: [x1, y1, x2, y2, x3, y3, ..]

View File

@ -23,6 +23,7 @@
#ifndef _CurveCreator_ICurve_HeaderFile #ifndef _CurveCreator_ICurve_HeaderFile
#define _CurveCreator_ICurve_HeaderFile #define _CurveCreator_ICurve_HeaderFile
#include "CurveCreator.hxx"
#include "CurveCreator_Macro.hxx" #include "CurveCreator_Macro.hxx"
#include <TColgp_HArray1OfPnt.hxx> #include <TColgp_HArray1OfPnt.hxx>
@ -76,7 +77,7 @@ public:
typedef std::pair<int,int> SectionToPoint; typedef std::pair<int,int> SectionToPoint;
typedef std::deque<SectionToPoint> SectionToPointList; typedef std::deque<SectionToPoint> SectionToPointList;
typedef std::deque< std::pair< SectionToPoint,std::deque< float > > > SectionToPointCoordsList; typedef std::deque< std::pair< SectionToPoint, CurveCreator::Coordinates > > SectionToPointCoordsList;
public: public:
/***********************************************/ /***********************************************/
@ -167,14 +168,14 @@ public:
* Insert one or several points to the specified section starting from the given theIPnt index * 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). * (or add these at the end of section points if \a theIPnt is -1).
*/ */
virtual bool addPoints( const std::deque<float>& theCoords, virtual bool addPoints( const CurveCreator::Coordinates& theCoords,
const int theISection, const int theISection,
const int theIPnt = -1 ) = 0; const int theIPnt = -1 ) = 0;
//! Set coordinates of specified point //! Set coordinates of specified point
virtual bool setPoint( const int theISection, virtual bool setPoint( const int theISection,
const int theIPnt, const int theIPnt,
const std::deque<float>& theNewCoords ) = 0; const CurveCreator::Coordinates& theNewCoords ) = 0;
//! Set coordinates of specified points from different sections //! Set coordinates of specified points from different sections
virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords, virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
@ -186,13 +187,13 @@ public:
virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0; virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0;
//! Get coordinates of specified point //! Get coordinates of specified point
virtual std::deque<float> getPoint( const int theISection, virtual CurveCreator::Coordinates getPoint( const int theISection,
const int theIPnt ) const = 0; const int theIPnt ) const = 0;
/** /**
* Get points of a section (the total points in Curve if theISection is equal to -1).. * Get points of a section (the total points in Curve if theISection is equal to -1)..
*/ */
virtual std::deque<float> 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 * Get number of points in specified section or (the total number of points

View File

@ -1059,7 +1059,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven
if ( myDragStarted ) { if ( myDragStarted ) {
bool isDragged = myDragged; bool isDragged = myDragged;
CurveCreator_ICurve::SectionToPointList aDraggedPoints; CurveCreator_ICurve::SectionToPointList aDraggedPoints;
QMap<CurveCreator_ICurve::SectionToPoint, std::deque< float > > anInitialDragPointsCoords; QMap<CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates > anInitialDragPointsCoords;
if ( myDragged ) { if ( myDragged ) {
aDraggedPoints = myDragPoints; aDraggedPoints = myDragPoints;
anInitialDragPointsCoords = myInitialDragPointsCoords; anInitialDragPointsCoords = myInitialDragPointsCoords;
@ -1105,7 +1105,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEven
for ( ; anIt != aLast; anIt++ ) { for ( ; anIt != aLast; anIt++ ) {
int aSectionId = anIt->first; int aSectionId = anIt->first;
int aPointId = anIt->second; int aPointId = anIt->second;
std::deque<float> aPos = myCurve->getPoint( aSectionId, aPointId ); CurveCreator::Coordinates aPos = myCurve->getPoint( aSectionId, aPointId );
aCoordList.push_back( aCoordList.push_back(
std::make_pair( std::make_pair( aSectionId, aPointId ), aPos ) ); 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 aX = myLocalPointView->item( theRow, 2 )->data( Qt::UserRole ).toDouble();
double anY = myLocalPointView->item( theRow, 3 )->data( Qt::UserRole ).toDouble(); double anY = myLocalPointView->item( theRow, 3 )->data( Qt::UserRole ).toDouble();
std::deque<float> aChangedPos; CurveCreator::Coordinates aChangedPos;
aChangedPos.push_back( aX ); aChangedPos.push_back( aX );
aChangedPos.push_back( anY ); aChangedPos.push_back( anY );
myCurve->setPoint( aCurrSect, aPntIndex, aChangedPos ); myCurve->setPoint( aCurrSect, aPntIndex, aChangedPos );
@ -1338,7 +1338,7 @@ void CurveCreator_Widget::moveSelectedPoints( const int theXPosition,
double anYDelta = aStartPnt.Y() - anEndPnt.Y(); double anYDelta = aStartPnt.Y() - anEndPnt.Y();
CurveCreator_ICurve::SectionToPointCoordsList aCoordList; CurveCreator_ICurve::SectionToPointCoordsList aCoordList;
std::deque<float> aChangedPos; CurveCreator::Coordinates aChangedPos;
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myDragPoints.begin(), CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myDragPoints.begin(),
aLast = myDragPoints.end(); aLast = myDragPoints.end();
for ( ; anIt != aLast; anIt++ ) { for ( ; anIt != aLast; anIt++ ) {