Examples of XMLGridSubset


Examples of org.geowebcache.config.XMLGridSubset

    }

    @Test
    public void testMarshallingGridSubsets() {
        List<XMLGridSubset> subsets = new ArrayList<XMLGridSubset>();
        XMLGridSubset subset;
        subset = new XMLGridSubset();
        subset.setGridSetName("EPSG:4326");
        subset.setZoomStart(1);
        subset.setZoomStop(10);
        subset.setExtent(new BoundingBox(0, 0, 180, 90));
        subsets.add(subset);

        subset = new XMLGridSubset();
        subset.setGridSetName("EPSG:900913");
        subsets.add(subset);

        subset = new XMLGridSubset();
        subset.setGridSetName("GlobalCRS84Scale");
        subset.setZoomStart(4);
        subset.setExtent(new BoundingBox(-100, -40, 100, 40));
        subsets.add(subset);

        info.getGridSubsets().add(subsets.get(0));
        testMarshaling(info);
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        info.setEnabled(defaults.isCacheLayersByDefault());
        info.setAutoCacheStyles(defaults.isCacheNonDefaultStyles());

        for (String gsetId : defaults.getDefaultCachingGridSetIds()) {
            XMLGridSubset subset = new XMLGridSubset();
            subset.setGridSetName(gsetId);
            info.getGridSubsets().add(subset);
        }

        info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats());
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        for (String code : epsgCodes) {
            if (code.trim().length() == 0) {
                continue;
            }
            try {
                XMLGridSubset xmlGridSubset = new XMLGridSubset();
                xmlGridSubset.setGridSetName(code);
                gridSubsets.add(xmlGridSubset);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "Invalid GridSubset list: " + gridSubsetsStr);
            }
        }
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        assertNotNull(gridSubsets);
        assertEquals(2, gridSubsets.size());

        Set<XMLGridSubset> subsets = layerInfoTileLayer.getInfo().getGridSubsets();
        subsets.clear();
        XMLGridSubset xmlGridSubset = new XMLGridSubset();
        xmlGridSubset.setGridSetName("EPSG:900913");
        subsets.add(xmlGridSubset);
        LegacyTileLayerInfoLoader.save(layerInfoTileLayer.getInfo(), layerInfo.getMetadata());
        layerInfoTileLayer = new GeoServerTileLayer(layerInfo, defaults, gridSetBroker);

        gridSubsets = layerInfoTileLayer.getGridSubsets();
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        layerGroupInfoTileLayer = new GeoServerTileLayer(layerGroup, defaults, gridSetBroker);

        // force building and setting the bounds to the saved representation
        layerGroupInfoTileLayer.getGridSubsets();

        XMLGridSubset savedSubset = layerGroupInfoTileLayer.getInfo().getGridSubsets().iterator()
                .next();

        BoundingBox gridSubsetExtent = savedSubset.getExtent();
        BoundingBox expected = gridSetBroker.WORLD_EPSG3857.getOriginalExtent();
        // don't use equals(), it uses an equality threshold we want to avoid here
        double threshold = 1E-16;
        assertTrue("Expected " + expected + ", got " + gridSubsetExtent,
                expected.equals(gridSubsetExtent, threshold));
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        return oldValue;
    }

    @Override
    public void addGridSubset(GridSubset gridSubset) {
        XMLGridSubset gridSubsetInfo = new XMLGridSubset(gridSubset);
        Set<XMLGridSubset> gridSubsets = new HashSet<XMLGridSubset>(info.getGridSubsets());
        gridSubsets.add(gridSubsetInfo);
        info.setGridSubsets(gridSubsets);
        this.subSets = null;
    }
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

            protected void populateItem(final ListItem<XMLGridSubset> item) {
                // odd/even style
                final int index = item.getIndex();
                item.add(new SimpleAttributeModifier("class", index % 2 == 0 ? "even" : "odd"));

                final XMLGridSubset gridSubset = item.getModelObject();
                GridSetBroker gridSetBroker = GWC.get().getGridSetBroker();

                String gridsetDescription = null;
                int gridsetLevels;
                boolean gridsetExists;
                {
                    final GridSet gridSet = gridSetBroker.get(gridSubset.getGridSetName());
                    gridsetExists = gridSet != null;
                    if (gridsetExists) {
                        gridsetLevels = gridSet.getNumLevels();
                        gridsetDescription = gridSet.getDescription();
                    } else {
                        gridsetLevels = gridSubset.getZoomStop() == null ? 1 : gridSubset
                                .getZoomStop().intValue();
                    }
                }
                final Label gridSetLabel;
                final Component gridSetBounds;

                gridSetLabel = new Label("gridSet", new PropertyModel<String>(item.getModel(),
                        "gridSetName"));
                if(!gridsetExists){
                    gridSetLabel.add(new AttributeModifier("style", true, new Model<String>("color:red;text-decoration:line-through;")));
                    getPage().warn("GridSet " + gridSubset.getGridSetName() + " does not exist");
                }
                item.add(gridSetLabel);
                if (null != gridsetDescription) {
                    gridSetLabel.add(new AttributeModifier("title", true, new Model<String>(
                            gridsetDescription)));
                }

                final Component removeLink;

                final int maxZoomLevel = gridsetLevels - 1;
                final ArrayList<Integer> zoomLevels = new ArrayList<Integer>(maxZoomLevel + 1);
                for (int z = 0; z <= maxZoomLevel; z++) {
                    zoomLevels.add(Integer.valueOf(z));
                }

                // zoomStart has all zoom levels as choices
                // zoomStop choices start at zoomStart's selection
                // minCachedLevel start at zoomStart's selection and ends at zoomStop's selection
                // maxCachedLevel start at minCachedLevels' and ends at zoomStop's selection

                final IModel<Integer> zoomStartModel;
                final IModel<Integer> zoomStopModel;
                final IModel<Integer> minCachedLevelModel;
                final IModel<Integer> maxCachedLevelModel;

                final ZoomLevelDropDownChoice zoomStart;
                final ZoomLevelDropDownChoice zoomStop;
                final ZoomLevelDropDownChoice minCachedLevel;
                final ZoomLevelDropDownChoice maxCachedLevel;

                zoomStartModel = new PropertyModel<Integer>(item.getModel(), "zoomStart");
                zoomStopModel = new PropertyModel<Integer>(item.getModel(), "zoomStop");
                minCachedLevelModel = new PropertyModel<Integer>(item.getModel(), "minCachedLevel");
                maxCachedLevelModel = new PropertyModel<Integer>(item.getModel(), "maxCachedLevel");

                @SuppressWarnings({ "rawtypes", "unchecked" })
                final IModel<List<Integer>> allLevels = new Model(zoomLevels);

                zoomStart = new ZoomLevelDropDownChoice("zoomStart", zoomStartModel, allLevels);
                zoomStart.setEnabled(gridsetExists);
                item.add(zoomStart);

                zoomStop = new ZoomLevelDropDownChoice("zoomStop", zoomStopModel, allLevels);
                zoomStop.setEnabled(gridsetExists);
                item.add(zoomStop);

                minCachedLevel = new ZoomLevelDropDownChoice("minCachedLevel", minCachedLevelModel,
                        allLevels);
                minCachedLevel.setEnabled(gridsetExists);
                item.add(minCachedLevel);

                maxCachedLevel = new ZoomLevelDropDownChoice("maxCachedLevel", maxCachedLevelModel,
                        allLevels);
                maxCachedLevel.setEnabled(gridsetExists);
                item.add(maxCachedLevel);

                for (ZoomLevelDropDownChoice dropDown : Arrays.asList(zoomStart, zoomStop,
                        minCachedLevel, maxCachedLevel)) {
                    dropDown.add(new OnChangeAjaxBehavior() {
                        private static final long serialVersionUID = 1L;

                        // cascades to zoomStop, min and max cached levels
                        @Override
                        protected void onUpdate(AjaxRequestTarget target) {
                            updateValidZoomRanges(zoomStart, zoomStop, minCachedLevel,
                                    maxCachedLevel, target);
                        }
                    });
                }

                updateValidZoomRanges(zoomStart, zoomStop, minCachedLevel, maxCachedLevel, null);

                // gridSetBounds = new EnvelopePanel("bounds");
                // gridSetBounds.setCRSFieldVisible(false);
                // gridSetBounds.setCrsRequired(false);
                // gridSetBounds.setLabelsVisibility(false);
                // gridSetBounds.setModel(new Model<ReferencedEnvelope>(new ReferencedEnvelope()));
                gridSetBounds = new Label("bounds", new ResourceModel(
                        "GridSubsetsEditor.bounds.dynamic"));
                item.add(gridSetBounds);

                removeLink = new ImageAjaxLink("removeLink", GWCIconFactory.DELETE_ICON) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void onClick(AjaxRequestTarget target) {
                        List<XMLGridSubset> list;
                        list = new ArrayList<XMLGridSubset>(grids.getModelObject());
                        final XMLGridSubset subset = (XMLGridSubset) getDefaultModelObject();

                        list.remove(subset);

                        grids.setModelObject(list);

                        List<String> choices = new ArrayList<String>(availableGridSets.getChoices());
                        choices.add(subset.getGridSetName());
                        Collections.sort(choices);
                        availableGridSets.setChoices(choices);

                        target.addComponent(container);
                        target.addComponent(availableGridSets);
                    }
                };
                removeLink.setDefaultModel(item.getModel());
                removeLink.add(new AttributeModifier("title", true, new ResourceModel(
                        "GridSubsetsEditor.removeLink")));
                item.add(removeLink);
            }
        };

        grids.setOutputMarkupId(true);
        // this is necessary to avoid loosing item contents on edit/validation checks
        grids.setReuseItems(true);
        table.add(grids);

        List<String> gridSetNames = new ArrayList<String>(GWC.get().getGridSetBroker().getNames());
        for (XMLGridSubset gs : model.getObject()) {
            gridSetNames.remove(gs.getGridSetName());
        }
        Collections.sort(gridSetNames);

        GeoServerAjaxFormLink addGridsubsetLink = new GeoServerAjaxFormLink("addGridSubset") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onClick(AjaxRequestTarget target, Form form) {
                availableGridSets.processInput();

                final String selectedGridset = availableGridSets.getModelObject();
                if (null == selectedGridset) {
                    return;
                }

                List<String> choices = new ArrayList<String>(availableGridSets.getChoices());
                choices.remove(selectedGridset);
                availableGridSets.setChoices(choices);
                availableGridSets.setEnabled(!choices.isEmpty());

                XMLGridSubset newSubset = new XMLGridSubset();
                newSubset.setGridSetName(selectedGridset);
                grids.getModelObject().add(newSubset);

                target.addComponent(table);
                target.addComponent(availableGridSets);
            }
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

        GridSetBroker broker = gridSetBroker;

        for (String gsetName : gridSetNames) {
            GridSet gridSet = broker.get(gsetName);
            XMLGridSubset xmlGridSubset = new XMLGridSubset();
            String gridSetName = gridSet.getName();
            xmlGridSubset.setGridSetName(gridSetName);
            GridSubset gridSubSet = xmlGridSubset.getGridSubSet(broker);
            subsets.put(gsetName, gridSubSet);
            bySrs.put(gridSet.getSrs(), gridSubSet);

            when(tileLayer.getGridSubset(eq(gsetName))).thenReturn(gridSubSet);
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

            Iterator<XMLOldGrid> iter = grids.values().iterator();
            while (iter.hasNext()) {
                GridSubset converted = iter.next().convertToGridSubset(gridSetBroker);
                subSets.put(converted.getSRS().toString(), converted);
                // hold it in case the layer is to be saved again
                gridSubsets.add(new XMLGridSubset(converted));
            }
            // Null it for the garbage collector
            grids = null;
        }
View Full Code Here

Examples of org.geowebcache.config.XMLGridSubset

    }

    @Override
    public synchronized GridSubset removeGridSubset(String gridSetId) {
        for (Iterator<XMLGridSubset> it = gridSubsets.iterator(); it.hasNext();) {
            XMLGridSubset configSubset = it.next();
            if (gridSetId.equals(configSubset.getGridSetName())) {
                it.remove();
                break;
            }
        }
        return subSets.remove(gridSetId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.