1 // Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: CurveCreator_Curve.cxx
21 // Author: Sergey KHROMOV
23 #include "CurveCreator_Curve.hxx"
25 #include "CurveCreator.hxx"
26 #include "CurveCreator_PosPoint.hxx"
27 #include "CurveCreator_Section.hxx"
28 #include "CurveCreator_Displayer.h"
29 #include "CurveCreator_Utils.h"
31 #include <AIS_Shape.hxx>
32 #include <AIS_InteractiveObject.hxx>
33 #include <Geom_CartesianPoint.hxx>
36 #include <TopoDS_Edge.hxx>
37 #include <TopoDS_Face.hxx>
38 #include <TopoDS_Wire.hxx>
42 //=======================================================================
43 // function: Constructor
45 //=======================================================================
46 CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimension )
48 myDimension (theDimension),
59 //=======================================================================
60 // function: Destructor
62 //=======================================================================
63 CurveCreator_Curve::~CurveCreator_Curve()
65 // Delete all allocated data.
69 //=======================================================================
70 // function: getDimension
72 //=======================================================================
73 CurveCreator::Dimension CurveCreator_Curve::getDimension() const
78 //=======================================================================
79 // function: getUniqSectionName
80 // purpose: return unique section name
81 //=======================================================================
82 std::string CurveCreator_Curve::getUniqSectionName() const
84 CurveCreator_Section* aSection;
85 for( int i = 0 ; i < 1000000 ; i++ ){
87 sprintf( aBuffer, "Section_%d", i+1 );
88 std::string aName(aBuffer);
90 for( j = 0 ; j < mySections.size() ; j++ ){
91 aSection = getSection( j );
92 if ( aSection && aSection->myName == aName )
95 if( j == mySections.size() )
101 //=======================================================================
102 // function: setDisplayer
103 // purpose: set curve changes Displayer
104 //=======================================================================
105 void CurveCreator_Curve::setDisplayer( CurveCreator_Displayer* theDisplayer )
107 myDisplayer = theDisplayer;
110 //=======================================================================
111 // function: getDisplayer
112 // purpose: get curve changes Displayer
113 //=======================================================================
114 CurveCreator_Displayer* CurveCreator_Curve::getDisplayer()
119 //=======================================================================
120 // function: removeDisplayer
121 // purpose: remove the attached Displayer
122 //=======================================================================
123 void CurveCreator_Curve::removeDisplayer()
128 //=======================================================================
131 //=======================================================================
132 bool CurveCreator_Curve::addEmptyDiff()
134 bool isEnabled = false;
136 if (myUndoDepth != 0) {
137 // Forget all Redos after the current one.
140 myListDiffs.erase(myCurrenPos, myListDiffs.end());
143 if (myUndoDepth == -1 || myNbUndos < myUndoDepth) {
144 // Increase the number of undos.
147 // If there are too many differences, remove the first one.
148 myListDiffs.pop_front();
151 // Add new difference.
152 myListDiffs.push_back(CurveCreator_Diff());
153 myCurrenPos = myListDiffs.end();
160 void CurveCreator_Curve::startOperation()
165 void CurveCreator_Curve::finishOperation()
170 //=======================================================================
171 // function: toICoord
173 //=======================================================================
174 int CurveCreator_Curve::toICoord(const int theIPnt) const
176 return theIPnt * myDimension;
179 //=======================================================================
180 // function: setUndoDepth
182 //=======================================================================
183 void CurveCreator_Curve::setUndoDepth(const int theDepth)
186 // Reset all undo/redo data.
190 myCurrenPos = myListDiffs.end();
192 } else if (theDepth == -1) {
193 // There is nothing to do as the depth become unlimited.
195 } else if (theDepth > 0) {
196 // The new "real" depth is set.
197 if (theDepth < myNbRedos) {
198 // The new depth is less then number of redos. Remove the latest redos.
199 int aShift = (myNbRedos - theDepth);
200 ListDiff::iterator aFromPos = myListDiffs.end();
206 myListDiffs.erase(aFromPos, myListDiffs.end());
207 myNbRedos = theDepth;
210 if (theDepth < myNbUndos + myNbRedos) {
211 // The new depth is less then the total number of differences.
212 // Remove the first undos.
213 int aShift = (myNbUndos + myNbRedos - theDepth);
214 ListDiff::iterator aToPos = myListDiffs.begin();
220 myListDiffs.erase(myListDiffs.begin(), aToPos);
221 myNbUndos = theDepth - myNbRedos;
224 myUndoDepth = theDepth;
228 //=======================================================================
229 // function: getUndoDepth
231 //=======================================================================
232 int CurveCreator_Curve::getUndoDepth() const
237 void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const
239 CurveCreator::Coordinates aCoords = getPoint( theISection, theIPoint );
243 if( getDimension() == CurveCreator::Dim3d ){
248 void CurveCreator_Curve::redisplayCurve()
251 myDisplayer->eraseAll( false );
254 myDisplayer->display( getAISObject( true ), true );
258 //! For internal use only! Undo/Redo are not used here.
259 bool CurveCreator_Curve::moveSectionInternal(const int theISection,
260 const int theNewIndex)
263 int aMovedSectionId = theISection >= 0 ? theISection : mySections.size()-1;
265 if (aMovedSectionId != theNewIndex) {
266 CurveCreator_Section* aSection = getSection( aMovedSectionId );
269 CurveCreator::Sections::iterator anIter = mySections.begin() + aMovedSectionId;
271 mySections.erase(anIter);
274 anIter = mySections.begin() + theNewIndex;
275 mySections.insert(anIter, aSection);
281 //=======================================================================
282 // function: moveSection
284 //=======================================================================
285 bool CurveCreator_Curve::moveSection(const int theISection,
286 const int theNewIndex)
289 // Set the difference.
291 if (addEmptyDiff()) {
292 myListDiffs.back().init(this, CurveCreator_Operation::MoveSection,
293 theISection, theNewIndex);
297 res = moveSectionInternal(theISection, theNewIndex);
302 /************ Implementation of INTERFACE methods ************/
304 /***********************************************/
305 /*** Undo/Redo methods ***/
306 /***********************************************/
308 //! Get number of available undo operations
309 int CurveCreator_Curve::getNbUndo() const
314 //! Undo previous operation
315 bool CurveCreator_Curve::undo()
322 myCurrenPos->applyUndo(this);
328 //! Get number of available redo operations
329 int CurveCreator_Curve::getNbRedo() const
334 //! Redo last previously "undone" operation
335 bool CurveCreator_Curve::redo()
339 myCurrenPos->applyRedo(this);
348 /***********************************************/
349 /*** Section methods ***/
350 /***********************************************/
351 //! For internal use only! Undo/Redo are not used here.
352 bool CurveCreator_Curve::clearInternal()
354 // erase curve from the viewer
356 myDisplayer->eraseAll( true );
359 // Delete all allocated data.
361 const int aNbSections = getNbSections();
363 CurveCreator_Section* aSection;
364 for (; i < aNbSections; i++) {
365 aSection = getSection( i );
375 //=======================================================================
378 //=======================================================================
379 bool CurveCreator_Curve::clear()
383 // Set the difference.
384 if (addEmptyDiff()) {
385 myListDiffs.back().init(this);
387 res = clearInternal();
392 //! For internal use only! Undo/Redo are not used here.
393 bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
396 if ( theSections.empty() )
399 int anISectionMain = theSections.front();
400 CurveCreator_Section* aSectionMain = getSection( anISectionMain );
402 std::list <int> aSectionsToJoin = theSections;
403 aSectionsToJoin.erase( aSectionsToJoin.begin() ); // skip the main section
404 // it is important to sort and reverse the section ids in order to correctly remove them
405 aSectionsToJoin.sort();
406 aSectionsToJoin.reverse();
408 std::list<int>::const_iterator anIt = aSectionsToJoin.begin(), aLast = aSectionsToJoin.end();
409 CurveCreator_Section* aSection;
410 for (; anIt != aLast; anIt++) {
411 aSection = getSection( *anIt );
412 aSectionMain->myPoints.insert(aSectionMain->myPoints.end(), aSection->myPoints.begin(),
413 aSection->myPoints.end());
414 res = removeSectionInternal(*anIt);
423 bool CurveCreator_Curve::join( const std::list<int>& theSections )
427 if ( !theSections.empty() )
431 myListDiffs.back().init(this, CurveCreator_Operation::Join, theSections);
433 res = joinInternal( theSections );
440 //! Get number of sections
441 int CurveCreator_Curve::getNbSections() const
443 return mySections.size();
446 //! For internal use only! Undo/Redo are not used here.
447 int CurveCreator_Curve::addSectionInternal
448 (const std::string& theName, const CurveCreator::SectionType theType,
449 const bool theIsClosed, const CurveCreator::Coordinates &thePoints)
451 CurveCreator_Section *aSection = new CurveCreator_Section;
453 std::string aName = theName;
455 aName = getUniqSectionName();
457 aSection->myName = aName;
458 aSection->myType = theType;
459 aSection->myIsClosed = theIsClosed;
460 aSection->myPoints = thePoints;
461 mySections.push_back(aSection);
463 return mySections.size()-1;
466 //=======================================================================
467 // function: addSection
468 // purpose: adds an empty section
469 //=======================================================================
470 int CurveCreator_Curve::addSection
471 (const std::string& theName, const CurveCreator::SectionType theType,
472 const bool theIsClosed)
474 int resISection = -1;
475 // Set the difference.
477 CurveCreator::Coordinates aCoords; //empty list
478 if (addEmptyDiff()) {
479 myListDiffs.back().init(this, CurveCreator_Operation::AddSection,
480 theName, aCoords, theType, theIsClosed);
483 resISection = addSectionInternal(theName, theType, theIsClosed, aCoords);
488 //=======================================================================
489 // function: addSection
490 // purpose: adds a section with the given points
491 //=======================================================================
492 int CurveCreator_Curve::addSection
493 (const std::string& theName, const CurveCreator::SectionType theType,
494 const bool theIsClosed, const CurveCreator::Coordinates &thePoints)
496 int resISection = -1;
497 // Set the difference.
499 if (addEmptyDiff()) {
500 myListDiffs.back().init(this, CurveCreator_Operation::AddSection,
501 theName, thePoints, theType, theIsClosed);
504 resISection = addSectionInternal(theName, theType, theIsClosed, thePoints);
510 //! For internal use only! Undo/Redo are not used here.
511 bool CurveCreator_Curve::removeSectionInternal( const int theISection )
513 if (theISection == -1) {
514 delete mySections.back();
515 mySections.pop_back();
517 CurveCreator::Sections::iterator anIterRm = mySections.begin() + theISection;
520 mySections.erase(anIterRm);
526 //! Removes the given sections.
527 bool CurveCreator_Curve::removeSection( const int theISection )
530 // Set the difference.
533 myListDiffs.back().init(this, CurveCreator_Operation::RemoveSection, theISection);
535 res = removeSectionInternal( theISection );
542 * Get number of points in specified section or (the total number of points
543 * in Curve if theISection is equal to -1).
545 int CurveCreator_Curve::getNbPoints( const int theISection ) const
549 CurveCreator_Section* aSection;
550 if (theISection == -1) {
552 const int aNbSections = getNbSections();
554 for (; i < aNbSections; i++) {
555 aSection = getSection( i );
557 aNbCoords += aSection->myPoints.size();
560 aSection = getSection( theISection );
562 aNbCoords = aSection->myPoints.size();
565 return aNbCoords/myDimension;
568 void CurveCreator_Curve::setSkipSorting( const bool theIsToSkip )
570 mySkipSorting = theIsToSkip;
573 bool CurveCreator_Curve::canPointsBeSorted()
579 * Saves points coordinates difference.
580 * \param theOldCoords the old points coordinates
582 void CurveCreator_Curve::saveCoordDiff( const SectionToPointCoordsList &theOldCoords )
584 // Set the difference.
586 if (addEmptyDiff()) {
587 myListDiffs.back().init(this, theOldCoords);
592 //! Get "closed" flag of the specified section
593 bool CurveCreator_Curve::isClosed( const int theISection ) const
595 CurveCreator_Section* aSection = getSection( theISection );
596 return aSection ? aSection->myIsClosed : false;
599 //! For internal use only! Undo/Redo are not used here.
600 bool CurveCreator_Curve::setClosedInternal( const int theISection,
601 const bool theIsClosed )
603 CurveCreator_Section* aSection = 0;
604 if (theISection == -1) {
605 int aSize = mySections.size();
608 for (i = 0; i < aSize; i++) {
609 aSection = getSection( i );
611 aSection->myIsClosed = theIsClosed;
616 aSection = getSection( theISection );
618 aSection->myIsClosed = theIsClosed;
626 * Set "closed" flag of the specified section (all sections if
627 * \a theISection is -1).
629 bool CurveCreator_Curve::setClosed( const int theISection,
630 const bool theIsClosed )
633 // Set the difference.
635 if (addEmptyDiff()) {
636 myListDiffs.back().init(this, CurveCreator_Operation::SetClosed,
637 theIsClosed, theISection);
639 res = setClosedInternal( theISection, theIsClosed );
644 //! Returns specified section name
645 std::string CurveCreator_Curve::getSectionName( const int theISection ) const
647 CurveCreator_Section* aSection = getSection( theISection );
648 return aSection ? aSection->myName : "";
651 //! For internal use only! Undo/Redo are not used here.
652 bool CurveCreator_Curve::setSectionNameInternal( const int theISection,
653 const std::string& theName )
656 CurveCreator_Section* aSection = getSection( theISection );
658 aSection->myName = theName;
664 /** Set name of the specified section */
665 bool CurveCreator_Curve::setSectionName( const int theISection,
666 const std::string& theName )
669 // Set the difference.
671 if (addEmptyDiff()) {
672 myListDiffs.back().init(this, CurveCreator_Operation::RenameSection,
673 theName, theISection);
675 res = setSectionNameInternal( theISection, theName );
680 //! Get type of the specified section
681 CurveCreator::SectionType CurveCreator_Curve::getSectionType
682 ( const int theISection ) const
684 CurveCreator_Section* aSection = getSection( theISection );
685 return aSection ? aSection->myType : CurveCreator::Polyline;
688 //! For internal use only! Undo/Redo are not used here.
689 bool CurveCreator_Curve::setSectionTypeInternal( const int theISection,
690 const CurveCreator::SectionType theType )
692 CurveCreator_Section* aSection;
693 if (theISection == -1) {
695 const int aNbSections = getNbSections();
697 for (; i < aNbSections; i++) {
698 aSection = getSection( i );
700 aSection->myType = theType;
704 aSection = getSection( theISection );
705 if ( aSection && aSection->myType != theType ){
706 aSection->myType = theType;
714 * Set type of the specified section (or all sections
715 * if \a theISection is -1).
717 bool CurveCreator_Curve::setSectionType( const int theISection,
718 const CurveCreator::SectionType theType )
722 // Set the difference.
723 if (addEmptyDiff()) {
724 myListDiffs.back().init(this, CurveCreator_Operation::SetType,
725 theType, theISection);
728 res = setSectionTypeInternal( theISection, theType );
735 /***********************************************/
736 /*** Point methods ***/
737 /***********************************************/
739 //! For internal use only! Undo/Redo are not used here.
740 bool CurveCreator_Curve::addPointsInternal( const CurveCreator::SectionsMap &theSectionsMap )
743 CurveCreator::SectionsMap::const_iterator anIt = theSectionsMap.begin();
744 CurveCreator_Section *aSection = 0;
745 for ( ; anIt != theSectionsMap.end(); anIt++ ) {
746 int anISection = anIt->first;
747 aSection = getSection( anISection );
749 CurveCreator::PosPointsList aSectionPoints = anIt->second;
750 CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
751 for( ; aPntIt != aSectionPoints.end(); aPntIt++ ){
752 int anIPnt = (*aPntIt)->myID;
753 CurveCreator::Coordinates aCoords = (*aPntIt)->myCoords;
754 CurveCreator::Coordinates::iterator anIterPosition;
756 anIterPosition = aSection->myPoints.end();
758 anIterPosition = aSection->myPoints.begin() + toICoord(anIPnt);
759 CurveCreator::Coordinates::const_iterator aFirstPosition =
761 aSection->myPoints.insert(anIterPosition,
762 aCoords.begin(), aCoords.end());
773 * Add one point to the specified section starting from the given theIPnt index
774 * (or at the end of points if \a theIPnt is -1).
776 bool CurveCreator_Curve::addPoints( const CurveCreator::Coordinates& theCoords,
777 const int theISection,
781 CurveCreator::Coordinates aCoords = theCoords;
782 // Set the difference.
784 if (addEmptyDiff()) {
785 CurveCreator_ICurve::SectionToPointCoordsList aList;
786 aList.push_back(std::make_pair(std::make_pair(theISection, theIPnt), theCoords));
787 myListDiffs.back().init(this, CurveCreator_Operation::InsertPoints,
790 CurveCreator::SectionsMap aSectionsMap;
791 CurveCreator::PosPointsList aPoints;
792 CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( theIPnt, theCoords );
793 aPoints.push_back( aPosPoint );
794 aSectionsMap[theISection] = aPoints;
796 res = addPointsInternal( aSectionsMap );
802 //! For internal use only! Undo/Redo are not used here.
803 bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theSectionsMap )
807 CurveCreator::SectionsMap::const_iterator anIt = theSectionsMap.begin();
808 CurveCreator_Section *aSection = 0;
809 for ( ; anIt != theSectionsMap.end(); anIt++ ) {
810 int anISection = anIt->first;
811 aSection = getSection( anISection );
813 CurveCreator::PosPointsList aSectionPoints = anIt->second;
814 CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
815 for( ; aPntIt != aSectionPoints.end(); aPntIt++ ){
816 int anIPnt = (*aPntIt)->myID;
817 CurveCreator::Coordinates aCoords = (*aPntIt)->myCoords;
818 for ( int i = 0; i < myDimension; i++)
819 aSection->myPoints.at(toICoord(anIPnt) + i) = aCoords[i];
830 //! Set coordinates of specified point
831 bool CurveCreator_Curve::setPoint( const int theISection,
833 const CurveCreator::Coordinates& theNewCoords )
836 // Set the difference.
838 if (addEmptyDiff()) {
839 CurveCreator_ICurve::SectionToPointCoordsList aList;
840 aList.push_back(std::make_pair(std::make_pair(theISection, theIPnt), theNewCoords));
841 myListDiffs.back().init(this, CurveCreator_Operation::SetCoordinates,
844 CurveCreator::SectionsMap aSectionsMap;
845 CurveCreator::PosPointsList aPoints;
846 CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( theIPnt, theNewCoords );
847 aPoints.push_back( aPosPoint );
848 aSectionsMap[theISection] = aPoints;
850 int aSize1 = getNbPoints( theISection );
851 res = setPointInternal( aSectionsMap );
852 int aSize2 = getNbPoints( theISection );
859 //! Set coordinates of specified points from different sections
860 bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
861 const bool theIsToSaveDiff )
864 // Set the difference.
866 if (theIsToSaveDiff && addEmptyDiff()) {
867 myListDiffs.back().init(this, CurveCreator_Operation::SetCoordinates,
868 theSectionToPntCoords);
870 CurveCreator::SectionsMap aSectionsMap;
871 CurveCreator::PosPointsList aPosPoints;
872 CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt =
873 theSectionToPntCoords.begin(), aLast = theSectionToPntCoords.end();
874 int aSectionId, aPointId;
875 for ( ; anIt != aLast; anIt++ ) {
877 aSectionId = anIt->first.first;
878 aPointId = anIt->first.second;
879 CurveCreator::Coordinates aNewCoords = anIt->second;
880 CurveCreator_PosPoint* aPosPoint =
881 new CurveCreator_PosPoint( aPointId, aNewCoords );
882 if( aSectionsMap.find(aSectionId) != aSectionsMap.end() )
883 aPosPoints = aSectionsMap[aSectionId];
884 aPosPoints.push_back( aPosPoint );
885 aSectionsMap[aSectionId] = aPosPoints;
888 res = setPointInternal( aSectionsMap );
894 //! For internal use only! Undo/Redo are not used here.
895 bool CurveCreator_Curve::removePointsInternal( const SectionToPointList &thePoints )
898 std::map<int, std::list<int> > aConvPoints;
899 convert( thePoints, aConvPoints );
900 std::map<int, std::list<int> >::const_iterator anIt = aConvPoints.begin(),
901 aLast = aConvPoints.end();
902 for ( ; anIt != aLast; anIt++ ) {
903 int aSectionId = anIt->first;
904 aRes = removeSectionPoints(aSectionId, anIt->second);
912 //! Remove point with given id
913 bool CurveCreator_Curve::removePoint( const int theISection, const int theIPnt )
916 // Set the difference.
918 SectionToPointList aListOfSectionsToPoints;
919 aListOfSectionsToPoints.push_back(std::make_pair(theISection, theIPnt));
920 if (addEmptyDiff()) {
921 myListDiffs.back().init(this, CurveCreator_Operation::RemovePoints,
922 aListOfSectionsToPoints);
924 res = removePointsInternal( aListOfSectionsToPoints );
929 //! Remove several points from different sections with given ids
930 bool CurveCreator_Curve::removeSeveralPoints( const SectionToPointList &theSectionToPntIDs)
933 // Set the difference.
935 if (addEmptyDiff()) {
936 myListDiffs.back().init(this, CurveCreator_Operation::RemovePoints,
939 res = removePointsInternal( theSectionToPntIDs );
944 //=======================================================================
945 // function: getCoordinates
947 //=======================================================================
948 CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
949 const int theIPnt) const
951 CurveCreator_Section* aSection = getSection( theISection );
952 CurveCreator::Coordinates::const_iterator
953 anIter = aSection->myPoints.begin() + toICoord(theIPnt);
954 CurveCreator::Coordinates aResult(anIter, anIter + myDimension);
959 //=======================================================================
960 // function: getPoints
962 //=======================================================================
963 CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
965 CurveCreator_Section* aSection = getSection( theISection );
966 return aSection ? aSection->myPoints : CurveCreator::Coordinates();
969 void CurveCreator_Curve::constructAISObject()
972 CurveCreator_Utils::constructShape( this, aShape );
974 myAISShape = new AIS_Shape( aShape );
977 CurveCreator_Section* CurveCreator_Curve::getSection( const int theSectionId ) const
979 CurveCreator_Section *aSection = 0;
980 if ( theSectionId >= 0 && theSectionId < mySections.size() )
981 aSection = mySections.at( theSectionId );
986 Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
988 if ( !myAISShape && theNeedToBuild ) {
989 CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
990 aCurve->constructAISObject();
995 bool CurveCreator_Curve::removeSectionPoints( const int theSectionId,
996 const std::list<int>& thePointIds )
1000 CurveCreator_Section* aSection = getSection( theSectionId );
1004 std::list<int> aSectionPoints = thePointIds;
1005 aSectionPoints.sort();
1006 std::list<int>::const_reverse_iterator aPntIt = aSectionPoints.rbegin();
1007 for ( ; aPntIt != aSectionPoints.rend(); aPntIt++ ) {
1008 int aPntIndx = *aPntIt;
1009 CurveCreator::Coordinates::iterator aFirstPosition;
1010 if ( aPntIndx == -1 )
1011 aFirstPosition = aSection->myPoints.end() - getDimension();
1013 aFirstPosition = aSection->myPoints.begin() + toICoord( aPntIndx );
1014 aSection->myPoints.erase( aFirstPosition, aFirstPosition + getDimension() );
1020 void CurveCreator_Curve::convert( const SectionToPointList& thePoints,
1021 std::map< int, std::list<int> >& theConvPoints )
1023 theConvPoints.clear();
1025 SectionToPointList::const_iterator anIt = thePoints.begin(), aLast = thePoints.end();
1026 std::list<int> aPoints;
1027 int aSectionId, aPointId;
1028 for ( ; anIt != aLast; anIt++ ) {
1029 aSectionId = anIt->first;
1030 aPointId = anIt->second;
1032 if ( theConvPoints.find( aSectionId ) != theConvPoints.end() )
1033 aPoints = theConvPoints[aSectionId];
1034 aPoints.push_back( aPointId );
1035 theConvPoints[aSectionId] = aPoints;