Java code...

imap at chesapeake.net imap at chesapeake.net
Fri May 26 03:07:33 EDT 2000



Marc,

The CGI will do whatever the application requires....
In our applications, as a base function, we do image
"Swapping" to no need for the CGI reload page bullshit.
In this case we have java call a mapscript CGI in the
image param that generates "Image Only".

Then you can modify the applet to handle other Mime
Types ;)
 
Regards,

Chris Stuber (mapsurfer)
Silicon Mapping Solutions, Inc.
410.257.3187


Marc JACQUIN wrote:
> 
> Hi all,
> 
> Don't know if you used this applet. This could be really interesting
> specially with the feature that Steve mentioned : the image param can be a
> CGI call.
> 
> Do you know how this works ? What should the CGI return : an URL to a GIF
> (location: url) ?
> 
> thx
> 
> Marc
> 
> > -----Original Message-----
> > From: Stephen Lime [mailto:steve.lime at dnr.state.mn.us]
> > Sent: Wednesday, October 27, 1999 1:15 PM
> > To: mapserver-users at lists.gis.umn.edu
> > Subject: Java code...
> >
> >
> > Ok. Here's my working version. It's Java 1.1 code and compiles fine
> > under 1.2 except for a few "depricated methods" messages. If anyone
> > is interested in porting to 1.2 and swing let me know.
> >
> > To install: Copy the mapimage.class file someplace on you system that
> > is web accessible. If you need to rebuild from source you'll need to make
> > sure that the Netscape java classes (either a .zip or a .jar) are in your
> > CLASSPATH environment variable.
> >
> > To use:
> >
> >   1. Make sure your normal MapServer form has a name attribute
> > (eg. name="mapserv")
> >   2. Add the following javascript code to the HTML header section:
> >
> >     <script language="javascript">
> >       function SetImageXY(i) { document.mapserv.imgxy.value = i; }
> >       function SetImageBox(i) { document.mapserv.imgbox.value = i; }
> >     </script>
> >
> >      These functions are called by the applet, so the names can't
> > be changed. However, you
> >      could change the function code itself to, for example:
> >
> >      - submit the form immediately
> >      - update the status line of the browser
> >
> >   3.  Add a couple of hidden variables to the form:
> >
> >     <input type="hidden" name="imgbox" value="-1 -1 -1 -1">
> >     <input type="hidden" name="imgxy" value="149.5 199.5">
> >
> >     imgbox allows the MapServer to process a pair of mouse clicks
> > (ie. a box). It is ignored if the box is
> >     simply a point, hence the initialization value. imgxy is a
> > way to pass a single mouse click to the
> >     MapServer. This mimics the standard forms based method. The
> > initial value should be something
> >     meaningful like the center of the image. Remember that the
> > coordinates on the image start at 0
> >     and end at nrows-1 or ncols-1. To compute center x use
> > (ncols-1)/2 and y use (nrows-1)/2 and
> >     keep the decimal value. This allows the user to zoom using a
> > button rather than the image.
> >
> >   4. Add a call to the applet (this replaces the normal
> > form-based call to the image <input type="image"...>).
> >       Here's an example from a template file (note the [img]
> > substitution):
> >
> >     <applet codebase="/java/mapimage" code="mapimage.class"
> > width="300" height ="400" name="mapimage" MAYSCRIPT>
> >         <param name="image" value="http://www.dnr.state.mn.us[img]">
> >         <param name="jitter" value="1">
> >         <param name="color" value="255 0 0">
> >       </applet>
> >
> >      The parameters are:
> >
> >        image - fully qualified URL to the image. This can be a CGI call.
> >        jitter - allowable slop in mouse clicking. Basically sets
> > a minimum box size.
> >        color - RGB triplet that sets the color of the box or cursor.
> >
> > That covers the basic use. There are 3 public methods that can be
> > called from javascript that change
> > the behavior of the applet.
> >
> > boxOn and boxOff toggle the applets ability to display a dragged
> > box. Useful when adding features to
> > an interface. For example, it doesn't make sense to drag a box
> > when zooming out. No arguments.
> >
> > newMap(string image_url) allows you to swap images without
> > changing the rest of the page. The function
> > uses the java MediaTracker interface to delay image loading until
> > the new image is completely loaded. This
> > is useful with advanced interface setup. It's possible to manage
> > extents, layers etc completely on the client
> > using javascript requesting a new image only when necessary via
> > the applet. It's actually pretty cool once
> > it's set up that way. The string supplied to newMap must be a
> > fully qualified URL for an image (can be a CGI
> > call).
> >
> > Examples of this applet can be found at:
> >
> >   - http://deli.dnr.state.mn.us/
> >   - http://www.dnr.state.mn.us/mis/gis/gislis99/example1.html
> > (click "next step" until you hit example 5)
> >   - http://www.ra.dnr.state.mn.us/
> >
> > Possible enhancements:
> >
> >   - displaying coordinates on the image as the mouse moves
> >   - bubble attributes (eg. move mouse over feature label and
> > display attributes or whatever)
> >
> > Hope this helps, have fun!
> >
> > Steve
> >
> > Stephen Lime
> > Internet Applications Analyst
> > MIS Bureau - MN DNR
> >
> > (651) 297-2937
> > steve.lime at dnr.state.mn.us
> >
> >



More information about the mapserver-users mailing list