refs #1331: disabling automatic sorting of points in the GUI table

This commit is contained in:
asl 2017-09-22 09:19:37 +03:00
parent 81f3aca1cb
commit 28c4349bd9
8 changed files with 43 additions and 35 deletions

View File

@ -971,11 +971,17 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
// function: getPoints
// purpose:
//=======================================================================
CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
CurveCreator::Coordinates CurveCreator_Curve::getCoords( int theISection ) const
{
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates();
}
Handle(TColgp_HArray1OfPnt) CurveCreator_Curve::GetDifferentPoints( int theISection ) const
{
//DEBTRACE("getPoints");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates();
return aSection ? aSection->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)();
}
void CurveCreator_Curve::constructAISObject()

View File

@ -261,7 +261,9 @@ public:
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
*/
virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const;
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const;
CurveCreator::Coordinates getCoords( int theISection = -1 ) const;
/**

View File

@ -336,7 +336,7 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
aSectionId = anIt->first;
aPointId = anIt->second;
const CurveCreator::Coordinates &aPoints =
theCurve->getPoints(aSectionId);
theCurve->getCoords(aSectionId);
CurveCreator::Coordinates::const_iterator anIterBegin =
aPoints.begin() + (aDim*aPointId);
CurveCreator::Coordinates::const_iterator anIterEnd =
@ -526,7 +526,7 @@ bool CurveCreator_Diff::addSectionToUndo
CurveCreator_Operation &theOperation) const
{
const std::string aName = theCurve->getSectionName(theIndex);
const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex);
const CurveCreator::Coordinates &aPnts = theCurve->getCoords(theIndex);
const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
const bool isClosed = theCurve->isClosed(theIndex);

View File

@ -59,8 +59,7 @@ struct CURVECREATOR_EXPORT CurveCreator_ISection
virtual ~CurveCreator_ISection() {}
//! Calculates the different points of the section.
virtual void GetDifferentPoints(
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
};
/**
@ -192,7 +191,7 @@ public:
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
*/
virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0;
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const = 0;
/**
* Get number of points in specified section or (the total number of points

View File

@ -30,9 +30,10 @@ const double POINT_CONFUSION = 1e-4;
// function: GetDifferentPoints
// purpose:
//=======================================================================
void CurveCreator_Section::GetDifferentPoints(
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
{
Handle(TColgp_HArray1OfPnt) points;
std::vector<gp_Pnt> aTmpPoints;
CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
@ -62,9 +63,11 @@ void CurveCreator_Section::GetDifferentPoints(
}
}
thePoints = new TColgp_HArray1OfPnt(1, aPointCount);
points = new TColgp_HArray1OfPnt(1, aPointCount);
for (int aPI = 0; aPI < aPointCount; ++aPI)
{
thePoints->SetValue(aPI + 1, aTmpPoints[aPI]);
points->SetValue(aPI + 1, aTmpPoints[aPI]);
}
return points;
}

View File

@ -42,7 +42,7 @@ struct CURVECREATOR_EXPORT CurveCreator_Section :
bool myIsClosed; //!< closed or not
//! A virtual method.
void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const;
Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
};
#endif

View File

@ -311,9 +311,7 @@ void CurveCreator_Utils::constructShape(
}
// Get the different points.
const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI);
Handle(TColgp_HArray1OfPnt) aPoints;
aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
Handle(TColgp_HArray1OfPnt) aPoints = theCurve->GetDifferentPoints( aSectionI );
const int aPointCount = aPoints->Length();
const bool isClosed = theCurve->isClosed(aSectionI);
@ -619,6 +617,12 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
theContext->SetAutomaticHilight( Standard_False );
Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
aLast = thePoints.end();
bool isFound = false;
for( int i=0; i<aSize; i++ )
{
for( aSelection->Init(); aSelection->More(); aSelection->Next() )
{
#if OCC_VERSION_LARGE > 0x06080100
@ -635,12 +639,6 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
gp_Pnt anOwnerPnt = aSenPnt->Point();
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
aLast = thePoints.end();
bool isFound = false;
for( int i=0; i<aSize; i++ )
{
bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE &&
fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
if( isIntersect )

View File

@ -252,7 +252,7 @@ void EntityGUI_PolylineDlg::GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
for (i = 0; i < aNbSec; ++i) {
// Set coordinates
CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
CurveCreator::Coordinates aCoords = myCurve->getCoords(i);
const int aNbPoints = aCoords.size();
theCoords[i].length(aNbPoints);