Example #1
0
void cv::viz::InteractorStyle::zoomOut()
{
    FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);
    // Zoom out
    StartDolly();
    double factor = 10.0 * -0.2 * .5;
    Dolly(std::pow(1.1, factor));
    EndDolly();
}
Example #2
0
void
pcl::visualization::PCLVisualizerInteractorStyle::zoomOut ()
{
  FindPokedRenderer (Interactor->GetEventPosition ()[0], Interactor->GetEventPosition ()[1]);
  // Zoom out
  StartDolly ();
  double factor = 10.0 * -0.2 * .5;
  Dolly (pow (1.1, factor));
  EndDolly ();
}
void vtkInteractorStyleQuench::OnMouseMove()
{
  _mouse_moved = true;
	vtkRenderWindowInteractor *rwi = this->Interactor;
	int x = rwi->GetEventPosition()[0];
	int y = rwi->GetEventPosition()[1];
	int dx = rwi->GetEventPosition()[0] - rwi->GetLastEventPosition()[0];
	int dy = rwi->GetEventPosition()[1] - rwi->GetLastEventPosition()[1];
	this->FindPokedRenderer(x,y);

	//If we are still drawing a gesture, continue doing so
	if(_interaction_mode == INTERACTION_DRAW_GESTURE)
	{	  
		_GestureInteractor->AddPoint(x,y);
		//NotifyAllListeners(PEvent ( new EventRefreshViz(true) ) );
		//CurrentRenderer->GetRenderWindow()->Render();
		return;
	}

	if (_interaction_mode == INTERACTION_PATHWAYS)
	  {
	    _pathwayViz->OnMouseMove(x, abs(y));
	  }
	  /*	if(_left_button_down && _pathwayViz->OnMouseMove(x,abs(y))) {
	  cerr << "mode selector moved." << endl;
		return; //Mode selector panel moved
		}*/

	if (_interaction_mode == INTERACTION_ROI_EDIT)
	  {
	    _voiEditor->OnMouseMove(x,abs(y));
	  }

	/*	if(_editing_voi && (_left_button_down || _right_button_down) && _voiEditor->OnMouseMove(x,abs(y)))
		return; //ROI editing in process.
	*/
	else {
	  switch (this->State)  
	    {
	    case VTKIS_ROTATE:
	      Rotate();
	      InvokeEvent(vtkCommand::InteractionEvent, NULL);
	      break;
	    case VTKIS_PAN:
	      Pan();
	      InvokeEvent(vtkCommand::InteractionEvent, NULL);
	      break;
	    case VTKIS_DOLLY:
	      {
		double *center = CurrentRenderer->GetCenter();
		double dyf = MotionFactor * (double)(dy) / (double)(center[1]);
		double scale = pow((double)1.1, dyf);
		Dolly(scale);
		_voiViz->Dolly(scale);
		CurrentRenderer->GetRenderWindow()->Render();
	      }
	      InvokeEvent(vtkCommand::InteractionEvent, NULL);
	      break;
	    case VTKIS_SPIN:
	      Spin();
	      InvokeEvent(vtkCommand::InteractionEvent, NULL);
	      //this->frame->RefreshViz ();
	      break;
	      //default:
	      // if(_Scene->GetPathwayViz()->PickManipulationTools(x,y) != -1)
	      //  frame->RefreshViz();
	      // break;
	    }
	}

}