[OpenMap Users] Programmatic OpenMap Component Initialisation

From: Thomas Schar <thomas.schar_at_dsto.defence.gov.au>
Date: Thu, 08 Jun 2006 16:14:42 +0930

Firstly, many thanks to all who responded to my earlier RPF/3d rendering
issue (the immaturity of the java3d stuff has put it outside my delivery
window, but I'm keen to see java1.6 when it is released). I'm still
working through reevaluating the code to ensure it's actually an openmap
problem, and not a problem with the way I'm employing openmap. Anyway,
I'm trying to build a trivial openmap panel instance to test the RPF
performance with programmatic initialisation of openmap components, and
I'm finding it quite difficult. Currently, I'm having to work from the
javadocs and reverse engineering the standard openmap.properties file.

My current test class is below (please excuse the long code fragment).
The map displays the graticule and political shape layers fine, but the
Rpf layer is now not rendering at all. I am using 1:5M data, and I am
using the pan/zoom to zoom in to australia at between 1:1M and 1:5M
scale levels and nothing is rendered. This layer works if I use the
openmap properties file, so I must be doing something wrong.
(ie. the Rpf data works through a properties file, but not through my
programmatic example below, and its not a data path problem)

The questions I had were:
(a) if I manually setViewAttributes(), I couldn't determine whether the
first prepare() will update the RpfCacheHandler's view attributes? do I
need to manually set the RpfCacheHandlers attributes via
"lyrRpf.getFrameProvider().setViewAttributes(lyrRpf.getViewAttributes());" ?
(b) is there better example for programmatic versus properties file
initialisation for openmap components?

public class aTestMap {
    private static void mspCreateGui() throws IOException{
        JFrame frm=new JFrame("test");
        frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JFrame.setDefaultLookAndFeelDecorated(true);
        JPanel pnl=new JPanel();
        JPanel pnlTop=new JPanel();
        final BasicMapPanel map=new BasicMapPanel();

        pnl.setLayout(new BorderLayout());
        LayerHandler lyr=new LayerHandler();
        map.addMapComponent(lyr);
        GraticuleLayer grat=new GraticuleLayer();
        ShapeLayer shp=new
ShapeLayer("C:/users/txs/GbmsData/shape/dcwpo-browse.shp");
        SpatialIndex ndx=new
SpatialIndex("C:/users/txs/GbmsData/shape/dcwpo-browse.ssx",
"C:/users/txs/GbmsData/shape/dcwpo-browse.shp");
        String[] aryPaths={"C:/users/txs/GbmsData/Aust5M"};
        RpfLayer lyrRpf=new RpfLayer(aryPaths);
        lyrRpf.getViewAttributes().showMaps=true;
        lyrRpf.getViewAttributes().imageScaleFactor=4.0f;
// lyrRpf.getViewAttributes().opaqueness=128;
// lyrRpf.getViewAttributes().numberOfColors=216;
// lyrRpf.getViewAttributes().showInfo=false;
// lyrRpf.getViewAttributes().scaleImages=true;
//
lyrRpf.getFrameProvider().setViewAttributes(lyrRpf.getViewAttributes());
        lyr.addLayer(lyrRpf);
        lyr.addLayer(shp);
        lyr.addLayer(grat);
       
        ZoomPanel pnlZoom=new ZoomPanel();
        pnlZoom.addZoomListener(new ZoomListener(){
            public void zoom(ZoomEvent evt){map.getMapBean().zoom(evt);}
        });
        NavigatePanel pnlNav=new NavigatePanel();
        pnlNav.addPanListener(new PanListener(){
            public void pan(PanEvent evt){map.getMapBean().pan(evt);}
        });
        LayersPanel pnlLayers=new LayersPanel(lyr);
        ScaleTextPanel pnlScale=new ScaleTextPanel();
        pnlScale.setupListeners(map.getMapBean());
        pnlTop.add(pnlZoom);
        pnlTop.add(pnlNav);
        pnlTop.add(pnlLayers);
        pnlTop.add(pnlScale);

        pnl.add(pnlTop, BorderLayout.PAGE_START);
        pnl.add(map, BorderLayout.CENTER);

        frm.add(pnl);
        frm.pack();
        frm.setVisible(true);
    }


Many thanks
Tom.

--
[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 Jun 08 2006 - 02:52:20 EDT

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