comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Moving a Line
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Moving a Line [message #20402] Mon, 19 June 2000 00:00
Steve Hartmann is currently offline  Steve Hartmann
Messages: 21
Registered: March 2000
Junior Member
Mark,

Your program stays in the REPEAT loop until a button other than the left
button is pressed. So when you are finished and you press the right mouse
button, 'xx1' is updated to the current x-position of the mouse.

If you replace the REPEAT...ENDREP loop with this:

Repeat Begin
Cursor, xtemp, ytemp, /Wait, /Device
If !Mouse.Button EQ 1 Then Begin
xx1= xtemp
Device, Copy=[0,0,sx,sy,0,0,1]
PlotS, [xx,xx1], [yy,yy], /Device
EndIf
EndRep Until !Mouse.Button NE 1


then it appears to work as desired. It still doesn't work correctly if the
second x-coordinate is smaller than the first (but maybe you aren't concerned
about this possibility). If you replace you last line with the following, then
the magnitude of the line will be re-drawn in the lower left corner, even if
the line goes from right to left.

Device, Copy=[xx < xx1, yy, xx > xx1,yy,5,5,lastwin]

I'm not sure if you want to 'move' or 'copy' the line. Right now it will do
either, depending on where the first line is drawn. You can add the following
line at the end of the program to erase the first line:

Device, Copy=[0,0, sx, sy, 0, 6, 1]

I hope this helps,
Steve Hartmann

Mark Guagenti wrote:

> I need some help figuring out how to copy a line drawn on the current
> graphics window to another position in the same window. What should happen
> is the user draws a straight line with the mouse on the current window and
> then that line he drew gets moved to the lover left hand corner of the
> window. What my program does right now is when the user clicks with his
> left mouse button it gets the first point then waits for the user to click
> the left mouse button again to get the second point. The program then uses
> plots to make a straight horizontal line using the 2 x positions
> found. The program SHOULD then copy that line to start at position
> [5,5]. But instead the program draws a line starting at [5,5] which goes
> to the x position of the current mouse position instead of the last
> clicked mouse position. I attached the code I am using to try
> this. Thanks for any help.
>
> -- Mark
>
> Grace and peace to you from God our Father and the Lord Jesus Christ.
> 1 Cor. 1:3
>
> PRO CursorHelp
> result = Dialog_Message('Click with your LEFT
> mouse button to choose the first point. Then click your LEFT mouse button
> again to choose the second point. Click the RIGHT mouse button to show
> the measurement.', /INFORMATION)
> Window, 2, XSize=300, YSize=300
> sx = 300
> sy=300
> LastWin = !D.Window
> Window, 1, /Pixmap, XSize =300, YSize=300
> WSet, LastWin
> Cursor, xx, yy, /Device, /Down
>
> y = yy - 0
> x = xx - 0
> if !order ne 0 then y = sy - 1 - y ;Invert?
> if (x lt 0) or (x ge sx) or (y lt 0) or (y ge
> sy) then begin
> result = dialog_message('Point outside
> image', /INFORMATION)
> return
> endif
> REPEAT BEGIN
> Cursor, xx1, yy1, /Wait, /Device
> Device, Copy=[0,0,sx,sy,0,0,1]
> PlotS, [xx,xx1], [yy,yy], /Device
> ENDREP UNTIL !Mouse.Button NE 1
> Device, Copy=[xx,yy,xx1,yy,5,5,lastwin]
> END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: using TVRD on idl 5.1
Next Topic: Re: user graphics drawing without prior current image knowledge

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 08:30:29 PDT 2025

Total time taken to generate the page: 0.40041 seconds