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

Home » Public Forums » archive » Re: Dragging mouse question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Dragging mouse question [message #3963] Thu, 13 April 1995 00:00
Fergus Gallagher is currently offline  Fergus Gallagher
Messages: 41
Registered: January 1995
Member
cabr69@ccsun.strath.ac.uk ( "D.H.Brooks") wrote:
> Hello everyone,
>
> I have written a (very simple) procedure which displays data points on
an xy-axis
> and allows you to manipulate them using the left mouse button (i.e. it
just uses
> tvrdc,x,y,/down to get the point-within a specified range-and reads the
position of
> the next click to place it).At the moment all it does is re-plot every
time you move
> a point and although it is satisfactory for my purposes it takes a
> while to get the plot line looking smooth.Clearly it would be neater
> if i could drag the points and have the screen continually update the
> plot so i could see the original line itself moving
> with the cursor.I expect it to be fairly simple but have looked
> in the IDl manual/reference guide and at the library routines for
> clues and have found nothing helpful.Does anyone know what commands
> i should be using? Any help would be appreciated.
>
> Cheers,
>
> David
>

Dear David,

Your simplest option is probably to use

device,set_graphics_function=6 ; GXxor. IDL Ref manual page 3-20

With Xor set, redrawing a line erases it, since (a xor b) xor b == a
This works well for black and white line-type drawings, but an
intermediate (a xor b) can produce some funny colours in other
situations.

Your line drawing code might look something like:
(I'm writing this on the fly, so don't trust it!!!)

;=============================
pro rubberline,x,y ; x and y are 2-element vectors
common rub,oldx,oldy

device,get_graphics=oldgraphics
device,set_graphics=6; xor

if n_elements(oldx) ne 0 then begin
plots,oldx,oldy ; undraw old line - if it exists.
endif
plots,x,y
oldx = x
oldy = y
device,set_graphics=oldgraphics
end
;==============================

when you've finished drawing a line, you will probably want to draw it
with the default graphics function (15=GXset)


Fergus

=================================================
| Fergus Gallagher |
| Remote Sensing Applications Development Unit |
| British National Space Centre |
| Monks Wood |
| Huntingdon PE17 2LS / UK |
| |
| F.Gallagher@nerc.ac.uk |
| http://uh.nmt.ac.uk/bnsc/fgg.html |
=================================================
[Message index]
 
Read Message
Previous Topic: q
Next Topic: Re: What IS PV-WAVE??

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

Current Time: Wed Oct 08 19:30:22 PDT 2025

Total time taken to generate the page: 0.00440 seconds