Invoking Java™ Classes Without Writing Java Code
By Bob Hazelton
One of the most innovative features of the WebFOCUS GIS Adapter is the ability to create and use symbol definitions for changing the appearance of map layers.
When you first create a GIS configuration file for a WebFOCUS application, several symbol definitions are created to get you started. These are useful in every GBIS application.
The main definitions are selectMapLine, selectMapPoint, selectMapPolygon, draw MapLine, drawMapPoint, and drawMapPolygon.
The default symbols have been named to reflect their respective uses. The "selectMap…" symbols are very useful when invoked for reports that are filtered with values from the map. They allow the user to see the selection they made reflected on the map. We'll explore the three that begin with "drawMap…" in a bit.
Let's take a closer look at selectMapPolygon. Within the EsriInfoEditor.jsp you can access the symbol list by clicking the "Edit Symbols" button and then clicking any of the links in the symbol list (see Screen 1).
Screen 1

Note: If you click the column name you will sort the list based on the values in that column.
The Java Class that gets invoked is a really long name for the code that is part of the ArcIMS Java Connector. Suffice it to say that the SimplePolygonSymbol class is used to change the appearance of a polygon map layer.
The column labeled "Parameter" is used to pass explicit values to the function name that appears on the left. In the selectMapPolygon symbol, the functions shown in Figure 1 receive values.
Figure 1 |
| Function |
Parameter |
| setBoundaryColor |
0,0,0 |
| setFillColor |
255,0,0 |
| setTransparency |
.5 |
Taken together, the result is that any polygon map layer that is changed with this symbol will have a black outline. The polygon will be filled with red. The red will be half transparent which will make it appear pink. Setting the transparency on a map feature allows other items that are "below" it to still be
visible in layer order.
To use this symbol definition, select it from the "Symbol ID" dropdown list of an inbound layer while creating a fex definition. When you select fex from the toolbar menu of the map viewer, and a rectangle or circle is used to select map features, they will turn a pinkish color after the report is launched.
The three symbols that begin with "drawMap…" can be used to change each of the different map layer types based on data retrieved via WebFOCUS. The drawMapPoint symbol contains usage of most of the replaceable parameters that the adapter can handle.
The Java class SimpleMarkerSymbol is used to change the appearance of point map layers.
With this symbol definition we see the usage of the "Replace Parameter" column. The names in brackets are references or pointers to the same name edit box in the fex definition form.
In this symbol definition the functions shown in Figure 2 receive values.
Figure 2 |
| Function |
Replace Parameter |
Parameter |
| setColor |
{COLOR} |
|
| setMarkerType |
{SHAPE} |
|
| setOutline |
|
0,0,0 |
| setWidth |
{SIZE} |
|
Fexes that are used to change the appearance of the map collect the data values from WebFOCUS accessible data sources. The output is returned to the GIS Adapter as XML. The map fex definition creates the structured linkages that allow the adapter to scan the XML for the data values to pass as replaceable parameters to the symbol definition. An example will help illustrate this.
Suppose you have a map fex that looks like this:
TABLE FILE CRIMEDATA
PRINT REPORTID
COMPUTE MYCOLOR/A15=…some IF-THEN-ELSE logic for color choice;
COMPUTE MYSHAPE/A15=…some IF-THEN-ELSE logic for shape choice;
COMPUTE MYSIZE/A5=…some IF-THEN-ELSE logic for size choice;
COMPUTE MYTITLE/A255=…concatenate values together for the legend;
END
The bracket reference for {COLOR} will cause the adapter to look in the fex definition for the fieldname in the "Color" edit box. The adapter will use the fieldname provided to search for values in the XML output named MYCOLOR and pass them to the setColor function. The same linkage occurs for the setMarkerType/{SHAPE} and setWidth/{SIZE} functions. The setOutline function will always receive 0,0,0, which will add a black outline to each of the shapes that are used.
As each record in the XML output is processed, the values for changing the color, shape and size of the
exact map feature identified are passed to the functions and the map image gets created. As you get more advanced in your development and GBIS integration you may find that you want to design more sophisticated symbol definitions. The WebFOCUS GIS Adapter supports the creation of customized symbols to fit your application.
It is possible to create a symbol definition that lets you easily integrate your own JPEG or GIF images or to refer to TrueType font characters as the way of displaying your map-based results. We'll explore that subject in future issue of the WebFOCUS Newsletter.
Java and all Java-based marks are trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
|