theShape = aComp;
}
+class ComparePnt
+{
+public:
+ ComparePnt( const gp_Pnt& thePoint ) : myPoint( thePoint) {};
+ ~ComparePnt() {}
+
+ bool operator < ( const ComparePnt& theOtherPoint ) const
+ {
+ bool isLess = myPoint.X() < theOtherPoint.myPoint.X();
+ if ( !isLess && myPoint.X() == theOtherPoint.myPoint.X() ) {
+ isLess = myPoint.Y() < theOtherPoint.myPoint.Y();
+ if ( !isLess && myPoint.Y() == theOtherPoint.myPoint.Y() )
+ isLess = myPoint.Z() < theOtherPoint.myPoint.Z();
+ }
+ return isLess;
+ }
+private:
+ gp_Pnt myPoint;
+};
std::list<float> CurveCreator_Utils::getSelectedPoints( Handle(AIS_InteractiveContext) theContext )
{
std::list<float> aSelectedPoints;
gp_Pnt aPnt;
+ std::map<ComparePnt, int> aPntMap;
+
for ( theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected() ) {
TopoDS_Vertex aVertex;
TopoDS_Shape aShape = theContext->SelectedShape();
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
aVertex = TopoDS::Vertex( theContext->SelectedShape() );
- else {
- Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner();
- if ( !anOwner.IsNull() ) {
- Handle(AIS_InteractiveObject) anAIS = Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() );
- if ( !anAIS.IsNull() ) {
- Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast( anAIS);
- if ( !aPoint.IsNull() )
- aVertex = TopoDS::Vertex( aPoint->Vertex() );
- }
- if ( aVertex.IsNull() ) {
- // the following happens if there are no points in the current curve, there is only a shape
- /*Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
- if ( aBrepOwner.IsNull() )
- continue;
- if ( aBrepOwner->HasShape() ) {
- const TopoDS_Shape& aShape = aBrepOwner->Shape();
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- {
- aVertex = TopoDS::Vertex( aShape );
- }
- }*/
- }
- }
- }
+
if ( aVertex.IsNull() )
continue;
aPnt = BRep_Tool::Pnt( aVertex );
+ if ( aPntMap.find( aPnt ) != aPntMap.end() )
+ continue;
+ aPntMap[aPnt] = 0;
aSelectedPoints.push_back( aPnt.X() );
aSelectedPoints.push_back( aPnt.Y() );
aSelectedPoints.push_back( aPnt.Z() );
CurveCreator_Widget::CurveCreator_Widget(QWidget* parent,
CurveCreator_ICurve *theCurve,
- Qt::WindowFlags fl)
+ Qt::WindowFlags fl,
+ int theLocalPointRowLimit )
: QWidget(parent), myNewSectionEditor(NULL), myCurve(theCurve), mySection(0),
myDragStarted( false ), myDragInteractionStyle( SUIT_ViewModel::STANDARD ),
- myOCCViewer( 0 )
+ myOCCViewer( 0 ), myLocalPointRowLimit( theLocalPointRowLimit )
{
myNewSectionEditor = new CurveCreator_NewSectionDlg( this );
myNewSectionEditor->hide();
return;
std::list<float> aSelectedList = CurveCreator_Utils::getSelectedPoints( aContext );
+ int aNbPoints = aSelectedList.size()/3;
+ bool isRowLimit = aNbPoints > myLocalPointRowLimit;
+ myLocalPointView->setVisible( !isRowLimit );
+ if ( isRowLimit )
+ return;
std::list<float>::const_iterator anIt = aSelectedList.begin(), aLast = aSelectedList.end();
public:
explicit CurveCreator_Widget( QWidget* parent,
CurveCreator_ICurve *theCurve,
- Qt::WindowFlags fl=0 );
+ Qt::WindowFlags fl=0,
+ int theLocalPointRowLimit = 20);
// OCC viewer manipulation
void setOCCViewer( OCCViewer_Viewer* theViewer );
CurveCreator_TableView* myLocalPointView;
CurveCreator_NewSectionDlg* myNewSectionEditor;
OCCViewer_Viewer* myOCCViewer;
+ int myLocalPointRowLimit;
int mySection;
int myPointNum;
bool myDragStarted;