mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
Merge changes for HYDRO project : hydro/imps_2017_salome_83 branch.
This commit is contained in:
commit
89e60b0cd0
@ -56,7 +56,11 @@ CurveCreator_Curve::CurveCreator_Curve( const CurveCreator::Dimension theDimensi
|
||||
myNbRedos (0),
|
||||
myUndoDepth (-1),
|
||||
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");
|
||||
if( myDisplayer ) {
|
||||
myDisplayer->eraseAll( false );
|
||||
if( myDisplayer )
|
||||
{
|
||||
if (preEraseAllObjects)
|
||||
myDisplayer->eraseAll( false );
|
||||
else
|
||||
myDisplayer->erase( myAISShape, false);
|
||||
myAISShape = NULL;
|
||||
|
||||
myDisplayer->display( getAISObject( true ), true );
|
||||
}
|
||||
}
|
||||
@ -357,8 +364,12 @@ bool CurveCreator_Curve::redo()
|
||||
bool CurveCreator_Curve::clearInternal()
|
||||
{
|
||||
// erase curve from the viewer
|
||||
if( myDisplayer ) {
|
||||
myDisplayer->eraseAll( true );
|
||||
if( myDisplayer )
|
||||
{
|
||||
if (myEraseAll)
|
||||
myDisplayer->eraseAll( true );
|
||||
else
|
||||
myDisplayer->erase(myAISShape, false);
|
||||
myAISShape = NULL;
|
||||
}
|
||||
// Delete all allocated data.
|
||||
@ -394,6 +405,23 @@ bool CurveCreator_Curve::clear()
|
||||
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.
|
||||
bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
|
||||
{
|
||||
@ -422,7 +450,7 @@ bool CurveCreator_Curve::joinInternal( const std::list<int>& theSections )
|
||||
break;
|
||||
}
|
||||
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -465,7 +493,7 @@ int CurveCreator_Curve::addSectionInternal
|
||||
aSection->myIsClosed = theIsClosed;
|
||||
aSection->myPoints = thePoints;
|
||||
mySections.push_back(aSection);
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return mySections.size()-1;
|
||||
}
|
||||
|
||||
@ -525,7 +553,7 @@ bool CurveCreator_Curve::removeSectionInternal( const int theISection )
|
||||
delete *anIterRm;
|
||||
mySections.erase(anIterRm);
|
||||
}
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -616,14 +644,14 @@ bool CurveCreator_Curve::setClosedInternal( const int theISection,
|
||||
aSection = (CurveCreator_Section*)getSection( i );
|
||||
if( aSection ) {
|
||||
aSection->myIsClosed = theIsClosed;
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
aSection = (CurveCreator_Section*)getSection( theISection );
|
||||
if ( aSection ) {
|
||||
aSection->myIsClosed = theIsClosed;
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -706,12 +734,12 @@ bool CurveCreator_Curve::setSectionTypeInternal( const int theISection,
|
||||
if ( aSection )
|
||||
aSection->myType = theType;
|
||||
}
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
} else {
|
||||
aSection = (CurveCreator_Section*)getSection( theISection );
|
||||
if ( aSection && aSection->myType != theType ){
|
||||
aSection->myType = theType;
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -772,7 +800,7 @@ bool CurveCreator_Curve::addPointsInternal( const CurveCreator::SectionsMap &the
|
||||
}
|
||||
}
|
||||
if(res)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -830,7 +858,7 @@ bool CurveCreator_Curve::setPointInternal( const CurveCreator::SectionsMap &theS
|
||||
}
|
||||
}
|
||||
if(res)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -914,7 +942,7 @@ bool CurveCreator_Curve::removePointsInternal( const SectionToPointList &thePoin
|
||||
aRes = removeSectionPoints(aSectionId, anIt->second);
|
||||
}
|
||||
if( aRes)
|
||||
redisplayCurve();
|
||||
redisplayCurve(false);
|
||||
|
||||
return aRes;
|
||||
}
|
||||
@ -971,11 +999,17 @@ CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
|
||||
// function: getPoints
|
||||
// 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");
|
||||
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()
|
||||
@ -983,20 +1017,21 @@ void CurveCreator_Curve::constructAISObject()
|
||||
//DEBTRACE("constructAISObject");
|
||||
TopoDS_Shape 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();
|
||||
anAspect->SetScale( 3.0 );
|
||||
anAspect->SetTypeOfMarker(Aspect_TOM_O_POINT);
|
||||
anAspect->SetColor(Quantity_NOC_ROYALBLUE4);
|
||||
anAspect->SetColor(myPointAspectColor);
|
||||
myAISShape->Attributes()->SetPointAspect( anAspect );
|
||||
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
|
||||
{
|
||||
//DEBTRACE("getAISObject");
|
||||
if ( !myAISShape && theNeedToBuild ) {
|
||||
if ( !myAISShape && theNeedToBuild )
|
||||
{
|
||||
CurveCreator_Curve* aCurve = (CurveCreator_Curve*)this;
|
||||
aCurve->constructAISObject();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ struct CurveCreator_Section;
|
||||
class CurveCreator_Displayer;
|
||||
class AIS_Shape;
|
||||
class AIS_InteractiveObject;
|
||||
class Quantity_Color;
|
||||
|
||||
/**
|
||||
* The CurveCreator_Curve object is represented as one or more sets of
|
||||
@ -108,7 +109,7 @@ protected:
|
||||
public: // TODO: remove public
|
||||
void getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const;
|
||||
protected: // TODO: remove public
|
||||
void redisplayCurve();
|
||||
void redisplayCurve(bool preEraseAllObjects = true);
|
||||
|
||||
public:
|
||||
/************ Implementation of INTERFACE methods ************/
|
||||
@ -139,6 +140,14 @@ public:
|
||||
//! Clear the polyline (remove all sections)
|
||||
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.
|
||||
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)..
|
||||
*/
|
||||
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
|
||||
*/
|
||||
virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false ) const;
|
||||
virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -322,6 +333,9 @@ public:
|
||||
CurveCreator::Sections mySections; //!< curve data
|
||||
CurveCreator::Dimension myDimension; //!< curve dimension
|
||||
CurveCreator_Displayer* myDisplayer; //!< curve displayer
|
||||
Quantity_Color myPointAspectColor;
|
||||
Quantity_Color myCurveColor;
|
||||
double myLineWidth;
|
||||
|
||||
private:
|
||||
|
||||
@ -332,6 +346,7 @@ private:
|
||||
int myUndoDepth;
|
||||
int myOpLevel;
|
||||
AIS_Shape* myAISShape; //!< AIS shape
|
||||
bool myEraseAll;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -336,7 +336,7 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
|
||||
aSectionId = anIt->first;
|
||||
aPointId = anIt->second;
|
||||
const CurveCreator::Coordinates &aPoints =
|
||||
theCurve->getPoints(aSectionId);
|
||||
theCurve->getCoords(aSectionId);
|
||||
CurveCreator::Coordinates::const_iterator anIterBegin =
|
||||
aPoints.begin() + (aDim*aPointId);
|
||||
CurveCreator::Coordinates::const_iterator anIterEnd =
|
||||
@ -526,7 +526,7 @@ bool CurveCreator_Diff::addSectionToUndo
|
||||
CurveCreator_Operation &theOperation) const
|
||||
{
|
||||
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 bool isClosed = theCurve->isClosed(theIndex);
|
||||
|
||||
|
@ -54,14 +54,22 @@ void CurveCreator_Displayer::eraseAll( bool isUpdate )
|
||||
{
|
||||
if(myObjects.empty())
|
||||
return;
|
||||
for( int i = 0 ; i < myObjects.size() ; i++ ){
|
||||
for( int i = 0 ; i < myObjects.size() ; i++ )
|
||||
myContext->Erase(myObjects[i], Standard_False);
|
||||
}
|
||||
myObjects.clear();
|
||||
if( isUpdate )
|
||||
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 )
|
||||
{
|
||||
if( isHL ){
|
||||
@ -70,6 +78,13 @@ Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
|
||||
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 )
|
||||
{
|
||||
return;
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
|
||||
void display( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
|
||||
void eraseAll( bool isUpdate );
|
||||
void erase( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate );
|
||||
void Update();
|
||||
//void highlight( const AISObjectsList& theObjects, bool isHL );
|
||||
|
||||
protected:
|
||||
|
@ -59,8 +59,7 @@ struct CURVECREATOR_EXPORT CurveCreator_ISection
|
||||
virtual ~CurveCreator_ISection() {}
|
||||
|
||||
//! Calculates the different points of the section.
|
||||
virtual void GetDifferentPoints(
|
||||
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
|
||||
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -192,7 +191,7 @@ public:
|
||||
/**
|
||||
* 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
|
||||
|
@ -30,16 +30,24 @@ const double POINT_CONFUSION = 1e-4;
|
||||
// function: GetDifferentPoints
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void CurveCreator_Section::GetDifferentPoints(
|
||||
const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
|
||||
Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) points;
|
||||
|
||||
std::vector<gp_Pnt> aTmpPoints;
|
||||
|
||||
CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
|
||||
CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
|
||||
const gp_Pnt aFirstPoint(
|
||||
*aPIt, *(aPIt + 1), (theDimension == 2) ? 0 : *(aPIt + 2));
|
||||
gp_Pnt aPoint = aFirstPoint;
|
||||
aTmpPoints.push_back(aPoint);
|
||||
|
||||
gp_Pnt aFirstPoint;
|
||||
gp_Pnt 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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
thePoints->SetValue(aPI + 1, aTmpPoints[aPI]);
|
||||
points->SetValue(aPI + 1, aTmpPoints[aPI]);
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ struct CURVECREATOR_EXPORT CurveCreator_Section :
|
||||
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::SectionType myType; //!< type of the section
|
||||
bool myIsClosed; //!< closed or not
|
||||
|
||||
//! A virtual method.
|
||||
void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const;
|
||||
Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "CurveCreator_TableView.h"
|
||||
#include "CurveCreator_UtilsICurve.hxx"
|
||||
#include "CurveCreator_Widget.h"
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
@ -94,10 +95,14 @@ void CurveCreator_TableItemDelegate::setModelData( QWidget* theEditor,
|
||||
QItemDelegate::setModelData( theEditor, theModel, theIndex );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CurveCreator_TableView::CurveCreator_TableView( CurveCreator_ICurve* theCurve,
|
||||
QWidget* theParent,
|
||||
CurveCreator_Widget* theParent,
|
||||
const QStringList& theCoordTitles )
|
||||
: QTableWidget( theParent ), myCurve( theCurve )
|
||||
: QTableWidget( theParent ), myWidget( theParent ),
|
||||
myCurve( theCurve ), myCurrentSortId( -1 ), myCurrentSortOrder( Qt::AscendingOrder )
|
||||
{
|
||||
setItemDelegate( new CurveCreator_TableItemDelegate( this ) );
|
||||
setVisible( false );
|
||||
@ -199,5 +204,22 @@ int CurveCreator_TableView::getPointId( const int theRowId ) const
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <QItemDelegate>
|
||||
#include <QTableWidget>
|
||||
|
||||
class CurveCreator_Widget;
|
||||
|
||||
class CurveCreator_TableItemDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
@ -39,12 +41,12 @@ public:
|
||||
const QModelIndex& theIndex ) const;
|
||||
};
|
||||
|
||||
class CurveCreator_TableView : public QTableWidget
|
||||
class CURVECREATOR_EXPORT CurveCreator_TableView : public QTableWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CurveCreator_TableView( CurveCreator_ICurve* theCurve, QWidget* theParent = 0,
|
||||
CurveCreator_TableView( CurveCreator_ICurve* theCurve, CurveCreator_Widget* theParent,
|
||||
const QStringList& theCoordTitles = QStringList() );
|
||||
~CurveCreator_TableView() {};
|
||||
|
||||
@ -63,12 +65,15 @@ public:
|
||||
*/
|
||||
int getPointId( const int theRowId ) const;
|
||||
|
||||
private slots:
|
||||
public slots:
|
||||
void OnHeaderClick( int );
|
||||
|
||||
private:
|
||||
CurveCreator_Widget* myWidget;
|
||||
CurveCreator_ICurve* myCurve;
|
||||
|
||||
int myCurrentSortId;
|
||||
Qt::SortOrder myCurrentSortOrder;
|
||||
};
|
||||
|
||||
#endif // CURVECREATOR_TABLEVIEW_H
|
||||
|
@ -212,9 +212,13 @@ int CurveCreator_TreeViewModel::getPoint( const QModelIndex& theIndx ) const
|
||||
|
||||
void CurveCreator_TreeViewModel::setCurve( CurveCreator_ICurve* theCurve )
|
||||
{
|
||||
myCurve = theCurve;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
myCurve = theCurve;
|
||||
reset();
|
||||
#else
|
||||
beginResetModel();
|
||||
myCurve = theCurve;
|
||||
endResetModel();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -309,9 +309,7 @@ void CurveCreator_Utils::constructShape(
|
||||
}
|
||||
|
||||
// Get the different points.
|
||||
const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI);
|
||||
Handle(TColgp_HArray1OfPnt) aPoints;
|
||||
aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
|
||||
Handle(TColgp_HArray1OfPnt) aPoints = theCurve->GetDifferentPoints( aSectionI );
|
||||
const int aPointCount = aPoints->Length();
|
||||
const bool isClosed = theCurve->isClosed(aSectionI);
|
||||
|
||||
@ -617,24 +615,24 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
|
||||
theContext->SetAutomaticHilight( Standard_False );
|
||||
|
||||
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 );
|
||||
|
||||
gp_Pnt anOwnerPnt = aSenPnt->Point();
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
|
||||
|
||||
|
||||
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
|
||||
aLast = thePoints.end();
|
||||
bool isFound = false;
|
||||
for( int i=0; i<aSize; i++ )
|
||||
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
|
||||
aLast = thePoints.end();
|
||||
bool isFound = false;
|
||||
for( int i=0; i<aSize; i++ )
|
||||
{
|
||||
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 );
|
||||
|
||||
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 &&
|
||||
fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
|
||||
if( isIntersect )
|
||||
|
@ -80,11 +80,10 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent,
|
||||
CurveCreator_ICurve *theCurve,
|
||||
const int theActionFlags,
|
||||
const QStringList& theCoordTitles,
|
||||
Qt::WindowFlags fl,
|
||||
int theLocalPointRowLimit )
|
||||
Qt::WindowFlags fl )
|
||||
: QWidget(parent), myNewSectionEditor(NULL), myCurve(theCurve), mySection(0),
|
||||
myDragStarted( false ), myDragInteractionStyle( SUIT_ViewModel::STANDARD ),
|
||||
myOCCViewer( 0 ), myLocalPointRowLimit( theLocalPointRowLimit ),
|
||||
myOCCViewer( 0 ),
|
||||
myOld2DMode(OCCViewer_ViewWindow::No2dMode)
|
||||
{
|
||||
bool isToEnableClosed = !( theActionFlags & DisableClosedSection );
|
||||
@ -1460,16 +1459,16 @@ void CurveCreator_Widget::updateLocalPointView()
|
||||
CurveCreator_Utils::getSelectedPoints( aContext, myCurve, myLocalPoints );
|
||||
int aNbPoints = myLocalPoints.size();
|
||||
|
||||
bool isRowLimit = aNbPoints > myLocalPointRowLimit;
|
||||
myLocalPointView->setVisible( getActionMode() == ModificationMode && !isRowLimit );
|
||||
//bool isRowLimit = aNbPoints > myLocalPointRowLimit;
|
||||
myLocalPointView->setVisible( getActionMode() == ModificationMode/* && !isRowLimit */);
|
||||
|
||||
if ( !isRowLimit ) {
|
||||
bool isBlocked = myLocalPointView->blockSignals(true);
|
||||
//if ( !isRowLimit ) {
|
||||
bool isBlocked = myLocalPointView->blockSignals(true);
|
||||
|
||||
myLocalPointView->setLocalPointsToTable( myLocalPoints );
|
||||
myLocalPointView->setLocalPointsToTable( myLocalPoints );
|
||||
|
||||
myLocalPointView->blockSignals( isBlocked );
|
||||
}
|
||||
myLocalPointView->blockSignals( isBlocked );
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,8 +71,7 @@ public:
|
||||
CurveCreator_ICurve *theCurve,
|
||||
const int theActionFlags = NoFlags,
|
||||
const QStringList& theCoordTitles = QStringList(),
|
||||
Qt::WindowFlags fl=0,
|
||||
int theLocalPointRowLimit = 20);
|
||||
Qt::WindowFlags fl=0);
|
||||
|
||||
// OCC viewer manipulation
|
||||
void setOCCViewer( OCCViewer_Viewer* theViewer );
|
||||
@ -95,14 +94,18 @@ public:
|
||||
|
||||
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:
|
||||
void selectionChanged();
|
||||
void subOperationStarted( QWidget*, bool );
|
||||
void subOperationFinished( QWidget* );
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void onAdditionMode(bool checked);
|
||||
void onModificationMode(bool checked);
|
||||
void onDetectionMode(bool checked);
|
||||
@ -162,13 +165,15 @@ protected:
|
||||
BRING_TOGETHER_ID
|
||||
};
|
||||
|
||||
public:
|
||||
QAction* getAction(ActionId theId);
|
||||
QAction* getAction(ActionMode theMode);
|
||||
|
||||
private:
|
||||
OCCViewer_Viewer* getOCCViewer();
|
||||
|
||||
QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage,
|
||||
const QString& theToolTip, const QKeySequence& theShortcut );
|
||||
QAction* getAction(ActionId theId);
|
||||
QAction* getAction(ActionMode theMode);
|
||||
|
||||
void updateActionsStates();
|
||||
void updateUndoRedo();
|
||||
@ -179,14 +184,10 @@ private:
|
||||
void insertPointToSelectedSegment( 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 getSelectedPoints( CurveCreator_ICurve::SectionToPointList& thePoints );
|
||||
void setSelectedPoints( const CurveCreator_ICurve::SectionToPointList& =
|
||||
CurveCreator_ICurve::SectionToPointList() );
|
||||
|
||||
void stopActionMode();
|
||||
|
||||
|
@ -252,7 +252,7 @@ void EntityGUI_PolylineDlg::GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
|
||||
|
||||
for (i = 0; i < aNbSec; ++i) {
|
||||
// Set coordinates
|
||||
CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
|
||||
CurveCreator::Coordinates aCoords = myCurve->getCoords(i);
|
||||
const int aNbPoints = aCoords.size();
|
||||
|
||||
theCoords[i].length(aNbPoints);
|
||||
|
Loading…
Reference in New Issue
Block a user