X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Curve.cxx;h=25939c148716e0bf549d00a75a4e8cb04a5838e5;hb=ab0fa2ad7637d748339ba77b7ba151ef4f51fe9e;hp=a07b1316bc2513426da5b0d1869e00d70e07daf5;hpb=8c684d855bd28db57889a5fc78c0bdd3e638f7a8;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Curve.cxx b/src/HYDROCurveCreator/CurveCreator_Curve.cxx index a07b1316..25939c14 100644 --- a/src/HYDROCurveCreator/CurveCreator_Curve.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Curve.cxx @@ -43,6 +43,8 @@ #include +//#define AIS_CURVE_DISPLAY + //======================================================================= // function: Constructor // purpose: @@ -56,6 +58,9 @@ CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimensi myUndoDepth (-1), myOpLevel(0) { +#ifdef AIS_CURVE_DISPLAY + myAISCurve = new CurveCreator_AISCurve( this ); +#endif } //======================================================================= @@ -105,6 +110,10 @@ std::string CurveCreator_Curve::getUniqSectionName() const void CurveCreator_Curve::setDisplayer( CurveCreator_Displayer* theDisplayer ) { myDisplayer = theDisplayer; + +#ifdef AIS_CURVE_DISPLAY + myDisplayer->displayAIS( myAISCurve, false ); +#endif } //======================================================================= @@ -352,8 +361,12 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double& void CurveCreator_Curve::redisplayCurve() { if( myDisplayer ) { - myDisplayer->erase(); - myDisplayer->display( constructWire() ); +#ifdef AIS_CURVE_DISPLAY + myDisplayer->redisplayAIS(myAISCurve, false); +#else + myDisplayer->erase( false ); + myDisplayer->display( constructWire(), true ); +#endif } } @@ -472,7 +485,7 @@ bool CurveCreator_Curve::clearInternal() { // erase curve from the viewer if( myDisplayer ) - myDisplayer->erase(); + myDisplayer->erase( true ); // Delete all allocated data. int i = 0; const int aNbSections = getNbSections(); @@ -520,12 +533,13 @@ bool CurveCreator_Curve::joinInternal( const int theISectionTo, return res; } -//! Join range of sections to one section (join all sections if -1 is passed in one of arguments) +//! Join range of sections to one section (join all sections if -1 is passed in theISectionFrom argument) bool CurveCreator_Curve::join( const int theISectionTo, const int theISectionFrom ) { + //TODO bool res = false; - if (theISectionTo != theISectionFrom) { + if ( theISectionTo != theISectionFrom ) { startOperation(); if (addEmptyDiff()) myListDiffs.back().init(this, CurveCreator_Operation::Join, theISectionTo, theISectionFrom); @@ -874,7 +888,8 @@ bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theS for( ; aPntIt != aSectionPoints.end(); aPntIt++ ){ int anIPnt = (*aPntIt)->myID; CurveCreator::Coordinates aCoords = (*aPntIt)->myCoords; - aSection->myPoints.assign(aCoords.begin(), aCoords.end()); + for ( int i = 0; i < myDimension; i++) + aSection->myPoints.at(toICoord(anIPnt) + i) = aCoords[i]; } res = true; } @@ -905,7 +920,10 @@ bool CurveCreator_Curve::setPoint( const int theISection, aPoints.push_back( aPosPoint ); aSectionsMap[theISection] = aPoints; + int aSize1 = getNbPoints( theISection ); res = setPointInternal( aSectionsMap ); + int aSize2 = getNbPoints( theISection ); + finishOperation(); return res; @@ -914,7 +932,35 @@ bool CurveCreator_Curve::setPoint( const int theISection, //! Set coordinates of specified points from different sections bool CurveCreator_Curve::setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) { - return false; + bool res = false; + // Set the difference. + startOperation(); + if (addEmptyDiff()) { + myListDiffs.back().init(this, CurveCreator_Operation::SetCoordinates, + theSectionToPntCoords); + } + CurveCreator::SectionsMap aSectionsMap; + CurveCreator::PosPointsList aPosPoints; + CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt = + theSectionToPntCoords.begin(), aLast = theSectionToPntCoords.end(); + int aSectionId, aPointId; + for ( ; anIt != aLast; anIt++ ) { + aPosPoints.clear(); + aSectionId = anIt->first.first; + aPointId = anIt->first.second; + CurveCreator::Coordinates aNewCoords = anIt->second; + CurveCreator_PosPoint* aPosPoint = + new CurveCreator_PosPoint( aPointId, aNewCoords ); + if( aSectionsMap.find(aSectionId) != aSectionsMap.end() ) + aPosPoints = aSectionsMap[aSectionId]; + aPosPoints.push_back( aPosPoint ); + aSectionsMap[aSectionId] = aPosPoints; + + } + res = setPointInternal( aSectionsMap ); + finishOperation(); + + return res; } //! For internal use only! Undo/Redo are not used here.