void ImageSelectionToolCustom::unHighlight() { removeHighlight(); port = NULL; theX1 = 0; theX2 = 0; theY1 = 0; theY2 = 0; highlight_node_->setVisible(false); }
ACTION EdgeCreationMode::handleClick(double x, double y, unsigned hits, unsigned* pickBuffer) { std::vector<Shape*>* selected = getSelectedVector(); std::vector<Shape*>* shapes = getShapesVector(); selectLogic(hits, pickBuffer); ACTION ret = UNDEFINED; if(selected != NULL && shapes != NULL) { Circle* cl = NULL; Circle* cr = NULL; std::vector<Shape*>::iterator it; for(it = selected->begin() ; it != selected->end() ; ++it) { if((*it)->getType() == CIRCLE) { if(cl == NULL) { cl = static_cast<Circle*>(*it); } else { cr = static_cast<Circle*>(*it); break; } } } if(cl != NULL && cr != NULL) { removeHighlight(cl); removeHighlight(cr); Line* edge = new Line(cl, cr); shapes->push_back(edge); cl->addEdge(edge); cr->addEdge(edge); ret = ADDEDGE; } } return ret; }
int ImageSelectionToolCustom::processMouseEvent( ViewportMouseEvent& event ) { //SelectionManager* sel_manager = context_->getSelectionManager(); Q_EMIT mouseHasMoved(event.x, event.y); int flags = 0; moving_ = false; if( event.leftDown() ) { selecting_ = true; sel_start_x_ = event.x; sel_start_y_ = event.y; } if( selecting_ ) { /**std::cout<<"tool selected x1 " <<sel_start_x_<<std::endl; std::cout<<"tool selected y1 " <<sel_start_y_<<std::endl; std::cout<<"tool selected x2 " <<event.x<<std::endl; std::cout<<"selected y2 " <<event.y<<std::endl;**/ theX1 = sel_start_x_; theX2 = event.x; theY1 = sel_start_y_; theY2 = event.y; port = event.viewport; highlight( event.viewport, sel_start_x_, sel_start_y_, event.x, event.y ); if( event.leftUp() ) { SelectionManager::SelectType type = SelectionManager::Replace; M_Picked selection; /*if( event.shift() ) { type = SelectionManager::Add; } else if( event.control() ) { type = SelectionManager::Remove; }*/ //sel_manager->select( event.viewport, sel_start_x_, sel_start_y_, event.x, event.y, type ); removeHighlight(); Q_EMIT select( sel_start_x_, sel_start_y_, event.x, event.y ); selecting_ = false; } flags |= Render; } else { highlight( event.viewport, theX1, theY1, theX2, theY2 ); } return flags; }