[geotk] puzzle-gis lookup

Thys Meintjes sthysel at gmail.com
Wed Aug 3 02:34:40 EDT 2011


Thanks Johan - I'm messing with it like this, for now...:-)
@Override
    public void actionPerformed(ActionEvent e) {

        Collection<Radar> radars = (Collection<Radar>)
Lookup.getDefault().lookupAll(Radar.class);
        GISProject project = (GISProject)
OpenProjects.getDefault().getMainProject();
        for (MapContext context : project.getContexts()) {
            for (Radar radar : radars) {
                TargetMapLayer targetLayer = new
TargetMapLayer(radar.getTargetManager());
                context.layers().add(targetLayer);
                RadarLayer radarLayer = new RadarLayer(radar);
                context.layers().add(radarLayer);
            }
        }
    }

The auto map save mechanism of course now adds these "ephemeral" layers. But
I'll look into that during the day.

Thanks again.

On Tue, Aug 2, 2011 at 8:40 PM, sorel johann <johann.sorel at geomatys.fr>wrote:

> **
> Hi thys,
>
> Macontext objects are not always loaded from the start since that may imply
> loading plenty of datastores or coverage readers.
> Unfortunatly there are no lookup which contain all Mapcontext but I see
> three alternatives.
>
> 1 - You can acces the currents projects with :
> GISProject project = OpenProjects.getDefault().getMainProject();
> or Project[] projects = OpenProjects.getDefault().getOpenProjects();
> and use project.getContexts() to get all MapContexts. and mess them as much
> as you want.
>
> 2 - Like above when you have the project you can get the Map folder object
> :
> FileObject obj = project.getMapFolder(true);
> and then attach a listener on this one to be noticed when a new mapcontext
> file is added.
>
> 3 - Make a patch for the GisProject lookup implementation to forward all
> events on creation/deletion of Mapcontexts ;-)
>
> johann
>
>
> On 02/08/2011 18:55, Thys Meintjes wrote:
>
> Hi All,
>
>  I'm building a application on top of puzzle-gis. I want to add extra
> layers to all MapContext's currently loaded in the puzzle-gis application.
> Is there a convenient Lookup that
>  has all instances of currently loaded mapContexts ? Maybe
> all GISContextDataObject's are available in a lookup ?
>
>  Thanks and regards
>
> --
> Thys Meintjes
>
>
>
> _______________________________________________
> Geotoolkit mailing listGeotoolkit at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/geotoolkit
>
>
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit
>
>


-- 
Thys Meintjes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20110803/12e62de0/attachment.html


More information about the Geotoolkit mailing list