Merge changes for HYDRO project : hydro/imps_2017_salome_83 branch.

This commit is contained in:
rnv 2018-03-13 17:37:03 +03:00
commit 89e60b0cd0
15 changed files with 196 additions and 91 deletions

View File

@ -56,7 +56,11 @@ CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimensi
myNbRedos (0), myNbRedos (0),
myUndoDepth (-1), myUndoDepth (-1),
myOpLevel(0), myOpLevel(0),
mySkipSorting(false) mySkipSorting(false),
myPointAspectColor (Quantity_NOC_ROYALBLUE4),
myCurveColor (Quantity_NOC_RED),
myEraseAll(true),
myLineWidth(1)
{ {
} }
@ -249,13 +253,16 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double&
} }
} }
void CurveCreator_Curve::redisplayCurve() void CurveCreator_Curve::redisplayCurve(bool preEraseAllObjects)
{ {
//DEBTRACE("redisplayCurve"); //DEBTRACE("redisplayCurve");
if( myDisplayer ) { if( myDisplayer )
myDisplayer->eraseAll( false ); {
if (preEraseAllObjects)
myDisplayer->eraseAll( false );
else
myDisplayer->erase( myAISShape, false);
myAISShape = NULL; myAISShape = NULL;
myDisplayer->display( getAISObject( true ), true ); myDisplayer->display( getAISObject( true ), true );
} }
} }
@ -357,8 +364,12 @@ bool CurveCreator_Curve::redo()
bool CurveCreator_Curve::clearInternal() bool CurveCreator_Curve::clearInternal()
{ {
// erase curve from the viewer // erase curve from the viewer
if( myDisplayer ) { if( myDisplayer )
myDisplayer->eraseAll( true ); {
if (myEraseAll)
myDisplayer->eraseAll( true );
else
myDisplayer->erase(myAISShape, false);
myAISShape = NULL; myAISShape = NULL;
} }
// Delete all allocated data. // Delete all allocated data.
@ -394,6 +405,23 @@ bool CurveCreator_Curve::clear()
return res; return res;
} }
//=======================================================================
// function: clear
// purpose:
//=======================================================================
void CurveCreator_Curve::SetEraseAllState(bool toEraseAll)
{
myEraseAll = toEraseAll;
}
//=======================================================================
// function: clear
// purpose:
//=======================================================================
bool CurveCreator_Curve::GetEraseAllState() const
{
return myEraseAll;
}
//! For internal use only! Undo/Redo are not used here. //! For internal use only! Undo/Redo are not used here.
bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections ) bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
{ {
@ -422,7 +450,7 @@ bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
break; break;
} }
redisplayCurve(); redisplayCurve(false);
return res; return res;
} }
@ -465,7 +493,7 @@ int CurveCreator_Curve::addSectionInternal
aSection->myIsClosed = theIsClosed; aSection->myIsClosed = theIsClosed;
aSection->myPoints = thePoints; aSection->myPoints = thePoints;
mySections.push_back(aSection); mySections.push_back(aSection);
redisplayCurve(); redisplayCurve(false);
return mySections.size()-1; return mySections.size()-1;
} }
@ -525,7 +553,7 @@ bool CurveCreator_Curve::removeSectionInternal( const int theISection )
delete *anIterRm; delete *anIterRm;
mySections.erase(anIterRm); mySections.erase(anIterRm);
} }
redisplayCurve(); redisplayCurve(false);
return true; return true;
} }
@ -616,14 +644,14 @@ bool CurveCreator_Curve::setClosedInternal( const int theISection,
aSection = (CurveCreator_Section*)getSection( i ); aSection = (CurveCreator_Section*)getSection( i );
if( aSection ) { if( aSection ) {
aSection->myIsClosed = theIsClosed; aSection->myIsClosed = theIsClosed;
redisplayCurve(); redisplayCurve(false);
} }
} }
} else { } else {
aSection = (CurveCreator_Section*)getSection( theISection ); aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection ) { if ( aSection ) {
aSection->myIsClosed = theIsClosed; aSection->myIsClosed = theIsClosed;
redisplayCurve(); redisplayCurve(false);
} }
} }
return true; return true;
@ -706,12 +734,12 @@ bool CurveCreator_Curve::setSectionTypeInternal( const int theISection,
if ( aSection ) if ( aSection )
aSection->myType = theType; aSection->myType = theType;
} }
redisplayCurve(); redisplayCurve(false);
} else { } else {
aSection = (CurveCreator_Section*)getSection( theISection ); aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection && aSection->myType != theType ){ if ( aSection && aSection->myType != theType ){
aSection->myType = theType; aSection->myType = theType;
redisplayCurve(); redisplayCurve(false);
} }
} }
return true; return true;
@ -772,7 +800,7 @@ bool CurveCreator_Curve::addPointsInternal( const CurveCreator::SectionsMap &the
} }
} }
if(res) if(res)
redisplayCurve(); redisplayCurve(false);
return res; return res;
} }
@ -830,7 +858,7 @@ bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theS
} }
} }
if(res) if(res)
redisplayCurve(); redisplayCurve(false);
return res; return res;
} }
@ -914,7 +942,7 @@ bool CurveCreator_Curve::removePointsInternal( const SectionToPointList &thePoin
aRes = removeSectionPoints(aSectionId, anIt->second); aRes = removeSectionPoints(aSectionId, anIt->second);
} }
if( aRes) if( aRes)
redisplayCurve(); redisplayCurve(false);
return aRes; return aRes;
} }
@ -971,11 +999,17 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
// function: getPoints // function: getPoints
// purpose: // purpose:
//======================================================================= //=======================================================================
CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const CurveCreator::Coordinates CurveCreator_Curve::getCoords( int theISection ) const
{
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates();
}
Handle(TColgp_HArray1OfPnt) CurveCreator_Curve::GetDifferentPoints( int theISection ) const
{ {
//DEBTRACE("getPoints"); //DEBTRACE("getPoints");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection ); CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates(); return aSection ? aSection->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)();
} }
void CurveCreator_Curve::constructAISObject() void CurveCreator_Curve::constructAISObject()
@ -983,20 +1017,21 @@ void CurveCreator_Curve::constructAISObject()
//DEBTRACE("constructAISObject"); //DEBTRACE("constructAISObject");
TopoDS_Shape aShape; TopoDS_Shape aShape;
CurveCreator_Utils::constructShape( this, aShape ); CurveCreator_Utils::constructShape( this, aShape );
myAISShape = new AIS_Shape( aShape );
myAISShape = new AIS_Shape( aShape ); myAISShape->SetColor( myCurveColor );
myAISShape->SetWidth( myLineWidth );
Handle(Prs3d_PointAspect) anAspect = myAISShape->Attributes()->PointAspect(); Handle(Prs3d_PointAspect) anAspect = myAISShape->Attributes()->PointAspect();
anAspect->SetScale( 3.0 ); anAspect->SetScale( 3.0 );
anAspect->SetTypeOfMarker(Aspect_TOM_O_POINT); anAspect->SetTypeOfMarker(Aspect_TOM_O_POINT);
anAspect->SetColor(Quantity_NOC_ROYALBLUE4); anAspect->SetColor(myPointAspectColor);
myAISShape->Attributes()->SetPointAspect( anAspect ); myAISShape->Attributes()->SetPointAspect( anAspect );
} }
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
{ {
//DEBTRACE("getAISObject"); //DEBTRACE("getAISObject");
if ( !myAISShape && theNeedToBuild ) { if ( !myAISShape && theNeedToBuild )
{
CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this; CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
aCurve->constructAISObject(); aCurve->constructAISObject();
} }

View File

@ -36,6 +36,7 @@ struct CurveCreator_Section;
class CurveCreator_Displayer; class CurveCreator_Displayer;
class AIS_Shape; class AIS_Shape;
class AIS_InteractiveObject; class AIS_InteractiveObject;
class Quantity_Color;
/** /**
* The CurveCreator_Curve object is represented as one or more sets of * The CurveCreator_Curve object is represented as one or more sets of
@ -108,7 +109,7 @@ protected:
public: // TODO: remove public public: // TODO: remove public
void getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const; void getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const;
protected: // TODO: remove public protected: // TODO: remove public
void redisplayCurve(); void redisplayCurve(bool preEraseAllObjects = true);
public: public:
/************ Implementation of INTERFACE methods ************/ /************ Implementation of INTERFACE methods ************/
@ -139,6 +140,14 @@ public:
//! Clear the polyline (remove all sections) //! Clear the polyline (remove all sections)
virtual bool clear(); virtual bool clear();
//! set erase-all state
//! if true => erase all objects from viever, else remove only the current curve
void SetEraseAllState(bool toEraseAll);
//! get erase-all state
//! if true => erase all objects from viever, else remove only the current curve
bool GetEraseAllState() const;
//! For internal use only! Undo/Redo are not used here. //! For internal use only! Undo/Redo are not used here.
virtual bool joinInternal( const std::list<int>& theSections ); virtual bool joinInternal( const std::list<int>& theSections );
@ -261,7 +270,9 @@ public:
/** /**
* Get points of a section (the total points in Curve if theISection is equal to -1).. * Get points of a section (the total points in Curve if theISection is equal to -1)..
*/ */
virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const; virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const;
CurveCreator::Coordinates getCoords( int theISection = -1 ) const;
/** /**
@ -292,7 +303,7 @@ public:
/** /**
* Get the curve AIS object * Get the curve AIS object
*/ */
virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false ) const; virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false) const;
protected: protected:
/** /**
@ -322,6 +333,9 @@ public:
CurveCreator::Sections mySections; //!< curve data CurveCreator::Sections mySections; //!< curve data
CurveCreator::Dimension myDimension; //!< curve dimension CurveCreator::Dimension myDimension; //!< curve dimension
CurveCreator_Displayer* myDisplayer; //!< curve displayer CurveCreator_Displayer* myDisplayer; //!< curve displayer
Quantity_Color myPointAspectColor;
Quantity_Color myCurveColor;
double myLineWidth;
private: private:
@ -332,6 +346,7 @@ private:
int myUndoDepth; int myUndoDepth;
int myOpLevel; int myOpLevel;
AIS_Shape* myAISShape; //!< AIS shape AIS_Shape* myAISShape; //!< AIS shape
bool myEraseAll;
}; };
#endif #endif

View File

@ -336,7 +336,7 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
aSectionId = anIt->first; aSectionId = anIt->first;
aPointId = anIt->second; aPointId = anIt->second;
const CurveCreator::Coordinates &aPoints = const CurveCreator::Coordinates &aPoints =
theCurve->getPoints(aSectionId); theCurve->getCoords(aSectionId);
CurveCreator::Coordinates::const_iterator anIterBegin = CurveCreator::Coordinates::const_iterator anIterBegin =
aPoints.begin() + (aDim*aPointId); aPoints.begin() + (aDim*aPointId);
CurveCreator::Coordinates::const_iterator anIterEnd = CurveCreator::Coordinates::const_iterator anIterEnd =
@ -526,7 +526,7 @@ bool CurveCreator_Diff::addSectionToUndo
CurveCreator_Operation &theOperation) const CurveCreator_Operation &theOperation) const
{ {
const std::string aName = theCurve->getSectionName(theIndex); const std::string aName = theCurve->getSectionName(theIndex);
const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex); const CurveCreator::Coordinates &aPnts = theCurve->getCoords(theIndex);
const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex); const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
const bool isClosed = theCurve->isClosed(theIndex); const bool isClosed = theCurve->isClosed(theIndex);

View File

@ -54,14 +54,22 @@ void CurveCreator_Displayer::eraseAll( bool isUpdate )
{ {
if(myObjects.empty()) if(myObjects.empty())
return; return;
for( int i = 0 ; i < myObjects.size() ; i++ ){ for( int i = 0 ; i < myObjects.size() ; i++ )
myContext->Erase(myObjects[i], Standard_False); myContext->Erase(myObjects[i], Standard_False);
}
myObjects.clear(); myObjects.clear();
if( isUpdate ) if( isUpdate )
myContext->UpdateCurrentViewer(); myContext->UpdateCurrentViewer();
} }
void CurveCreator_Displayer::erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate )
{
if(theObject.IsNull())
return;
myContext->Erase(theObject, Standard_False);
if( isUpdate )
myContext->UpdateCurrentViewer();
}
Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL ) Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
{ {
if( isHL ){ if( isHL ){
@ -70,6 +78,13 @@ Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
return Quantity_Color( 0., 1., 0., Quantity_TOC_RGB ); return Quantity_Color( 0., 1., 0., Quantity_TOC_RGB );
} }
void CurveCreator_Displayer::Update()
{
for( int i = 0 ; i < myObjects.size() ; i++ )
myContext->Update(myObjects[i], Standard_True);
myContext->UpdateCurrentViewer();
}
/*void CurveCreator_Displayer::highlight( const AISObjectsList& theObjects, bool isHL ) /*void CurveCreator_Displayer::highlight( const AISObjectsList& theObjects, bool isHL )
{ {
return; return;

View File

@ -38,6 +38,8 @@ public:
void display( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate ); void display( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
void eraseAll( bool isUpdate ); void eraseAll( bool isUpdate );
void erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
void Update();
//void highlight( const AISObjectsList& theObjects, bool isHL ); //void highlight( const AISObjectsList& theObjects, bool isHL );
protected: protected:

View File

@ -59,8 +59,7 @@ struct CURVECREATOR_EXPORT CurveCreator_ISection
virtual ~CurveCreator_ISection() {} virtual ~CurveCreator_ISection() {}
//! Calculates the different points of the section. //! Calculates the different points of the section.
virtual void GetDifferentPoints( virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
}; };
/** /**
@ -192,7 +191,7 @@ public:
/** /**
* Get points of a section (the total points in Curve if theISection is equal to -1).. * Get points of a section (the total points in Curve if theISection is equal to -1)..
*/ */
virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0; virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const = 0;
/** /**
* Get number of points in specified section or (the total number of points * Get number of points in specified section or (the total number of points

View File

@ -30,16 +30,24 @@ const double POINT_CONFUSION = 1e-4;
// function: GetDifferentPoints // function: GetDifferentPoints
// purpose: // purpose:
//======================================================================= //=======================================================================
void CurveCreator_Section::GetDifferentPoints( Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
{ {
Handle(TColgp_HArray1OfPnt) points;
std::vector<gp_Pnt> aTmpPoints; std::vector<gp_Pnt> aTmpPoints;
CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin(); CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end(); CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
const gp_Pnt aFirstPoint(
*aPIt, *(aPIt + 1), (theDimension == 2) ? 0 : *(aPIt + 2)); gp_Pnt aFirstPoint;
gp_Pnt aPoint = aFirstPoint; gp_Pnt aPoint;
aTmpPoints.push_back(aPoint);
if( myPoints.size() > 0 )
{
aFirstPoint = gp_Pnt(*aPIt, *(aPIt + 1), (theDimension == 2) ? 0 : *(aPIt + 2));
aPoint = aFirstPoint;
aTmpPoints.push_back(aPoint);
}
for (; aPIt != aPItLast; aPIt += theDimension) for (; aPIt != aPItLast; aPIt += theDimension)
{ {
@ -62,9 +70,11 @@ void CurveCreator_Section::GetDifferentPoints(
} }
} }
thePoints = new TColgp_HArray1OfPnt(1, aPointCount); points = new TColgp_HArray1OfPnt(1, aPointCount);
for (int aPI = 0; aPI < aPointCount; ++aPI) for (int aPI = 0; aPI < aPointCount; ++aPI)
{ {
thePoints->SetValue(aPI + 1, aTmpPoints[aPI]); points->SetValue(aPI + 1, aTmpPoints[aPI]);
} }
return points;
} }

View File

@ -36,13 +36,13 @@ struct CURVECREATOR_EXPORT CurveCreator_Section :
CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false) CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false)
{ } { }
std::string myName; //!< section name std::string myName; //!< section name
CurveCreator::Coordinates myPoints; //!< points coordinates CurveCreator::Coordinates myPoints; //!< points coordinates
CurveCreator::SectionType myType; //!< type of the section CurveCreator::SectionType myType; //!< type of the section
bool myIsClosed; //!< closed or not bool myIsClosed; //!< closed or not
//! A virtual method. //! A virtual method.
void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const; Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
}; };
#endif #endif

View File

@ -19,6 +19,7 @@
#include "CurveCreator_TableView.h" #include "CurveCreator_TableView.h"
#include "CurveCreator_UtilsICurve.hxx" #include "CurveCreator_UtilsICurve.hxx"
#include "CurveCreator_Widget.h"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
@ -94,10 +95,14 @@ void CurveCreator_TableItemDelegate::setModelData( QWidget* theEditor,
QItemDelegate::setModelData( theEditor, theModel, theIndex ); QItemDelegate::setModelData( theEditor, theModel, theIndex );
} }
CurveCreator_TableView::CurveCreator_TableView( CurveCreator_ICurve* theCurve, CurveCreator_TableView::CurveCreator_TableView( CurveCreator_ICurve* theCurve,
QWidget* theParent, CurveCreator_Widget* theParent,
const QStringList& theCoordTitles ) const QStringList& theCoordTitles )
: QTableWidget( theParent ), myCurve( theCurve ) : QTableWidget( theParent ), myWidget( theParent ),
myCurve( theCurve ), myCurrentSortId( -1 ), myCurrentSortOrder( Qt::AscendingOrder )
{ {
setItemDelegate( new CurveCreator_TableItemDelegate( this ) ); setItemDelegate( new CurveCreator_TableItemDelegate( this ) );
setVisible( false ); setVisible( false );
@ -199,5 +204,22 @@ int CurveCreator_TableView::getPointId( const int theRowId ) const
void CurveCreator_TableView::OnHeaderClick( int theLogicalId ) void CurveCreator_TableView::OnHeaderClick( int theLogicalId )
{ {
sortByColumn( theLogicalId, Qt::AscendingOrder ); if( theLogicalId == myCurrentSortId )
if( myCurrentSortOrder == Qt::AscendingOrder )
myCurrentSortOrder = Qt::DescendingOrder;
else
myCurrentSortOrder = Qt::AscendingOrder;
sortByColumn( theLogicalId, myCurrentSortOrder );
CurveCreator_ICurve::SectionToPointList selected;
for( int r=0, n=rowCount(); r<n; r++ )
{
int section = item( r, 0 )->data( Qt::UserRole ).toInt();
int point = item( r, 1 )->data( Qt::UserRole ).toInt();
selected.push_back( CurveCreator_ICurve::SectionToPoint( section, point ) );
}
myWidget->setSelectedPoints( selected );
myCurrentSortId = theLogicalId;
} }

View File

@ -25,6 +25,8 @@
#include <QItemDelegate> #include <QItemDelegate>
#include <QTableWidget> #include <QTableWidget>
class CurveCreator_Widget;
class CurveCreator_TableItemDelegate : public QItemDelegate class CurveCreator_TableItemDelegate : public QItemDelegate
{ {
public: public:
@ -39,12 +41,12 @@ public:
const QModelIndex& theIndex ) const; const QModelIndex& theIndex ) const;
}; };
class CurveCreator_TableView : public QTableWidget class CURVECREATOR_EXPORT CurveCreator_TableView : public QTableWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
CurveCreator_TableView( CurveCreator_ICurve* theCurve, QWidget* theParent = 0, CurveCreator_TableView( CurveCreator_ICurve* theCurve, CurveCreator_Widget* theParent,
const QStringList& theCoordTitles = QStringList() ); const QStringList& theCoordTitles = QStringList() );
~CurveCreator_TableView() {}; ~CurveCreator_TableView() {};
@ -63,12 +65,15 @@ public:
*/ */
int getPointId( const int theRowId ) const; int getPointId( const int theRowId ) const;
private slots: public slots:
void OnHeaderClick( int ); void OnHeaderClick( int );
private: private:
CurveCreator_Widget* myWidget;
CurveCreator_ICurve* myCurve; CurveCreator_ICurve* myCurve;
int myCurrentSortId;
Qt::SortOrder myCurrentSortOrder;
}; };
#endif // CURVECREATOR_TABLEVIEW_H #endif // CURVECREATOR_TABLEVIEW_H

View File

@ -212,9 +212,13 @@ int CurveCreator_TreeViewModel::getPoint( const QModelIndex& theIndx ) const
void CurveCreator_TreeViewModel::setCurve( CurveCreator_ICurve* theCurve ) void CurveCreator_TreeViewModel::setCurve( CurveCreator_ICurve* theCurve )
{ {
myCurve = theCurve;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myCurve = theCurve;
reset(); reset();
#else
beginResetModel();
myCurve = theCurve;
endResetModel();
#endif #endif
} }

View File

@ -309,9 +309,7 @@ void CurveCreator_Utils::constructShape(
} }
// Get the different points. // Get the different points.
const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI); Handle(TColgp_HArray1OfPnt) aPoints = theCurve->GetDifferentPoints( aSectionI );
Handle(TColgp_HArray1OfPnt) aPoints;
aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
const int aPointCount = aPoints->Length(); const int aPointCount = aPoints->Length();
const bool isClosed = theCurve->isClosed(aSectionI); const bool isClosed = theCurve->isClosed(aSectionI);
@ -617,24 +615,24 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
theContext->SetAutomaticHilight( Standard_False ); theContext->SetAutomaticHilight( Standard_False );
Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) ); Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
for( aSelection->Init(); aSelection->More(); aSelection->Next() )
{
const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
if( aHSenEntity.IsNull() )
continue;
Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity ); CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
aLast = thePoints.end();
gp_Pnt anOwnerPnt = aSenPnt->Point(); bool isFound = false;
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() ); for( int i=0; i<aSize; i++ )
{
for( aSelection->Init(); aSelection->More(); aSelection->Next() )
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
aLast = thePoints.end();
bool isFound = false;
for( int i=0; i<aSize; i++ )
{ {
const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
if( aHSenEntity.IsNull() )
continue;
Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity );
gp_Pnt anOwnerPnt = aSenPnt->Point();
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE && bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE &&
fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE; fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
if( isIntersect ) if( isIntersect )

View File

@ -80,11 +80,10 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent,
CurveCreator_ICurve *theCurve, CurveCreator_ICurve *theCurve,
const int theActionFlags, const int theActionFlags,
const QStringList& theCoordTitles, const QStringList& theCoordTitles,
Qt::WindowFlags fl, Qt::WindowFlags fl )
int theLocalPointRowLimit )
: QWidget(parent), myNewSectionEditor(NULL), myCurve(theCurve), mySection(0), : QWidget(parent), myNewSectionEditor(NULL), myCurve(theCurve), mySection(0),
myDragStarted( false ), myDragInteractionStyle( SUIT_ViewModel::STANDARD ), myDragStarted( false ), myDragInteractionStyle( SUIT_ViewModel::STANDARD ),
myOCCViewer( 0 ), myLocalPointRowLimit( theLocalPointRowLimit ), myOCCViewer( 0 ),
myOld2DMode(OCCViewer_ViewWindow::No2dMode) myOld2DMode(OCCViewer_ViewWindow::No2dMode)
{ {
bool isToEnableClosed = !( theActionFlags & DisableClosedSection ); bool isToEnableClosed = !( theActionFlags & DisableClosedSection );
@ -1460,16 +1459,16 @@ void CurveCreator_Widget::updateLocalPointView()
CurveCreator_Utils::getSelectedPoints( aContext, myCurve, myLocalPoints ); CurveCreator_Utils::getSelectedPoints( aContext, myCurve, myLocalPoints );
int aNbPoints = myLocalPoints.size(); int aNbPoints = myLocalPoints.size();
bool isRowLimit = aNbPoints > myLocalPointRowLimit; //bool isRowLimit = aNbPoints > myLocalPointRowLimit;
myLocalPointView->setVisible( getActionMode() == ModificationMode && !isRowLimit ); myLocalPointView->setVisible( getActionMode() == ModificationMode/* && !isRowLimit */);
if ( !isRowLimit ) { //if ( !isRowLimit ) {
bool isBlocked = myLocalPointView->blockSignals(true); bool isBlocked = myLocalPointView->blockSignals(true);
myLocalPointView->setLocalPointsToTable( myLocalPoints ); myLocalPointView->setLocalPointsToTable( myLocalPoints );
myLocalPointView->blockSignals( isBlocked ); myLocalPointView->blockSignals( isBlocked );
} //}
} }
/** /**

View File

@ -71,8 +71,7 @@ public:
CurveCreator_ICurve *theCurve, CurveCreator_ICurve *theCurve,
const int theActionFlags = NoFlags, const int theActionFlags = NoFlags,
const QStringList& theCoordTitles = QStringList(), const QStringList& theCoordTitles = QStringList(),
Qt::WindowFlags fl=0, Qt::WindowFlags fl=0);
int theLocalPointRowLimit = 20);
// OCC viewer manipulation // OCC viewer manipulation
void setOCCViewer( OCCViewer_Viewer* theViewer ); void setOCCViewer( OCCViewer_Viewer* theViewer );
@ -95,14 +94,18 @@ public:
void SetViewer2DMode(const bool To2D); void SetViewer2DMode(const bool To2D);
void setSelectedPoints( const CurveCreator_ICurve::SectionToPointList& =
CurveCreator_ICurve::SectionToPointList() );
void updateLocalPointView();
void setLocalPointContext( const bool theOpen, const bool isUpdateTable = false );
signals: signals:
void selectionChanged(); void selectionChanged();
void subOperationStarted( QWidget*, bool ); void subOperationStarted( QWidget*, bool );
void subOperationFinished( QWidget* ); void subOperationFinished( QWidget* );
public slots: public slots:
protected slots:
void onAdditionMode(bool checked); void onAdditionMode(bool checked);
void onModificationMode(bool checked); void onModificationMode(bool checked);
void onDetectionMode(bool checked); void onDetectionMode(bool checked);
@ -162,13 +165,15 @@ protected:
BRING_TOGETHER_ID BRING_TOGETHER_ID
}; };
public:
QAction* getAction(ActionId theId);
QAction* getAction(ActionMode theMode);
private: private:
OCCViewer_Viewer* getOCCViewer(); OCCViewer_Viewer* getOCCViewer();
QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage, QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage,
const QString& theToolTip, const QKeySequence& theShortcut ); const QString& theToolTip, const QKeySequence& theShortcut );
QAction* getAction(ActionId theId);
QAction* getAction(ActionMode theMode);
void updateActionsStates(); void updateActionsStates();
void updateUndoRedo(); void updateUndoRedo();
@ -179,14 +184,10 @@ private:
void insertPointToSelectedSegment( const int theXPosition, void insertPointToSelectedSegment( const int theXPosition,
const int theYPosition ); const int theYPosition );
void moveSelectedPoints( const int theXPosition, const int theYPosition ); void moveSelectedPoints( const int theXPosition, const int theYPosition );
void updateLocalPointView();
void setLocalPointContext( const bool theOpen, const bool isUpdateTable = false );
void setDragStarted( const bool theState, const QPoint& thePoint = QPoint() ); void setDragStarted( const bool theState, const QPoint& thePoint = QPoint() );
void getSelectedPoints( CurveCreator_ICurve::SectionToPointList& thePoints ); void getSelectedPoints( CurveCreator_ICurve::SectionToPointList& thePoints );
void setSelectedPoints( const CurveCreator_ICurve::SectionToPointList& =
CurveCreator_ICurve::SectionToPointList() );
void stopActionMode(); void stopActionMode();

View File

@ -252,7 +252,7 @@ void EntityGUI_PolylineDlg::GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
for (i = 0; i < aNbSec; ++i) { for (i = 0; i < aNbSec; ++i) {
// Set coordinates // Set coordinates
CurveCreator::Coordinates aCoords = myCurve->getPoints(i); CurveCreator::Coordinates aCoords = myCurve->getCoords(i);
const int aNbPoints = aCoords.size(); const int aNbPoints = aCoords.size();
theCoords[i].length(aNbPoints); theCoords[i].length(aNbPoints);