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

Home » Public Forums » archive » Rubber band lines: How to do it
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Rubber band lines: How to do it [message #478] Wed, 15 July 1992 06:17 Go to previous message
eaustin is currently offline  eaustin
Messages: 6
Registered: June 1992
Junior Member
Last week I posted a question to the net asking how to make rubber band lines,
that is, over plot on an existing plot a line from a point to the cursor
that appears to follow the cursor and leave the previously existing plot
unchanged. My thanks to all those who responded, especially Gwyn and Adam.

The trick is to set the graphics function to 6 (XOR) by using the command
DEVICE,SET_GRAPHICS=6
I had seen this in the IDL manual before I asked the question (section E.2)
but I did not understand how it would work. If you then OPLOT a line with
this set you will get a line of some strange color depending on exactly
what your color table is. If you then oplot the same line again the XOR
causes the new line to 'cancel' the old line and sets the original plot,
done with the default graphics function of 3 (COPY), back the way it was.

Thus, my procedure to make rubber band lines was structured like

DEVICE,SET_GRAPHICS=6 ; start XOR plotting
IF (a rubber band line has already been drawn) THEN
OPLOT,the same x and y as the existing rubber band line ;this cancels old line
ENDIF
OPLOT,x and y of the new rubber band line ; this plots new line
set flag to show that a line has been drawn
DEVICE,SET_GRAPHICS=3 ; stop XOR plotting, go back to COPY

This is still not fast like some drawing packages I have seen but it sure
beats continuously replotting the whole plot.

It is still not clear to me exactly how the XOR works in setting colors
but this does give a visible rubber band line. Hope this is helpful.

------------------------------------------------------------ ------
As a further enhancement to the rubber band effect I would like to be able
to get a particular color with XOR set. For example, I would like to be
able to oplot a red X on a red line and have the X move around on the line
in response to the cursor position. Is this posible or does the working of
XOR prevent red on red like this? I would also like to put a blue mark
on a red line and move the blue mark around.
--
Eric J. Austin EMAIL: eaustin@ll.mit.edu
[Message index]
 
Read Message
Read Message
Previous Topic: selecting postscript prolog file in wave/idl
Next Topic: Re: STick Plots...

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

Current Time: Wed Oct 08 17:14:26 PDT 2025

Total time taken to generate the page: 0.00432 seconds