Re: Fix for panning problem

From: Don Dietrick <dietrick@bbn.com>
Date: Mon May 13 2002 - 17:45:42 EDT

Right, that's where the disconnect in the OpenMap code is - The
navigation tool expects the pan factor to be specified in percentage of
screen, and the projection classes want decimal degrees.

The problem is coming up with an algorithm that works in any projection
that gives expected behavior. When users click on the up-right arrow,
do they expect to go in the up-right direction in x/y space, or do they
expect to go in a 45N azimuth direction. They may not be the same. I
think they mean to go in the 45N azimuth, which means you have to do a
little more trig to figure out how far to pan. I don't think it's
really that hard to do, it just needs to be worked out, and the
OMToolSet components need to be updated to use the properties.

- Don

On Monday, May 13, 2002, at 04:53 PM, Chris Hopkins wrote:

>
> Hi Don -
>
> Good point. Yes, that's exactly what I'm seeing. It still does
> pan the specified number of degrees but it does seem as if it
> is notpanning as much as it should if you zoom out a lot. I
> never noticed since we are focused on a particular area of
> the map and we're never zooming out to really notice the
> difference. So, I guess it depends on your point of view. Are
> you specifying a percentage of screen to pan or a set degree
> value? I think you are talking about percentage of screen which
> does seem to make the most sense.
>
> For the time being, this little hack will work for our purposes.
> If we have a need to zoom out to that extent, I'll look into it
> again.
>
> Thanks,
> Chris
>
>> -----Original Message-----
>> From: Don Dietrick [mailto:dietrick@bbn.com]
>> Sent: Monday, May 13, 2002 4:44 PM
>> To: Chris Hopkins
>> Cc: 'openmap-users@bbn.com'
>> Subject: Re: Fix for panning problem
>>
>>
>> Hi Chris,
>>
>> How does this work out when you change scales? Seems that if
>> you zoom
>> out, the pan factor will appear to diminish, likewise the
>> opposite when
>> you zoom in. If you don't zoom in or out, it's not a problem, but if
>> you do, you may need to recalculate the factor to figure out how many
>> degrees to pan in that direction to move the screen a certain
>> amount.
>> At least, that's the way I remember what the major obstacle to this
>> problem was.
>>
>> Cheers,
>>
>> Don
>>
>> On Monday, May 13, 2002, at 12:36 PM, Chris Hopkins wrote:
>>
>>>
>>> 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"]
>>>
>>>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>

--
[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 17:46:13 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT