RE: [OpenMap Users] resize mapbean (and keep extents)

From: Ben Podoll <benjamin.podoll_at_und.edu>
Date: Tue, 3 Aug 2004 09:22:42 -0500

Thanks! I think that will come in handy.

Do you happen to know how I could turn on and off a layer with the
LayerHandler?

I can get the LayerHandler and get the associated Layers, and if the layer
is on by default I can just take that Layer object and say setVisible(false)
and it goes off... But if I do that with a Layer that isn't visible by
default I get nothing to show.

I can loop thru the Layers that the LayerHandler has and I see all the
Layers I define in my openmap.properties file. I can even loop thru and only
show Layers that satisfy isShowing() and it works, but I have tried using
addLayer(), init(), turnLayerOn(), validate(), setVisibile(), ... to no
avail to get a Layer to show.

Here is a bit of my code where I grab the LayerHandler and then try to do
something with it (without finding how to turn it on).

LayerHandler layerHandler =
(LayerHandler)gisp.basicMapPanel.getMapComponent("layerHandler");

         Layer[] layers = layerHandler.getLayers();
         for(int i=0; i<layers.length; i++){
            Layer tempLayer = (Layer)layers[i];
            
            //tempLayer.isValid();
            //layerHandler.hasLayer(tempLayer)
            //if(tempLayer.isShowing()){
            // tempLayer.setVisible(status);
            // System.out.println(tempLayer);
            //}else{
            if(tempLayer.getName().equalsIgnoreCase("usRivers")){
               System.out.println("Turning Rivers on...");
               Layer[] tempLayerArr = { tempLayer };
               tempLayer.validate();
               tempLayer.setVisible(true);
               layerHandler.turnLayerOn(true,i);
               layerHandler.init(tempLayerArr);
               layerHandler.addLayer(tempLayer);
            }
         }

What am I missing?

> -----Original Message-----
> From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
> On Behalf Of Hudson Brian R Contr AFRL/IFSF
> Sent: Tuesday, August 03, 2004 7:13 AM
> To: Ben Podoll; openmap-users_at_bbn.com
> Cc: 'OpenMap Support'
> Subject: RE: [OpenMap Users] resize mapbean (and keep extents)
>
> Hey,
>
> Before switching, grab the lat lon extents (the top left and bottom
> right
> lat/lons) from the Projection.
>
> You can then use the Projections getScale(LatLonPoint, LatLonPoint,
> Point,
> Point) function to determined what scale you should go to in order to
> maintain the same extents.
>
> Hope this helps,
>
> Brian Hudson
>
> -----Original Message-----
> From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
> On
> Behalf Of Ben Podoll
> Sent: Monday, August 02, 2004 7:08 PM
> To: openmap-users_at_bbn.com
> Cc: 'OpenMap Support'
> Subject: [OpenMap Users] resize mapbean (and keep extents)
>
>
> Hi,
>
> I have an application that takes my BasicMapPanel and swaps it from one
> JPanel on the GUI to another. One is the main view (big) and the other
> is
> the reference view (small).
>
> My problem is that: I want it to keep the same extents (or as close as
> possible when it switches from panel to panel) and they are never the
> same
> size because the frame it resides in can be pulled horizontally and
> vertically by the user.
>
> So I am hoping there is a way to do this by possibly zooming out a bit
> when
> it goes to the smaller Panel and zooming back in when it goes back to
> the
> larger one?
>
> Any ideas?
>
> Thanks,
> Ben
>
>
> --
> [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"]


--
[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 Aug 03 2004 - 10:23:44 EDT

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