[vtkusers] How to draw lines in wxWindow

Sercani sercanimailgroups at gmail.com
Fri Jun 27 07:53:20 EDT 2008


Thanks again Julian, I've tried this again but nothing is drawn , any other
ideas or samples?

 

From: Julian Ibarz [mailto:julian.ibarz at gmail.com] 
Sent: Thursday, June 26, 2008 4:46 PM
To: Sercani; vtkusers at vtk.org
Subject: Re: [vtkusers] How to draw lines in wxWindow

 

To convert from wx coordinates to display coordinates (that is the display
coordinates of VTK and viewport coordinates of opengl) you just simply did
this :

x = x;
y = height - y; // height of the renderer

And doing this stuff (java syntax) :

vtkCoordinate coord = new vtkCoordinate();
coord.SetValue(x,y,0);
coord.SetCoordinateSystemToDisp

lay();

 

2008/6/26 Julian Ibarz <julian.ibarz at gmail.com>:

To convert from wx coordinates to display coordinates (that is the display
coordinates of VTK and viewport coordinates of opengl) you just simply did
this :

x = x;
y = height - y; // height of the renderer

And doing this stuff (java syntax) :

vtkCoordinate coord = new vtkCoordinate();
coord.SetValue(x,y,0);
coord.SetCoordinateSystemToDisplay();




2008/6/26 Sercani <sercanimailgroups at gmail.com>:

Hi everyone;

I am trying to get the points where user clicks and drags the mouse and
create shapes by using these points. I've written a class that looks like
wxVTKRenderWindowInteractor which doesn't handle interaction but shows vtk
scene in wxWindow. When user selects one of the toggle toolbar buttons (for
drawing line, angle, rectangle etc.) mouse events are sent to a class named
GlassPanel that handles all drawing stuff. When user clicks a point, that
point is taken as p1, and when user starts dragging the mouse , position of
mouse is taken as p2, depending on what shape is selected a shape must be
created by using these two points. Firstly I decided to use vtkLineWidget
for drawing lines but I couldn't manage it, because wxWidgets coordinate
system's origin is upper left hand corner, and vtk uses lower left hand
corner as origin. I tried to convert wxWidgets event coordinates to
vtkCoordinate system, but I even couldn't find which coordinate system is
used by vtkRenderer. Wherever i click on wxWindow lines are drawn at the
windows center. How should I convert these coordinates?Or what is the best
way to draw 2D shapes using vtk?

Thanks already.

 

 

 

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




-- 
Julian Ibarz 




-- 
Julian Ibarz 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080627/41f173a8/attachment.htm>


More information about the vtkusers mailing list