Hi Don, et. al. -
Here is a fix I made for the panning problem. It allows me to customize the
amount the map pans when I click on one of the panning buttons. The fix
ultimately lies in the actionPerformed of the NavigatePanel class. I've
created
a subclass of the NavigatePanel for our own purposes and wired that into a
customized OMToolSet object (extending both of those...I made no changes
to the OpenMap source). I use our custom OMToolSet object in the
openmap.properties file now. The MICAProperties object is a statically
accessed object I came up with for accessing the OpenMap properties
object. So for a real fix, the OpenMap properties will need to be accessed
if you want it customizeable through the props file.
Here is what the new actionPerformed method looks like along with a new
firePaneEvent method. Also, because this is a customized NavigatePanel
and I didn't want to have to worry about where the images where for the
navigation UI were, I overloaded the addImageIcon method. I included that
one as well. That way you can just pick up the images in the OpenMap
.jar file.
public void actionPerformed(java.awt.event.ActionEvent e) {
String command = e.getActionCommand();
float panf = 45.0f;
Object ob = MICAProperties.get("mica.panfactor");
if(ob != null)
{
String panamt = (String)ob;
panf = Float.valueOf(panamt).floatValue();
}
if (command.equals(panNWCmd)) {
firePanEvent(-45f, panf);
} else if (command.equals(panNCmd)) {
firePanEvent(0f, panf);
} else if (command.equals(panNECmd)) {
firePanEvent(45f, panf);
} else if (command.equals(panECmd)) {
firePanEvent(90f, panf);
} else if (command.equals(panSECmd)) {
firePanEvent(135f, panf);
} else if (command.equals(panSCmd)) {
firePanEvent(180f, panf);
} else if (command.equals(panSWCmd)) {
firePanEvent(-135f, panf);
} else if (command.equals(panWCmd)) {
firePanEvent(-90f, panf);
} else if (command.equals(centerCmd)) {
// go back to the center point
float lat;
float lon;
if (useDefaultCenter) {
lat = defaultCenterLat;
lon = defaultCenterLon;
} else {
lat = Environment.getFloat(Environment.Latitude, 0f);
lon = Environment.getFloat(Environment.Longitude, 0f);
}
fireCenterEvent(lat, lon);
}
}
protected synchronized void firePanEvent(float az, float c) {
System.out.println("Panning..." + c);
panDelegate.firePan(az, c);
}
protected ImageIcon addImageIcon(ImageIcon imageIcon,
String imageName,
String imageTip) {
URL url = NavigatePanel.class.getResource(imageName);
imageIcon = new ImageIcon(url, imageTip);
return imageIcon;
}
The 'panf' amount ends up being the degrees you wish to pan. I
currently have it set to 0.5 and that seems to be a good amount
for what we want to do. There is some noticeable flicker if you
do this in rapid succession but I can live with that for the time
being.
Feel free to use this to your hearts content. Not sure if this is what
you intended or not but that's how I fixed it. ;) Feel free to ask me
any questions or if you want me to send you the source code.
Chris Hopkins
Software Engineer
Charles River Analytics
-- [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 Mon May 13 12:41:24 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT