This is an automated email from the ASF dual-hosted git repository.
desruisseaux 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 52de2b5 Edit javadoc and complete equals/hashCode implementations.
52de2b5 is described below
commit 52de2b522410083caa3f370a610f7a4456130ab5
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri May 15 12:32:19 2020 +0200
Edit javadoc and complete equals/hashCode implementations.
---
.../apache/sis/gui/coverage/CoverageCanvas.java | 2 +-
.../sis/internal/coverage/j2d/ImageUtilities.java | 11 ++++++++-
.../sis/internal/storage/query/SimpleQuery.java | 28 +++++++++++++++-------
3 files changed, 30 insertions(+), 11 deletions(-)
diff --git
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index e886291..b8b6003 100644
---
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -239,7 +239,7 @@ public class CoverageCanvas extends MapCanvasAWT {
bounds = imageGeometry.getEnvelope();
}
setObjectiveBounds(bounds);
- requestRepaint(); // Cause `Worker` class to be executed.
+ requestRepaint(); // Cause `Worker` class to be
executed.
}
/**
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
index 8f19bee..2fee3e2 100644
---
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
+++
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
@@ -423,7 +423,13 @@ public final class ImageUtilities extends Static {
* are equal to 1) and if that translation is integer, then Java2D will
fetch only tiles that are required
* for the area to draw. Otherwise Java2D fetches a copy of the whole
image.</p>
*
- * @param tr the transform to round. Rounding will be applied in place.
+ * <p>This method assumes that the given argument is a transform from
something to display coordinates in pixel
+ * units, or other kind of measurements usually expressed as integer
values. In particular this method assumes
+ * that if the scale and shear factors are integers, then translation
terms should also be integer. Be careful
+ * to not use this method with transforms where the translation terms may
have a 0.5 offset (e.g. for mapping
+ * pixel centers).</p>
+ *
+ * @param tr the transform to round in place. Target coordinates should
be integer measurements such as pixels.
* @return whether the transform has integer coefficients (possibly after
rounding applied by this method).
*/
public static boolean roundIfAlmostInteger(final AffineTransform tr) {
@@ -437,6 +443,9 @@ public final class ImageUtilities extends Static {
/*
* At this point the scale and shear coefficients can been rounded
to integers.
* Continue only if this rounding does not make the transform
non-invertible.
+ *
+ * Note: we round translation terms without checking if they are
close to integers
+ * on the assumption that the transform target coordinates are
pixel coordinates.
*/
if ((m00!=0 || m01!=0) && (m10!=0 || m11!=0)) {
final double m02 = rint(tr.getTranslateX());
diff --git
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java
index 7fca2e3..6931c8e 100644
---
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java
+++
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/SimpleQuery.java
@@ -106,8 +106,12 @@ public class SimpleQuery extends Query implements
Cloneable {
private SortBy[] sortBy;
/**
- * Hint use by resources to optimise returned features.
+ * Hint used by resources to optimize returned features.
* Different stores makes use of vector tiles of different scales.
+ * A {@code null} value means to query data at their full resolution.
+ *
+ * @see #getLinearResolution()
+ * @see #setLinearResolution(Quantity)
*/
private Quantity<Length> linearResolution;
@@ -263,19 +267,20 @@ public class SimpleQuery extends Query implements
Cloneable {
}
/**
- * Set linear resolution hint.
- * This hing is optional, resources may ignore it.
+ * Sets the desired spatial resolution of geometries.
+ * This property is an optional hint; resources may ignore it.
*
- * @param linearResolution can be null.
+ * @param linearResolution desired spatial resolution, or {@code null}
for full resolution.
*/
- public void setLinearResolution(Quantity<Length> linearResolution) {
+ public void setLinearResolution(final Quantity<Length> linearResolution) {
this.linearResolution = linearResolution;
}
/**
- * Get linear resolution hint.
+ * Returns the desired spatial resolution of geometries.
+ * A {@code null} value means that data are queried at their full
resolution.
*
- * @return linear resolution, may be null.
+ * @return desired spatial resolution, or {@code null} for full
resolution.
*/
public Quantity<Length> getLinearResolution() {
return linearResolution;
@@ -471,7 +476,8 @@ public class SimpleQuery extends Query implements Cloneable
{
@Override
public int hashCode() {
return 97 * Arrays.hashCode(columns) + 31 * filter.hashCode()
- + 7 * Arrays.hashCode(sortBy) + Long.hashCode(limit ^ skip);
+ + 7 * Arrays.hashCode(sortBy) + Long.hashCode(limit ^ skip)
+ + 3 * Objects.hashCode(linearResolution);
}
/**
@@ -491,7 +497,8 @@ public class SimpleQuery extends Query implements Cloneable
{
limit == other.limit &&
filter.equals(other.filter) &&
Arrays.equals(columns, other.columns) &&
- Arrays.equals(sortBy, other.sortBy);
+ Arrays.equals(sortBy, other.sortBy) &&
+ Objects.equals(linearResolution, other.linearResolution);
}
return false;
}
@@ -523,6 +530,9 @@ public class SimpleQuery extends Query implements Cloneable
{
sb.append(sortBy[i]);
}
}
+ if (linearResolution != null) {
+ sb.append(" RESOLUTION ").append(linearResolution);
+ }
if (limit != UNLIMITED) {
sb.append(" LIMIT ").append(limit);
}