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

Home » Public Forums » archive » Re: Tracking Cursor in Object Graphics Draw Widgets
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: Tracking Cursor in Object Graphics Draw Widgets [message #42249] Mon, 24 January 2005 14:57
Robert Barnett is currently offline  Robert Barnett
Messages: 70
Registered: May 2004
Member
Indeed, it does require a little more work if you're doing it as a once
off. There are two ways I see:

1) Putting IDLgrWindow into a Widget_Draw and doing event processing
using widgets to emulate tvcrs().
2) Rendering onto IDLgrBuffer and displaying the image and cursor using
tv, thus you can use tvcrs(). However, there may be signifcant
performance issues.

In practise most of my applications are in a Widget_Base and have event
loops set up. Thus, most of the work required for option 1 would be done
anyway :)

Robbie

David Fanning wrote:

> Antonio Santiago writes:
>
>
>> I dont know if I understand so well your question.
>>
>> I am supossing you are refering to have 2 widget draw with a pair of
>> "photos" and select some points on one implies select the same points in
>> the other.
>>
>> (I hope i am right with my suposition because this message is a bit
>> sticky :) )
>>
>
> Alas, what I was referring to was the object graphics
> equivalent of TVCRS. This turns out to be an old feature
> request that has never been implemented. To work around it,
> you usually define some kind of "symbol" object to use as
> a cursor, and you move that around in both windows, using
> whatever event or message passing capability you have built
> into your objects to communicate with one another.
>
> It's a bit more work than I was hoping for, but ... that's
> the nature of object graphics. :-)
>
> Cheers,
>
> David
>
>


--

nrb@
Robbie Barnett
imag
Research Assistant
wsahs
Nuclear Medicine & Ultrasound
nsw
Westmead Hospital
gov
Sydney Australia
au
+61 2 9845 7223
Re: Tracking Cursor in Object Graphics Draw Widgets [message #42264 is a reply to message #42249] Fri, 21 January 2005 09:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Antonio Santiago writes:

> I dont know if I understand so well your question.
>
> I am supossing you are refering to have 2 widget draw with a pair of
> "photos" and select some points on one implies select the same points in
> the other.
>
> (I hope i am right with my suposition because this message is a bit
> sticky :) )

Alas, what I was referring to was the object graphics
equivalent of TVCRS. This turns out to be an old feature
request that has never been implemented. To work around it,
you usually define some kind of "symbol" object to use as
a cursor, and you move that around in both windows, using
whatever event or message passing capability you have built
into your objects to communicate with one another.

It's a bit more work than I was hoping for, but ... that's
the nature of object graphics. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Tracking Cursor in Object Graphics Draw Widgets [message #42265 is a reply to message #42264] Fri, 21 January 2005 09:28 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Hi,

I dont know if I understand so well your question.

I am supossing you are refering to have 2 widget draw with a pair of
"photos" and select some points on one implies select the same points in
the other.

(I hope i am right with my suposition because this message is a bit
sticky :) )





Some time ago I create a little "EventAction" class that can add signals
(events) and actions to the objects.
Supossing you have a new object graphics class that show an image and
select some points you can use "EventAction" to emit the signal
"point_select" and configure a method of your class to receive the event.
Then you can connect one object with the other using signals (events).

For example, i have a class that shows a "photo" and permits me to
select a region. It inherits from my "EventAction" class and:


FUNCTION SelectMap::Init, parent, _EXTRA=extra

;;Initilize superclass
result = self->EventAction::Init()

IF NOT KEYWORD_SET(parent) THEN RETURN, 0

;;Create widget and object hieriarchy.
wBase = WIDGET_BASE(parent)
wDraw = WIDGET_DRAW(wBase, GRAPHICS_LEVEL=2, /EXPOSE_EVENTS, $
/BUTTON_EVENTS, /MOTION_EVENTS, _EXTRA=extra, $
UVALUE={class_name: 'SelectMap', object: self, $
handler: 'EventHandler'})

self.parent_id = parent
self.base_id = wBase
self.widget_id = wDraw

;;Register the 'event' of the class
self->AddEvent, 'POINT_SELECT'
self->AddEvent, 'POINT_UNSELECT'
self->AddEvent, 'LINE_SELECTION'
self->AddEvent, 'SQUARE_SELECTION'
self->AddEvent, 'MOTION'

self->Initialize

RETURN, 1
END


I initialize some signals (events) in the class.
Later in the method that handles the events i emit the corresponding
events. For example when I select a point:

self->EmitEvent, 'POINT_SELECT', $
EVENT_STRUCT={x: values[0], y: values[1]}

Then all method object, function or procedures that are connected with
that signal are executed.


You can use the same mechanism to "connect" your classes without
coupling them. One class dont known anything of the others that are
listening it.


Well, this is a link to my home page:
" http://asantiago.gentelibre.org/index.php/archives/2004/11/1 8/a-signal-mechanism-for-objects-in-idl/".
It has an example how to use. It is not very object oriented but at work
i use it between object and helps me very often.

Bye.
Antonio


> Object Graphics Gurus,
>
> Suppose I have two object graphics draw widgets in a program.
> And suppose I wanted to move the cursor in one window and
> have it mirrored in the other. Anybody know how to do that
> in object graphics?
>
> Cheers,
>
> David
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Convert ascii data to binary
Next Topic: Plotting streamlines in 3D

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

Current Time: Thu Oct 09 09:32:46 PDT 2025

Total time taken to generate the page: 0.48535 seconds