#include "CurveCreator_Widget.h"
#include "CurveCreator_TreeView.h"
#include "CurveCreator_ICurve.hxx"
-//#include "CurveCreator_CurveEditor.hxx"
#include "CurveCreator.hxx"
-//#include "CurveCreator_NewPointDlg.h"
#include "CurveCreator_NewSectionDlg.h"
#include "CurveCreator_Utils.h"
#include "CurveCreator_UtilsICurve.hxx"
#include <OCCViewer_ViewPort3d.h>
#include "OCCViewer_Utilities.h"
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Dir.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_Shape.hxx>
-#include <AIS_LocalContext.hxx>
-#include <Geom_Point.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_Line.hxx>
-
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
setLocalPointContext( aMode == ModificationMode, true );
}
-void CurveCreator_Widget::onAddNewPoint(const CurveCreator::Coordinates& theCoords)
-{
- if( !myCurve )
- return;
- //myCurve->addPoints(theCoords, mySection, myPointNum );
- //mySectionView->pointsAdded( mySection, myPointNum );
- //myPointNum++;
- QList<int> aSections = mySectionView->getSelectedSections();
- if( aSections.size() == 0 ){
- return;
- }
- int aSection = aSections[0];
- myCurve->addPoints(theCoords, aSection); // add to the end of section
- mySectionView->pointsAdded( aSection, myCurve->getNbPoints( aSection ) );
- updateActionsStates();
- updateUndoRedo();
-}
-
void CurveCreator_Widget::onNewSection()
{
if( !myCurve )
onCancelSection();
}
-/*void CurveCreator_Widget::onEditPoint( int theSection, int thePoint )
-{
- if( !myNewPointEditor || !myEdit )
- return;
- mySection = theSection;
- myPointNum = thePoint;
- QString aSectName = QString::fromStdString( myCurve->getSectionName(theSection));
- myNewPointEditor->setEditMode(true);
- myNewPointEditor->setSectionName(aSectName);
- myNewPointEditor->setDimension( myCurve->getDimension() );
- CurveCreator::Coordinates aCoords = myCurve->getCoordinates(theSection,thePoint);
- myNewPointEditor->setCoordinates(aCoords);
- emit subOperationStarted( myNewPointEditor );
-}
-
-void CurveCreator_Widget::onModifyPoint()
-{
- if( !myEdit )
- return;
- CurveCreator::Coordinates aCoords = myNewPointEditor->getCoordinates();
- myEdit->setCoordinates( aCoords, mySection, myPointNum );
- mySectionView->pointDataChanged( mySection, myPointNum );
- updateUndoRedo();
- onCancelPoint();
-}*/
-
void CurveCreator_Widget::onJoin()
{
if( !myCurve )
//=================================================================================
-// function : GeometryGUI::onGetCoordsByClick()
+// function : GeometryGUI::addCoordsByClick()
// purpose : Manage mouse press events in Additon mode
//=================================================================================
-void CurveCreator_Widget::onGetCoordsByClick( QMouseEvent* pe )
+void CurveCreator_Widget::addCoordsByClick( QMouseEvent* pe )
{
if (pe->button() != Qt::LeftButton)
return;
else
ic->Select(); // New selection
- /*TopoDS_Shape aShape;
-
- ic->InitSelected();
- if ( ic->MoreSelected() )
- aShape = ic->SelectedShape();
-
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
- else*/
{
OCCViewer_ViewPort3d* vp = getViewPort();
aPnt = CurveCreator_Utils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
if ( myCurve->getDimension() == 3 ) {
aCoords.push_back( aPnt.Z() );
}
- onAddNewPoint(aCoords);
-// myNewPointEditor->setCoordinates( aCoords );
+ addNewPoint(aCoords);
}
}
break;
}
case AdditionMode: {
- onGetCoordsByClick( theEvent );
+ addCoordsByClick( theEvent );
break;
}
default:
finishCurveModification( CurveCreator_ICurve::SectionToPointList() );
}
+void CurveCreator_Widget::addNewPoint(const CurveCreator::Coordinates& theCoords)
+{
+ if( !myCurve )
+ return;
+ QList<int> aSections = mySectionView->getSelectedSections();
+ if( aSections.size() == 0 ){
+ return;
+ }
+ int aSection = aSections[0];
+ myCurve->addPoints(theCoords, aSection); // add to the end of section
+ mySectionView->pointsAdded( aSection, myCurve->getNbPoints( aSection ) );
+ updateActionsStates();
+ updateUndoRedo();
+}
+
void CurveCreator_Widget::insertPointToSelectedSegment( const int theX,
const int theY )
{