RE: [OpenMap Users] changing buffered shape layer properties

From: Vincent, Chuck <CVincent_at_sfa.com>
Date: Tue, 9 Aug 2005 13:03:09 -0400

No one?

 

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of Vincent, Chuck
Sent: Wednesday, August 03, 2005 2:25 PM
To: openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] changing buffered shape layer properties

I tried your second suggestion, but just calling setProperties() did not
change the map. I came up with the following function that removes all
Componets and then calls shapeLayer.setProperties(), and add(shapeLayer)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public void setMap(int mapId)
{
        Component[] lComp = getComponents();
        for(int k = 0; k < lComp.length; k++ )
        {
                remove(k);
        }
        if("shape".equals(dataProperties[mapId].get("dataType")))
        {
                dataProperties[mapId].put("shapeFile", server_ +
dataProperties[mapId].get("dataFile"));
                myShapeLayer.setProperties(dataProperties[mapId]);
                add(myShapeLayer);
        }
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 

However, this will only work if you changed the projection between
calls. If I call this setMap(1) and then go a pan then setMap(2) map 1
will be removed and map 2 will be drawn. If I do not do the change,
just the blue background of the map will be on the screen UNTIL I
perform a projection change such as a pan or zoom.

Any ideas to what I am doing wrong?

Thanks,
Chuck


-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: Friday, July 29, 2005 6:16 PM
To: Vincent, Chuck
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] changing buffered shape layer properties

Hi Chuck,

On Jul 29, 2005, at 9:21 AM, Vincent, Chuck wrote:

> I need the ability to change the Properties of a BufferedShapeLayer
> and have the MapBean redraw. Particularly, I need that ability to
> change the shapeFile property to reflect different user selected data.

The easiest thing to do is create a new SpatialIndex object with the
new shape file, and then set that on the layer. You'll want to call
setList(getWholeWorld()) on the BufferedShapeLayer, too after
resetting the SpatialIndex property.

You can also set the new file by creating a new set of properties and
calling setProperties on the layer.

> I have tried to create a new BufferedShapeLayer and adding it to
> the MapBean [mapBean.add(myBShapeLayer)] am I missing a command to
> redraw? Do I have to do something special before adding the new
> layer?

No, if it's configured correctly, it should render.

- Don

--
[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 09 2005 - 13:03:36 EDT

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