Package org.geoserver.wms

Examples of org.geoserver.wms.WMSMapContent


    @Before
    public void setMapContent() throws Exception {
       
        layer = createMapLayer(MockData.BASIC_POLYGONS);

        mapContent = new WMSMapContent(createGetMapRequest(MockData.BASIC_POLYGONS));
        mapContent.addLayer(layer);
    }
View Full Code Here


        Document document;

        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
        featureSource = (SimpleFeatureSource) Layer.getFeatureSource();
        int nfeatures = featureSource.getFeatures().size();
        WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.POINTS));
        try {
            mapContent.addLayer(Layer);
            KMLVectorTransformer transformer = new KMLVectorTransformer(getWMS(), mapContent,
                    Layer);
            transformer.setIndentation(2);

            // print(document);
            document = WMSTestSupport.transform(featureSource.getFeatures(), transformer);
        } finally {
            mapContent.dispose();
        }
        // make sure we are generating icon styles, but that we're not sticking a color onto them
        XMLAssert.assertXpathEvaluatesTo("" + nfeatures, "count(//Style/IconStyle/Icon/href)",
                document);
        XMLAssert.assertXpathEvaluatesTo("0", "count(//Style/IconStyle/Icon/color)", document);
View Full Code Here

        Layer layer = createMapLayer(MockData.POINTS, "BridgeSubdir");

        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
        featureSource = (SimpleFeatureSource) layer.getFeatureSource();

        WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.POINTS));
        Document document;
        try {
            mapContent.addLayer(layer);
            KMLVectorTransformer transformer = new KMLVectorTransformer(getWMS(), mapContent,
                    layer);
            transformer.setIndentation(2);
            // print(document);
            document = WMSTestSupport.transform(featureSource.getFeatures(), transformer);
        } finally {
            mapContent.dispose();
        }
        // make sure we are generating icon styles with the subdir path
        XMLAssert.assertXpathEvaluatesTo(
                "http://localhost:8080/geoserver/styles/graphics/bridgesubdir.png",
                "//Style/IconStyle/Icon/href", document);
View Full Code Here

            FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
            featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) layer
                    .getFeatureSource();
            int nfeatures = featureSource.getFeatures().size();

            WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.POINTS));
            Document document;

            try {
                mapContent.addLayer(layer);
                KMLVectorTransformer transformer = new KMLVectorTransformer(getWMS(), mapContent,
                        layer);
                transformer.setIndentation(2);

                document = WMSTestSupport.transform(featureSource.getFeatures(), transformer);
                // print(document);
            } finally {
                mapContent.dispose();
            }
            // make sure we are using the proxy base URL
            XMLAssert.assertXpathEvaluatesTo("http://myhost:9999/gs/styles/bridge.png",
                    "//Style/IconStyle/Icon/href", document);
        } finally {
View Full Code Here

        Layer layer = createMapLayer(MockData.BASIC_POLYGONS, "SingleFeature");

        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
        featureSource = (SimpleFeatureSource) layer.getFeatureSource();

        WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.BASIC_POLYGONS));
        Document document;
        try {
            mapContent.addLayer(layer);

            KMLVectorTransformer transformer = new KMLVectorTransformer(getWMS(), mapContent,
                    layer);
            transformer.setIndentation(2);
            document = WMSTestSupport.transform(featureSource.getFeatures(), transformer);
        } finally {
            mapContent.dispose();
        }
        Element element = document.getDocumentElement();
        assertEquals("kml", element.getNodeName());
        assertEquals(1, element.getElementsByTagName("Placemark").getLength());
        assertEquals(1, element.getElementsByTagName("Style").getLength());
View Full Code Here

        HashMap formatOptions = new HashMap();
        formatOptions.put("kmplacemark", new Boolean(doPlacemarks));
        formatOptions.put("kmscore", new Integer(0));
        getMapRequest.setFormatOptions(formatOptions);

        WMSMapContent mapContent = new WMSMapContent(getMapRequest);
        mapContent.addLayer(layer);
        mapContent.setMapHeight(1024);
        mapContent.setMapWidth(1024);

        // create the map producer
        KMZMapOutputFormat mapProducer = new KMZMapOutputFormat(getWMS());
        KMZMapResponse mapEncoder = new KMZMapResponse(getWMS());
        KMZMap kmzMap = mapProducer.produceMap(mapContent);
View Full Code Here

        // Map<String, String> namespaces = new HashMap<String, String>();
        // namespaces.put("atom", "http://purl.org/atom/ns#");
        // XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces));

        MapLayerInfo layer = mockData.addFeatureTypeLayer("TestPoints", Point.class);
        mapContent = new WMSMapContent();
        GetMapRequest request = mockData.createRequest();
        request.setLayers(Collections.singletonList(layer));

        SimpleFeatureSource featureSource;
        featureSource = (SimpleFeatureSource) ((FeatureTypeInfo)layer.getFeature()).getFeatureSource(null, null);
View Full Code Here

    @Before
    public void prepare() throws Exception {
       
        Layer = createMapLayer(DISPERSED_FEATURES);

        mapContent = new WMSMapContent(createGetMapRequest(MockData.BASIC_POLYGONS));
        mapContent.addLayer(Layer);
    }
View Full Code Here

        b = new SimpleFeatureBuilder(type2);
        b.add(wkt.read("LINESTRING(0 0, 1 1)"));
        b.add("one");
        features2.add(b.buildFeature("fid.1"));
       
        WMSMapContent context = new WMSMapContent();
        context.addLayer(new FeatureLayer(DataUtilities.source(features1), null));
        context.addLayer(new FeatureLayer(DataUtilities.source(features2), null));
        context.setMapWidth(500);
        context.setMapHeight(500);
        context.getViewport().setBounds(new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84));
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        adapter.write(context, out);
       
        String result = "500;500\n" +
View Full Code Here

        SimpleFeatureCollection features = FeatureCollections
                .newCollection();
        Style style = mockData.getDefaultStyle().getStyle();
        Layer layer = new FeatureLayer(features, style);

        WMSMapContent mapContent = new WMSMapContent();
        GetMapRequest request = mockData.createRequest();
        mapContent.setRequest(request);

        KMLVectorTransformer transformer = new KMLVectorTransformer(mockData.getWMS(), mapContent, layer);

        Document document;
View Full Code Here

TOP

Related Classes of org.geoserver.wms.WMSMapContent

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.