Package org.geotools.map

Examples of org.geotools.map.Layer


public abstract class AbstractGeoSearchDecorator implements KmlDecorator {

    protected String getFeatureTypeURL(KmlEncodingContext context) throws IOException {
        GeoServer gs = context.getWms().getGeoServer();
        Catalog catalog = gs.getCatalog();
        Layer layer = context.getCurrentLayer();
        FeatureSource featureSource = layer.getFeatureSource();
        Name typeName = featureSource.getSchema().getName();
        String nsUri = typeName.getNamespaceURI();
        NamespaceInfo ns = catalog.getNamespaceByURI(nsUri);
        String featureTypeName = typeName.getLocalPart();
        GetMapRequest request = context.getRequest();
View Full Code Here


        int defMaxDecimals = writer.getMaximunFractionDigits();

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

        for (int i = 0; i < nLayers; i++) {
            Layer layer = layers.get(i);
            SimpleFeatureIterator featureReader = null;
            SimpleFeatureSource fSource;
            fSource = (SimpleFeatureSource) layer.getFeatureSource();
            SimpleFeatureType schema = fSource.getSchema();

            try {
                String defaultGeometry = schema.getGeometryDescriptor().getName().getLocalPart();
                ReferencedEnvelope renderingArea = mapContent.getRenderingArea();
                BBOX bboxFilter = ff.bbox(ff.property(defaultGeometry), renderingArea);

                Query bboxQuery = new Query(schema.getTypeName(), bboxFilter);
                Query definitionQuery = layer.getQuery();
                Query finalQuery = new Query(DataUtilities.mixQueries(definitionQuery, bboxQuery,
                        "svgEncoder"));
                finalQuery.setHints(definitionQuery.getHints());
                finalQuery.setSortBy(definitionQuery.getSortBy());
                finalQuery.setStartIndex(definitionQuery.getStartIndex());

                LOGGER.fine("obtaining FeatureReader for " + schema.getTypeName());
                featureReader = fSource.getFeatures(finalQuery).features();
                LOGGER.fine("got FeatureReader, now writing");

                String groupId = null;
                String styleName = null;

                groupId = schema.getTypeName();

                styleName = layer.getStyle().getName();

                writer.write("<g id=\"" + groupId + "\"");

                if (!styleName.startsWith("#")) {
                    writer.write(" class=\"" + styleName + "\"");
View Full Code Here

            style = catalog.getStyleByName(styleName).getStyle();
        }

        FeatureTypeInfo info = catalog.getFeatureTypeByName(
                layerName.getNamespaceURI(), layerName.getLocalPart());
        Layer layer = null;
        if (info != null) {
            FeatureSource<? extends FeatureType, ? extends Feature> featureSource;
            featureSource = info.getFeatureSource(null, null);

            layer = new FeatureLayer(featureSource, style);
        }
        else {
            //try a coverage
            CoverageInfo cinfo =
                catalog.getCoverageByName(layerName.getNamespaceURI(), layerName.getLocalPart());
            GridCoverage2D cov = (GridCoverage2D) cinfo.getGridCoverage(null, null);
       
            layer = new GridCoverageLayer(cov, style);
        }

        if (layer == null) {
            throw new IllegalArgumentException("Could not find layer for " + layerName);
        }

        layer.setTitle(layerInfo.getTitle());
        return layer;
    }
View Full Code Here

        request.setBaseUrl("http://geoserver.org:8181/geoserver");

        mapContent = new WMSMapContent(request);
        FeatureSource source = layer.getFeatureSource(true);
        Style layerStyle = mockData.getDefaultStyle().getStyle();
        Layer Layer = new FeatureLayer(source, layerStyle);
        mapContent.addLayer(Layer);
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testExternalGraphicBackround() throws Exception {

        Layer Layer = createMapLayer(MockData.POINTS, "Bridge");
        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,
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testExternalGraphicSubdir() throws Exception {

        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);
View Full Code Here

        try {
            GeoServerInfo info = gs.getGlobal();
            info.setProxyBaseUrl("http://myhost:9999/gs");
            gs.save(info);

            Layer layer = createMapLayer(MockData.POINTS, "Bridge");
            FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
            featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) layer
                    .getFeatureSource();
            int nfeatures = featureSource.getFeatures().size();

            WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.POINTS));
            Document document;
View Full Code Here

        }
    }

    @Test
    public void testFilteredData() throws Exception {
        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);
View Full Code Here

    @Test
    public void testSetStandAlone() throws Exception {
        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);
View Full Code Here

        SimpleFeatureSource fs =
            (SimpleFeatureSource) typeInfo.getFeatureSource(null, null);
        SimpleFeatureCollection features = fs.getFeatures();

        Style style = mockData.getDefaultStyle().getStyle();
        Layer layer = new FeatureLayer(features, style);
        layer.setTitle("TestPointsTitle");

        GetMapRequest request = mockData.createRequest();
        request.setLayers(Collections.singletonList(mli));

        request.setMaxFeatures(2);
View Full Code Here

TOP

Related Classes of org.geotools.map.Layer

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.