[OpenMap Users] FW: Open map bug with OMCircle???

From: Stevens, Neil <neil.stevens_at_goodrich.com>
Date: Tue, 16 Oct 2007 09:50:08 +0100

Hi

Sometimes I've noticed an OMCircle is not displayed when it is centered
in the top right quarter of the map displayed. The attached example
illustrates this. It should draw lots of red circles centred around the
point (40, 30). However any circles with a radius of between 50 and 130
degrees are not drawn when this example is run.

I have noticed that an OMCircle is not displayed if

 1) It is centred in the top right quarter of the visible map.
 
 AND
 
 2) It has a radius greater than 90 minus centre point latitude
 
 AND
 
 3) It has a radius less than 90 plus centre point latitude
 
 Alternatively use the openmap executable program and try drawing a
circle centred in the top right quarter. The same problem occurs with
the circle not being displayed.
 
 I am using windows XP with java 1.6 and openmap 4.6.3
 
 EXAMPLE PROGRAM:
 import java.awt.Graphics2D;
 import javax.swing.JFrame;
 import com.bbn.openmap.*;
 import com.bbn.openmap.layer.GraticuleLayer;
 import com.bbn.openmap.proj.*;
 import com.bbn.openmap.omGraphics.*;
 
 public class BasicMapFrame extends JFrame {
   // The Map bean
   private BufferedLayerMapBean mapBean = new BufferedLayerMapBean();
 
   // initialises the map bean and displays it in a frame
   public BasicMapFrame()
   {
     // add openmap bean to frame
     this.add(mapBean);
     this.setSize(800, 600);
     this.setVisible(true);
 
     //initialise openmap stuff
     MapHandler mapHandler = new MapHandler();
     mapHandler.add(mapBean);
         mapHandler.add(new LayerHandler());
         setMapProjection();
         mapHandler.add(new GraticuleLayer());
   }
 
   // creates a new BasicMapFrame and paints circles on it
   public static void main(String args[]) throws Exception
   {
     BasicMapFrame frame = new BasicMapFrame();
 
     // wait 2 seconds then paint the circles
     Thread.sleep(2000);
     frame.paintCircles();
   }
 
   // should paint read circles around the point (40,30)
   public void paintCircles(){
     Graphics2D graphics2d = (Graphics2D)mapBean.getGraphics();
     graphics2d.setColor(java.awt.Color.RED);
 
     // paint red circles centre around the point (40, 30)
     final float circleCentreLatitude = 40;
     final float circleCentreLongitude = 30;
     for(float circleRadius = 0; circleRadius < 180; circleRadius +=1)
     {
       OMCircle circle = new OMCircle(circleCentreLatitude,
                                      circleCentreLongitude,
                                      circleRadius);
 
       circle.generate(mapBean.getProjection());
       graphics2d.draw(circle.getShape());
     }
   }
 
   private void setMapProjection()
   {
     Projection currentProjection = mapBean.getProjection();
     CADRG cadrgProjection = new CADRG(currentProjection.getCenter(),
       currentProjection.getScale(),
       currentProjection.getWidth(),
       currentProjection.getHeight());
 
     mapBean.setProjection(cadrgProjection);
   }
 
}

Has any one else come across this bug and does any one know of a work
around for this to make the circle appear?

Thanks in advance for any help you can give me

Neil
--------------------------------------------------------

Rosemount Aerospace Limited.
Registered Office: Stratford Road, Solihull, West Midlands, B90 4LA.
Registered in England No. 02849033.

--------------------------------------------------------

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Oct 16 2007 - 05:16:19 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT