Re: Multi Planar Viewer [message #50513 is a reply to message #50511] |
Wed, 04 October 2006 18:40   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Robbie writes:
> Speaking of messaging. Which would you think is faster?
>
> IDLitIMessaging::DoOnNotify
>
> or
>
> IDLitData::NotifyDataChange
I haven't the faintest idea. I didn't even know
they existed. Too old to learn about them, probably. :-)
> IDLitIMessaging is more particular and makes a single method call to
> IDLitTool, but iTools must search for the matching identifier to call
> ::OnNotify. There are a lot of string comparisons in IDLitIMessaging
> which makes me feel very uncomfortable. I also don't know the etiqutte
> of defining new IDLitIMessaging "Message Strings". IDLitIMessaging
> feels like spaghetti but I guess it gets the job done.
I implemented messaging the way JD recommended (I think it
was him, there were a lot of ideas swirling around at the
time). Every object has the ability to "register" interest
in a message with every other object. When an object does
something that could potentially justify a message, it
looks in its "objects to notify" bin and notifies those
objects who have registered for a particular "message".
For example, a colorbar object sends a "COLORS_CHANGED"
message whenever it modifies the color vectors. Images
that are interested in knowing about such a change (so
they can re-draw themselves with the new colors, for example)
register this interest with the colorbar object. Perhaps
four images are interested, then the colorbar object sends
this "COLORS_CHANGED" message to four image objects, and
four draw widgets are updated when the images draw themselves.
The message sending is very fast. The image re-draw is
relatively slow. If you have 50 mri images on the display
at once, it can take a second or so to see all the
images update themselves. This is primarily because we
have to resize them to display them, since we don't
know ahead of time what size image we are going to need.
This depends on what the user wants to see in each window, etc.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|