Package org.geoserver.wms

Examples of org.geoserver.wms.MapLayerInfo


            throw new ServiceException("Missing FORMAT parameter for GetLegendGraphic",
                    "MissingFormat");
        }

        WMS wms = request.getWMS();
        MapLayerInfo mli = null;
        if (layer != null) {
            LayerInfo layerInfo = wms.getLayerByName(layer);
            if (layerInfo == null) {
                throw new WmsException(layer + " layer does not exists.");
            }

            mli = new MapLayerInfo(layerInfo);

            try {
                if (layerInfo.getType() == Type.VECTOR) {
                    FeatureType featureType = mli.getFeature().getFeatureType();
                    request.setLayer(featureType);
                } else if (layerInfo.getType() == Type.RASTER) {
                    CoverageInfo coverageInfo = mli.getCoverage();

                    // it much safer to wrap a reader rather than a coverage in most cases, OOM can
                    // occur otherwise
                    final AbstractGridCoverage2DReader reader = (AbstractGridCoverage2DReader) coverageInfo
                            .getGridCoverageReader(new NullProgressListener(), GeoTools
View Full Code Here


            //for every layer specified in the request
            for (int i = 0; i < layers.length; i++) {
                //layer and info
                MapLayer layer = layers[i];
                MapLayerInfo layerInfo = mapContext.getRequest().getLayers()[i];

                //was a super overlay requested?
                Boolean superoverlay = (Boolean)mapContext.getRequest().getFormatOptions().get("superoverlay");
                superoverlay = (superoverlay == null ? Boolean.FALSE : superoverlay);
                if (superoverlay) {
                    //encode as super overlay
                    encodeSuperOverlayLayer(mapContext, layer);
                } else {
                    //figure out which type of layer this is, raster or vector
                    if (layerInfo.getType() != MapLayerInfo.TYPE_RASTER) {
                        //vector
                        encodeVectorLayer(mapContext, layer);
                    } else {
                        //encode as normal ground overlay
                        encodeRasterLayer(mapContext, layer);
View Full Code Here

    //Can't fetch bil for more than 1 layer
    if (reqlayers.length > 1)
    {
      throw new ServiceException("Cannot combine layers into BIL output");
    }
    MapLayerInfo mapLayerInfo = reqlayers[0];
   
    /*
    final ParameterValueGroup writerParams = format.getWriteParameters();
        writerParams.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString())
                    .setValue(wp);
    */
    GridCoverageReader coverageReader = mapLayerInfo.getCoverageReader();
   
    /*
     * Try to use a gridcoverage style render
     */
    GridCoverage2D subCov = null;
View Full Code Here

           
            Envelope e = new Envelope();
            e.setToNull();
           
            for ( int i = 0; i < request.getLayers().length; i++ ) {
                MapLayerInfo layer = request.getLayers()[i];
               
                Envelope b = null;
                try {
                    b = request.getLayers()[i].getLatLongBoundingBox();
                } catch (IOException e1) {
                    LOGGER.warning( "Unable to calculate bounds for " + layer.getName() );
                    continue;
                }
                if ( e.isNull() ) {
                    e.init( b );
                }
View Full Code Here

        mockData = new WMSMockData();
        mockData.setUp();

        request = mockData.createRequest();
        //add a layer so its a valid request
        MapLayerInfo layer = mockData.addFeatureTypeLayer("testType", Point.class);
        request.setLayers(new MapLayerInfo[] { layer });

        response = mockData.createResponse();
    }
View Full Code Here

    public void testSingleVectorLayer() throws IOException {
        DummyRasterMapProducer producer = new DummyRasterMapProducer();
        response = new GetMapResponse(Collections.singleton((GetMapProducer) producer));
        request.setFormat(DummyRasterMapProducer.MIME_TYPE);

        MapLayerInfo layer = mockData.addFeatureTypeLayer("testSingleVectorLayer", Point.class);
        request.setLayers(new MapLayerInfo[] { layer });

        response.execute(request);
       
        assertNotNull(producer.mapContext);
View Full Code Here

            //set the content disposition
        StringBuffer filename = new StringBuffer();
        boolean containsRasterData = false;
        boolean isRegionatingFriendly = true;
        for ( int i = 0; i < request.getLayers().length; i++ ) {
            MapLayerInfo layer = request.getLayers()[i];
            String name = layer.getName();
            containsRasterData = containsRasterData || (layer.getType() == MapLayerInfo.TYPE_RASTER);

            if (layer.getType() == MapLayerInfo.TYPE_VECTOR) {
                isRegionatingFriendly = isRegionatingFriendly &&
                    layer.getFeature().getFeatureSource(null,null).getQueryCapabilities().isReliableFIDSupported();
            } else if (layer.getType() == MapLayerInfo.TYPE_REMOTE_VECTOR) {
                isRegionatingFriendly = isRegionatingFriendly &&
                    layer.getRemoteFeatureSource().getQueryCapabilities().isReliableFIDSupported();
            }

            //strip off prefix
            int j = name.indexOf(':');
            if ( j > -1 ) {
View Full Code Here

        transformer.transform(request, writer);
        assertTrue(writer.getBuffer().indexOf(expected) > 0);
    }

    public void testSingleVectorLayer() throws Exception {
        MapLayerInfo mapLayerInfo = new MapLayerInfo(vectorLayerInfo);

        request.addLayer(mapLayerInfo);

        final String serverBaseUrl = "http://geoserver.org";
View Full Code Here

        assertXpathExists(layerDescPath + "/Query", dom);
        assertXpathEvaluatesTo("geos:states", layerDescPath + "/Query/@typeName", dom);
    }

    public void testSingleRasterLayer() throws Exception {
        MapLayerInfo mapLayerInfo = new MapLayerInfo(coverageLayerInfo);

        request.addLayer(mapLayerInfo);

        final String serverBaseUrl = "http://geoserver.org";
View Full Code Here

        assertXpathExists(layerDescPath + "/Query", dom);
        assertXpathEvaluatesTo("geos:fakeCoverage", layerDescPath + "/Query/@typeName", dom);
    }

    public void testMultipleLayers() throws Exception {
        request.addLayer(new MapLayerInfo(vectorLayerInfo));
        request.addLayer(new MapLayerInfo(coverageLayerInfo));

        final String serverBaseUrl = "http://geoserver.org";

        transformer = new DescribeLayerTransformer(serverBaseUrl);
        final Document dom = WMSTestSupport.transform(request, transformer);
View Full Code Here

TOP

Related Classes of org.geoserver.wms.MapLayerInfo

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.