Package org.geoserver.catalog

Examples of org.geoserver.catalog.LayerGroupInfo


        Object obj = event.getSource();
      
        String prefixedName = null;
       
        if(obj instanceof LayerGroupInfo) {
            LayerGroupInfo lgInfo = (LayerGroupInfo) obj;
            prefixedName = lgInfo.getName();
        } else
        if(obj instanceof LayerInfo) {
            LayerInfo layerInfo = (LayerInfo) obj;
            prefixedName = layerInfo.getResource().getPrefixedName();
        }
View Full Code Here


        }
               
        // Adding layer groups
        Iterator<LayerGroupInfo> lgIter = cat.getLayerGroups().iterator();
        while(lgIter.hasNext()) {
            LayerGroupInfo lgi = lgIter.next();
           
            TileLayer tl = getLayer(lgi);
            //System.out.println(tl.getName() + " layergroupinfo");
            list.add(tl);
        }
View Full Code Here

        //layergroups
        File layergroups = resourceLoader.find( "layergroups" );
        if ( layergroups != null ) {
            for ( File lgf : list( layergroups, new SuffixFileFilter( ".xml" ) ) ) {
                try {
                    LayerGroupInfo lg = depersist( xp, lgf, LayerGroupInfo.class );
                    if(lg.getLayers() == null || lg.getLayers().size() == 0) {
                        LOGGER.warning("Skipping empty layer group '" + lg.getName() + "', it is invalid");
                        continue;
                    }
                    catalog.add( lg );
                   
                    LOGGER.info( "Loaded layer group '" + lg.getName() + "'" );   
                }
                catch( Exception e ) {
                    LOGGER.log( Level.WARNING, "Failed to load layer group '" + lgf.getName() + "'", e );
                }
            }
View Full Code Here

       
        File f = new File( testData.getDataDirectoryRoot(),
            "layergroups/lg.xml");
        assertFalse( f.exists() );
       
        LayerGroupInfo lg = catalog.getFactory().createLayerGroup();
        lg.setName("lg");
        lg.getLayers().add( catalog.getLayerByName( "foo") );
        lg.getStyles().add( catalog.getStyleByName( "foostyle") );
        lg.getLayers().add( catalog.getLayerByName( "foo") );
        lg.getStyles().add( /* default style */ null);
        lg.getLayers().add( catalog.getLayerByName( "foo") );
        lg.getStyles().add( catalog.getStyleByName( "foostyle"));

        catalog.add( lg );
       
        assertTrue( f.exists() );
    }
View Full Code Here

    }
   
    public void testModifyLayerGroup() throws Exception {
        testAddLayerGroup();
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( "lg" );
       
        StyleInfo s = catalog.getFactory().createStyle();
        s.setName( "foostyle2" );
        s.setFilename( "foostyle2.sld");
        catalog.add( s );
       
        lg.getStyles().set( 0, s );
        catalog.save( lg );
       
        File f = new File( testData.getDataDirectoryRoot(),
            "layergroups/lg.xml");
        Document dom = dom( f );
View Full Code Here

       
        setNativeBox(catalog, lakes);
        setNativeBox(catalog, forests);
        setNativeBox(catalog, bridges);
       
        LayerGroupInfo lg = catalog.getFactory().createLayerGroup();
        lg.setName(LAKES_GROUP);
        lg.getLayers().add(catalog.getLayerByName(lakes));
        lg.getStyles().add(catalog.getStyleByName(lakes));
        lg.getLayers().add(catalog.getLayerByName(forests));
        lg.getStyles().add(catalog.getStyleByName(forests));
        lg.getLayers().add(catalog.getLayerByName(bridges));
        lg.getStyles().add(catalog.getStyleByName(bridges));
        CatalogBuilder builder = new CatalogBuilder(catalog);
        builder.calculateLayerGroupBounds(lg);
        catalog.add(lg);
    }
View Full Code Here

        assertEquals(catalog.getResourceByName(name, ResourceInfo.class),
                visitor.getObjects(ResourceInfo.class, ModificationType.DELETE).get(0));
       
        // the group has been marked to update? (we need to compare by id as the
        // objects won't compare properly by equality)
        LayerGroupInfo group = catalog.getLayerGroupByName(LAKES_GROUP);
        assertEquals(group.getId(), visitor.getObjects(LayerGroupInfo.class,
                ModificationType.GROUP_CHANGED).get(0).getId());
    }
View Full Code Here

        List<MapLayerInfo> layerInfos = new ArrayList<MapLayerInfo>();
        for (String layerName : queryLayers) {
            LayerInfo layerInfo = wms.getLayerByName(layerName);
            if (layerInfo == null) {
                LayerGroupInfo layerGroup = wms.getLayerGroupByName(layerName);
                if (layerGroup == null) {
                    throw new WmsException("Layer " + layerName + " does not exist",
                            "LayerNotDefined");
                }
                for (LayerInfo li : layerGroup.getLayers()) {
                    layerInfos.add(new MapLayerInfo(li));
                }
            } else {
                layerInfos.add(new MapLayerInfo(layerInfo));
            }
View Full Code Here

                for (int i = 0; i < requestedLayerInfos.size(); i++) {
                    Object o = requestedLayerInfos.get(i);
                    Style style = oldStyles.isEmpty() ? null : (Style) oldStyles.get(i);
                   
                    if (o instanceof LayerGroupInfo) {
                        LayerGroupInfo groupInfo = (LayerGroupInfo)o;
                        for(int j = 0; j < groupInfo.getStyles().size(); j++) {
                            StyleInfo si = groupInfo.getStyles().get(j);
                            if(si == null)
                                si = groupInfo.getLayers().get(j).getDefaultStyle();
                            newStyles.add(si.getStyle());
                        }
                        // expand the filter on the layer group to all its sublayers
                        if(filters != null) {
                            for (int j = 0; j < groupInfo.getLayers().size(); j++) {
                                newFilters.add(getFilter(filters, i));
                            }
                        }
                    } else if(o instanceof LayerInfo){
                        style = oldStyles.size() > 0? oldStyles.get(i) : null;
View Full Code Here

                    } catch (Exception e) {
                        throw new WmsException(e);
                    }
                } else {
                    if(wms.getLayerGroupByName(layerName) != null) {
                        LayerGroupInfo group = wms.getLayerGroupByName(layerName);
                        for(int i = 0; i < group.getLayers().size(); i++) {
                            LayerInfo layer = group.getLayers().get(i);
                            layers.add(new MapLayerInfo(layer));
                            StyleInfo style = group.getStyles().get(i);
                            if(style != null) {
                                styles.add(style.getStyle());
                            } else {
                                styles.add(layer.getDefaultStyle().getStyle());
                            }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.LayerGroupInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.