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 canvas and render exception prototypes
Date Fri, 22 Nov 2019 14:17:58 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 8458471  Portrayal : add canvas and render exception prototypes
8458471 is described below

commit 84584715b9569680ae591c23b9b26a5b404f389a
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Fri Nov 22 15:17:43 2019 +0100

    Portrayal : add canvas and render exception prototypes
---
 .../org/apache/sis/internal/map/GridCanvas.java    | 49 ++++++++++++
 .../org/apache/sis/internal/map/Presentation.java  | 92 ++++++++++++++++++++++
 .../apache/sis/internal/map/RenderException.java   | 47 +++++++++++
 3 files changed, 188 insertions(+)

diff --git a/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/GridCanvas.java
b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/GridCanvas.java
new file mode 100644
index 0000000..1d9a38e
--- /dev/null
+++ b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/GridCanvas.java
@@ -0,0 +1,49 @@
+/*
+ * 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.coverage.grid.GridExtent;
+import org.apache.sis.coverage.grid.GridGeometry;
+import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.util.ArgumentChecks;
+
+/**
+ *
+ * <p>
+ * NOTE: this class is a first draft subject to modifications.
+ * </p>
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @version 2.0
+ * @since   2.0
+ * @module
+ */
+public abstract class GridCanvas {
+
+    private GridGeometry gridGeometry = new GridGeometry(new GridExtent(360, 180), CRS.getDomainOfValidity(CommonCRS.WGS84.normalizedGeographic()));
+
+    public GridGeometry getGridGeometry() {
+        return gridGeometry;
+    }
+
+    public void setGridGeometry(GridGeometry gridGeometry) {
+        ArgumentChecks.ensureNonNull("gridGeometry", gridGeometry);
+        this.gridGeometry = gridGeometry;
+    }
+
+}
diff --git a/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/Presentation.java
b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/Presentation.java
new file mode 100644
index 0000000..0b13ec6
--- /dev/null
+++ b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/Presentation.java
@@ -0,0 +1,92 @@
+/*
+ * 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.feature.Feature;
+
+/**
+ * When rendering resources, the first step is to generate the visual aspect
+ * of each feature or coverage, we call each one a Presentation.
+ * <p>
+ * A presentation object must be a simplistic description without any evaluation,
+ * processing or loading work remaining.
+ * </p>
+ * <p>
+ * It is important to note that multiple presentations may be generated for the
+ * same feature.
+ * </p>
+ *
+ * <p>
+ * NOTE: this class is a first draft subject to modifications.
+ * </p>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @version 2.0
+ * @since   2.0
+ * @module
+ */
+public abstract class Presentation {
+
+    private MapLayer layer;
+    private Object candidate;
+
+    public Presentation() {
+    }
+
+    public Presentation(MapLayer layer, Object candidate) {
+        this.layer = layer;
+        this.candidate = candidate;
+    }
+
+    /**
+     * Returns the original map layer the feature comes from.
+     *
+     * @return MapLayer can be null if the presentation is not associated to a layer.
+     */
+    public MapLayer getLayer() {
+        return layer;
+    }
+
+    /**
+     * Set map layer this presentation comes from.
+     *
+     * @param layer may be null
+     */
+    public void setLayer(MapLayer layer) {
+        this.layer = layer;
+    }
+
+    /**
+     * Returns the original candidate having this presentation.
+     * This is often a Coverage or a Feature.
+     *
+     * @return can be null if the presentation is not associated to any identifiable object.
+     */
+    public Object getCandidate() {
+        return candidate;
+    }
+
+    /**
+     * Set feature this presentation comes from.
+     *
+     * @param feature may be null
+     */
+    public void setCandidate(Feature feature) {
+        this.candidate = feature;
+    }
+
+}
diff --git a/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/RenderException.java
b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/RenderException.java
new file mode 100644
index 0000000..c65ba63
--- /dev/null
+++ b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/RenderException.java
@@ -0,0 +1,47 @@
+/*
+ * 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.util.ArgumentChecks;
+
+/**
+ *
+ * <p>
+ * NOTE: this class is a first draft subject to modifications.
+ * </p>
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @version 2.0
+ * @since   2.0
+ * @module
+ */
+public class RenderException extends Exception {
+
+    public RenderException(final String message) {
+        super(message);
+        ArgumentChecks.ensureNonEmpty("message", message);
+    }
+
+    public RenderException(final Throwable throwable) {
+        this(((throwable.getMessage() == null) ? "No message" : throwable.getMessage()),
throwable);
+    }
+
+    public RenderException(final String message, final Throwable throwable) {
+        super(message, throwable);
+        ArgumentChecks.ensureNonEmpty("message", message);
+    }
+}


Mime
View raw message