You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by js...@apache.org on 2020/03/16 15:49:39 UTC
[sis] 01/01: feat(Resample): draft resampling classes
This is an automated email from the ASF dual-hosted git repository.
jsorel pushed a commit to branch feat/resample
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 66224b2a22b12b4f978db0f66c4ea47040d28785
Author: jsorel <jo...@geomatys.com>
AuthorDate: Mon Mar 16 16:48:59 2020 +0100
feat(Resample): draft resampling classes
---
.../internal/coverage/resample/Interpolator.java | 26 ++++++
.../sis/internal/coverage/resample/Resample.java | 32 +++++++
.../coverage/resample/ResampleBuilder.java | 97 ++++++++++++++++++++++
.../internal/coverage/resample/WarpBuilder.java | 26 ++++++
.../sis/internal/coverage/resample/WarpGrid.java | 26 ++++++
.../internal/coverage/resample/WarpTransform.java | 43 ++++++++++
6 files changed, 250 insertions(+)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Interpolator.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Interpolator.java
new file mode 100644
index 0000000..45fa7ab
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Interpolator.java
@@ -0,0 +1,26 @@
+/*
+ * 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.coverage.resample;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+interface Interpolator {
+
+}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Resample.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Resample.java
new file mode 100644
index 0000000..6924034
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/Resample.java
@@ -0,0 +1,32 @@
+/*
+ * 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.coverage.resample;
+
+import org.apache.sis.coverage.grid.GridCoverage;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+final class Resample {
+
+ GridCoverage process() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/ResampleBuilder.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/ResampleBuilder.java
new file mode 100644
index 0000000..bc364ed
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/ResampleBuilder.java
@@ -0,0 +1,97 @@
+/*
+ * 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.coverage.resample;
+
+import java.awt.image.RenderedImage;
+import java.awt.image.WritableRenderedImage;
+import java.util.function.BiFunction;
+import org.apache.sis.coverage.grid.GridCoverage;
+import org.apache.sis.coverage.grid.GridGeometry;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+public class ResampleBuilder {
+
+ public ResampleBuilder setSource(GridCoverage coverage) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public ResampleBuilder setSource(GridGeometry grid, RenderedImage image) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public ResampleBuilder setTarget(GridCoverage coverage) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public ResampleBuilder setTarget(CoordinateReferenceSystem crs) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public ResampleBuilder setTarget(GridGeometry grid) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ /**
+ * Resample to target coverage image.
+ *
+ * @param grid
+ * @param image
+ * @return
+ */
+ public ResampleBuilder setTarget(GridGeometry grid, WritableRenderedImage image) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public ResampleBuilder setInterpolation(Interpolator interpolator) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ /**
+ * Set target value used to fill samples when source datas are out of coverage extent.
+ *
+ * @param fill
+ * @return
+ */
+ public ResampleBuilder setFillValue(double ... fill) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ /**
+ * When resampling multiple coverage onto a single image, how values should be merge
+ * may depend on the algorithm.
+ * For example if a value is already defined in the target image and the source
+ * image provide NaN values we could want to preserve the value in the image instead of the NaN.
+ *
+ * By default source samples will override any value in the target image.
+ *
+ * @param merger
+ * @return
+ */
+ public ResampleBuilder setMerger(BiFunction<double[], double[], double[]> merger) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public Resample build() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpBuilder.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpBuilder.java
new file mode 100644
index 0000000..4bd8674
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpBuilder.java
@@ -0,0 +1,26 @@
+/*
+ * 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.coverage.resample;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+final class WarpBuilder {
+
+}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpGrid.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpGrid.java
new file mode 100644
index 0000000..63222cc
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpGrid.java
@@ -0,0 +1,26 @@
+/*
+ * 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.coverage.resample;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+final class WarpGrid {
+
+}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpTransform.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpTransform.java
new file mode 100644
index 0000000..c83942e
--- /dev/null
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/resample/WarpTransform.java
@@ -0,0 +1,43 @@
+/*
+ * 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.coverage.resample;
+
+import org.apache.sis.referencing.operation.transform.AbstractMathTransform2D;
+import org.apache.sis.util.ArgumentChecks;
+import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.TransformException;
+
+/**
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Johann Sorel (Geomatys)
+ */
+final class WarpTransform extends AbstractMathTransform2D {
+
+ private final WarpGrid grid;
+
+ WarpTransform(WarpGrid grid) {
+ ArgumentChecks.ensureNonNull("grid", grid);
+ this.grid = grid;
+ }
+
+ @Override
+ public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws TransformException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+}