Creating Panels in iTools [message #46492] |
Tue, 22 November 2005 16:00  |
James Everton
Messages: 19 Registered: November 2005
|
Junior Member |
|
|
Hello all,
This is my first post using google groups, but I have found that a lot
of your replies to other topics are extremely helpful and well thought
out. So, I would like to pre-emptively thank you for at least reading
this.
Here is my situation right now:
I recently started interning at a company that handles satellite
imagery, and I have been given the job to create user interfaces (using
iTools) that read in and output the images. In the last month, I've
started learning IDL and the iTools libraries, so I am a bit of a
beginner to all this, but I've been able to create a basic interface
that does some of what I want. Unfortunately, I've having a little
problem trying to create a UI panel.
First of all, I'm able to make a simple panel, but I have not been able
to find any help on how to relocate the panel. At the moment, it
automatically shows up on the right side of the window with the "image"
panel I need, but I would like to place it on the left side.
Secondly, I'm having a little trouble with the event handling within
the panel. In my panel, I have a series of draw widgets that are
essentially thumbnails that I would like the user to be able to click
on. However, I'm having trouble understanding how I can register a
mouse-click on one of the thumbnails, and then how I can then replace
the image in the main window with a blown up version of the thumbnail.
> From some of your previous postings, I can tell that not many of you
can stand iTools. It seems like there are a lot of better languages I
could use to create this, but I need the image processing functions in
iTools for later use.
Thank you very much for any help you can give me.
Sincerely,
James Everton
|
|
|
Re: Creating Panels in iTools [message #46668 is a reply to message #46492] |
Wed, 07 December 2005 09:46  |
David Alexander
Messages: 26 Registered: August 2005
|
Junior Member |
|
|
James Everton wrote:
> To let you know, I decided to keep the panel I made on the right side
> using "the simple method" and my boss didn't seem to mind that very
> much. Also, I was able to make the event listener on the draw widgets
> that I created in my panel. The problem I'm having now is that I'm not
> sure how to initially put my images into the draw widgets of the panel,
> nor exactly how to retrieve the images from the parameter set of the
> iTool to put into the widgets, or the main window when one is clicked.
>
> In my code right now, I created some temporary images in my initial
> procedure and put them into the parameter set for the iTool using this
> syntax, where 'image1' is the image:
> /----------------------------------
> oParmSet->Add, OBJ_NEW('IDLitDataIDLImagePixels', image1, $
> NAME='Image Planes', $
> IDENTIFIER='ImagePixels', $
> _EXTRA=_extra), PARAMETER_NAME='IMAGE1'
> \----------------------------------
>
> Also, when I created the draw widgets in my panel, I attempted to
> create an array of pointers to the draw widgets (to be used later when
> I wanted to
> /----------------------------------
> ; Create the draw widget
> wTV1 = widget_draw(wBase, xsize=128, ysize=128, /BUTTON_EVENTS, $
> EVENT_PRO = 'tv1_event')
> ; Make the array
> TVs = ptrarr(7, /allocate_heap)
> TVs[0] = ptr_new(wTV1)
> \----------------------------------
> However, when I used this code and did some checks to see what type of
> variable *TVs[0] was (using the 'help' procedure), I got the response
> that it was a LONG value, and not anything particularly useful.
>
> To sum up my questions in the order I should probably implement them:
> + How do I get identifiers to the draw widgets so I can put them into
my 'TVs' array?
> + How do I retrieve the images that I put into the parameter set of the
iTool?
> + How do I use the identifier to a draw widget to then 'TV' the image
from the parameter set?
For the draw widgets:
-------------------------
One idea: you could give each draw widget a unique name (using the
UNAME keyword when calling WIDGET_DRAW), then in your panel event
handler get the UNAME of the widget that sent the event like this:
uname=WIDGET_INFO(event.id,/UNAME)
then create a CASE block that would do the right thing depending on
which draw widget was clicked.
To get the images in the draw widgets, you'll need access to the data
manager where you stored the images. You can do this with the UI object
that's passed to your panel code as the 2nd argument:
oParamSet=oUI->GetByIdentifier("/Data Manager/paramsetname")
where 'paramsetname' is the identifier you gave to the parameter
set that contains the images. Then you can grab that parameters from
the paramset, and then the data. Something like this:
oParam=oParamSet->GetByName("image1")
result=oParam->GetData(image1)
The LONG value you see when calling HELP on the draw widget is the
widget ID of the widget (all widgets are given a unique ID which is a
long). To get access to the window in the draw widget, you need to do:
WIDGET_CONTROL,wTV,GET_VALUE=win
If you're using direct graphics, 'win' will be the window ID
(that you would pass to WSET). If you're using object graphics,
'win' will be the object reference to the IDLgrWindow object in the
draw widget.
Data Manager/Updating the Image:
------------------------------------------
When you initially load your data, you would presumably create your own
parameter set containing all the image data, and store it in the data
manager. This parameter set would not be associated with any particular
visualization. Then when you want to update the image data in the image
visualization (in the event handler of your panel, for example), you
would do something like this:
;Get the image data:
oParamSet=oUI->GetByIdentifier("/Data Manager/paramsetname")
oParam=oParamSet->GetByName("image1")
;Get the image visualization.
;If you have more one image visualization in your tool, this may need
to be changed.
idImage=oTool->FindIdentifiers("*image",/VISUALIZATIONS)
oImage=oTool->GetByIdentifier(idImage)
;Update the image visualization with the new data
oImage->OnDataChangeUpdate,oParam,"IMAGEPIXELS"
I think this will automatically redraw the image visualization, but if
it doesn't, you may additionally need to call:
oTool->RefreshCurrentWindow
You can initially create the image visualization by either basing your
tool on iimage, and calling iimage with the first image as the command
line argument. Or you could use the Insert->Visualization menu item to
create the image. A third (undocumented) way is to call the
CreateVisualization method on the system object
(IDLitSystem::CreateVisualization).
|
|
|