Hey,
You need to call setLat/setLon within the actionPerformed function otherwise
your never updating the icons location.
You may have to call generate on the raster again as well, I'm not sure.
Your actionPerformed should look something like this, as I showed you
earlier today:
public void actionPerformed(ActionEvent e) {
myOMRaster.setLat(gps_Lat++);
myOMRaster.setLon(gps_Lon++);
myOMRaster.generate(getProjection()); // Not sure if this is needed,
but it is smart enough to know
}
-----Original Message-----
From: P Jaya Sunderam [mailto:jspothar@cs.uccs.edu]
Sent: Tuesday, February 17, 2004 1:48 PM
To: dietrick@bbn.com
Cc: openmap-users@bbn.com
Subject: [OpenMap Users] moving icon
hi people,
i am trying to make the icon move on a layer. ihave drawn a layer with an
icon displayed on it.now i want to make it move over the map.when i try and
increment the lat /lon it does not change even though i repaint the layer .
###########################################
Timer _timer = new Timer(1000,this);
float gps_lat=45;
float gps_lon=50;
public void actionPerformed(ActionEvent e) {
repaint();
}
public ExpLayer2() {
super();
initGraphics();
//_timer.setDelay(1000); // This is in milliseconds
_timer.addActionListener(this);
_timer.start();
}
protected void initGraphics() {
gpsDevice = new OMRaster();
gpsDevice.setLat(gps_lat++);
gpsDevice.setLon(gps_lon++);
gpsDevice.setImageIcon(new
ImageIcon("/home/jay/openmap-4.6/src/openmap/com/bbn/openmap/layer/imgicon.g
if"));
OMGraphicList list= new OMGraphicList();
list.add(gpsDevice);
setList(list);
gpsDevice.generate(getProjection());
};
#####################################
thanks in advance
jay
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Tue Feb 17 14:18:04 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:37 EDT