From: asl Date: Fri, 22 Sep 2017 06:19:37 +0000 (+0300) Subject: refs #1331: disabling automatic sorting of points in the GUI table X-Git-Tag: v2.1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=28c4349bd99a8875631511b725a20ade0f42475e;p=modules%2Fgeom.git refs #1331: disabling automatic sorting of points in the GUI table --- diff --git a/src/CurveCreator/CurveCreator_Curve.cxx b/src/CurveCreator/CurveCreator_Curve.cxx index e307e8160..fb85db9d8 100644 --- a/src/CurveCreator/CurveCreator_Curve.cxx +++ b/src/CurveCreator/CurveCreator_Curve.cxx @@ -971,13 +971,19 @@ 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 { - //DEBTRACE("getPoints"); 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->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)(); +} + void CurveCreator_Curve::constructAISObject() { //DEBTRACE("constructAISObject"); diff --git a/src/CurveCreator/CurveCreator_Curve.hxx b/src/CurveCreator/CurveCreator_Curve.hxx index 74667f4f0..5763d1fff 100644 --- a/src/CurveCreator/CurveCreator_Curve.hxx +++ b/src/CurveCreator/CurveCreator_Curve.hxx @@ -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; /** diff --git a/src/CurveCreator/CurveCreator_Diff.cxx b/src/CurveCreator/CurveCreator_Diff.cxx index a9f08d302..c4e1f9212 100644 --- a/src/CurveCreator/CurveCreator_Diff.cxx +++ b/src/CurveCreator/CurveCreator_Diff.cxx @@ -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); diff --git a/src/CurveCreator/CurveCreator_ICurve.hxx b/src/CurveCreator/CurveCreator_ICurve.hxx index 150e37d2e..d1a2e48bc 100644 --- a/src/CurveCreator/CurveCreator_ICurve.hxx +++ b/src/CurveCreator/CurveCreator_ICurve.hxx @@ -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 diff --git a/src/CurveCreator/CurveCreator_Section.cxx b/src/CurveCreator/CurveCreator_Section.cxx index e2298c092..2b9beda57 100644 --- a/src/CurveCreator/CurveCreator_Section.cxx +++ b/src/CurveCreator/CurveCreator_Section.cxx @@ -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 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; } diff --git a/src/CurveCreator/CurveCreator_Section.hxx b/src/CurveCreator/CurveCreator_Section.hxx index 9ad98048a..07b1bc973 100644 --- a/src/CurveCreator/CurveCreator_Section.hxx +++ b/src/CurveCreator/CurveCreator_Section.hxx @@ -36,13 +36,13 @@ struct CURVECREATOR_EXPORT CurveCreator_Section : CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false) { } - std::string myName; //!< section name + std::string myName; //!< section name CurveCreator::Coordinates myPoints; //!< points coordinates CurveCreator::SectionType myType; //!< type of the 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 diff --git a/src/CurveCreator/CurveCreator_Utils.cxx b/src/CurveCreator/CurveCreator_Utils.cxx index 5f53caea4..20b16f4c4 100644 --- a/src/CurveCreator/CurveCreator_Utils.cxx +++ b/src/CurveCreator/CurveCreator_Utils.cxx @@ -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,28 +617,28 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo theContext->SetAutomaticHilight( Standard_False ); Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) ); - for( aSelection->Init(); aSelection->More(); aSelection->Next() ) - { + + CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(), + aLast = thePoints.end(); + bool isFound = false; + for( int i=0; iInit(); aSelection->More(); aSelection->Next() ) + { #if OCC_VERSION_LARGE > 0x06080100 - const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive(); - if( aHSenEntity.IsNull() ) - continue; - Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive(); + const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive(); + if( aHSenEntity.IsNull() ) + continue; + Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive(); #else - Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive(); + Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive(); #endif - Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity ); - - gp_Pnt anOwnerPnt = aSenPnt->Point(); - Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() ); + Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity ); + + 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; igetPoints(i); + CurveCreator::Coordinates aCoords = myCurve->getCoords(i); const int aNbPoints = aCoords.size(); theCoords[i].length(aNbPoints);