Re: [OpenMap Users] Programmatic OpenMap Component Initialisation

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 9 Jun 2006 11:45:37 -0400

Hi Thomas,

On Jun 8, 2006, at 2:44 AM, Thomas Schar wrote:

> 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());" ?

If you set the view attributes before you do anything with the layer,
the changes should filter down to the RpfCacheManager and Handlers.
They don't get created until the first time the layer is added to the
MapBean. If you call setViewAttributes later, the attributes should
make it down to the FrameProvider. You don't need to explicitly make
the call you ask about unless the layer has already been added to the
map.

> (b) is there better example for programmatic versus properties file
> initialisation for openmap components?

This looks OK. What is the projection type, scale and location?

- Don



>
> 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"]

--
[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 Fri Jun 09 2006 - 11:46:13 EDT

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