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 for( int i = 0 ; i < 1000000 ; i++ ){
86 sprintf( aBuffer, "Section_%d", i+1 );
87 std::string aName(aBuffer);
89 for( j = 0 ; j < mySections.size() ; j++ ){
90 if( mySections[j]->myName == aName )
93 if( j == mySections.size() )
99 //=======================================================================
100 // function: setDisplayer
101 // purpose: set curve changes Displayer
102 //=======================================================================
103 void CurveCreator_Curve::setDisplayer( CurveCreator_Displayer* theDisplayer )
105 myDisplayer = theDisplayer;
108 //=======================================================================
109 // function: getDisplayer
110 // purpose: get curve changes Displayer
111 //=======================================================================
112 CurveCreator_Displayer* CurveCreator_Curve::getDisplayer()
117 //=======================================================================
118 // function: removeDisplayer
119 // purpose: remove the attached Displayer
120 //=======================================================================
121 void CurveCreator_Curve::removeDisplayer()
126 //=======================================================================
129 //=======================================================================
130 bool CurveCreator_Curve::addEmptyDiff()
132 bool isEnabled = false;
134 if (myUndoDepth != 0) {
135 // Forget all Redos after the current one.
138 myListDiffs.erase(myCurrenPos, myListDiffs.end());
141 if (myUndoDepth == -1 || myNbUndos < myUndoDepth) {
142 // Increase the number of undos.
145 // If there are too many differences, remove the first one.
146 myListDiffs.pop_front();
149 // Add new difference.
150 myListDiffs.push_back(CurveCreator_Diff());
151 myCurrenPos = myListDiffs.end();
158 void CurveCreator_Curve::startOperation()
163 void CurveCreator_Curve::finishOperation()
168 //=======================================================================
169 // function: toICoord
171 //=======================================================================
172 int CurveCreator_Curve::toICoord(const int theIPnt) const
174 return theIPnt * myDimension;
177 //=======================================================================
178 // function: setUndoDepth
180 //=======================================================================
181 void CurveCreator_Curve::setUndoDepth(const int theDepth)
184 // Reset all undo/redo data.
188 myCurrenPos = myListDiffs.end();
190 } else if (theDepth == -1) {
191 // There is nothing to do as the depth become unlimited.
193 } else if (theDepth > 0) {
194 // The new "real" depth is set.
195 if (theDepth < myNbRedos) {
196 // The new depth is less then number of redos. Remove the latest redos.
197 int aShift = (myNbRedos - theDepth);
198 ListDiff::iterator aFromPos = myListDiffs.end();
204 myListDiffs.erase(aFromPos, myListDiffs.end());
205 myNbRedos = theDepth;
208 if (theDepth < myNbUndos + myNbRedos) {
209 // The new depth is less then the total number of differences.
210 // Remove the first undos.
211 int aShift = (myNbUndos + myNbRedos - theDepth);
212 ListDiff::iterator aToPos = myListDiffs.begin();
218 myListDiffs.erase(myListDiffs.begin(), aToPos);
219 myNbUndos = theDepth - myNbRedos;
222 myUndoDepth = theDepth;
226 //=======================================================================
227 // function: getUndoDepth
229 //=======================================================================
230 int CurveCreator_Curve::getUndoDepth() const
235 void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const
237 CurveCreator::Coordinates aCoords = getPoint( theISection, theIPoint );
241 if( getDimension() == CurveCreator::Dim3d ){
246 void CurveCreator_Curve::redisplayCurve()
249 myDisplayer->eraseAll( false );
252 myDisplayer->display( getAISObject( true ), true );
256 //! For internal use only! Undo/Redo are not used here.
257 bool CurveCreator_Curve::moveSectionInternal(const int theISection,
258 const int theNewIndex)
261 int aMovedSectionId = theISection >= 0 ? theISection : mySections.size()-1;
263 if (aMovedSectionId != theNewIndex) {
264 CurveCreator_Section *aSection = mySections.at(aMovedSectionId);
267 CurveCreator::Sections::iterator anIter = mySections.begin() + aMovedSectionId;
269 mySections.erase(anIter);
272 anIter = mySections.begin() + theNewIndex;
273 mySections.insert(anIter, aSection);
279 //=======================================================================
280 // function: moveSection
282 //=======================================================================
283 bool CurveCreator_Curve::moveSection(const int theISection,
284 const int theNewIndex)
287 // Set the difference.
289 if (addEmptyDiff()) {
290 myListDiffs.back().init(this, CurveCreator_Operation::MoveSection,
291 theISection, theNewIndex);
295 res = moveSectionInternal(theISection, theNewIndex);
300 /************ Implementation of INTERFACE methods ************/
302 /***********************************************/
303 /*** Undo/Redo methods ***/
304 /***********************************************/
306 //! Get number of available undo operations
307 int CurveCreator_Curve::getNbUndo() const
312 //! Undo previous operation
313 bool CurveCreator_Curve::undo()
320 myCurrenPos->applyUndo(this);
326 //! Get number of available redo operations
327 int CurveCreator_Curve::getNbRedo() const
332 //! Redo last previously "undone" operation
333 bool CurveCreator_Curve::redo()
337 myCurrenPos->applyRedo(this);
346 /***********************************************/
347 /*** Section methods ***/
348 /***********************************************/
349 //! For internal use only! Undo/Redo are not used here.
350 bool CurveCreator_Curve::clearInternal()
352 // erase curve from the viewer
354 myDisplayer->eraseAll( true );
357 // Delete all allocated data.
359 const int aNbSections = getNbSections();
361 for (; i < aNbSections; i++) {
362 delete mySections[i];
370 //=======================================================================
373 //=======================================================================
374 bool CurveCreator_Curve::clear()
378 // Set the difference.
379 if (addEmptyDiff()) {
380 myListDiffs.back().init(this);
382 res = clearInternal();
387 //! For internal use only! Undo/Redo are not used here.
388 bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
391 if ( theSections.empty() )
394 int anISectionMain = theSections.front();
395 CurveCreator_Section* aSectionMain = mySections.at( anISectionMain );
396 std::list <int> aSectionsToJoin = theSections;
397 aSectionsToJoin.erase( aSectionsToJoin.begin() ); // skip the main section
398 // it is important to sort and reverse the section ids in order to correctly remove them
399 aSectionsToJoin.sort();
400 aSectionsToJoin.reverse();
402 std::list<int>::const_iterator anIt = aSectionsToJoin.begin(), aLast = aSectionsToJoin.end();
403 CurveCreator_Section* aSection;
404 for (; anIt != aLast; anIt++) {
405 aSection = mySections.at(*anIt);
406 aSectionMain->myPoints.insert(aSectionMain->myPoints.end(), aSection->myPoints.begin(),
407 aSection->myPoints.end());
408 res = removeSectionInternal(*anIt);
417 bool CurveCreator_Curve::join( const std::list<int>& theSections )
421 if ( !theSections.empty() )
425 myListDiffs.back().init(this, CurveCreator_Operation::Join, theSections);
427 res = joinInternal( theSections );
434 //! Get number of sections
435 int CurveCreator_Curve::getNbSections() const
437 return mySections.size();
440 //! For internal use only! Undo/Redo are not used here.
441 int CurveCreator_Curve::addSectionInternal
442 (const std::string& theName, const CurveCreator::SectionType theType,
443 const bool theIsClosed, const CurveCreator::Coordinates &thePoints)
445 CurveCreator_Section *aSection = new CurveCreator_Section;
447 std::string aName = theName;
449 aName = getUniqSectionName();
451 aSection->myName = aName;
452 aSection->myType = theType;
453 aSection->myIsClosed = theIsClosed;
454 aSection->myPoints = thePoints;
455 mySections.push_back(aSection);
457 return mySections.size()-1;
460 //=======================================================================
461 // function: addSection
462 // purpose: adds an empty section
463 //=======================================================================
464 int CurveCreator_Curve::addSection
465 (const std::string& theName, const CurveCreator::SectionType theType,
466 const bool theIsClosed)
468 int resISection = -1;
469 // Set the difference.
471 CurveCreator::Coordinates aCoords; //empty list
472 if (addEmptyDiff()) {
473 myListDiffs.back().init(this, CurveCreator_Operation::AddSection,
474 theName, aCoords, theType, theIsClosed);
477 resISection = addSectionInternal(theName, theType, theIsClosed, aCoords);
482 //=======================================================================
483 // function: addSection
484 // purpose: adds a section with the given points
485 //=======================================================================
486 int CurveCreator_Curve::addSection
487 (const std::string& theName, const CurveCreator::SectionType theType,
488 const bool theIsClosed, const CurveCreator::Coordinates &thePoints)
490 int resISection = -1;
491 // Set the difference.
493 if (addEmptyDiff()) {
494 myListDiffs.back().init(this, CurveCreator_Operation::AddSection,
495 theName, thePoints, theType, theIsClosed);
498 resISection = addSectionInternal(theName, theType, theIsClosed, thePoints);
504 //! For internal use only! Undo/Redo are not used here.
505 bool CurveCreator_Curve::removeSectionInternal( const int theISection )
507 if (theISection == -1) {
508 delete mySections.back();
509 mySections.pop_back();
511 CurveCreator::Sections::iterator anIterRm = mySections.begin() + theISection;
514 mySections.erase(anIterRm);
520 //! Removes the given sections.
521 bool CurveCreator_Curve::removeSection( const int theISection )
524 // Set the difference.
527 myListDiffs.back().init(this, CurveCreator_Operation::RemoveSection, theISection);
529 res = removeSectionInternal( theISection );
536 * Get number of points in specified section or (the total number of points
537 * in Curve if theISection is equal to -1).
539 int CurveCreator_Curve::getNbPoints( const int theISection ) const
543 if (theISection == -1) {
545 const int aNbSections = getNbSections();
547 for (; i < aNbSections; i++) {
548 aNbCoords += mySections[i]->myPoints.size();
551 if ( ( theISection >= 0 ) && ( theISection < mySections.size() ) )
552 aNbCoords = mySections.at(theISection)->myPoints.size();
555 return aNbCoords/myDimension;
558 void CurveCreator_Curve::setSkipSorting( const bool theIsToSkip )
560 mySkipSorting = theIsToSkip;
563 bool CurveCreator_Curve::canPointsBeSorted()
569 * Saves points coordinates difference.
570 * \param theOldCoords the old points coordinates
572 void CurveCreator_Curve::saveCoordDiff( const SectionToPointCoordsList &theOldCoords )
574 // Set the difference.
576 if (addEmptyDiff()) {
577 myListDiffs.back().init(this, theOldCoords);
582 //! Get "closed" flag of the specified section
583 bool CurveCreator_Curve::isClosed( const int theISection ) const
585 return mySections.at(theISection)->myIsClosed;
588 //! For internal use only! Undo/Redo are not used here.
589 bool CurveCreator_Curve::setClosedInternal( const int theISection,
590 const bool theIsClosed )
592 if (theISection == -1) {
593 int aSize = mySections.size();
596 for (i = 0; i < aSize; i++) {
597 mySections[i]->myIsClosed = theIsClosed;
601 mySections.at(theISection)->myIsClosed = theIsClosed;
608 * Set "closed" flag of the specified section (all sections if
609 * \a theISection is -1).
611 bool CurveCreator_Curve::setClosed( const int theISection,
612 const bool theIsClosed )
615 // Set the difference.
617 if (addEmptyDiff()) {
618 myListDiffs.back().init(this, CurveCreator_Operation::SetClosed,
619 theIsClosed, theISection);
621 res = setClosedInternal( theISection, theIsClosed );
626 //! Returns specified section name
627 std::string CurveCreator_Curve::getSectionName( const int theISection ) const
629 if( ( theISection >= 0 ) && ( theISection < mySections.size() ))
630 return mySections.at(theISection)->myName;
634 //! For internal use only! Undo/Redo are not used here.
635 bool CurveCreator_Curve::setSectionNameInternal( const int theISection,
636 const std::string& theName )
639 if( ( theISection >= 0 ) && ( theISection < mySections.size() )){
640 mySections.at(theISection)->myName = theName;
646 /** Set name of the specified section */
647 bool CurveCreator_Curve::setSectionName( const int theISection,
648 const std::string& theName )
651 // Set the difference.
653 if (addEmptyDiff()) {
654 myListDiffs.back().init(this, CurveCreator_Operation::RenameSection,
655 theName, theISection);
657 res = setSectionNameInternal( theISection, theName );
662 //! Get type of the specified section
663 CurveCreator::SectionType CurveCreator_Curve::getSectionType
664 ( const int theISection ) const
666 return mySections.at(theISection)->myType;
669 //! For internal use only! Undo/Redo are not used here.
670 bool CurveCreator_Curve::setSectionTypeInternal( const int theISection,
671 const CurveCreator::SectionType theType )
673 if (theISection == -1) {
675 const int aNbSections = getNbSections();
677 for (; i < aNbSections; i++) {
678 mySections[i]->myType = theType;
682 if( mySections.at(theISection)->myType != theType ){
683 mySections.at(theISection)->myType = theType;
691 * Set type of the specified section (or all sections
692 * if \a theISection is -1).
694 bool CurveCreator_Curve::setSectionType( const int theISection,
695 const CurveCreator::SectionType theType )
699 // Set the difference.
700 if (addEmptyDiff()) {
701 myListDiffs.back().init(this, CurveCreator_Operation::SetType,
702 theType, theISection);
705 res = setSectionTypeInternal( theISection, theType );
712 /***********************************************/
713 /*** Point methods ***/
714 /***********************************************/
716 //! For internal use only! Undo/Redo are not used here.
717 bool CurveCreator_Curve::addPointsInternal( const CurveCreator::SectionsMap &theSectionsMap )
720 CurveCreator::SectionsMap::const_iterator anIt = theSectionsMap.begin();
721 CurveCreator_Section *aSection = 0;
722 for ( ; anIt != theSectionsMap.end(); anIt++ ) {
723 int anISection = anIt->first;
724 aSection = mySections.at(anISection);
726 CurveCreator::PosPointsList aSectionPoints = anIt->second;
727 CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
728 for( ; aPntIt != aSectionPoints.end(); aPntIt++ ){
729 int anIPnt = (*aPntIt)->myID;
730 CurveCreator::Coordinates aCoords = (*aPntIt)->myCoords;
731 CurveCreator::Coordinates::iterator anIterPosition;
733 anIterPosition = aSection->myPoints.end();
735 anIterPosition = aSection->myPoints.begin() + toICoord(anIPnt);
736 CurveCreator::Coordinates::const_iterator aFirstPosition =
738 aSection->myPoints.insert(anIterPosition,
739 aCoords.begin(), aCoords.end());
750 * Add one point to the specified section starting from the given theIPnt index
751 * (or at the end of points if \a theIPnt is -1).
753 bool CurveCreator_Curve::addPoints( const CurveCreator::Coordinates& theCoords,
754 const int theISection,
758 CurveCreator::Coordinates aCoords = theCoords;
759 // Set the difference.
761 if (addEmptyDiff()) {
762 CurveCreator_ICurve::SectionToPointCoordsList aList;
763 aList.push_back(std::make_pair(std::make_pair(theISection, theIPnt), theCoords));
764 myListDiffs.back().init(this, CurveCreator_Operation::InsertPoints,
767 CurveCreator::SectionsMap aSectionsMap;
768 CurveCreator::PosPointsList aPoints;
769 CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( theIPnt, theCoords );
770 aPoints.push_back( aPosPoint );
771 aSectionsMap[theISection] = aPoints;
773 res = addPointsInternal( aSectionsMap );
779 //! For internal use only! Undo/Redo are not used here.
780 bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theSectionsMap )
784 CurveCreator::SectionsMap::const_iterator anIt = theSectionsMap.begin();
785 CurveCreator_Section *aSection = 0;
786 for ( ; anIt != theSectionsMap.end(); anIt++ ) {
787 int anISection = anIt->first;
788 aSection = mySections.at(anISection);
790 CurveCreator::PosPointsList aSectionPoints = anIt->second;
791 CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
792 for( ; aPntIt != aSectionPoints.end(); aPntIt++ ){
793 int anIPnt = (*aPntIt)->myID;
794 CurveCreator::Coordinates aCoords = (*aPntIt)->myCoords;
795 for ( int i = 0; i < myDimension; i++)
796 aSection->myPoints.at(toICoord(anIPnt) + i) = aCoords[i];
807 //! Set coordinates of specified point
808 bool CurveCreator_Curve::setPoint( const int theISection,
810 const CurveCreator::Coordinates& theNewCoords )
813 // Set the difference.
815 if (addEmptyDiff()) {
816 CurveCreator_ICurve::SectionToPointCoordsList aList;
817 aList.push_back(std::make_pair(std::make_pair(theISection, theIPnt), theNewCoords));
818 myListDiffs.back().init(this, CurveCreator_Operation::SetCoordinates,
821 CurveCreator::SectionsMap aSectionsMap;
822 CurveCreator::PosPointsList aPoints;
823 CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( theIPnt, theNewCoords );
824 aPoints.push_back( aPosPoint );
825 aSectionsMap[theISection] = aPoints;
827 int aSize1 = getNbPoints( theISection );
828 res = setPointInternal( aSectionsMap );
829 int aSize2 = getNbPoints( theISection );
836 //! Set coordinates of specified points from different sections
837 bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
838 const bool theIsToSaveDiff )
841 // Set the difference.
843 if (theIsToSaveDiff && addEmptyDiff()) {
844 myListDiffs.back().init(this, CurveCreator_Operation::SetCoordinates,
845 theSectionToPntCoords);
847 CurveCreator::SectionsMap aSectionsMap;
848 CurveCreator::PosPointsList aPosPoints;
849 CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt =
850 theSectionToPntCoords.begin(), aLast = theSectionToPntCoords.end();
851 int aSectionId, aPointId;
852 for ( ; anIt != aLast; anIt++ ) {
854 aSectionId = anIt->first.first;
855 aPointId = anIt->first.second;
856 CurveCreator::Coordinates aNewCoords = anIt->second;
857 CurveCreator_PosPoint* aPosPoint =
858 new CurveCreator_PosPoint( aPointId, aNewCoords );
859 if( aSectionsMap.find(aSectionId) != aSectionsMap.end() )
860 aPosPoints = aSectionsMap[aSectionId];
861 aPosPoints.push_back( aPosPoint );
862 aSectionsMap[aSectionId] = aPosPoints;
865 res = setPointInternal( aSectionsMap );
871 //! For internal use only! Undo/Redo are not used here.
872 bool CurveCreator_Curve::removePointsInternal( const SectionToPointList &thePoints )
875 std::map<int, std::list<int> > aConvPoints;
876 convert( thePoints, aConvPoints );
877 std::map<int, std::list<int> >::const_iterator anIt = aConvPoints.begin(),
878 aLast = aConvPoints.end();
879 for ( ; anIt != aLast; anIt++ ) {
880 int aSectionId = anIt->first;
881 aRes = removeSectionPoints(aSectionId, anIt->second);
889 //! Remove point with given id
890 bool CurveCreator_Curve::removePoint( const int theISection, const int theIPnt )
893 // Set the difference.
895 SectionToPointList aListOfSectionsToPoints;
896 aListOfSectionsToPoints.push_back(std::make_pair(theISection, theIPnt));
897 if (addEmptyDiff()) {
898 myListDiffs.back().init(this, CurveCreator_Operation::RemovePoints,
899 aListOfSectionsToPoints);
901 res = removePointsInternal( aListOfSectionsToPoints );
906 //! Remove several points from different sections with given ids
907 bool CurveCreator_Curve::removeSeveralPoints( const SectionToPointList &theSectionToPntIDs)
910 // Set the difference.
912 if (addEmptyDiff()) {
913 myListDiffs.back().init(this, CurveCreator_Operation::RemovePoints,
916 res = removePointsInternal( theSectionToPntIDs );
921 //=======================================================================
922 // function: getCoordinates
924 //=======================================================================
925 CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
926 const int theIPnt) const
928 CurveCreator_Section *aSection = mySections.at(theISection);
929 CurveCreator::Coordinates::const_iterator
930 anIter = aSection->myPoints.begin() + toICoord(theIPnt);
931 CurveCreator::Coordinates aResult(anIter, anIter + myDimension);
936 //=======================================================================
937 // function: getPoints
939 //=======================================================================
940 CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
942 CurveCreator::Coordinates aCoords;
943 if ( ( theISection >= 0 ) && ( theISection < mySections.size() ) )
945 aCoords = mySections.at(theISection)->myPoints;
950 void CurveCreator_Curve::constructAISObject()
953 CurveCreator_Utils::constructShape( this, aShape );
955 myAISShape = new AIS_Shape( aShape );
958 Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
960 if ( !myAISShape && theNeedToBuild ) {
961 CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
962 aCurve->constructAISObject();
967 bool CurveCreator_Curve::removeSectionPoints( const int theSectionId,
968 const std::list<int>& thePointIds )
972 CurveCreator_Section *aSection = mySections.at( theSectionId );
976 std::list<int> aSectionPoints = thePointIds;
977 aSectionPoints.sort();
978 std::list<int>::const_reverse_iterator aPntIt = aSectionPoints.rbegin();
979 for ( ; aPntIt != aSectionPoints.rend(); aPntIt++ ) {
980 int aPntIndx = *aPntIt;
981 CurveCreator::Coordinates::iterator aFirstPosition;
982 if ( aPntIndx == -1 )
983 aFirstPosition = aSection->myPoints.end() - getDimension();
985 aFirstPosition = aSection->myPoints.begin() + toICoord( aPntIndx );
986 aSection->myPoints.erase( aFirstPosition, aFirstPosition + getDimension() );
992 void CurveCreator_Curve::convert( const SectionToPointList& thePoints,
993 std::map< int, std::list<int> >& theConvPoints )
995 theConvPoints.clear();
997 SectionToPointList::const_iterator anIt = thePoints.begin(), aLast = thePoints.end();
998 std::list<int> aPoints;
999 int aSectionId, aPointId;
1000 for ( ; anIt != aLast; anIt++ ) {
1001 aSectionId = anIt->first;
1002 aPointId = anIt->second;
1004 if ( theConvPoints.find( aSectionId ) != theConvPoints.end() )
1005 aPoints = theConvPoints[aSectionId];
1006 aPoints.push_back( aPointId );
1007 theConvPoints[aSectionId] = aPoints;