sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject svn commit: r1827413 - in /sis/branches/JDK8/core/sis-portrayal: ./ src/main/java/org/apache/sis/internal/ src/main/java/org/apache/sis/internal/map/
Date Wed, 21 Mar 2018 14:16:21 GMT
Author: jsorel
Date: Wed Mar 21 14:16:21 2018
New Revision: 1827413

URL: http://svn.apache.org/viewvc?rev=1827413&view=rev
Log:
Map : add a first version of map context and layers classes

Added:
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapContext.java
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapGroup.java
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapItem.java
    sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapLayer.java
Modified:
    sis/branches/JDK8/core/sis-portrayal/pom.xml

Modified: sis/branches/JDK8/core/sis-portrayal/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-portrayal/pom.xml?rev=1827413&r1=1827412&r2=1827413&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-portrayal/pom.xml (original)
+++ sis/branches/JDK8/core/sis-portrayal/pom.xml Wed Mar 21 14:16:21 2018
@@ -109,8 +109,8 @@ Symbology, map and rendering engine repr
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.sis.core</groupId>
-      <artifactId>sis-feature</artifactId>
+      <groupId>org.apache.sis.storage</groupId>
+      <artifactId>sis-storage</artifactId>
       <version>${project.version}</version>
     </dependency>
 

Added: sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapContext.java?rev=1827413&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapContext.java
(added)
+++ sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapContext.java
Wed Mar 21 14:16:21 2018
@@ -0,0 +1,65 @@
+/*
+ * 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 org.opengis.geometry.Envelope;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+/**
+ * A map context is the root node of a map.
+ *
+ * The map context contains all displayed layers like a MapGroup and
+ * defines the area of interest which should be focused by default when
+ * displayed.
+ *
+ * <p>
+ * NOTE : this class is a first draft subject to modifications.
+ * </p>
+ * 
+ * @author Johann Sorel (Geomatys)
+ * @since 1.0
+ * @module
+ */
+public class MapContext extends MapGroup {
+
+    private Envelope aoi;
+
+    /**
+     * Returns the map default area of interest.
+     *
+     * If the returned envelope is empty, at least the {@link CoordinateReferenceSystem}
+     * defined should be used for displaying the map.
+     *
+     * @return map area of interest, may be null
+     */
+    public Envelope getAreaOfInterest() {
+        return aoi;
+    }
+
+    /**
+     * Set map default area of interest.
+     *
+     * The given envelope is unrelated to the data contained in the map context.
+     * It may be wider, small and in a different {@link CoordinateReferenceSystem}.
+     *
+     * @param aoi map area of interest, may be null
+     */
+    public void setAreaOfInterest(Envelope aoi) {
+        this.aoi = aoi;
+    }
+
+}

Added: sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapGroup.java?rev=1827413&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapGroup.java
(added)
+++ sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapGroup.java
Wed Mar 21 14:16:21 2018
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+/**
+ * A map group is collection of layers.
+ *
+ * <p>
+ * Groups are used in map contexts to regroup similar layers under a same node.
+ * This allows global actions, like hiding background layers in one call.
+ * </p>
+ *
+ * <p>
+ * NOTE : this class is a first draft subject to modifications.
+ * </p>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @since 1.0
+ * @module
+ */
+public class MapGroup extends MapItem {
+
+    private final List<MapItem> components = new ArrayList<>();
+
+    /**
+     * Get the list of layers contained in this group.
+     *
+     * <p>
+     * The layers in the list are presented in rendering order.
+     * This means the first rendered layer which will be under all others on the
+     * result map is at index zero.
+     * </p>
+     *
+     * <p>
+     * The returned list is modifiable.
+     * </p>
+     *
+     * @return List of layers, never null
+     */
+    public List<MapItem> getComponents() {
+        return components;
+    }
+
+}

Added: sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapItem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapItem.java?rev=1827413&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapItem.java
(added)
+++ sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapItem.java
Wed Mar 21 14:16:21 2018
@@ -0,0 +1,84 @@
+/*
+ * 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;
+
+/**
+ * Parent class of all map elements.
+ *
+ *
+ * <p>
+ * NOTE : this class is a first draft subject to modifications.
+ * </p>
+ * 
+ * @author Johann Sorel (Geomatys)
+ * @since 1.0
+ * @module
+ */
+public abstract class MapItem {
+
+    private CharSequence title;
+    private boolean visible = true;
+
+    /**
+     * Only used by classes in this package
+     */
+    MapItem() {
+
+    }
+
+    /**
+     * Returns the title of this map item.
+     *
+     * This title should be user friendly and may be a InternationalString.
+     * It must not be used as an identifier.
+     *
+     * @return user friendly title, may be null
+     */
+    public CharSequence getTitle() {
+        return title;
+    }
+
+    /**
+     * Set map item title.
+     *
+     * @param title user friendly title, can be null
+     */
+    public void setTitle(CharSequence title) {
+        this.title = title;
+    }
+
+    /**
+     * Return visibility state of this map item.
+     *
+     * @return true if item is visible
+     */
+    public boolean isVisible() {
+        return visible;
+    }
+
+    /**
+     * Set visibility state of this item.
+     * In the case of a MapGroup, all components should be hidden too when
+     * rendering.
+     *
+     * @param visible set to false to hide item and all it's components
+     */
+    public void setVisible(boolean visible) {
+        this.visible = visible;
+    }
+
+}

Added: sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapLayer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapLayer.java?rev=1827413&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapLayer.java
(added)
+++ sis/branches/JDK8/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/MapLayer.java
Wed Mar 21 14:16:21 2018
@@ -0,0 +1,98 @@
+/*
+ * 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 org.apache.sis.storage.Resource;
+import org.opengis.style.Style;
+
+/**
+ * A map layer is an association of a {@link Resource} and a {@link Style}.
+ *
+ * <p>
+ * Map layers are the key elements of a map, they defined the relationship
+ * between datas and a symbology. The visual result of a layer should be similar
+ * for any rendering engine. The result may be different because of different
+ * rendering strategies for label placements, 2D or 3D but the fundamentals
+ * representation of each Feature or Coverage should be unchanged.
+ * </p>
+ *
+ * <p>
+ * NOTE : this class is a first draft subject to modifications.
+ * </p>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @since 1.0
+ * @module
+ */
+public final class MapLayer {
+
+    private Resource resource;
+    private Style style;
+
+    /**
+     * Returns layer base resource.
+     *
+     * <p>
+     * The resource should be a DataSet but may still be a Aggregate.
+     * The behavior in such case depends on the rendering engine.
+     * </p>
+     *
+     * @return rendered resource
+     */
+    public Resource getResource() {
+        return resource;
+    }
+
+    /**
+     * Set layer resource.
+     *
+     * <p>
+     * The resource should never be null, still the null case is tolerate
+     * to indicate the layer should have exist but is unavailable for an indeterminate
+     * reason. This case may happen for processed or distant services resources.
+     * </p>
+     *
+     * @param resource , may be null
+     */
+    public void setResource(Resource resource) {
+        this.resource = resource;
+    }
+
+    /**
+     * Returns the layer style.
+     *
+     * <p>
+     * If the style is undefined, the behavior is left to the rendering engine.
+     * It is expected that a default style should be used.
+     * </p>
+     *
+     * @return layer style, may be null
+     */
+    public Style getStyle() {
+        return style;
+    }
+
+    /**
+     * Set layer style.
+     *
+     * @param style layer style, can be null
+     */
+    public void setStyle(Style style) {
+        this.style = style;
+    }
+
+}



Mime
View raw message