sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [sis] branch geoapi-4.0 updated: Portrayal : add SEPortrayalTest and mock classes
Date Mon, 18 Jan 2021 07:39:19 GMT
This is an automated email from the ASF dual-hosted git repository.

jsorel pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 6dd1602  Portrayal : add SEPortrayalTest and mock classes
6dd1602 is described below

commit 6dd1602285e86ccdc97bfab94a18de0f84d44cdd
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Mon Jan 18 08:38:28 2021 +0100

    Portrayal : add SEPortrayalTest and mock classes
---
 .../sis/internal/map/MockFeatureTypeStyle.java     | 107 ++++++++++
 .../sis/internal/map/MockLineSymbolizer.java       | 112 ++++++++++
 .../java/org/apache/sis/internal/map/MockRule.java | 131 ++++++++++++
 .../org/apache/sis/internal/map/MockStyle.java     |  86 ++++++++
 .../apache/sis/internal/map/SEPortrayerTest.java   | 231 +++++++++++++++++++++
 5 files changed, 667 insertions(+)

diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockFeatureTypeStyle.java
b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockFeatureTypeStyle.java
new file mode 100644
index 0000000..9c754e9
--- /dev/null
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockFeatureTypeStyle.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.map;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.opengis.filter.Id;
+import org.opengis.metadata.citation.OnlineResource;
+import org.opengis.style.Description;
+import org.opengis.style.FeatureTypeStyle;
+import org.opengis.style.Rule;
+import org.opengis.style.SemanticType;
+import org.opengis.style.StyleVisitor;
+import org.opengis.util.GenericName;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class MockFeatureTypeStyle implements FeatureTypeStyle {
+
+    private String name;
+    private Description description;
+    private final Set<GenericName> featureTypeNames = new HashSet<>();
+    private final Set<SemanticType> semanticTypes = new HashSet<>();
+    private final List<Rule> rules = new ArrayList<>();
+    private OnlineResource onlineResource;
+
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public Description getDescription() {
+        return description;
+    }
+
+    public void setDescription(Description description) {
+        this.description = description;
+    }
+
+
+    @Override
+    public Set<GenericName> featureTypeNames() {
+        return featureTypeNames;
+    }
+
+    @Override
+    public Set<SemanticType> semanticTypeIdentifiers() {
+        return semanticTypes;
+    }
+
+    @Override
+    public List<Rule> rules() {
+        return rules;
+    }
+
+    @Override
+    public OnlineResource getOnlineResource() {
+        return onlineResource;
+    }
+
+    public void setOnlineResource(OnlineResource onlineResource) {
+        this.onlineResource = onlineResource;
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Id getFeatureInstanceIDs() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Object accept(StyleVisitor sv, Object o) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+}
diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockLineSymbolizer.java
b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockLineSymbolizer.java
new file mode 100644
index 0000000..61412f8
--- /dev/null
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockLineSymbolizer.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.map;
+
+import javax.measure.Unit;
+import javax.measure.quantity.Length;
+import org.opengis.filter.expression.Expression;
+import org.opengis.style.Description;
+import org.opengis.style.LineSymbolizer;
+import org.opengis.style.Stroke;
+import org.opengis.style.StyleVisitor;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class MockLineSymbolizer implements LineSymbolizer {
+
+    private String name;
+    private Description description;
+
+    private Stroke stroke;
+    private Expression perpendicularOffset;
+    private Unit<Length> unitOfMeasure;
+    private Expression geometry;
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public Description getDescription() {
+        return description;
+    }
+
+    public void setDescription(Description description) {
+        this.description = description;
+    }
+
+    @Override
+    public Stroke getStroke() {
+        return stroke;
+    }
+
+    public void setStroke(Stroke stroke) {
+        this.stroke = stroke;
+    }
+
+    @Override
+    public Expression getPerpendicularOffset() {
+        return perpendicularOffset;
+    }
+
+    public void setPerpendicularOffset(Expression perpendicularOffset) {
+        this.perpendicularOffset = perpendicularOffset;
+    }
+
+    @Override
+    public Unit<Length> getUnitOfMeasure() {
+        return unitOfMeasure;
+    }
+
+    public void setUnitOfMeasure(Unit<Length> unitOfMeasure) {
+        this.unitOfMeasure = unitOfMeasure;
+    }
+
+    @Override
+    public Expression getGeometry() {
+        return geometry;
+    }
+
+    public void setGeometry(Expression geometry) {
+        this.geometry = geometry;
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public String getGeometryPropertyName() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Object accept(StyleVisitor sv, Object o) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+}
diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockRule.java b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockRule.java
new file mode 100644
index 0000000..d8f38c0
--- /dev/null
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockRule.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.map;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opengis.filter.Filter;
+import org.opengis.metadata.citation.OnlineResource;
+import org.opengis.style.Description;
+import org.opengis.style.GraphicLegend;
+import org.opengis.style.Rule;
+import org.opengis.style.StyleVisitor;
+import org.opengis.style.Symbolizer;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class MockRule implements Rule {
+
+    private String name;
+    private Description description;
+    private GraphicLegend legend;
+    private Filter filter;
+    private boolean iselseFilter;
+    private double minScaleDenominator = 0.0;
+    private double maxScaleDenominator = Double.MAX_VALUE;
+    private final List<Symbolizer> symbolizers = new ArrayList<>();
+    private OnlineResource onlineResource;
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public Description getDescription() {
+        return description;
+    }
+
+    public void setDescription(Description description) {
+        this.description = description;
+    }
+
+    @Override
+    public GraphicLegend getLegend() {
+        return legend;
+    }
+
+    public void setLegeng(GraphicLegend legend) {
+        this.legend = legend;
+    }
+
+    @Override
+    public Filter getFilter() {
+        return filter;
+    }
+
+    public void setFilter(Filter filter) {
+        this.filter = filter;
+    }
+
+    @Override
+    public boolean isElseFilter() {
+        return iselseFilter;
+    }
+
+    public void setIsElseFilter(boolean iselseFilter) {
+        this.iselseFilter = iselseFilter;
+    }
+
+    @Override
+    public double getMinScaleDenominator() {
+        return minScaleDenominator;
+    }
+
+    public void setMinScaleDenominator(double minScaleDenominator) {
+        this.minScaleDenominator = minScaleDenominator;
+    }
+
+    @Override
+    public double getMaxScaleDenominator() {
+        return maxScaleDenominator;
+    }
+
+    public void setMaxScaleDenominator(double maxScaleDenominator) {
+        this.maxScaleDenominator = maxScaleDenominator;
+    }
+
+    @Override
+    public List<Symbolizer> symbolizers() {
+        return symbolizers;
+    }
+
+    @Override
+    public OnlineResource getOnlineResource() {
+        return onlineResource;
+    }
+
+    public void setOnlineResource(OnlineResource onlineResource) {
+        this.onlineResource = onlineResource;
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Object accept(StyleVisitor sv, Object o) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+}
diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockStyle.java b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockStyle.java
new file mode 100644
index 0000000..2109949
--- /dev/null
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/MockStyle.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.map;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opengis.style.Description;
+import org.opengis.style.FeatureTypeStyle;
+import org.opengis.style.StyleVisitor;
+import org.opengis.style.Symbolizer;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class MockStyle implements org.opengis.style.Style {
+
+    private String name;
+    private Description description;
+    private final List<FeatureTypeStyle> fts = new ArrayList<>();
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public Description getDescription() {
+        return description;
+    }
+
+    public void setDescription(Description description) {
+        this.description = description;
+    }
+
+    @Override
+    public List<FeatureTypeStyle> featureTypeStyles() {
+        return fts;
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public boolean isDefault() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Symbolizer getDefaultSpecification() {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+    /**
+     * Will likely be removed from geoapi.
+     */
+    @Deprecated
+    @Override
+    public Object accept(StyleVisitor sv, Object o) {
+        throw new UnsupportedOperationException("Not supported.");
+    }
+
+}
diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/SEPortrayerTest.java
b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/SEPortrayerTest.java
new file mode 100644
index 0000000..02ae357
--- /dev/null
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/SEPortrayerTest.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.map;
+
+import java.util.AbstractMap;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.sis.coverage.grid.GridExtent;
+import org.apache.sis.coverage.grid.GridGeometry;
+import org.apache.sis.coverage.grid.GridOrientation;
+import org.apache.sis.feature.builder.AttributeRole;
+import org.apache.sis.feature.builder.FeatureTypeBuilder;
+import org.apache.sis.internal.feature.AttributeConvention;
+import org.apache.sis.internal.storage.MemoryFeatureSet;
+import org.apache.sis.portrayal.MapItem;
+import org.apache.sis.portrayal.MapLayer;
+import org.apache.sis.portrayal.MapLayers;
+import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.storage.FeatureSet;
+import org.apache.sis.test.TestCase;
+import org.apache.sis.util.iso.Names;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.locationtech.jts.geom.Point;
+import org.locationtech.jts.geom.Polygon;
+import org.opengis.feature.Feature;
+import org.opengis.feature.FeatureType;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.style.SemanticType;
+import org.opengis.style.Symbolizer;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public class SEPortrayerTest extends TestCase {
+
+    private final FeatureSet fishes;
+    private final FeatureSet boats;
+
+    public SEPortrayerTest() {
+
+        final GeometryFactory gf = new GeometryFactory();
+        final CoordinateReferenceSystem crs = CommonCRS.WGS84.normalizedGeographic();
+
+        final FeatureTypeBuilder fishbuilder = new FeatureTypeBuilder();
+        fishbuilder.setName("fish");
+        fishbuilder.addAttribute(String.class).setName("id").addRole(AttributeRole.IDENTIFIER_COMPONENT);
+        fishbuilder.addAttribute(Point.class).setCRS(crs).setName("geom").addRole(AttributeRole.DEFAULT_GEOMETRY);
+        final FeatureType fishType = fishbuilder.build();
+
+        final Point point1 = gf.createPoint(new Coordinate(0, 0));
+        point1.setUserData(crs);
+        final Feature fish1 = fishType.newInstance();
+        fish1.setPropertyValue("id", "1");
+        fish1.setPropertyValue("geom", point1);
+
+        final Point point2 = gf.createPoint(new Coordinate(1, 1));
+        point2.setUserData(crs);
+        final Feature fish2 = fishType.newInstance();
+        fish2.setPropertyValue("id", "2");
+        fish2.setPropertyValue("geom", point2);
+
+        fishes = new MemoryFeatureSet(null, fishType, Arrays.asList(fish1, fish2));
+
+
+        final FeatureTypeBuilder boatbuilder = new FeatureTypeBuilder();
+        boatbuilder.setName("boat");
+        boatbuilder.addAttribute(String.class).setName("id").addRole(AttributeRole.IDENTIFIER_COMPONENT);
+        boatbuilder.addAttribute(Polygon.class).setCRS(crs).setName("geom").addRole(AttributeRole.DEFAULT_GEOMETRY);
+        final FeatureType boatType = boatbuilder.build();
+
+        final Polygon poly1 = gf.createPolygon(gf.createLinearRing(new Coordinate[]{new Coordinate(0,
0),new Coordinate(0, 1),new Coordinate(1, 1),new Coordinate(0, 0)}));
+        poly1.setUserData(crs);
+        final Feature boat1 = boatType.newInstance();
+        boat1.setPropertyValue("id", "10");
+        boat1.setPropertyValue("geom", poly1);
+
+        final Polygon poly2 = gf.createPolygon(gf.createLinearRing(new Coordinate[]{new Coordinate(0,
0),new Coordinate(0, 1),new Coordinate(1, 1),new Coordinate(0, 0)}));
+        poly2.setUserData(crs);
+        final Feature boat2 = boatType.newInstance();
+        boat2.setPropertyValue("id", "20");
+        boat2.setPropertyValue("geom", poly2);
+
+        boats = new MemoryFeatureSet(null, boatType, Arrays.asList(boat1, boat2));
+    }
+
+    private Set<Entry<String, Symbolizer>> present(MapItem item) {
+        final GridGeometry grid = new GridGeometry(new GridExtent(360, 180), CRS.getDomainOfValidity(CommonCRS.WGS84.normalizedGeographic()),
GridOrientation.REFLECTION_Y);
+        final SEPortrayer portrayer = new SEPortrayer();
+        final Stream<Presentation> stream = portrayer.present(grid, item);
+        final List<Presentation> presentations = stream.collect(Collectors.toList());
+
+        final Set<Entry<String,Symbolizer>> ids = new HashSet<>();
+
+        presentations.stream().forEach(new Consumer<Presentation>() {
+            @Override
+            public void accept(Presentation t) {
+                if (t instanceof SEPresentation) {
+                    Symbolizer symbolizer = ((SEPresentation) t).getSymbolizer();
+                    Feature Feature = (Feature) ((SEPresentation) t).getCandidate();
+                    ids.add(new AbstractMap.SimpleEntry<>(String.valueOf(Feature.getPropertyValue(AttributeConvention.IDENTIFIER)),
symbolizer));
+                }
+            }
+        });
+
+        return ids;
+    }
+
+    /**
+     * Portray using no filtering operations
+     */
+    @Test
+    public void testSanity() {
+
+        final MockStyle style = new MockStyle();
+        final MockFeatureTypeStyle fts = new MockFeatureTypeStyle();
+        final MockRule rule = new MockRule();
+        final MockLineSymbolizer symbolizer = new MockLineSymbolizer();
+        style.featureTypeStyles().add(fts);
+        fts.rules().add(rule);
+        rule.symbolizers().add(symbolizer);
+
+
+        final MapLayer fishLayer = new MapLayer();
+        fishLayer.setData(fishes);
+        fishLayer.setStyle(style);
+        final MapLayer boatLayer = new MapLayer();
+        boatLayer.setData(boats);
+        boatLayer.setStyle(style);
+        final MapLayers layers = new MapLayers();
+        layers.getComponents().add(fishLayer);
+        layers.getComponents().add(boatLayer);
+
+        final Set<Entry<String, Symbolizer>> presentations = present(layers);
+        assertEquals(4, presentations.size());
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("1", symbolizer)));
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("2", symbolizer)));
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("10", symbolizer)));
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("20", symbolizer)));
+    }
+
+    /**
+     * Portray using defined type names.
+     * Test expect only boat type features to be rendered.
+     */
+    @Test
+    public void testFeatureTypeStyleTypeNames() {
+
+        final MockStyle style = new MockStyle();
+        final MockFeatureTypeStyle fts = new MockFeatureTypeStyle();
+        fts.featureTypeNames().add(Names.createLocalName(null, null, "boat"));
+        final MockRule rule = new MockRule();
+        final MockLineSymbolizer symbolizer = new MockLineSymbolizer();
+        style.featureTypeStyles().add(fts);
+        fts.rules().add(rule);
+        rule.symbolizers().add(symbolizer);
+
+
+        final MapLayer fishLayer = new MapLayer();
+        fishLayer.setData(fishes);
+        fishLayer.setStyle(style);
+        final MapLayer boatLayer = new MapLayer();
+        boatLayer.setData(boats);
+        boatLayer.setStyle(style);
+        final MapLayers layers = new MapLayers();
+        layers.getComponents().add(fishLayer);
+        layers.getComponents().add(boatLayer);
+
+        final Set<Entry<String, Symbolizer>> presentations = present(layers);
+        assertEquals(2, presentations.size());
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("10", symbolizer)));
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("20", symbolizer)));
+    }
+
+    /**
+     * Portray using defined type names.
+     * Test expect only point geometric type to be rendered.
+     */
+    @Test
+    public void testFeatureTypeStyleSemanticType() {
+
+        final MockStyle style = new MockStyle();
+        final MockFeatureTypeStyle fts = new MockFeatureTypeStyle();
+        fts.semanticTypeIdentifiers().add(SemanticType.POINT);
+        final MockRule rule = new MockRule();
+        final MockLineSymbolizer symbolizer = new MockLineSymbolizer();
+        style.featureTypeStyles().add(fts);
+        fts.rules().add(rule);
+        rule.symbolizers().add(symbolizer);
+
+
+        final MapLayer fishLayer = new MapLayer();
+        fishLayer.setData(fishes);
+        fishLayer.setStyle(style);
+        final MapLayer boatLayer = new MapLayer();
+        boatLayer.setData(boats);
+        boatLayer.setStyle(style);
+        final MapLayers layers = new MapLayers();
+        layers.getComponents().add(fishLayer);
+        layers.getComponents().add(boatLayer);
+
+        final Set<Entry<String, Symbolizer>> presentations = present(layers);
+        assertEquals(2, presentations.size());
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("1", symbolizer)));
+        assertTrue(presentations.contains(new AbstractMap.SimpleEntry<>("2", symbolizer)));
+    }
+}


Mime
View raw message