From: akl Date: Fri, 25 Oct 2013 05:00:54 +0000 (+0000) Subject: 1) Correct points creation mode behavior; X-Git-Tag: BR_hydro_v_0_3~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4fc25cf22b7bc925e7d9402910d98411c3969d1b;p=modules%2Fgeom.git 1) Correct points creation mode behavior; 2) Add a new modes management; 3) detach ICurve interface for curves --- diff --git a/resources/Makefile.am b/resources/Makefile.am index cf26dd50f..6d24503ac 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -86,6 +86,7 @@ display.png \ displayonly.png \ displayall.png \ draft.png \ +edit_points.png \ erase.png \ eraseall.png \ extruded_boss.png \ diff --git a/resources/edit_points.png b/resources/edit_points.png new file mode 100644 index 000000000..6bb8f62ca Binary files /dev/null and b/resources/edit_points.png differ diff --git a/src/CurveCreator/CurveCreator_Curve.cxx b/src/CurveCreator/CurveCreator_Curve.cxx index 67ad36961..94536f91d 100644 --- a/src/CurveCreator/CurveCreator_Curve.cxx +++ b/src/CurveCreator/CurveCreator_Curve.cxx @@ -38,144 +38,10 @@ //======================================================================= CurveCreator_Curve::CurveCreator_Curve (const CurveCreator::Dimension theDimension) -: myIsLocked (false), - myDimension (theDimension), - myListener(NULL) +: CurveCreator_ICurve(theDimension) { } -//======================================================================= -// function: Destructor -// purpose: -//======================================================================= -CurveCreator_Curve::~CurveCreator_Curve() -{ - // Delete all allocated data. - clear(); -} - -//======================================================================= -// function: isLocked -// purpose: -//======================================================================= -bool CurveCreator_Curve::isLocked() const -{ - return myIsLocked; -} - -//======================================================================= -// function: getDimension -// purpose: -//======================================================================= -CurveCreator::Dimension CurveCreator_Curve::getDimension() const -{ - return myDimension; -} - -//======================================================================= -// function: getNbPoints -// purpose: -//======================================================================= -int CurveCreator_Curve::getNbPoints(const int theISection) const -{ - int aNbCoords = 0; - - if (theISection == -1) { - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - aNbCoords += mySections[i]->myPoints.size(); - } - } else { - aNbCoords = mySections.at(theISection)->myPoints.size(); - } - - return aNbCoords/myDimension; -} - -//======================================================================= -// function: getNbSections -// purpose: -//======================================================================= -int CurveCreator_Curve::getNbSections() const -{ - return mySections.size(); -} - -//======================================================================= -// function: getCoordinates -// purpose: -//======================================================================= -CurveCreator::Coordinates CurveCreator_Curve::getCoordinates - (const int theISection, const int theIPnt) const -{ - CurveCreator_Section *aSection = mySections.at(theISection); - CurveCreator::Coordinates::const_iterator - anIter = aSection->myPoints.begin() + toICoord(theIPnt); - CurveCreator::Coordinates aResult(anIter, anIter + myDimension); - - return aResult; -} - -//======================================================================= -// function: getType -// purpose: -//======================================================================= -CurveCreator::Type CurveCreator_Curve::getType(const int theISection) const -{ - return mySections.at(theISection)->myType; -} - -//======================================================================= -// function: getPoints -// purpose: -//======================================================================= -const CurveCreator::Coordinates &CurveCreator_Curve::getPoints - (const int theISection) const -{ - return mySections.at(theISection)->myPoints; -} - -//======================================================================= -// function: isClosed -// purpose: -//======================================================================= -bool CurveCreator_Curve::isClosed(const int theISection) const -{ - return mySections.at(theISection)->myIsClosed; -} - -std::string CurveCreator_Curve::getSectionName(const int theISection) const -{ - return mySections.at(theISection)->myName; -} - -//======================================================================= -// function: setType -// purpose: -//======================================================================= -void CurveCreator_Curve::setType - (const CurveCreator::Type theType, const int theISection) -{ - if (theISection == -1) { - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - mySections[i]->myType = theType; - } - if( myListener ) - myListener->curveChanged(); - } else { - if( mySections.at(theISection)->myType != theType ){ - mySections.at(theISection)->myType = theType; - if( myListener ) - myListener->sectionTypeChanged(theISection); - } - } -} - //======================================================================= // function: addPoints // purpose: @@ -191,289 +57,3 @@ void CurveCreator_Curve::addPoints if( myListener ) myListener->pointInserted( theISection, -1 ); } - -//======================================================================= -// function: addSection -// purpose: -//======================================================================= -void CurveCreator_Curve::addSection - (const std::string& theName, - const CurveCreator::Type theType, - const bool theIsClosed, - const CurveCreator::Coordinates &thePoints) -{ - CurveCreator_Section *aSection = new CurveCreator_Section; - - std::string aName = theName; - if( aName.empty() ){ - aName = getUnicSectionName(); - } - aSection->myName = aName; - aSection->myType = theType; - aSection->myIsClosed = theIsClosed; - aSection->myPoints = thePoints; - mySections.push_back(aSection); - if( myListener ) - myListener->sectionAdded( -1 ); -} - -//======================================================================= -// function: removeSection -// purpose: -//======================================================================= -void CurveCreator_Curve::removeSection(const int theISection) -{ - if (theISection == -1) { - delete mySections.back(); - mySections.pop_back(); - } else { - Sections::iterator anIterRm = mySections.begin() + theISection; - - delete *anIterRm; - mySections.erase(anIterRm); - } - myListener->sectionRemoved(theISection); -} - -//======================================================================= -// function: insertPoints -// purpose: -//======================================================================= -void CurveCreator_Curve::insertPoints - (const CurveCreator::Coordinates &thePoints, - const int theISection, - const int theIPnt) -{ - if (theIPnt == -1) { - // Add points to the end of section points. - addPoints(thePoints, theISection); - } else { - CurveCreator_Section *aSection = - (theISection == -1 ? mySections.back() : mySections.at(theISection)); - - aSection->myPoints.insert(aSection->myPoints.begin() + toICoord(theIPnt), - thePoints.begin(), thePoints.end()); - if( myListener ) - myListener->pointInserted( theISection, theIPnt ); - } -} - -void CurveCreator_Curve::movePoint(const int theISection, const int theIPointFrom, const int theNewIndex) -{ - CurveCreator::Coordinates aCoords = getCoordinates(theISection, theIPointFrom ); - insertPoints(aCoords, theISection, theNewIndex+1); - int aRemPntIndx = theIPointFrom; - if( theNewIndex < theIPointFrom ) - aRemPntIndx++; - removePoints(theISection, aRemPntIndx, 1 ); -} - -//======================================================================= -// function: removePoints -// purpose: -//======================================================================= -void CurveCreator_Curve::removePoints(const int theISection, - const int theIPnt, - const int theNbPoints) -{ - CurveCreator_Section *aSection = mySections.at(theISection); - CurveCreator::Coordinates::iterator anIterBegin = - aSection->myPoints.begin() + toICoord(theIPnt); - CurveCreator::Coordinates::iterator anIterEnd = - (theNbPoints == -1 ? - aSection->myPoints.end() : anIterBegin + toICoord(theNbPoints)); - - aSection->myPoints.erase(anIterBegin, anIterEnd); - myListener->pointRemoved(theISection, theIPnt, theNbPoints ); -} - -//======================================================================= -// function: clear -// purpose: -//======================================================================= -void CurveCreator_Curve::clear() -{ - // Delete all allocated data. - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - delete mySections[i]; - } - - mySections.clear(); - if( myListener ) - myListener->curveChanged(); -} - -//======================================================================= -// function: setCoordinates -// purpose: -//======================================================================= -void CurveCreator_Curve::setCoordinates - (const CurveCreator::Coordinates &theCoords, - const int theISection, - const int theIPnt) -{ - if (theCoords.size() == myDimension) { - CurveCreator_Section *aSection = mySections.at(theISection); - int i; - - for (i = 0; i < myDimension; i++) { - aSection->myPoints.at(toICoord(theIPnt) + i) = theCoords[i]; - } - - if( myListener ) - myListener->pointChanged( theISection, theIPnt ); - } -} - -//======================================================================= -// function: setClosed -// purpose: -//======================================================================= -void CurveCreator_Curve::setClosed(const bool theIsClosed, - const int theISection) -{ - if (theISection == -1) { - int aSize = mySections.size(); - int i; - - for (i = 0; i < aSize; i++) { - mySections[i]->myIsClosed = theIsClosed; - if( myListener ){ - myListener->sectionClosed( theISection, theIsClosed ); - } - } - } else { - mySections.at(theISection)->myIsClosed = theIsClosed; - if( myListener ){ - myListener->sectionClosed( theISection, theIsClosed ); - } - } -} - -/** Set name of the specified section. - */ -void CurveCreator_Curve::setName( const std::string& theName, const int theISection ) -{ - if( ( theISection >= 0 ) && ( theISection < mySections.size() )){ - mySections.at(theISection)->myName = theName; - } -} - -//======================================================================= -// function: moveSection -// purpose: -//======================================================================= -void CurveCreator_Curve::moveSection(const int theISection, - const int theNewIndex) -{ - if (theISection != theNewIndex) { - CurveCreator_Section *aSection = mySections.at(theISection); - - // Remove section - Sections::iterator anIter = mySections.begin() + theISection; - - mySections.erase(anIter); - - // Insert section. - anIter = mySections.begin() + theNewIndex; - mySections.insert(anIter, aSection); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_Curve::join(const int theISectionTo, - const int theISectionFrom) -{ - if (theISectionTo != theISectionFrom) { - CurveCreator_Section *aSection1 = mySections.at(theISectionTo); - CurveCreator_Section *aSection2 = mySections.at(theISectionFrom); - - aSection1->myPoints.insert(aSection1->myPoints.end(), - aSection2->myPoints.begin(), aSection2->myPoints.end()); - - removeSection(theISectionFrom); - if( myListener ) - myListener->curveChanged(); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_Curve::join() -{ - const int aSize = mySections.size(); - - if (aSize > 1) { - CurveCreator_Section *aSection1 = mySections[0]; - int i; - - for (i = 1; i < aSize; i++) { - CurveCreator_Section *aSection2 = mySections[i]; - - aSection1->myPoints.insert(aSection1->myPoints.end(), - aSection2->myPoints.begin(), aSection2->myPoints.end()); - delete aSection2; - } - - // Just erace section pointers as they were deleted before. - mySections.erase(mySections.begin() + 1, mySections.end()); - if( myListener ) - myListener->curveChanged(); - } -} - -//======================================================================= -// function: toICoord -// purpose: -//======================================================================= -int CurveCreator_Curve::toICoord(const int theIPnt) const -{ - return theIPnt*myDimension; -} - -//======================================================================= -// function: getUnicSectionName -// purpose: return unic section name -//======================================================================= -std::string CurveCreator_Curve::getUnicSectionName() -{ - for( int i = 0 ; i < 1000000 ; i++ ){ - char aBuffer[255]; - sprintf( aBuffer, "Section_%d", i+1 ); - std::string aName(aBuffer); - int j; - for( j = 0 ; j < mySections.size() ; j++ ){ - if( mySections[j]->myName == aName ) - break; - } - if( j == mySections.size() ) - return aName; - } - return ""; -} - -//======================================================================= -// function: setListener -// purpose: set curve changes listener -//======================================================================= -void CurveCreator_Curve::setListener( CurveCreator_Listener* theListener ) -{ - myListener = theListener; -} - -//======================================================================= -// function: setListener -// purpose: set curve changes listener -//======================================================================= -void CurveCreator_Curve::removeListener() -{ - myListener = NULL; -} diff --git a/src/CurveCreator/CurveCreator_Curve.hxx b/src/CurveCreator/CurveCreator_Curve.hxx index de4d53384..92076e6bc 100644 --- a/src/CurveCreator/CurveCreator_Curve.hxx +++ b/src/CurveCreator/CurveCreator_Curve.hxx @@ -30,6 +30,7 @@ #include +#include #include #include @@ -45,12 +46,8 @@ class CurveCreator_Listener; * only ends � start and end points � in other words non-manifold curves * are not supported. */ -class CURVECREATOR_EXPORT CurveCreator_Curve +class CURVECREATOR_EXPORT CurveCreator_Curve : public CurveCreator_ICurve { - - //! List of curves - typedef std::deque Sections; - public: //! Constructor of the curve. /** The dimension is explicitly specified in the constructor @@ -58,138 +55,12 @@ public: */ CurveCreator_Curve(const CurveCreator::Dimension theDimension); - //! Destructor. - ~CurveCreator_Curve(); - - //! Returns true if this curve is locked by a curve editor. - bool isLocked() const; - - //! Get the dimension. - CurveCreator::Dimension getDimension() const; - - //! Get number of sections. - int getNbSections() const; - - /** Get number of points in specified section or (the total number of points - * in Curve if theISection is equal to -1). - */ - int getNbPoints(const int theISection = -1) const; - - //! Get coordinates of specified point - CurveCreator::Coordinates getCoordinates - (const int theISection, const int theIPnt) const; - - //! Get points of a section. - const CurveCreator::Coordinates &getPoints(const int theISection) const; - - //! Get type of the specified section - CurveCreator::Type getType(const int theISection) const; - - //! Get �closed� flag of the specified section - bool isClosed(const int theISection) const; - - //! Returns specifyed section name - std::string getSectionName(const int theISection) const; - - /** - * Return unic section name - */ - std::string getUnicSectionName(); - - /** - * Set curve creator listener object - */ - void setListener( CurveCreator_Listener* myWatcher ); - - /** - * Remove curve creator listener object - */ - void removeListener(); - -protected: - - /** Set type of the specified section (or all sections - * if \a theISection is -1). - */ - void setType(const CurveCreator::Type theType, const int theISection = -1); - /** Add points to the specified section (or last section * if \a theISection is -1). */ - void addPoints + virtual void addPoints (const CurveCreator::Coordinates &thePoints, const int theISection = -1); - //! Add a new section. - void addSection (const std::string &theName, const CurveCreator::Type theType, - const bool theIsClosed, - const CurveCreator::Coordinates &thePoints); - - //! Removes the section. If theISection equals -1, removes the last section. - void removeSection(const int theISection = -1); - - /** Insert points in the given position (add to the end of list - * if \a theIPnt parameter is -1) of the specified section - * (or last section if \a theISection parameter is -1). - */ - void insertPoints(const CurveCreator::Coordinates &thePoints, - const int theISection = -1, - const int theIPnt = -1); - - /** Remove \a nbPoints points from given \a theISection, - * starting from given \a theIPnt (of all points up to the end of - * section if \a theNbPoints is -1). - */ - void removePoints(const int theISection, - const int theIPnt, - const int theNbPoints = -1); - - /** Move specified point within section to new position - */ - void movePoint(const int theISection, - const int theIPointFrom, - const int theNewIndex); - - //! Remove all sections. - void clear(); - - //! Set coordinates of specified point - void setCoordinates(const CurveCreator::Coordinates &theCoords, - const int theISection, - const int theIPnt); - - /** Set �closed� flag of the specified section (all sections if - * \a theISection is -1). - */ - void setClosed(const bool theIsClosed, const int theISection = -1); - - /** Set name of the specified section. - */ - void setName( const std::string& theName, const int theISection ); - - /** Move specified \a theISection to the specified position - * in the sections list. - */ - void moveSection(const int theISection, const int theNewIndex); - - //! Join two sections to one section - void join(const int theISectionTo, const int theISectionFrom); - - //! Join all sections to the single curve - void join(); - - /** - * This method converts the point index to the index in - * an array of coordinates. - */ - int toICoord(const int theIPnt) const; - -protected: - - bool myIsLocked; - Sections mySections; //!< curve data - CurveCreator::Dimension myDimension; //!< curve dimension - CurveCreator_Listener* myListener; //!< listener - friend class CurveCreator_CurveEditor; friend class CurveCreator_Operation; diff --git a/src/CurveCreator/CurveCreator_ICurve.cxx b/src/CurveCreator/CurveCreator_ICurve.cxx new file mode 100644 index 000000000..1cf2869d8 --- /dev/null +++ b/src/CurveCreator/CurveCreator_ICurve.cxx @@ -0,0 +1,463 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: CurveCreator_ICurve.cxx +// Created: Thu Jun 20 9:54:07 2013 +// Author: Sergey KHROMOV +// + + +#include +#include +#include + +#include + +//======================================================================= +// function: Constructor +// purpose: +//======================================================================= +CurveCreator_ICurve::CurveCreator_ICurve + (const CurveCreator::Dimension theDimension) +: myIsLocked (false), + myDimension (theDimension), + myListener(NULL) +{ +} + +//======================================================================= +// function: Destructor +// purpose: +//======================================================================= +CurveCreator_ICurve::~CurveCreator_ICurve() +{ + // Delete all allocated data. + clear(); +} + +//======================================================================= +// function: isLocked +// purpose: +//======================================================================= +bool CurveCreator_ICurve::isLocked() const +{ + return myIsLocked; +} + +//======================================================================= +// function: getDimension +// purpose: +//======================================================================= +CurveCreator::Dimension CurveCreator_ICurve::getDimension() const +{ + return myDimension; +} + +//======================================================================= +// function: getNbPoints +// purpose: +//======================================================================= +int CurveCreator_ICurve::getNbPoints(const int theISection) const +{ + int aNbCoords = 0; + + if (theISection == -1) { + int i = 0; + const int aNbSections = getNbSections(); + + for (; i < aNbSections; i++) { + aNbCoords += mySections[i]->myPoints.size(); + } + } else { + aNbCoords = mySections.at(theISection)->myPoints.size(); + } + + return aNbCoords/myDimension; +} + +//======================================================================= +// function: getNbSections +// purpose: +//======================================================================= +int CurveCreator_ICurve::getNbSections() const +{ + return mySections.size(); +} + +//======================================================================= +// function: getCoordinates +// purpose: +//======================================================================= +CurveCreator::Coordinates CurveCreator_ICurve::getCoordinates + (const int theISection, const int theIPnt) const +{ + CurveCreator_Section *aSection = mySections.at(theISection); + CurveCreator::Coordinates::const_iterator + anIter = aSection->myPoints.begin() + toICoord(theIPnt); + CurveCreator::Coordinates aResult(anIter, anIter + myDimension); + + return aResult; +} + +//======================================================================= +// function: getType +// purpose: +//======================================================================= +CurveCreator::Type CurveCreator_ICurve::getType(const int theISection) const +{ + return mySections.at(theISection)->myType; +} + +//======================================================================= +// function: getPoints +// purpose: +//======================================================================= +const CurveCreator::Coordinates &CurveCreator_ICurve::getPoints + (const int theISection) const +{ + return mySections.at(theISection)->myPoints; +} + +//======================================================================= +// function: isClosed +// purpose: +//======================================================================= +bool CurveCreator_ICurve::isClosed(const int theISection) const +{ + return mySections.at(theISection)->myIsClosed; +} + +std::string CurveCreator_ICurve::getSectionName(const int theISection) const +{ + return mySections.at(theISection)->myName; +} + +//======================================================================= +// function: setType +// purpose: +//======================================================================= +void CurveCreator_ICurve::setType + (const CurveCreator::Type theType, const int theISection) +{ + if (theISection == -1) { + int i = 0; + const int aNbSections = getNbSections(); + + for (; i < aNbSections; i++) { + mySections[i]->myType = theType; + } + if( myListener ) + myListener->curveChanged(); + } else { + if( mySections.at(theISection)->myType != theType ){ + mySections.at(theISection)->myType = theType; + if( myListener ) + myListener->sectionTypeChanged(theISection); + } + } +} + +//======================================================================= +// function: addSection +// purpose: +//======================================================================= +void CurveCreator_ICurve::addSection + (const std::string& theName, + const CurveCreator::Type theType, + const bool theIsClosed, + const CurveCreator::Coordinates &thePoints) +{ + CurveCreator_Section *aSection = new CurveCreator_Section; + + std::string aName = theName; + if( aName.empty() ){ + aName = getUnicSectionName(); + } + aSection->myName = aName; + aSection->myType = theType; + aSection->myIsClosed = theIsClosed; + aSection->myPoints = thePoints; + mySections.push_back(aSection); + if( myListener ) + myListener->sectionAdded( -1 ); +} + +//======================================================================= +// function: removeSection +// purpose: +//======================================================================= +void CurveCreator_ICurve::removeSection(const int theISection) +{ + if (theISection == -1) { + delete mySections.back(); + mySections.pop_back(); + } else { + Sections::iterator anIterRm = mySections.begin() + theISection; + + delete *anIterRm; + mySections.erase(anIterRm); + } + myListener->sectionRemoved(theISection); +} + +//======================================================================= +// function: insertPoints +// purpose: +//======================================================================= +void CurveCreator_ICurve::insertPoints + (const CurveCreator::Coordinates &thePoints, + const int theISection, + const int theIPnt) +{ + if (theIPnt == -1) { + // Add points to the end of section points. + addPoints(thePoints, theISection); + } else { + CurveCreator_Section *aSection = + (theISection == -1 ? mySections.back() : mySections.at(theISection)); + + aSection->myPoints.insert(aSection->myPoints.begin() + toICoord(theIPnt), + thePoints.begin(), thePoints.end()); + if( myListener ) + myListener->pointInserted( theISection, theIPnt ); + } +} + +void CurveCreator_ICurve::movePoint(const int theISection, const int theIPointFrom, const int theNewIndex) +{ + CurveCreator::Coordinates aCoords = getCoordinates(theISection, theIPointFrom ); + insertPoints(aCoords, theISection, theNewIndex+1); + int aRemPntIndx = theIPointFrom; + if( theNewIndex < theIPointFrom ) + aRemPntIndx++; + removePoints(theISection, aRemPntIndx, 1 ); +} + +//======================================================================= +// function: removePoints +// purpose: +//======================================================================= +void CurveCreator_ICurve::removePoints(const int theISection, + const int theIPnt, + const int theNbPoints) +{ + CurveCreator_Section *aSection = mySections.at(theISection); + CurveCreator::Coordinates::iterator anIterBegin = + aSection->myPoints.begin() + toICoord(theIPnt); + CurveCreator::Coordinates::iterator anIterEnd = + (theNbPoints == -1 ? + aSection->myPoints.end() : anIterBegin + toICoord(theNbPoints)); + + aSection->myPoints.erase(anIterBegin, anIterEnd); + myListener->pointRemoved(theISection, theIPnt, theNbPoints ); +} + +//======================================================================= +// function: clear +// purpose: +//======================================================================= +void CurveCreator_ICurve::clear() +{ + // Delete all allocated data. + int i = 0; + const int aNbSections = getNbSections(); + + for (; i < aNbSections; i++) { + delete mySections[i]; + } + + mySections.clear(); + if( myListener ) + myListener->curveChanged(); +} + +//======================================================================= +// function: setCoordinates +// purpose: +//======================================================================= +void CurveCreator_ICurve::setCoordinates + (const CurveCreator::Coordinates &theCoords, + const int theISection, + const int theIPnt) +{ + if (theCoords.size() == myDimension) { + CurveCreator_Section *aSection = mySections.at(theISection); + int i; + + for (i = 0; i < myDimension; i++) { + aSection->myPoints.at(toICoord(theIPnt) + i) = theCoords[i]; + } + + if( myListener ) + myListener->pointChanged( theISection, theIPnt ); + } +} + +//======================================================================= +// function: setClosed +// purpose: +//======================================================================= +void CurveCreator_ICurve::setClosed(const bool theIsClosed, + const int theISection) +{ + if (theISection == -1) { + int aSize = mySections.size(); + int i; + + for (i = 0; i < aSize; i++) { + mySections[i]->myIsClosed = theIsClosed; + if( myListener ){ + myListener->sectionClosed( theISection, theIsClosed ); + } + } + } else { + mySections.at(theISection)->myIsClosed = theIsClosed; + if( myListener ){ + myListener->sectionClosed( theISection, theIsClosed ); + } + } +} + +/** Set name of the specified section. + */ +void CurveCreator_ICurve::setName( const std::string& theName, const int theISection ) +{ + if( ( theISection >= 0 ) && ( theISection < mySections.size() )){ + mySections.at(theISection)->myName = theName; + } +} + +//======================================================================= +// function: moveSection +// purpose: +//======================================================================= +void CurveCreator_ICurve::moveSection(const int theISection, + const int theNewIndex) +{ + if (theISection != theNewIndex) { + CurveCreator_Section *aSection = mySections.at(theISection); + + // Remove section + Sections::iterator anIter = mySections.begin() + theISection; + + mySections.erase(anIter); + + // Insert section. + anIter = mySections.begin() + theNewIndex; + mySections.insert(anIter, aSection); + } +} + +//======================================================================= +// function: join +// purpose: +//======================================================================= +void CurveCreator_ICurve::join(const int theISectionTo, + const int theISectionFrom) +{ + if (theISectionTo != theISectionFrom) { + CurveCreator_Section *aSection1 = mySections.at(theISectionTo); + CurveCreator_Section *aSection2 = mySections.at(theISectionFrom); + + aSection1->myPoints.insert(aSection1->myPoints.end(), + aSection2->myPoints.begin(), aSection2->myPoints.end()); + + removeSection(theISectionFrom); + if( myListener ) + myListener->curveChanged(); + } +} + +//======================================================================= +// function: join +// purpose: +//======================================================================= +void CurveCreator_ICurve::join() +{ + const int aSize = mySections.size(); + + if (aSize > 1) { + CurveCreator_Section *aSection1 = mySections[0]; + int i; + + for (i = 1; i < aSize; i++) { + CurveCreator_Section *aSection2 = mySections[i]; + + aSection1->myPoints.insert(aSection1->myPoints.end(), + aSection2->myPoints.begin(), aSection2->myPoints.end()); + delete aSection2; + } + + // Just erace section pointers as they were deleted before. + mySections.erase(mySections.begin() + 1, mySections.end()); + if( myListener ) + myListener->curveChanged(); + } +} + +//======================================================================= +// function: toICoord +// purpose: +//======================================================================= +int CurveCreator_ICurve::toICoord(const int theIPnt) const +{ + return theIPnt*myDimension; +} + +//======================================================================= +// function: getUnicSectionName +// purpose: return unic section name +//======================================================================= +std::string CurveCreator_ICurve::getUnicSectionName() +{ + for( int i = 0 ; i < 1000000 ; i++ ){ + char aBuffer[255]; + sprintf( aBuffer, "Section_%d", i+1 ); + std::string aName(aBuffer); + int j; + for( j = 0 ; j < mySections.size() ; j++ ){ + if( mySections[j]->myName == aName ) + break; + } + if( j == mySections.size() ) + return aName; + } + return ""; +} + +//======================================================================= +// function: setListener +// purpose: set curve changes listener +//======================================================================= +void CurveCreator_ICurve::setListener( CurveCreator_Listener* theListener ) +{ + myListener = theListener; +} + +//======================================================================= +// function: setListener +// purpose: set curve changes listener +//======================================================================= +void CurveCreator_ICurve::removeListener() +{ + myListener = NULL; +} diff --git a/src/CurveCreator/CurveCreator_ICurve.hxx b/src/CurveCreator/CurveCreator_ICurve.hxx new file mode 100644 index 000000000..801bacc14 --- /dev/null +++ b/src/CurveCreator/CurveCreator_ICurve.hxx @@ -0,0 +1,195 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: CurveCreator_Curve.hxx +// Created: Thu Jun 20 9:54:14 2013 +// Author: Sergey KHROMOV +// + +#ifndef _CurveCreator_ICurve_HeaderFile +#define _CurveCreator_ICurve_HeaderFile + + +#include +#include +#include + +#include + +class CurveCreator_Section; +class CurveCreator_Listener; + +/** + * The CurveCreator_ICurve object is represented as one or more sets of + * connected points; thus CurveCreator_ICurve object can contain several + * not connected curves (polylines or b-splines), each such curve has two + * only ends � start and end points � in other words non-manifold curves + * are not supported. + */ +class CURVECREATOR_EXPORT CurveCreator_ICurve +{ + + //! List of curves + typedef std::deque Sections; + +public: + //! Constructor of the curve. + /** The dimension is explicitly specified in the constructor + * and cannot be changed later. + */ + CurveCreator_ICurve(const CurveCreator::Dimension theDimension); + + //! Destructor. + virtual ~CurveCreator_ICurve(); + + //! Returns true if this curve is locked by a curve editor. + virtual bool isLocked() const; + + //! Get the dimension. + virtual CurveCreator::Dimension getDimension() const; + + //! Get number of sections. + virtual int getNbSections() const; + + /** Get number of points in specified section or (the total number of points + * in Curve if theISection is equal to -1). + */ + virtual int getNbPoints(const int theISection = -1) const; + + //! Get coordinates of specified point + virtual CurveCreator::Coordinates getCoordinates + (const int theISection, const int theIPnt) const; + + //! Get points of a section. + virtual const CurveCreator::Coordinates &getPoints(const int theISection) const; + + //! Get type of the specified section + virtual CurveCreator::Type getType(const int theISection) const; + + //! Get �closed� flag of the specified section + virtual bool isClosed(const int theISection) const; + + //! Returns specifyed section name + virtual std::string getSectionName(const int theISection) const; + + /** + * Return unic section name + */ + virtual std::string getUnicSectionName(); + + /** + * Set curve creator listener object + */ + virtual void setListener( CurveCreator_Listener* myWatcher ); + + /** + * Remove curve creator listener object + */ + virtual void removeListener(); + +protected: + + /** Set type of the specified section (or all sections + * if \a theISection is -1). + */ + virtual void setType(const CurveCreator::Type theType, const int theISection = -1); + + /** Add points to the specified section (or last section + * if \a theISection is -1). + */ + virtual void addPoints + (const CurveCreator::Coordinates &thePoints, const int theISection = -1) = 0; + + //! Add a new section. + virtual void addSection (const std::string &theName, const CurveCreator::Type theType, + const bool theIsClosed, + const CurveCreator::Coordinates &thePoints); + + //! Removes the section. If theISection equals -1, removes the last section. + virtual void removeSection(const int theISection = -1); + + /** Insert points in the given position (add to the end of list + * if \a theIPnt parameter is -1) of the specified section + * (or last section if \a theISection parameter is -1). + */ + virtual void insertPoints(const CurveCreator::Coordinates &thePoints, + const int theISection = -1, + const int theIPnt = -1); + + /** Remove \a nbPoints points from given \a theISection, + * starting from given \a theIPnt (of all points up to the end of + * section if \a theNbPoints is -1). + */ + virtual void removePoints(const int theISection, + const int theIPnt, + const int theNbPoints = -1); + + /** Move specified point within section to new position + */ + virtual void movePoint(const int theISection, + const int theIPointFrom, + const int theNewIndex); + + //! Remove all sections. + virtual void clear(); + + //! Set coordinates of specified point + virtual void setCoordinates(const CurveCreator::Coordinates &theCoords, + const int theISection, + const int theIPnt); + + /** Set �closed� flag of the specified section (all sections if + * \a theISection is -1). + */ + virtual void setClosed(const bool theIsClosed, const int theISection = -1); + + /** Set name of the specified section. + */ + virtual void setName( const std::string& theName, const int theISection ); + + /** Move specified \a theISection to the specified position + * in the sections list. + */ + virtual void moveSection(const int theISection, const int theNewIndex); + + //! Join two sections to one section + virtual void join(const int theISectionTo, const int theISectionFrom); + + //! Join all sections to the single curve + virtual void join(); + + /** + * This method converts the point index to the index in + * an array of coordinates. + */ + virtual int toICoord(const int theIPnt) const; + +public: + + bool myIsLocked; + Sections mySections; //!< curve data + CurveCreator::Dimension myDimension; //!< curve dimension + CurveCreator_Listener* myListener; //!< listener + +}; + +#endif diff --git a/src/CurveCreator/CurveCreator_TreeView.cxx b/src/CurveCreator/CurveCreator_TreeView.cxx index d7ff92f46..d7b49f9c7 100755 --- a/src/CurveCreator/CurveCreator_TreeView.cxx +++ b/src/CurveCreator/CurveCreator_TreeView.cxx @@ -40,14 +40,16 @@ CurveCreator_TreeViewModel::CurveCreator_TreeViewModel( CurveCreator_Curve* theC if( !aPointIcon.isNull() ) myCachedIcons[ICON_POINT] = aPointIcon; + setHeaderData(1, Qt::Horizontal, QVariant("Name"), Qt::DisplayRole); + setHeaderData(2, Qt::Horizontal, QVariant("Nb points"), Qt::DisplayRole); } int CurveCreator_TreeViewModel::columnCount(const QModelIndex & parent ) const { if( parent.internalId() == ID_SECTION ) - return 1; + return 2; else - return 1; + return 2; } QVariant CurveCreator_TreeViewModel::data(const QModelIndex & index, int role ) const @@ -59,6 +61,8 @@ QVariant CurveCreator_TreeViewModel::data(const QModelIndex & index, int role ) if( role == Qt::DisplayRole ){ if( aColumn == 0 ) return QString::fromStdString(myCurve->getSectionName(aRow)); + else if( aColumn == 1 ) + return QString::number(myCurve->getNbPoints(aRow)); return QVariant(); } else if( role == Qt::DecorationRole ){ @@ -83,7 +87,7 @@ QVariant CurveCreator_TreeViewModel::data(const QModelIndex & index, int role ) } } } - else{ +/* else{ if( role == Qt::DisplayRole ){ if( aColumn == 1 ) return QVariant(); @@ -105,7 +109,7 @@ QVariant CurveCreator_TreeViewModel::data(const QModelIndex & index, int role ) return myCachedIcons[ICON_POINT]; } } - } + }*/ } return QVariant(); } @@ -193,13 +197,15 @@ CurveCreator_TreeView::CurveCreator_TreeView( CurveCreator_Curve* theCurve, QWid QTreeView(parent) { header()->hide(); + header()->setResizeMode(QHeaderView::ResizeToContents); setUniformRowHeights(true); setContextMenuPolicy( Qt::CustomContextMenu ); CurveCreator_TreeViewModel* aModel = new CurveCreator_TreeViewModel(theCurve, this); setModel(aModel); setSelectionBehavior(SelectRows); setSelectionMode(ExtendedSelection); - setExpandsOnDoubleClick(false); + setRootIsDecorated(false); + setItemsExpandable(false); connect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(selectionChanged()) ); connect( this, SIGNAL(activated(QModelIndex)), this, SLOT(onActivated(QModelIndex))); @@ -211,7 +217,8 @@ QList CurveCreator_TreeView::getSelectedSections() const CurveCreator_TreeViewModel* aModel = dynamic_cast(model()); if( !aModel ) return aSect; - QModelIndexList anIndxs = selectionModel()->selectedIndexes(); +// QModelIndexList anIndxs = selectionModel()->selectedIndexes(); + QModelIndexList anIndxs = selectionModel()->selectedRows(); for( int i = 0 ; i < anIndxs.size() ; i++ ){ if( aModel->isSection(anIndxs[i]) ){ aSect << aModel->getSection( anIndxs[i] ); @@ -227,7 +234,7 @@ void CurveCreator_TreeView::pointsAdded( int theSection, int thePoint, int thePo if( aModel ){ QModelIndex aSectIndx = aModel->sectionIndex( theSection ); rowsInserted(aSectIndx, thePoint, thePoint + thePointsCnt - 1 ); - expand( aSectIndx ); +// expand( aSectIndx ); } } diff --git a/src/CurveCreator/CurveCreator_TreeView.h b/src/CurveCreator/CurveCreator_TreeView.h index 19067ec85..aab39b6af 100755 --- a/src/CurveCreator/CurveCreator_TreeView.h +++ b/src/CurveCreator/CurveCreator_TreeView.h @@ -15,6 +15,7 @@ public: virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; virtual QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; virtual QModelIndex parent(const QModelIndex & theIndex) const; +// virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole); QModelIndex sectionIndex( int theSection ) const; QModelIndex pointIndex( int theSection, int thePoint ) const; diff --git a/src/CurveCreator/CurveCreator_Widget.cxx b/src/CurveCreator/CurveCreator_Widget.cxx index 961eb6d41..b741dca4d 100644 --- a/src/CurveCreator/CurveCreator_Widget.cxx +++ b/src/CurveCreator/CurveCreator_Widget.cxx @@ -69,6 +69,8 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, QPixmap aRedoPixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_REDO"))); QPixmap aNewSectionPixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_NEW_SECTION"))); QPixmap aNewPointPixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_NEW_POINT"))); + QPixmap anEditPointsPixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_EDIT_POINTS"))); + QPixmap aDetectPointsPixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_EDIT_POINTS"))); QPixmap aPolylinePixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_POLYLINE"))); QPixmap aSplinePixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_SPLINE"))); QPixmap aRemovePixmap(aResMgr->loadPixmap("GEOM", tr("ICON_CC_DELETE"))); @@ -103,6 +105,7 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, QKeySequence(Qt::ControlModifier|Qt::Key_N) ); connect(anAct, SIGNAL(triggered()), this, SLOT(onNewSection()) ); aTB->addAction(anAct); + aTB->addSeparator(); anAct = createAction( INSERT_SECTION_BEFORE_ID, tr("INSERT_SECTION_BEFORE"), QPixmap(), tr("INSERT_SECTION_BEFORE_TLT"), @@ -114,11 +117,26 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Insert ) ); connect(anAct, SIGNAL(triggered()), this, SLOT(onInsertSectionAfter()) ); - anAct = createAction( NEW_POINT_ID, tr("NEW_POINT"), aNewPointPixmap, tr("NEW_POINT_TLT"), - QKeySequence(Qt::ControlModifier|Qt::Key_P) ); - connect(anAct, SIGNAL(triggered()), this, SLOT(onNewPoint()) ); + anAct = createAction( CREATION_MODE_ID, tr("CREATION_MODE"), aNewPointPixmap, tr("CREATION_MODE_TLT"), + QKeySequence() ); + anAct->setCheckable(true); + connect(anAct, SIGNAL(triggered(bool)), this, SLOT(onNewPoint(bool)) ); + connect(anAct, SIGNAL(toggled(bool)), this, SLOT(onModeChanged(bool)) ); + aTB->addAction(anAct); + + anAct = createAction( EDITION_MODE_ID, tr("EDITION_MODE"), anEditPointsPixmap, tr("EDITION_MODE_TLT"), + QKeySequence() ); + anAct->setCheckable(true); + connect(anAct, SIGNAL(triggered(bool)), this, SLOT(onEditPoints(bool)) ); + connect(anAct, SIGNAL(toggled(bool)), this, SLOT(onModeChanged(bool)) ); + aTB->addAction(anAct); + + anAct = createAction( DETECTION_MODE_ID, tr("DETECTION_MODE"), aDetectPointsPixmap, tr("DETECTION_MODE_TLT"), + QKeySequence() ); + anAct->setCheckable(true); + connect(anAct, SIGNAL(triggered(bool)), this, SLOT(onDetectPoints(bool)) ); + connect(anAct, SIGNAL(toggled(bool)), this, SLOT(onModeChanged(bool)) ); aTB->addAction(anAct); - aTB->addSeparator(); anAct = createAction( INSERT_POINT_BEFORE_ID, tr("INSERT_POINT_BEFORE"), QPixmap(), tr("INSERT_POINT_BEFORE_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_B) ); @@ -160,12 +178,10 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, anAct = createAction( UP_ID, tr("STEP_UP"), aStepUpPixmap, tr("STEP_UP_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Up ) ); connect( anAct, SIGNAL(triggered()), this, SLOT(onMoveUp()) ); - aTB->addAction(anAct); anAct = createAction( DOWN_ID, tr("STEP_DOWN"), aStepDownPixmap, tr("STEP_DOWN"), QKeySequence(Qt::ControlModifier|Qt::Key_Down ) ); connect( anAct, SIGNAL(triggered()), this, SLOT(onMoveDown()) ); - aTB->addAction(anAct); anAct = createAction( CLEAR_ALL_ID, tr("CLEAR_ALL"), QPixmap(), tr("CLEAR_ALL_TLT"), QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Delete ) ); @@ -230,7 +246,7 @@ void CurveCreator_Widget::onSelectionChanged() anEnabledAct << UP_ID; } if( aSelSections.size() == 1 ){ - anEnabledAct << NEW_POINT_ID << INSERT_SECTION_BEFORE_ID << INSERT_SECTION_AFTER_ID; + anEnabledAct << CREATION_MODE_ID << EDITION_MODE_ID; } if( aSelSections[ aSelSections.size() - 1 ] < ( myCurve->getNbSections() - 1 ) ){ anEnabledAct << DOWN_ID; @@ -278,10 +294,29 @@ void CurveCreator_Widget::onSelectionChanged() emit selectionChanged(); } -void CurveCreator_Widget::onNewPoint() +void CurveCreator_Widget::onNewPoint(bool checked) { if( !myEdit ) return; + + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if ( activeStudy ) + aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if ( aViewWindow == 0 ) + return; + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() ) { + if (checked) { + connect( aViewManager, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ), + this, SLOT( onMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); + } else { + disconnect( aViewManager, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ), + this, SLOT( onMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); + return; + } + } + mySection= -1; myPointNum = -1; QList aSelSection = mySectionView->getSelectedSections(); @@ -308,18 +343,36 @@ void CurveCreator_Widget::onNewPoint() myNewPointEditor->setSectionName(aSectName); myNewPointEditor->setDimension(myCurve->getDimension()); - SUIT_ViewWindow* aViewWindow = 0; - SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); - if ( activeStudy ) - aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - if ( aViewWindow == 0 ) +// emit subOperationStarted( myNewPointEditor ); +} + +void CurveCreator_Widget::onEditPoints(bool checked) +{ +} + +void CurveCreator_Widget::onDetectPoints(bool checked) +{ +} + +void CurveCreator_Widget::onModeChanged(bool checked) +{ + if (!checked) return; - SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); - if ( aViewManager->getType() == OCCViewer_Viewer::Type() ) { - connect( aViewManager, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ), - this, SLOT( onMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); + QAction* anAction = (QAction*)sender(); + switch(myActionMap.key(anAction)) { + case CREATION_MODE_ID: + myActionMap[EDITION_MODE_ID]->setChecked(false); + myActionMap[DETECTION_MODE_ID]->setChecked(false); + break; + case EDITION_MODE_ID: + myActionMap[CREATION_MODE_ID]->setChecked(false); + myActionMap[DETECTION_MODE_ID]->setChecked(false); + break; + case DETECTION_MODE_ID: + myActionMap[CREATION_MODE_ID]->setChecked(false); + myActionMap[EDITION_MODE_ID]->setChecked(false); + break; } - emit subOperationStarted( myNewPointEditor ); } void CurveCreator_Widget::onAddNewPoint() @@ -328,7 +381,7 @@ void CurveCreator_Widget::onAddNewPoint() return; CurveCreator::Coordinates aCoords = myNewPointEditor->getCoordinates(); myEdit->insertPoints(aCoords, mySection, myPointNum ); - mySectionView->pointsAdded( mySection, myPointNum ); +// mySectionView->pointsAdded( mySection, myPointNum ); // myNewPointEditor->clear(); myPointNum++; onSelectionChanged(); diff --git a/src/CurveCreator/CurveCreator_Widget.h b/src/CurveCreator/CurveCreator_Widget.h index dfe61e3c2..b98027442 100644 --- a/src/CurveCreator/CurveCreator_Widget.h +++ b/src/CurveCreator/CurveCreator_Widget.h @@ -39,7 +39,10 @@ signals: public slots: protected slots: - void onNewPoint(); + void onNewPoint(bool checked); + void onEditPoints(bool checked); + void onDetectPoints(bool checked); + void onModeChanged(bool checked); void onNewSection(); void onSelectionChanged(); void onAddNewPoint(); @@ -70,10 +73,11 @@ protected slots: void onContextMenu(QPoint thePoint); void onMousePress( SUIT_ViewWindow*, QMouseEvent* ); protected: - enum ActionId{ UNDO_ID, REDO_ID, NEW_SECTION_ID, NEW_POINT_ID, REMOVE_ID, REMOVE_ALL_ID, JOIN_ID, + enum ActionId{ UNDO_ID, REDO_ID, NEW_SECTION_ID, CREATION_MODE_ID, REMOVE_ID, REMOVE_ALL_ID, JOIN_ID, JOIN_ALL_ID, UP_ID, DOWN_ID, INSERT_SECTION_BEFORE_ID, INSERT_SECTION_AFTER_ID, INSERT_POINT_BEFORE_ID, INSERT_POINT_AFTER_ID, CLOSE_SECTIONS_ID, UNCLOSE_SECTIONS_ID, - SET_SECTIONS_POLYLINE_ID, SET_SECTIONS_SPLINE_ID, CLEAR_ALL_ID, SEPARATOR_ID }; + SET_SECTIONS_POLYLINE_ID, SET_SECTIONS_SPLINE_ID, CLEAR_ALL_ID, SEPARATOR_ID, + EDITION_MODE_ID, DETECTION_MODE_ID }; private: QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage, const QString& theToolTip, const QKeySequence& theShortcut ); diff --git a/src/CurveCreator/Makefile.am b/src/CurveCreator/Makefile.am index e3656316d..adb96bf3a 100644 --- a/src/CurveCreator/Makefile.am +++ b/src/CurveCreator/Makefile.am @@ -34,10 +34,12 @@ dist_libCurveCreator_la_SOURCES = \ CurveCreator_Operation.hxx \ CurveCreator_Diff.hxx \ CurveCreator_Section.hxx \ + CurveCreator_ICurve.hxx \ CurveCreator_Curve.hxx \ CurveCreator_CurveEditor.hxx \ CurveCreator_Operation.cxx \ CurveCreator_Diff.cxx \ + CurveCreator_ICurve.cxx \ CurveCreator_Curve.cxx \ CurveCreator_CurveEditor.cxx @@ -48,6 +50,7 @@ salomeinclude_HEADERS = \ CurveCreator_Operation.hxx \ CurveCreator_Diff.hxx \ CurveCreator_Section.hxx \ + CurveCreator_ICurve.hxx \ CurveCreator_Curve.hxx \ CurveCreator_CurveEditor.hxx \ CurveCreator_Listener.hxx diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 754ec86c8..4157be9a5 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -35,6 +35,10 @@ ICON_CC_NEW_SECTION new_section.png + + ICON_CC_EDIT_POINTS + edit_points.png + ICON_CC_POINT point2.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 9e06c0897..7fcf0a08e 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5320,12 +5320,20 @@ Ignoring units will cause model scaling (as dimensions are supposed to be specif Insert section after - NEW_POINT - New point + CREATION_MODE + Creation mode - NEW_POINT_TLT - New point + CREATION_MODE_TLT + Creation mode + + + EDITION_MODE + Edition mode + + + EDITION_MODE_TLT + Edition mode INSERT_POINT_BEFORE