Re: [OpenMap Users] global layer properties

From: F.Bayliss <bayliss_at_alcatel-lucent.com>
Date: Wed, 13 Jun 2007 08:37:43 -0400

Thanks Don,

FYI...
In my application I have extended the map properties file to allow me to
control other aspects of my program. So, I'm loading the map properties
and then setting all the appropriate objects. Doing this allowed me to
add 'globals layer settings' for the layers. What I'm defining are
properties with a prefix of "global.layers" like this:

global.layers.fillColor=F8F6DA
global.layers.lineColor=ADACAC
 
I then search the "openmap.layers" property and add the attribute to the
layer property if they don't exist.

        // Look for global layer settings and add them to the layer
specific settings
        String layers = props.getProperty("openmap.layers");
        ArrayList<String> globals = new ArrayList<String>();
        Enumeration e = props.keys();
        while (e.hasMoreElements()) {
            String key = (String)e.nextElement();
            if ( key.indexOf("global.layers")==0) {
                globals.add(key);
            }
        }
        if (layers!=null && globals.size()>0) {
            StringTokenizer st = new StringTokenizer(layers," ");
            while (st.hasMoreTokens()) {
                String layerPrefix = st.nextToken();
                for (String key:globals) {
                    String attr = key.substring(14);
                    String layer = layerPrefix+"."+attr;
                    if ( props.getProperty(layer)==null) {
                        props.put(layer,props.get(key));
                    }
                }
            }
        }


Don Dietrick wrote:
> Hi Frank,
>
> It totally depends on the layer, and how it reads properties. The
> standard OpenMap layers all look for properties scoped for the
> particular instance of a layer (using the marker name), so there's no
> way to do this for them as the code is currently written. But if you
> want your own set of layers to all key off the same property, that's
> certainly doable. The Properties object that shows up in the
> setProperties(...) method contains all of the properties in the file,
> so the layer would just ask for the one you want it to use.
>
> Hope this helps,
>
> Don
>
> On Jun 12, 2007, at 3:31 PM, F.Bayliss wrote:
>
>> Hello,
>>
>> Is there a way to set fillColor and other drawing attributes in the
>> properties file so that all the layers use those values instead of
>> having to specify the fillColor for each layer?
>>
>> Thanks
>> Frank
>>
>> --
>> [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"]
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>

--
[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 Wed Jun 13 2007 - 08:38:39 EDT

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