Package org.geoserver.wms

Examples of org.geoserver.wms.WMS


        if (strict && format == null) {
            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);
View Full Code Here


    transformer = new KMLTransformer();

    // TODO: use GeoServer.isVerbose() to determine if we should indent?
    transformer.setIndentation(3);
    GetMapRequest request = mapContext.getRequest();
    WMS wms = request.getWMS();
    Charset encoding = wms.getCharSet();
    transformer.setEncoding(encoding);
  }
View Full Code Here

            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.LATLONG);
        } else {
            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.SIMPLE);
        }

        WMS wms = request.getWMS();
        Charset encoding = wms.getCharSet();
        tx.setEncoding(encoding);
        try {
            tx.transform(map, out);
        } catch (TransformerException e) {
            throw (IOException) new IOException().initCause(e);
View Full Code Here

            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.LATLONG);
        } else {
            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.SIMPLE);
        }

        WMS wms = request.getWMS();
        Charset encoding = wms.getCharSet();
        tx.setEncoding(encoding);
        try {
            tx.transform(map, out);
        } catch (TransformerException e) {
            throw (IOException) new IOException().initCause(e);
View Full Code Here

        transformer = new GeometryTransformer();
        // transformer.setUseDummyZ(true);
        transformer.setOmitXMLDeclaration(true);
        transformer.setNamespaceDeclarationEnabled(true);

        WMS config = mapContext.getRequest().getWMS();
        transformer.setNumDecimals(config.getNumDecimals());
       
        Object kmAttrObj = mapContext.getRequest().getFormatOptions().get("kmattr");
        if(kmAttrObj != null)
            this.vectorNameDescription = Converters.convert(kmAttrObj, Boolean.class);
        else
View Full Code Here

     * @see AbstractFeatureInfoResponse#writeTo(OutputStream)
     */
    @Override
    public void writeTo(final OutputStream out) throws ServiceException, IOException {
        final GetFeatureInfoRequest fInfoReq = getRequest();
        final WMS wmsConfig = fInfoReq.getWMS();

        //the 'response' object we'll pass to our OutputFormat
        FeatureCollectionType features = WfsFactory.eINSTANCE.createFeatureCollectionType();
       
        //the 'request' object we'll pass to our OutputFormat
        GetFeatureType gfreq = WfsFactory.eINSTANCE.createGetFeatureType();
        gfreq.setBaseUrl(fInfoReq.getBaseUrl());

        for (Iterator i = results.iterator(); i.hasNext();) {
            FeatureCollection<SimpleFeatureType, SimpleFeature> fc = (FeatureCollection)i.next();
            features.getFeature().add(fc);
           
            QueryType qt = WfsFactory.eINSTANCE.createQueryType();
            String crs = GML2EncodingUtils.epsgCode(fc.getSchema().getCoordinateReferenceSystem());
            if (crs != null) {
                final String srsName = "EPSG:" + crs;
                try {
                    qt.setSrsName(new URI(srsName));
                } catch (URISyntaxException e) {
                    throw new ServiceException("Unable to determite coordinate system for featureType " + fc.getSchema().getTypeName() + ".  Schema told us '" + srsName + "'", e);
                }
            }
            gfreq.getQuery().add(qt);
           
        }
       
        //this is a dummy wrapper around our 'request' object so that the new Dispatcher will accept it.
        Service serviceDesc = new Service("wms", null, null, Collections.EMPTY_LIST);
        Operation opDescriptor = new Operation("",serviceDesc,null, new Object[] { gfreq });
       
        final GeoServer gs = wmsConfig.getGeoServer();
        GML2OutputFormat format = new GML2OutputFormat(gs);
        format.write(features, out, opDescriptor);
    }
View Full Code Here

    @Override
    public void writeTo(OutputStream out)
        throws ServiceException, java.io.IOException {
        // setup the writer
        final GetFeatureInfoRequest request = getRequest();
        final WMS wmsConfig = request.getWMS();
        final Charset charSet = wmsConfig.getCharSet();
        final OutputStreamWriter osw = new OutputStreamWriter(out, charSet);
       
        // if there is only one feature type loaded, we allow for header/footer customization,
        // otherwise we stick with the generic ones
        Template header = null;
View Full Code Here

            templateLoader = new GeoServerTemplateLoader(getClass());
        }
       
        if(featureType != null) {
            final Name name = featureType.getName();
            final WMS wms = getRequest().getWMS();

            FeatureTypeInfo featureTypeInfo = wms.getFeatureTypeInfo(name);

            if(featureTypeInfo == null){
                //It may be a wrapped coverage
                CoverageInfo cInfo = wms.getCoverageInfo(name);
                if(cInfo != null){
                    templateLoader.setCoverage(cInfo);
                }else{
                    throw new IllegalArgumentException("Can't find neither a FeatureType nor " +
                            "a CoverageInfo named " + name);
View Full Code Here

        geosConfig.add(wmsInfo);

        catalog = new CatalogImpl();
        geosConfig.setCatalog(catalog);

        req = new WMSCapabilitiesRequest(new WMS(geosConfig));
        req.setBaseUrl(baseUrl);

        Map<String, String> namespaces = new HashMap<String, String>();
        namespaces.put("xlink", "http://www.w3.org/1999/xlink");
        XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces));
View Full Code Here

        catalog.add(coverageStoreInfo);
        catalog.add(coverageInfo);
        catalog.add(coverageLayerInfo);

        geoServerImpl.add(new WMSInfoImpl());
        WMS wms = new WMS(geoServerImpl);
        request = new DescribeLayerRequest(wms);
        request.setBaseUrl("http://localhost:8080/geoserver");
        request.setVersion("1.1.1");
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.WMS

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.