[vtkusers] interaction problem

G G greenlander1986 at gmail.com
Mon Apr 25 12:49:13 EDT 2011


I have something like this...

void ImageInteraction::Execute(vtkObject *, unsigned long event, void *)
{
    vtkRenderWindowInteractor *interactor = this->GetInteractor();

    int lastPos[2];
    interactor->GetLastEventPosition(lastPos);
    int currPos[2];
    interactor->GetEventPosition(currPos);

    if (event == vtkCommand::LeftButtonPressEvent)
      {
      this->Slicing = 1;

       // Pick at the mouse location provided by the interactor
       this->Picker->Pick(interactor->GetEventPosition()[0],
                   interactor->GetEventPosition()[1],
                   interactor->GetEventPosition()[2], this->Renderer);

       double pos[3];
       this->Picker->GetPickPosition(pos);



    // There could be other props assigned to this picker, so
    // make sure we picked the image actor
    vtkAssemblyPath* path = this->Picker->GetPath();
    bool validPick = false;

    if (path)
      {
      vtkCollectionSimpleIterator sit;
      path->InitTraversal(sit);
      vtkAssemblyNode *node;
      for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)
        {
        node = path->GetNextNode(sit);
        if (this->Actor == vtkImageActor::SafeDownCast(node->GetViewProp()))
          {
          validPick = true;
          break;
          }
        }
      }

    if (!validPick)
      {
      return;
      }
      }
    else if (event == vtkCommand::LeftButtonReleaseEvent)
      {
      this->Slicing = 0;
      }
    else if (event == vtkCommand::MouseMoveEvent)
      {
      if (this->Slicing)
        { // something
        }
      else
        {
        vtkInteractorStyle *style =
vtkInteractorStyle::SafeDownCast(interactor->GetInteractorStyle());
        if (style)
          {
          style->OnMouseMove();
          }
        }
      }
}

And I would like to get array pos to my GUI QT. I dont know, how to emit
signal from this class/method or "return" value to GUI class
Thanks for all answers.


2011/4/25 G G <greenlander1986 at gmail.com>

> Do you have some example? or example on the internet, please. I am trying
> something all afternoon but any solution :(
>
> 2011/4/25 Rashid Tanweer <quantum_cook at yahoo.com>
>
>> Hi,
>> QT and VTK events are different and are generated through seperate
>> pipelines. Best way is to have them both catch, vtk events in vtkCommand
>> Callback by registering it through interactor and QT Event by registering a
>> proper slot for it.
>>
>> Regards,
>> Rashid
>>
>> ------------------------------
>> *From:* G G <greenlander1986 at gmail.com>
>> *To:* vtkusers at vtk.org
>> *Sent:* Mon, April 25, 2011 1:30:35 AM
>> *Subject:* [vtkusers] interaction problem
>>
>> Hi, could someone help me, how to connect this code
>>
>> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/ImageProcessing/Cxx/ImageSlicing.cxx
>> with
>> vtkEventQtSlotConnect
>> ?
>> A dont know how to connect it :(
>> Thanks a lot
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110425/51b21545/attachment.htm>


More information about the vtkusers mailing list