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

From: Carsten . Madsen <com_at_navicon.dk>
Date: Thu, 18 Oct 2007 15:00:21 +0200

Hi

Just a thought. The Swing access is not done from the EDT in the demo
code that may/will cause "weird" behaviour".

Try wrapping the main stuff with

 SwingUtilities.invokeLater(new Runnable() {
     public void run() {
   BasicMapFrame frame = new BasicMapFrame();
     // wait 2 seconds then paint the circles
     Thread.sleep(2000);
     frame.paintCircles();
}
});

BR
Carsten

Don Dietrick wrote:
> Hi Neil,
>
> Thanks for the bug report with the code demonstration, I didn't notice
> this behavior before, I'm not sure why it's happening, but we'll look
> into it.
>
> Thanks again,
>
> - Don
>
> On Oct 16, 2007, at 4:50 AM, Stevens, Neil wrote:
>
>> 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"]
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>
> --
> [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"]

--
[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 Thu Oct 18 2007 - 09:28:12 EDT

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