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 // function: getPoints
// purpose: // 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"); //DEBTRACE("getPoints");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection ); 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() 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).. * 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; aSectionId = anIt->first;
aPointId = anIt->second; aPointId = anIt->second;
const CurveCreator::Coordinates &aPoints = const CurveCreator::Coordinates &aPoints =
theCurve->getPoints(aSectionId); theCurve->getCoords(aSectionId);
CurveCreator::Coordinates::const_iterator anIterBegin = CurveCreator::Coordinates::const_iterator anIterBegin =
aPoints.begin() + (aDim*aPointId); aPoints.begin() + (aDim*aPointId);
CurveCreator::Coordinates::const_iterator anIterEnd = CurveCreator::Coordinates::const_iterator anIterEnd =
@ -526,7 +526,7 @@ bool CurveCreator_Diff::addSectionToUndo
CurveCreator_Operation &theOperation) const CurveCreator_Operation &theOperation) const
{ {
const std::string aName = theCurve->getSectionName(theIndex); 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 CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
const bool isClosed = theCurve->isClosed(theIndex); const bool isClosed = theCurve->isClosed(theIndex);

View File

@ -59,8 +59,7 @@ struct CURVECREATOR_EXPORT CurveCreator_ISection
virtual ~CurveCreator_ISection() {} virtual ~CurveCreator_ISection() {}
//! Calculates the different points of the section. //! Calculates the different points of the section.
virtual void GetDifferentPoints( virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
}; };
/** /**
@ -192,7 +191,7 @@ public:
/** /**
* 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 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 * 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 // function: GetDifferentPoints
// purpose: // purpose:
//======================================================================= //=======================================================================
void CurveCreator_Section::GetDifferentPoints( Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
{ {
Handle(TColgp_HArray1OfPnt) points;
std::vector<gp_Pnt> aTmpPoints; std::vector<gp_Pnt> aTmpPoints;
CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin(); CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end(); 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) 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 bool myIsClosed; //!< closed or not
//! A virtual method. //! A virtual method.
void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const; Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
}; };
#endif #endif

View File

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

View File

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