Java Reference
In-Depth Information
The getJpeg() method's parameters are described here:
ra and dec specifythecentercoordinatesoftheimageintermsofrightascen-
sion and declination values, where each value is expressed in degrees.
scale specifies a scaling value in terms of arcseconds per pixel. One arc-
second equals 1/1296000 of a circle.
width and height identify the dimensions of the returned image.
opt identifies a sequence of character codes for drawing over the image; for
example, G (drawagridovertheimage), L (labeltheimage),and I (invertthe
image).
The getJpeg() method returns the image as an array of bytes. It never returns a
nullreference.Whenanerroroccurs,themethodreturnsanimagethatpresentstheerror
message.
Giventhisinformation,younextneedtofigureouthowtoinvoke getJpeg() .The
following steps accomplish this task:
1. Import
and
from
the
ImgCutout
ImgCutoutSoap
org.sdss.skyserver package.
2. Instantiate ImgCutout .
3. Invoke getImgCutoutSoap() on the ImgCutout instance.
4. Invoke getJpeg() on the returned ImgCutoutSoap instance.
I've created a SkyView application that demonstrates these tasks. This application
presentsaSwing-baseduserinterfaceforenteringthevaluesrequiredby getJpeg() ,
and displays the resulting image. Listing 11-10 presents this application's source code.
Listing 11-10. A client for accessing the Image Cutout web service
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
Search WWH ::




Custom Search