CWPlot
SIMG 726 Winter 2005
Final Project
A Tutorial on Compound Widgets
Jake Ward
2 Mar 2006
Contents
1
Project Information
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . .
1.2 Problem Statement . . . . . . . . . . . . . . . . . .
1.2.1 Using Only IDL Widget Primitives . . . . .
1.2.2 Compound Widgets to the Rescue . . . . . .
1.2.3 A Compound Widget for Creating IDL Plots
.
.
.
.
.
2
2
2
2
3
3
2
Compound Widget (CW Plot) Walkthrough/Testing
2.1 CW Plot Walkthrough . . . . . . . . . . . . . . . . . . . . . . .
2.2 CW Plot Testing . . . . . . . . . . . . . . . . . . . . . . . . . .
4
4
7
3
Conclusion
8
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Chapter 1
Project Information
1.1
Introduction
This tutorial is comprised of three parts:
1) This document, itself, which includes a discussion of IDL compound widgets as well as a walkthrough of an implementation of an example that uses a
compound widget that I created.
2) An MS Powerpoint presentation entitled Compound Widgets.ppt, which is
a guide for creating IDL compound widgets.
3) The IDL code in the .zip file, which includes an IDL project that holds
my implementation of a compound widget to help you create plots for potential
conference submissions, lab reports, or theses (n.b. an IDL code printout is not
included in this document because it would make it prohibitively long).
1.2
1.2.1
Problem Statement
Using Only IDL Widget Primitives
One can construct complex widget structures using just the primitive widgets in
IDL. However, they suffer the following drawbacks:
1) Large widget applications are difficult to organize and maintain.
2) Code reuse is stifled because complicated widget sub-trees cannot be successfully extricated and used in other parts of the program.
3) Testing becomes harder and redundant.
2
CHAPTER 1. PROJECT INFORMATION
1.2.2
3
Compound Widgets to the Rescue
IDL compound widgets are complete, self-contained, reusable sub-trees. They
behave like primitive widgets for the most part and are easy to maintain. The
inner details are hidden (i.e. abstracted) from the programmer wanting to use the
compound widget, yet programmers still have access to the compound widget user
value to store the state when instantiating the compound widget.
For complete details on how to construct a compound widget, consult the included presentation.
1.2.3
A Compound Widget for Creating IDL Plots
I think every IDL/ENVI user has spent hours (often in frustration) trying to construct/configure plots to be used in lab reports, publications, and/or theses. My
idea was to take code already available via David Fanning of Fanning Software
Consulting (at http://www.dfanning.com), and create an IDL compound widget
that encapsulates all the functionality necessary to easily be able to configure any
kind of plot which one could conceive. An illustrated walkthrough of my demo
program is included in Chapter 2.
Chapter 2
Compound Widget (CW Plot)
Walkthrough/Testing
2.1
CW Plot Walkthrough
As an aside, I would like to start by saying there are a lot of areas for potential
improvement that will most likely depend upon the overall level of interest this
tool receives. I will try to highlight potential areas and expound upon my ideas
for improvement.
The first step is to open the project file (cw proj.prj) within the IDL Development Environment. All of the variables are described in the detailed comment
section at the top of the file. The Build and Run commands are setup for readyuse. Building the project and running it will execute the demo cw program within
cwp plot.pro. You should see a small widget open that looks like the one in Figure
2.1.
In the current version of my compound widget, the user can only select from
Figure 2.1: Opening Demo Screen
4
CHAPTER 2. COMPOUND WIDGET ( CW PLOT) WALKTHROUGH/TESTING5
Figure 2.2: CW Plot
three canned functions to plot and three similar functions to overplot. For this
compound widget to be of any practical use, an IDL text widget needs to be included that allows the user to enter a function in ’string’ form that IDL can execute
via its EXECUTE() function. This string would then be compiled and executed to
fill out an array variable that could then be passed into the compound widget for
plotting/overplotting.
Getting back to the walkthrough, select any function to plot (and oplot, if
desired) and then select Start CW Demo from the Start drop-down menu. For instance, if you had selected to plot Sin(x/5)/Exp(x/50) and oplot Cos(x/3)/Exp(x/40),
your CW Plot widget should look like the one in Figure 2.2.
From here you can configure your plot by selecting the Modify Plot button at
the bottom of the screen depicted in Figure 2.2. This should bring up a dialog like
the one in seen in Figure 2.3, with all of the settings at their defaults.
Almost every aspect of the plot from titles and line/data point styles to a myriad of colors can be modified using this dialog. When you are finished, click
Close. If you are satified with your work, choose Save As from the screen shown
CHAPTER 2. COMPOUND WIDGET ( CW PLOT) WALKTHROUGH/TESTING6
Figure 2.3: Plot Options Dialog
CHAPTER 2. COMPOUND WIDGET ( CW PLOT) WALKTHROUGH/TESTING7
again in Figure 2.2. This will allow you to save your file in three common image
formats: bmp, jpeg, and tiff. I understand that there may some interest in saving
plots in post script–once again, David Fanning’s website would probably prove to
be of use since I am fairly certain he has libraries coded-up for doing just this.
2.2
CW Plot Testing
My approach to testing this program was not very mathematically (or scientifically) rigorous. Due to the sheer magnitude of library code involved, I was unable
to test all of the routines’ functionality. However, since this code’s main purpose
is for creating visually-pleasing plots for publications/presentations, I embarked
upon testing it just by ensuring the results were what I had intended and that they
were perceived to be correct. Once I was satisfied with the results I was getting
and could no longer get the program to crash, I considered it to be sufficiently
robust for this academic purpose.
Chapter 3
Conclusion
I would like to conclude by stating that this was a fun (and seemingly appropriate)
project, and that I would be happy to assist anyone that would like to use this
program or IDL compound widgets in the future.
8
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement