|
/*
** This external routine will display "(c) Logo"
** on the upper-left corner of JShape map.
*/
import java.awt.*;
class external extends Link
{
public int dispatch(String command,String argument)
{
if (command.equals("paint"))
{
Graphics g=jshape.GetPaintGraphics();
g.setColor(new Color(128,0,0));
g.drawString("(c) Logo",4,16);
};
return(0);
}
}
javac external.java
<applet code="jshape.class" width=500 height=400> <param name="project" value="Hide My Data"> ...... <param name="layer1" value="mydata.shp"> ...... </applet>
class external extends Link
{
public int dispatch(String command,String argument)
{
if (command.equals("init"))
{
jshape.SetJShapeBase("http://www.my.com/hidendata/");
};
return(0);
}
}
<applet code="jshape.class" width=500 height=400> <param name="project" value="Dynamic Map Extension"> ...... <param name="layer2" value="dmap/map.dmp"> <param name="title2" value="Quad Map"> ...... </applet>The filename extension ".dmp" indicates a Dynamic Map input file.
# file : map.dmp # mapfile, xmin, ymin, xmax, ymax map00.gif, -167425.86, -154874.75, -165802.64, -153271.43 map10.gif, -165802.64, -154874.75, -164179.42, -153271.43 map20.gif, -164179.42, -154874.75, -162556.20, -153271.43 map30.gif, -162556.20, -154874.75, -160932.98, -153271.43 map40.gif, -160932.98, -154874.75, -159309.76, -153271.43 map50.gif, -159309.76, -154874.75, -157686.32, -153271.43 map01.gif, -167425.86, -156478.07, -165802.64, -154874.75 map11.gif, -165802.64, -156478.07, -164179.42, -154874.75 map21.gif, -164179.42, -156478.07, -162556.20, -154874.75 map31.gif, -162556.20, -156478.07, -160932.98, -154874.75 map41.gif, -160932.98, -156478.07, -159309.76, -154874.75 map51.gif, -159309.76, -156478.07, -157686.32, -154874.75 map02.gif, -167425.86, -158081.39, -165802.64, -156478.07 map12.gif, -165802.64, -158081.39, -164179.42, -156478.07 map22.gif, -164179.42, -158081.39, -162556.20, -156478.07 map32.gif, -162556.20, -158081.39, -160932.98, -156478.07 map42.gif, -160932.98, -158081.39, -159309.76, -156478.07 map52.gif, -159309.76, -158081.39, -157686.32, -156478.07 map03.gif, -167425.86, -159684.71, -165802.64, -158081.39 map13.gif, -165802.64, -159684.71, -164179.42, -158081.39 map23.gif, -164179.42, -159684.71, -162556.20, -158081.39 map33.gif, -162556.20, -159684.71, -160932.98, -158081.39 map43.gif, -160932.98, -159684.71, -159309.76, -158081.39 map53.gif, -159309.76, -159684.71, -157686.32, -158081.39
import java.io.*;
import java.awt.*;
import java.net.*;
import java.util.Vector;
import java.util.StringTokenizer;
class MapDL extends Link
{
static String image_base="";
static Vector mapfile_vector=new Vector(1);
static Vector extent_vector=new Vector(1);
public int dispatch(String command,String argument)
{
if (command.equals("init"))
{
String line;
String mapfile;
double xmin,ymin,xmax,ymax;
int i;
for (i=argument.length()-1;i>=0;i--)
{
if ((argument.charAt(i) == '/') || (argument.charAt(i) == '\\'))
{
break;
};
};
image_base=argument.substring(0,i+1);
try
{
URL url=new URL(argument);
NetInputStream net=new NetInputStream(url.openStream());
while ((line=net.readLine()) != null)
{
line=line.trim();
if (line.length() == 0)
{
continue;
};
if (line.startsWith("#"))
{
continue;
};
StringTokenizer st=new StringTokenizer(line,", ");
mapfile=st.nextToken();
mapfile_vector.addElement(mapfile);
xmin=(new Double(st.nextToken())).doubleValue();
ymin=(new Double(st.nextToken())).doubleValue();
xmax=(new Double(st.nextToken())).doubleValue();
ymax=(new Double(st.nextToken())).doubleValue();
DRectangle extent=new DRectangle(new DPoint(xmin,ymin),new DPoint(xmax,ymax));
extent_vector.addElement(extent);
};
net.close();
net=null;
}
catch (Exception e)
{
return (-1);
};
};
if (command.equals("load"))
{
DRectangle load_extent=jshape.GetLoadExtent();
String org_image_base=jshape.GetImageBase();
jshape.SetImageBase(image_base);
for (int i=0;i<extent_vector.size();i++)
{
DRectangle extent=(DRectangle) extent_vector.elementAt(i);
if (load_extent.intersects(extent) == false)
{
continue;
};
Image img=jshape.GetImage((String) mapfile_vector.elementAt(i));
if (img == null)
{
continue;
};
jshape.MapAddImage(img,extent);
};
jshape.SetImageBase(org_image_base);
};
return(0);
}
}
<applet code="jshape.class" width=500 height=400> <param name="project" value="Dynamic Map Extension"> ...... <param name="layer3" value="dmap/mapgrid.inp"> <param name="title3" value="Map Grids"> ...... </applet>The filename extension ".inp" indicates a user data input (not necessary to be a TEXT format) file.
# file mapgrid.inp # Polygon Shape Type 5 # In each polygon, the start point and the end point must be the same. # If the start point and the end point are different, JShape will # automatically append the start point as the end point. # Number of Points 4 # Points Data -167425.86, -154874.75 -167425.86, -153271.43 -165802.64, -153271.43 -165802.64, -154874.75 # Number of Points 4 # Points Data -165802.64, -153271.43 -165802.64, -154874.75 -164179.42, -154874.75 -164179.42, -153271.43 # Number of Points 4 # Points Data -164179.42, -154874.75 -164179.42, -153271.43 -162556.20, -153271.43 -162556.20, -154874.75 # Number of Points 4 # Points Data -162556.20, -153271.43 -162556.20, -154874.75 -160932.98, -154874.75 -160932.98, -153271.43 # Number of Points 4 # Points Data -160932.98, -154874.75 -160932.98, -153271.43 -159309.76, -153271.43 -159309.76, -154874.75 # Number of Points 4 # Points Data -159309.76, -153271.43 -159309.76, -154874.75 -157686.32, -154874.75 -157686.32, -153271.43 # Number of Points 4 # Points Data -167425.86, -156478.07 -167425.86, -154874.75 -165802.64, -154874.75 -165802.64, -156478.07 # Number of Points 4 # Points Data -165802.64, -156478.07 -165802.64, -154874.75 -164179.42, -154874.75 -164179.42, -156478.07 # Number of Points 4 # Points Data -164179.42, -156478.07 -164179.42, -154874.75 -162556.20, -154874.75 -162556.20, -156478.07 # Number of Points 4 # Points Data -162556.20, -156478.07 -162556.20, -154874.75 -160932.98, -154874.75 -160932.98, -156478.07 # Number of Points 4 # Points Data -160932.98, -156478.07 -160932.98, -154874.75 -159309.76, -154874.75 -159309.76, -156478.07 # Number of Points 4 # Points Data -159309.76, -156478.07 -159309.76, -154874.75 -157686.32, -154874.75 -157686.32, -156478.07 # Number of Points 4 # Points Data -167425.86, -158081.39 -167425.86, -156478.07 -165802.64, -156478.07 -165802.64, -158081.39 # Number of Points 4 # Points Data -165802.64, -158081.39 -165802.64, -156478.07 -164179.42, -156478.07 -164179.42, -158081.39 # Number of Points 4 # Points Data -164179.42, -158081.39 -164179.42, -156478.07 -162556.20, -156478.07 -162556.20, -158081.39 # Number of Points 4 # Points Data -162556.20, -158081.39 -162556.20, -156478.07 -160932.98, -156478.07 -160932.98, -158081.39 # Number of Points 4 # Points Data -160932.98, -158081.39 -160932.98, -156478.07 -159309.76, -156478.07 -159309.76, -158081.39 # Number of Points 4 # Points Data -159309.76, -158081.39 -159309.76, -156478.07 -157686.32, -156478.07 -157686.32, -158081.39 # Number of Points 4 # Points Data -167425.86, -159684.71 -167425.86, -158081.39 -165802.64, -158081.39 -165802.64, -159684.71 # Number of Points 4 # Points Data -165802.64, -159684.71 -165802.64, -158081.39 -164179.42, -158081.39 -164179.42, -159684.71 # Number of Points 4 # Points Data -164179.42, -159684.71 -164179.42, -158081.39 -162556.20, -158081.39 -162556.20, -159684.71 # Number of Points 4 # Points Data -162556.20, -159684.71 -162556.20, -158081.39 -160932.98, -158081.39 -160932.98, -159684.71 # Number of Points 4 # Points Data -160932.98, -159684.71 -160932.98, -158081.39 -159309.76, -158081.39 -159309.76, -159684.71 # Number of Points 4 # Points Data -159309.76, -159684.71 -159309.76, -158081.39 -157686.32, -158081.39 -157686.32, -159684.71There are some possible text input files listed below :
# Point Shape Type 1 # Points Data -167425.86,-154874.75 -167425.86,-153271.43 -165802.64,-153271.43 -165802.64,-154874.75
# Arc Shape Type 3 # Number of Points 2 # Points Data -167425.86, -154874.75 -167425.86, -153271.43 # Number of Points 2 # Points Data -165802.64, -153271.43 -165802.64, -154874.75
import java.io.*;
import java.awt.*;
import java.net.*;
import java.util.Vector;
import java.lang.Math;
import java.util.StringTokenizer;
class Input extends Link
{
static Theme theme=null;
public int dispatch(String command,String argument)
{
if (command.equals("init"))
{
try
{
load_input(argument);
}
catch (Exception e)
{
return (-1);
};
};
return(0);
}
public DPoint getDP(String line)
{
double dx,dy;
StringTokenizer st=new StringTokenizer(line,", ");
dx=(new Double(st.nextToken())).doubleValue();
dy=(new Double(st.nextToken())).doubleValue();
return (new DPoint(dx,dy));
}
public void load_input(String filename) throws Exception
{
boolean shapetypeflag;
String aline;
int count;
int shapetype;
int numpoints;
URL url=new URL(filename);
NetInputStream net=new NetInputStream(url.openStream());
theme=null;
shapetypeflag=true;
shapetype=0;
while ((aline=net.readLine()) != null)
{
aline=aline.trim();
if (aline.length() == 0)
{
continue;
};
if (aline.startsWith("#"))
{
continue;
};
if (shapetypeflag == true)
{
shapetypeflag=false;
shapetype=(new Integer(aline)).intValue();
theme=jshape.ThemeOpen(shapetype);
continue;
};
switch (shapetype)
{
case 1 :
{
jshape.ThemeAddFeature(theme,getDP(aline));
};
break;
case 3 :
{
numpoints=(new Integer(aline)).intValue();
Vector PointVector=new Vector(1);
count=0;
while (count < numpoints)
{
aline=net.readLine();
aline=aline.trim();
if (aline.length() == 0)
{
continue;
};
if (aline.startsWith("#"))
{
continue;
};
PointVector.addElement(getDP(aline));
count++;
};
jshape.ThemeAddFeature(theme,PointVector);
};
break;
case 5 :
{
numpoints=(new Integer(aline)).intValue();
Vector PointVector=new Vector(1);
count=0;
while (count < numpoints)
{
aline=net.readLine();
aline=aline.trim();
if (aline.length() == 0)
{
continue;
};
if (aline.startsWith("#"))
{
continue;
};
PointVector.addElement(getDP(aline));
count++;
};
DPoint startdp=(DPoint) PointVector.elementAt(0);
DPoint enddp=(DPoint) PointVector.elementAt(PointVector.size()-1);
if ((startdp.dx != enddp.dx) || (startdp.dy != enddp.dy))
{
PointVector.addElement(startdp);
};
jshape.ThemeAddFeature(theme,PointVector);
};
break;
};
};
net.close();
net=null;
jshape.ThemeClose(theme);
}
}
class Language extends Object
{
//
// Menu bar texts
//
public static String MenuBarFileText="File";
public static String MenuBarEditText="Edit";
public static String MenuBarCommandText="Command";
public static String MenuBarHelpText="Help";
//
// Menu item texts
//
public static String MenuItemPrintMapText="Print Map";
public static String MenuItemPrintStatusText="Print Status";
public static String MenuItemCopyText="Copy";
public static String MenuItemLabelOnText="Label On";
public static String MenuItemLabelOffText="Label Off";
public static String MenuItemHelpText="Help";
public static String MenuItemAboutText="About";
//
// Action button texts
//
public static String ButtonUnZoomText="UnZoom";
public static String ButtonZoomInText="ZoomIn";
public static String ButtonZoomOutText="ZoomOut";
public static String ButtonPanText="Pan";
public static String ButtonIdentifyText="Identify";
public static String ButtonSelectText="Select";
public static String ButtonClearText="Clear";
public static String ButtonExecuteText="Execute";
public static String ButtonQueryText="Query";
//
// User button texts
//
public static boolean ButtonUserPanel=false;
public static String ButtonUser1Text="Restaurant Info";
public static String ButtonUser2Text="";
public static String ButtonUser3Text="";
public static String ButtonUser4Text="";
public static String ButtonUser5Text="";
//
// Dynamic button texts
//
public static String ButtonLoadText="Load";
public static String ButtonSaveText="Wait";
//
// Command Help Texts
//
public static String CommandHelpText=
"Console Commands :\n"+
"[Help] : help command\n"+
"[Extent] : report the full map extent information\n"+
"[CurrentExtent] : report the current map extent information\n"+
"[Count] : report the number of features of the focused layer\n"+
"[Export] : export the selected attribute information of the focused layer\n"+
"[BColor=] : set the background color of the focused layer\n"+
"==>> Example : BColor=red or BColor=FF00FF\n"+
"[FColor=] : set the foreground color of the focused layer\n"+
"[LColor=] : set the label color of the focused layer\n"+
"[SColor=] : set the selection color of the focused layer\n"+
"[Size=] : set the symbol size of the focused layer\n"+
"[SSize=] : set the symbol size of the selected features\n"+
"==>> Example : Size=5\n"+
"[Label=ON|OFF] : set the label information [ON|OFF] of the focused layer\n"+
"==>> Example : Label=ON\n"+
"[Label] : set the label information ON of the focused layer\n"+
"[LField=] : set the label atrribute field number of the focused layer\n"+
"==>> Example : LField=2\n"+
"[MBColor=] : set the background color of the map window\n";
}
<applet code="jshape.class" width=600 height=450> <param name="project" value="San Francisco Restaurants"> <param name="external" value="restaurant"> <param name="zoomxmin" value="94"> <param name="zoomymin" value="110"> <param name="zoomxmax" value="577"> <param name="zoomymax" value="397"> <param name="count" value="2"> <param name="layer1" value="url\restaurant.shp"> <param name="title1" value="Restaurants"> <param name="info1" value="url\restaurant.txt"> <param name="fcolor1" value="red"> <param name="lcolor1" value="red"> <param name="size1" value="8"> <param name="layer2" value="url\city.gif"> <param name="title2" value="City Map"> <param name="xmin2" value="0"> <param name="ymin2" value="0"> <param name="xmax2" value="639"> <param name="ymax2" value="479"> </applet>
# Point Shape Type 1 # Points Data 324,240 325,247 317,295 306,294 350,308 298,174 378,199
Stars Cafe@9807646 Spuntino@9809083 Taco Bell@9829665 Burger King@9827879 Kentucky Fried Chicken@9828078 Hayes Street Grill@9807131 Subway Sandwiches & Salads@9808375
import java.awt.*;
class restaurant extends Link
{
public boolean active;
public int touch(int radius)
{
DPoint ScrDp=jshape.GetMouseScrDp();
DPoint ScrMinDp=new DPoint(ScrDp.x-radius,ScrDp.y+radius);
DPoint ScrMaxDp=new DPoint(ScrDp.x+radius,ScrDp.y-radius);
DPoint MapMinDp=jshape.ScrToMapDp(ScrMinDp);
DPoint MapMaxDp=jshape.ScrToMapDp(ScrMaxDp);
for (int i=1;i<=jshape.GetFeatureCount(1);i++)
{
DPoint FeatureDp=jshape.GetFeatureExtent(1,i).min;
if ((FeatureDp.dx >= MapMinDp.dx) && (FeatureDp.dx <= MapMaxDp.dx) &&
(FeatureDp.dy >= MapMinDp.dy) && (FeatureDp.dy <= MapMaxDp.dy))
{
return (i);
};
};
return (0);
}
public int dispatch(String command,String argument)
{
if (command.equals("init"))
{
active=false;
jshape.SetPopupLabelFont(new Font("TimesRoman",Font.PLAIN,12));
jshape.SetPopupLabelColor(new Color(128,0,0));
};
if (command.equals("paint"))
{
Graphics g=jshape.GetPaintGraphics();
g.setColor(new Color(128,0,0));
g.drawString("(c) shiuhlin",4,16);
};
// When "User1 Button" is pressed, JShape will send "user1" dispatch
// command to the external routine. The argument variable contains the
// state of "User Button". "1" means the SET state, and "0" means the
// CLEAR state.
if (command.equals("user1"))
{
if (argument.equals("1"))
{
jshape.LockUserButton();
active=true;
jshape.BoldButton(jshape.GetUserButton());
}
else
{
active=false;
jshape.PlainButton(jshape.GetUserButton());
jshape.SetCursor(Frame.DEFAULT_CURSOR);
};
};
if (command.equals("mousemove"))
{
int index;
if (active == true)
{
if ((index=touch(4)) != 0)
{
jshape.SetCursor(Frame.HAND_CURSOR);
DPoint ScrDp=jshape.GetMouseScrDp();
jshape.ShowPopupLabel(ScrDp.x+8,ScrDp.y+4,jshape.GetAttribute(1,index,1));
jshape.ShowBrowserStatus(jshape.GetAttribute(1,index,1));
}
else
{
jshape.SetCursor(Frame.DEFAULT_CURSOR);
jshape.HidePopupLabel();
jshape.ShowBrowserStatus("");
};
};
};
if (command.equals("mousedown"))
{
int index;
if (active == true)
{
if ((index=touch(4)) != 0)
{
String URLStr="http://b1.yp.yahoo.com/py/ypMap.py?tuid=";
URLStr+=jshape.GetAttribute(1,index,2);
jshape.ShowBrowserStatus(URLStr);
jshape.GoToURL(URLStr,"JShape - Restaurant Menu");
};
};
};
return (0);
}
}
<applet code="jshape.class" width=560 height=460 archive="jshape.zip"> <param name="cabbase" value="jshape.cab"> <param name="project" value="The Populations of Japan Cities"> <param name="cmdfile" value="thematic/japan.cmd"> <param name="unzoomratio" value="2"> <param name="external" value="japan"> <param name="mbcolor" value="gray"> <param name="status" value="5"> <param name="count" value="2"> <param name="layer1" value="thematic/japancity.shp"> <param name="info1" value="thematic/japancity.txt"> <param name="title1" value="Cities"> <param name="fcolor1" value="green"> <param name="lcolor1" value="green"> <param name="size1" value="4"> <param name="thematic1" value="thematic/japancity.tmt"> <param name="tmenable1" value="off"> <param name="layer2" value="thematic/japan.shp"> <param name="title2" value="Japan"> <param name="fcolor2" value="red"> <param name="bcolor2" value="lightGray"> </applet>
# # User Menu Command : Tokyo Neighborhood # @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 MapDisplay=on # # User Menu Command : Select Larger Cities # @Select Larger Cities MapDisplay=off Clear UnZoom ActLayer=1 Enable=on TMEnable=off LField=2 SSize=16 Query=> 10000000 LField=1 MapDisplay=on # # User Menu Command : Population Report # @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=1The syntax of the command file is the following :
Sapporo@1912000@N Tokyo@23622000@Y Kawasaki@1089000@N Yokohama@2993000@N Nagoya@4801000@N Kyoto@1481000@N Osaka@15041000@N Hiroshima@1576000@N Kobe@1411000@N Fukuoka@1751000@N Kita Kyushu@1526000@N Aomori@295000@N Nagasaki@451000@N
import java.io.*;
import java.awt.*;
/*
** External Module : dispatch routine
*/
class japan extends Link
{
public int touch(int radius)
{
DPoint ScrDp=jshape.GetMouseScrDp();
DPoint ScrMinDp=new DPoint(ScrDp.x-radius,ScrDp.y+radius);
DPoint ScrMaxDp=new DPoint(ScrDp.x+radius,ScrDp.y-radius);
DPoint MapMinDp=jshape.ScrToMapDp(ScrMinDp);
DPoint MapMaxDp=jshape.ScrToMapDp(ScrMaxDp);
for (int i=1;i<=jshape.GetFeatureCount(1);i++)
{
DPoint FeatureDp=jshape.GetFeatureExtent(1,i).min;
if ((FeatureDp.dx >= MapMinDp.dx) && (FeatureDp.dx <= MapMaxDp.dx) &&
(FeatureDp.dy >= MapMinDp.dy) && (FeatureDp.dy <= MapMaxDp.dy))
{
return (i);
};
};
return (0);
}
public int dispatch(String command,String argument)
{
if (command.equals("init"))
{
jshape.SetLabelFont(new Font("TimesRoman",Font.BOLD|Font.ITALIC,12));
}
if (command.equals("paint"))
{
Graphics g=jshape.GetPaintGraphics();
g.setFont(new Font("TimesRoman",Font.BOLD,18));
g.setColor(new Color(255,255,0));
g.drawString("(c) jshape",4,16);
};
/*
** [identify] : triggered when "identify" button pressed
** attribute record is passed through "argument"
** return 0 : continue to process the default identify
** return 1 : do not continue to process the default identify
*/
if (command.equals("identify"))
{
String str;
int layer=jshape.GetActiveLayer();
jshape.ShowStatus("*\n");
switch (layer)
{
case 1 :
{
if ((str=jshape.GetAttributeField(argument,1)) != null)
{
jshape.ShowStatus("City : "+str+"\n");
};
if ((str=jshape.GetAttributeField(argument,2)) != null)
{
jshape.ShowStatus("Population : "+str+"\n");
};
break;
};
};
return (1);
};
if (command.equals("mousemove"))
{
int index;
if ((index=touch(4)) != 0)
{
DPoint ScrDp=jshape.GetMouseScrDp();
jshape.ShowPopupLabel(ScrDp.x+8,ScrDp.y+4,jshape.GetAttribute(1,index,1));
}
else
{
jshape.HidePopupLabel();
};
};
if (command.equalsIgnoreCase("show"))
{
jshape.ShowStatus(argument);
};
if (command.equalsIgnoreCase("scriptexit"))
{
jshape.ScriptExit();
};
return(0);
}
}
<param name="layer1" value="firstlayer.dlt"> <param name="layer2" value="secondlayer.dlt">Just like animation (.ani) theme type, there are no physical files "firstlayer.dlt" or "secondlayer.dlt" existing. JShape uses the special theme type (.dlt) as an indicator to perform a special initialization process. Instead of loading theme data from a data file, JShape sends a special command "DLTInit" to its external routine, and let the external routine to handle the Dynamic Load Theme completely. Here are the parts of source codes excerpted from the "Scarament Traffic Incidents" online demo.
// sacramento.java
class sacramento extends Link
{
public int mode=0;
public DPoint MapDp;
public String DataServerURL="";
......
public int dispatch(String command,String argument)
{
// JShape sends "DLTInit" command to initiate a Dynamic Load Theme.
if (command.equalsIgnoreCase("DLTInit"))
{
// the argument filed will contain the theme name like "firstlayer.dlt" or "secondlayer.dlt".
load_layer(0);
};
......
// When users press the "Refresh Information" button.
if (command.equals("user3"))
{
load_layer(1);
};
......
}
......
public void load_layer(int mode)
{
Theme theme;
if (mode == 0)
{
theme=jshape.ThemeOpen(1);
}
else
{
theme=jshape.ThemeGet(1);
jshape.ThemeReset(theme);
};
try
{
// Connect to JSWeb DATA server extension.
// You can not execute the following lines on your system. You need to provide
// the similar routines yourself.
String urlstr=DataServerURL+"/data?read&traffic.txt$";
urlstr+=(new java.util.Date()).toString().replace(' ','.');
URL url=new URL(urlstr);
// The following lines read data from the remote data source,
// and save the data to the Dynamic Load Theme.
NetInputStream net=new NetInputStream(url.openStream());
String line;
StringTokenizer st;
String xstr,ystr,astr;
double dx,dy;
while ((line=net.readLine()) != null)
{
astr=line;
st=new StringTokenizer(line,"$");
if (!st.hasMoreTokens())
{
continue;
};
xstr=st.nextToken();
if (!st.hasMoreTokens())
{
continue;
};
ystr=st.nextToken();
dx=new Double(xstr).doubleValue();
dy=new Double(ystr).doubleValue();
// Add spatial and attribute data into the Dynamic Load Theme
jshape.ThemeAddFeature(theme,new DPoint(dx,dy));
jshape.ThemeAddAttribute(theme,astr);
};
net.close();
}
catch (Exception e) {};
if (mode == 0)
{
jshape.ThemeClose(theme);
}
else
{
jshape.ThemeSave(1,theme);
jshape.UpdateMap();
};
}
......
}
Although there is an proprietary JShape extension designed for Animation Theme,
users still can create a timer object and use the above program to create their own animation
routines.