[Gvsig_english] Adding a Layer

Bruno Gomes semog15 at gmail.com
Fri Apr 23 03:17:03 CEST 2010


Hello to all!
Im my extension i'm trying to add a layer to a view.
I have a method to create a wcs layer[1], this create the layer with the
parameters passed by me. After the layer creation, i try to add the layer to
a view, i do something like this:

IWindow iwin = PluginServices.getMDIManager().getActiveWindow();
MapContext mapcontext = mapControl.getMapContext();
Map mapControl = ((View) iwin).getMapControl();

FLyrWCS l = createWCSLayer(param);
if (l != null) {
                l.setVisible(true);
                mapcontext.beginAtomicEvent();
                AddLayer.checkProjection(l, mapControl.getViewPort());
                try {
                    mapcontext.getLayers().addLayer(l);
                } catch (CancelationException e) {
                    e.printStackTrace();
                }
                mapcontext.endAtomicEvent();
            }

[1]
public FLyrWCS createWCSLayer(Map<String,Object> parametros){

        FLyrWCS layer = new FLyrWCS();

        layer.setHost((String) parametros.get("Host"));
        layer.setCoverageName((String)
parametros.get("CurrentCoverageName"));
        layer.setSRS((String) parametros.get("SRS"));
        layer.setFormat((String) parametros.get("Format"));
        layer.setDriver((FMapWCSDriver) parametros.get("Driver"));
        layer.setTime((String) parametros.get("Time"));
        layer.setParameter((String) parametros.get("Parameter"));
        layer.setName((String) parametros.get("Name"));
        layer.setMaxResolution((Point2D) parametros.get("MaxResolution"));

        return layer;
    }

The problem is that my layer appears in the view table of contents (TOC),
but the map not appear. What im doing wrong? Help please!!

-- 
Bruno Gomes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20100423/c1aa6395/attachment.htm 


More information about the Gvsig_internacional mailing list