Exemplo n.º 1
0
void Controller::dragAnchorPoint(double x, double y){
	if(getPolygon(x,y) != NULL){
		deselectAllPoints();
		getSelectedPoint(x,y)->setSelection(true);
		glfwSetMousePosCallback(MousePosCallback);
	}
}
void SelectableGeometryFeatures::deselectAll()
{
    deselectAllPath();
    deselectAllPoints();
}
Exemplo n.º 3
0
/**************************************************************
 *
 *  constructor 
 *  @param MainWindow the mainWindow
 *  @param parent the parent widget
 *  @return name the name of the canvas
 *
 *************************************************************/
Canvas2D::Canvas2D(MainWindow* mw, QWidget* parent, const char* name)
    : AbsCanvas(parent, name)
{ 

  _mw = mw;

  //set square number to default
  _squareNumber = SQUARE_NUMBER_DEFAULT; 

  //define canvas2D type
  QString type(name);
  if((type.compare(sectionS))==0){
    _canvasType = SECTION_CANVAS;
  }
  else if((type.compare(cheminS))==0){
        _canvasType = CHEMIN_CANVAS;
  }
  else if((type.compare(profilS))==0){
        _canvasType = PROFIL_CANVAS;
  }
  else{
    _canvasType = W3D_CANVAS;
  }

  //popup menu building (differs from canvas type)
  _fileMenu = new QPopupMenu(this);

  //creation of the QActions
  QAction *polyAction = 
    new QAction(QIconSet(QPixmap("../images/polyline.png")),
		"Polyline",0,this);

  QAction *nurbsAction = 
    new QAction(QIconSet(QPixmap("../images/nurbs.png")),
		"Nurbs",0,this);

  QAction *circleAction = 
    new QAction(QIconSet(QPixmap("../images/ellipse.png")),
		"Circle",0,this);

  QAction *quadriAction = 
    new QAction(QIconSet(QPixmap("../images/quadri.png")),
		"Rectangle",0,this);

  QAction *polygAction = 
    new QAction(QIconSet(QPixmap("../images/polygone.png")),
		"Polygon",0,this);

  QAction *selectAllAction = 
    new QAction(QIconSet(QPixmap("../images/selectAll.png")),
		"Select all",0,this);

  QAction *deselectAllAction = 
    new QAction(QIconSet(QPixmap("../images/deselectAll.png")),
		"Deselect all",0,this);

  QAction *deleteAllAction = 
    new QAction(QIconSet(QPixmap("../images/deleteAll.png")),
		"DeleteAll",0,this);

  //connect actions
  connect(polyAction,
          SIGNAL( activated() ),
          this,
          SLOT(setPolyMode()) );
  connect(nurbsAction,
          SIGNAL( activated() ),
          this,
          SLOT(setNurbsMode()) );
  connect(circleAction,
          SIGNAL( activated() ),
          this,
          SLOT(setCircleMode()) );
  connect(quadriAction,
          SIGNAL( activated() ),
          this,
          SLOT(setRecMode()) );
  connect(polygAction,
          SIGNAL( activated() ),
          this,
          SLOT(setPolygMode()) );

  connect(selectAllAction,
          SIGNAL( activated() ),
          this,
	  SLOT(selectAllPoints()) );

  connect(deselectAllAction,
          SIGNAL( activated() ),
          this,
          SLOT(deselectAllPoints()) );

  connect(deleteAllAction,
          SIGNAL( activated() ),
          this,
          SLOT(deleteAllPoints()) );

  //add QActions to menu
  polyAction->addTo(_fileMenu);
  nurbsAction->addTo(_fileMenu);
  circleAction->addTo(_fileMenu);
  quadriAction->addTo(_fileMenu);
  polygAction->addTo(_fileMenu);
  
  //if it's the canvas profil, disable many tools
  if(_canvasType == PROFIL_CANVAS){
    
    _fileMenu->setItemEnabled(_fileMenu->idAt(2),false);
    _fileMenu->setItemEnabled(_fileMenu->idAt(3),false);
    _fileMenu->setItemEnabled(_fileMenu->idAt(4),false);  
  }

  _fileMenu->insertSeparator();

  selectAllAction->addTo(_fileMenu);
  deselectAllAction->addTo(_fileMenu);
  _fileMenu->insertSeparator();
  deleteAllAction->addTo(_fileMenu);

  //polyline default tool
  _toolMode = POLY_MODE;
  
  //creation of the curves class
  _figure = new Curves(this);;
}