Due: Monday Mar 10, 2003

Homework 3

  1. In this homework, we will begin to explore the elements necessary to visualize large data geographical data set such as the TIGER data set. There are two sets of elements we explore: (a) GUI Interface, (b) Mechanics of Zooming and Panning.
  2. PART A Your GUI interface must set up a Window with two panels. It will look something like the following example Java applet program called PanelTest2.java. To compile and test this applet, type "make panel2" if you have the following Makefile in the current directory.

    For PART A: we want you to extend the PanelTest2.java program.

    	EXERCISE A-1: Draw borders around each of the 2 panels.
    	You will need the getSize() method.
    
    	EXERCISE A-2: The current buttons don't do anything.
    	Make the "Quit" button cause the applet to terminate.
    	Make the "Update" button read the text in the TextField,
    	and update the label "Old Entry: (BLANK)" to
    	"Old Entry: ..." where "..." is the text entered.
    	
  3. PART B The TIGER data for a single county is already too large to be properly visualized in a window. What we need are the ability to zoom and pan over the image. Here is a simple Java applet program called TranslateTest.java which reads an image, and allows you to pan the image. Here is the sample saint.gif. To compile and test this applet, type "make xlate" (assuming the same Makefile from part (a).

    For PART B: we want you combine TranslateTest.java with the GUI interface of PanelTest2.java. The result is a zoom-pan GUI interface.

    	EXERCISE B-1: Merge the present program (TranslateTest.java)
    	with the previous program (PanelTest2.java).
    	You basically replace Label and TextField components
    	in the original PanelTest2.java with a pannable image.
    	Call the resulting program "Pan.java".  In particular, the
    	current image translation demo should be placed in the
    	centerPanel of a workPanel.
    
    	EXERCISE B-2: Extend Pan.java with the ability to zoom.
    	Add two buttons named "+" and "-" into the controlPanel.
    	Clicking these will double or half the image size.
    	Call the resulting program PanZoom.java.
    	
  4. IMPLEMENTATION NOTES AND HINTS:
    -- Applets have getImage() methods that can read from a URL. But suppose you want to implement Pan.java as an application. You can read images almost as easily as in Applets:
    		import java.awt.Toolkit;
    		...
    		Image myI = getImage("file.name");     // method 1
    		URL myUrl = new URL("http://cs.nyu.edu/~yap/");
    		Image myI = getImage(myUrl);	       // method 2
    	
    The getImage() method, however, is taken from the Toolkit. So be sure to do this import.
  5. INSTRUCTIONS FOR SUBMITTING THIS HOMEWORK:
    -- Send me an email with the SUBJECT "hw3" and with a tar file as attachment. Your tar file should contain everything I need to compile and test your programs.
    	(1) The following java programs:
    		PanelTest3.java (for part A-1),
    		PanelTest4.java (for part A-2).
    		Pan.java (for part B-1),
    		PanZoom.java (for part B-2).
    	(2) An associated html file for each of the four programs.
    		The should be named "PanelTest3.html",
    		"PanelTest4.html",
    		"Pan.html" and "PanZoom.html".
    
    	(2) a Makefile (by extending the Makefile we provided above)
    	You need the following targets for your make file:
    
    		one:	to compile and test PanelTest3.java
    		two:	to compile and test PanelTest4.java
    		three:	to compile and test Pan.java
    		four:	to compile and test PanZoom.java
    
    	

    -- Be sure to cc your email to EACH member of the team. This helps me when I send my response to the whole team.
    -- Please be sure that all your programs are minimally commented, and can compile and run before you submit.