Package org.vfny.geoserver.wms.requests

Examples of org.vfny.geoserver.wms.requests.GetLegendGraphicRequest


       
        Rule rule = multipleRulesStyle.getFeatureTypeStyles()[0].getRules()[0];
        LOGGER.info("testing single rule " + rule.getName() + " from style "
            + multipleRulesStyle.getName());

        GetLegendGraphicRequest req = new GetLegendGraphicRequest(getWMS());
        FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(MockData.ROAD_SEGMENTS.getNamespaceURI(), MockData.ROAD_SEGMENTS.getLocalPart());
        req.setLayer(ftInfo.getFeatureType());
        req.setStyle(multipleRulesStyle);
        req.setRule(rule);
        req.setLegendOptions(new HashMap());

        final int HEIGHT_HINT = 30;
        req.setHeight(HEIGHT_HINT);

        //use default values for the rest of parameters
        this.legendProducer.produceLegendGraphic(req);

        BufferedImage legend = this.legendProducer.getLegendGraphic();
View Full Code Here


      Style multipleRulesStyle = getCatalog().getStyleByName("rainfall").getStyle();
     
      assertNotNull(multipleRulesStyle);
     
 
      GetLegendGraphicRequest req = new GetLegendGraphicRequest(getWMS());
      CoverageInfo cInfo = getCatalog().getCoverageByName("world");
      assertNotNull(cInfo);
     
        GridCoverage coverage = cInfo.getGridCoverage(null, null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> feature;
        feature = FeatureUtilities.wrapGridCoverage((GridCoverage2D) coverage);
        req.setLayer(feature.getSchema());
      req.setStyle(multipleRulesStyle);
      req.setLegendOptions(new HashMap());
 
      final int HEIGHT_HINT = 30;
      req.setHeight(HEIGHT_HINT);
 
      //use default values for the rest of parameters
      this.legendProducer.produceLegendGraphic(req);
 
      BufferedImage legend = this.legendProducer.getLegendGraphic();
View Full Code Here

     */
    public void testNoLayerProvidedAndNonStrictRequest() throws Exception {
        Style style = getCatalog().getStyleByName("rainfall").getStyle();
        assertNotNull(style);

        GetLegendGraphicRequest req = new GetLegendGraphicRequest(getWMS());
        req.setStrict(false);
        req.setLayer(null);
        req.setStyle(style);

        final int HEIGHT_HINT = 30;
        req.setHeight(HEIGHT_HINT);

        // use default values for the rest of parameters
        this.legendProducer.produceLegendGraphic(req);

        BufferedImage legend = this.legendProducer.getLegendGraphic();
View Full Code Here

     * @param req DOCUMENT ME!
     *
     * @throws ServiceException DOCUMENT ME!
     */
    public void execute(Request req) throws ServiceException {
        GetLegendGraphicRequest request = (GetLegendGraphicRequest) req;

        final String outputFormat = request.getFormat();
        this.delegate = getDelegate(outputFormat);
        this.delegate.produceLegendGraphic(request);
    }
View Full Code Here

     * @param req DOCUMENT ME!
     *
     * @throws ServiceException DOCUMENT ME!
     */
    public void execute(Request req) throws ServiceException {
        GetLegendGraphicRequest request = (GetLegendGraphicRequest) req;
        GetLegendGraphicProducerSpi glf = getProducerFactory(request.getFormat());
        this.producer = glf.createLegendProducer(request.getFormat());
        this.producer.produceLegendGraphic(request);
    }
View Full Code Here

        Style multipleRulesStyle = getDefaultStyle(ROAD_SEGMENTS_TYPE);
        Rule rule = multipleRulesStyle.getFeatureTypeStyles()[0].getRules()[0];
        LOGGER.info("testing single rule " + rule.getName() + " from style "
            + multipleRulesStyle.getName());

        GetLegendGraphicRequest req = new GetLegendGraphicRequest();
        req.setLayer(getCiteDataStore().getSchema(ROAD_SEGMENTS_TYPE));
        req.setStyle(multipleRulesStyle);
        req.setRule(rule);

        final int HEIGHT_HINT = 30;
        req.setHeight(HEIGHT_HINT);

        //use default values for the rest of parameters
        this.legendProducer.produceLegendGraphic(req);

        BufferedImage legend = this.legendProducer.getLegendGraphic();
View Full Code Here

     * @throws Exception DOCUMENT ME!
     */
    public void testRespectsScale() throws Exception {
        Style style = createSampleStyleWithScale();

        GetLegendGraphicRequest req = new GetLegendGraphicRequest();
        req.setLayer(getCiteDataStore().getSchema(BUILDINGS_TYPE));
        req.setStyle(style);

        final int HEIGHT_HINT = 30;
        req.setHeight(HEIGHT_HINT);

        //use default values for the rest of parameters
        this.legendProducer.produceLegendGraphic(req);

        BufferedImage legend = this.legendProducer.getLegendGraphic();
        assertEquals("Expected two symbols since no scale was set yet",
            2 * HEIGHT_HINT, legend.getHeight());

        req.setScale(1500);
        this.legendProducer.produceLegendGraphic(req);
        legend = this.legendProducer.getLegendGraphic();
        assertEquals("Expected only one symbol", HEIGHT_HINT, legend.getHeight());
    }
View Full Code Here

     *         asking the producer to generate the legend
     */
    private BufferedImage testProduceLegendGraphic(String citeTypeName,
        int ruleCount) throws Exception {
        FeatureType layer = getCiteDataStore().getSchema(citeTypeName);
        GetLegendGraphicRequest req = new GetLegendGraphicRequest();
        req.setLayer(layer);
        req.setStyle(getDefaultStyle(citeTypeName));

        final int HEIGHT_HINT = 30;
        req.setHeight(HEIGHT_HINT);
        req.setWidth(30);

        this.legendProducer.produceLegendGraphic(req);

        BufferedImage legend = this.legendProducer.getLegendGraphic();
        showImage("legend", 1000, legend);
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.wms.requests.GetLegendGraphicRequest

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.