Michael Bedward wrote:
2008/12/13 Matt Foster <matthew.fos...@noaa.gov>:
  
I'm trying to build a simple gui with a JStreamNavMap and a
JStreamNavigationBar.  The problem I'm having is that when the gui first
starts the map does not display.  I can click the "Zoom All" button on the
nav bar, and then the map will appear correctly.  I'm attaching the code.

Any ideas why the map isn't showing up on startup?

    

Hi Matt

I have the same problem.  If you modify your constructor like this I
think the map should appear...

  public MoverGUI2() throws URISyntaxException {
        setSize(600, 600);
        initComponents();
        final MapContext context = buildContext();
        navBar.setMap(map);
        map.getRenderingStrategy().setContext(context);

        this.addComponentListener(new ComponentAdapter() {

            @Override
            public void componentShown(ComponentEvent e) {
                try {

map.getRenderingStrategy().setMapArea(context.getLayerBounds());
                } catch (IOException ex) {
                    throw new RuntimeException("bummer");
                }
            }
        });
    }

Although this works for me it seems like a really ugly hack and it
uses a deprecated method.  If anyone knows a more elegant solution
please sing out.

  
Thanks Michael.  That worked for me as well.

What I don't understand, and likely shows my shallow knowledge of the subject matter, is that the deprecation remark in the StreamingStrategy interface says to use an AffineTransform, instead of Envelope.  I don't understand how one would do that.

Matt


-- 
Do not go where the path may lead; go instead where there is no path and leave a trail.
-- Ralph Waldo Emerson
begin:vcard
fn:Matt Foster - N0EYE
n:Foster;Matt
org:;NWS Forecast Office - Norman OK
email;internet:matthew.fos...@noaa.gov
title:Information Technology Officer
tel;work:(405) 325-3406
x-mozilla-html:TRUE
version:2.1
end:vcard

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to