Dynamic Layer Functions and Sub-Menu Commands
Sample Image from the online demo
Online Demo:
The purpose of this online demo is to show the following JShape features:
- Sub-Menu Commands
- Show and Hide Status Window
- Dynamically Add a Layer
- Dynamically Delete a Layer
- and More ...
Since the above features are only supported in JShape 2.x, users need to have
Java 1.1+ enabled browsers (like IE 4.0+, NetScape 4.06+, Lotus Notes 4.6+,
or HotJava) to view it.
The Populations of Japan Cities
JShape parameters and menu commands used in the online demo:
JShape Applet Parameters:
<applet code="jshape.class" width=560 height=460 archive="jshape.zip">
<param name="project" value="The Populations of Japan Cities">
<param name="unzoomratio" value="2">
<param name="cmdfile" value="menu/japan.cmd">
<param name="external" value="japan">
<param name="mbcolor" value="black">
<param name="status" value="5">
<param name="list" value="1,3">
<param name="layer1" value="menu/city.shp">
<param name="info1" value="menu/city.dbf">
<param name="title1" value="Cities">
<param name="fcolor1" value="green">
<param name="lcolor1" value="green">
<param name="size1" value="4">
<param name="thematic1" value="menu/city.tmt">
<param name="tmenable1" value="off">
<param name="layer2" value="menu/latlong.shp">
<param name="info2" value="menu/latlong.txt">
<param name="title2" value="Latlong">
<param name="fcolor2" value="cyan">
<param name="lcolor2" value="cyan">
<param name="layer3" value="menu/japan.shp">
<param name="title3" value="Japan">
<param name="fcolor3" value="red">
<param name="bcolor3" value="transparent">
<param name="size3" value="2">
</applet>
Command File : japan.cmd
@@Status Window
@Show Status Window
status=5
@Hide Status Window
status=0
@@
@Separator
@@Functions
@Add Latlong Layer (method 1)
ActLayer=1
AppendLayer="layer=menu/latlong.shp,info=menu/latlong.txt,title=Latlong,fcolor=cyan,lcolor=cyan"
@Add Latlong Layer (method 2)
ActLayer=1
AppendLayer=2
@Delete Latlong Layer
DeleteLayer=Latlong
@@Zoom/Query/Report
@Tokyo Neighborhood
MapDisplay=off
Status=off
Clear
Zoom=138.938, 34.694, 141.007, 36.563
ActLayer=1
Enable=on
TMEnable=on
LField=1
Label=on
Status=on
ShowStatus=JShape Map is zoomed to the Tokyo neighborhood area\n
MapDisplay=on
@Select Larger Cities
MapDisplay=off
Clear
UnZoom
ActLayer=1
Enable=on
TMEnable=off
LField=2
SSize=16
Query=> 10000000
LField=1
MapDisplay=on
@Population Report
ActLayer=1
Enable=on
LField=2
ExportHeader="City : |,\tPopulation : |, \tCapital : "
ShowStatus=[City Population Report] :\n
ExportAll
ShowStatus="Total "
ShowExportCount
ShowStatus= cities selected\n
ShowStatus="Total population : "
ShowExportSum
ShowStatus=\n
ShowStatus="Average population : "
ShowExportAvg
ShowStatus=\n
ExportHeader=
LField=1
@@
@@
@Copy Selected Labels
Status=clear
ExportNoTotal
MenuCommand=Copy
Detail Discussion
- At line 8 in JShape Applet Parameters : The "list" parameter specifies JShape
only to load layer 1 and layer 3. No "count" parameter is required.
- At line 11 in JShape Applet Parameters : JShape reads a dBase (.dbf) file as
its attribute information file.
- From line 1 to line 6 in japan.cmd : This block defines a sub-menu entry. The
syntax of a sub-menu is :
@@Status Window -> "@@ with text" means to begin a sub-menu.
@Show Status Window -> menu item
status=5 -> script command
@Hide Status Window -> menu item
status=0 -> script command
@@ -> "@@" means to end a sub-menu.
- At line 8 in japan.cmd : "@Separator" means add a separator line into the menu.
- From line 10 to line 64 in japan.cmd : This block defines a 2 level sub-menus.
@@Functions
......
@@Zoom/Query/Report
......
@@
@@
- At line 13 in japan.cmd : This line uses AppendLayer (or InsertLayer) command to dynamically
define and create a new layer. The layer definition is similar to that in JShape Applet Parameters,
and the only differences are:
- each parameter is delimitered with ','.
- no layer number (for examples : layer1, info2, fcolor3...) is required.
- At line 16 in japan.cmd : If there is layer definition (for example : line 19 - 23) in JShape
Applet Parameters, The AppendLayer (or InsertLayer) command can just use the specified
layer number to create a new layer.
- At line 18 in japan.cmd : The DeleteLayer command deletes a layer with the specified layer title.
- From line 66 to line 69 in japan.cmd : Depends on users' Java environment security settings,
the line 69 (MenuCommand=Copy) command may not run on users' WWW Java applet environments.
');
document.write('');
// document.write('');
document.write('');
document.write('');
if (document.cookie.indexOf('fcseenpop') == -1) {
pop_domain = document.domain.substring(document.domain.indexOf('.'));
expiry_date = new Date(new Date().getTime() + 86400000).toGMTString(); // 24 hours
document.write('');
document.cookie = 'fcseenpop=1; path=/; domain=' + pop_domain + '; expires=' + expiry_date;
}
}
}
// -->