You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2012/12/21 09:10:37 UTC
svn commit: r1424819 - in /sis/branches/JDK7:
sis-referencing/src/main/java/org/apache/sis/geometry/
sis-referencing/src/test/java/org/apache/sis/geometry/
sis-utility/src/main/java/org/apache/sis/util/resources/ src/main/docbook/fr/
Author: desruisseaux
Date: Fri Dec 21 08:10:37 2012
New Revision: 1424819
URL: http://svn.apache.org/viewvc?rev=1424819&view=rev
Log:
Added normalize() method to GeneralDirectPosition and GeneralEnvelope.
Modified:
sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/branches/JDK7/src/main/docbook/fr/geometry.xml
Modified: sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java (original)
+++ sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java Fri Dec 21 08:10:37 2012
@@ -37,6 +37,8 @@ import static org.apache.sis.util.String
// Related to JDK7
import java.util.Objects;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.RangeMeaning;
/**
@@ -70,6 +72,21 @@ public abstract class AbstractDirectPosi
}
/**
+ * Returns a sequence of numbers that hold the coordinate of this position in its
+ * reference system.
+ *
+ * @return The coordinates.
+ */
+ @Override
+ public double[] getCoordinate() {
+ final double[] ordinates = new double[getDimension()];
+ for (int i=0; i<ordinates.length; i++) {
+ ordinates[i] = getOrdinate(i);
+ }
+ return ordinates;
+ }
+
+ /**
* Sets this direct position to the given position. If the given position is
* {@code null}, then all ordinate values are set to {@link Double#NaN NaN}.
*
@@ -106,18 +123,55 @@ public abstract class AbstractDirectPosi
}
/**
- * Returns a sequence of numbers that hold the coordinate of this position in its
- * reference system.
- *
- * @return The coordinates.
- */
- @Override
- public double[] getCoordinate() {
- final double[] ordinates = new double[getDimension()];
- for (int i=0; i<ordinates.length; i++) {
- ordinates[i] = getOrdinate(i);
+ * Ensures that the position is contained in the coordinate system domain.
+ * For each dimension, this method compares the ordinate values against the
+ * limits of the coordinate system axis for that dimension.
+ * If some ordinates are out of range, then there is a choice depending on the
+ * {@linkplain CoordinateSystemAxis#getRangeMeaning() axis range meaning}:
+ *
+ * <ul>
+ * <li>If {@link RangeMeaning#EXACT} (typically <em>latitudes</em> ordinates), then values
+ * greater than the {@linkplain CoordinateSystemAxis#getMaximumValue() axis maximal value}
+ * are replaced by the axis maximum, and values smaller than the
+ * {@linkplain CoordinateSystemAxis#getMinimumValue() axis minimal value}
+ * are replaced by the axis minimum.</li>
+ *
+ * <li>If {@link RangeMeaning#WRAPAROUND} (typically <em>longitudes</em> ordinates), then
+ * a multiple of the axis range (e.g. 360° for longitudes) is added or subtracted.</li>
+ * </ul>
+ *
+ * @return {@code true} if this position has been modified as a result of this method call,
+ * or {@code false} if no change has been done.
+ */
+ public boolean normalize() {
+ boolean changed = false;
+ final CoordinateReferenceSystem crs = getCoordinateReferenceSystem();
+ if (crs != null) {
+ final int dimension = getDimension();
+ final CoordinateSystem cs = crs.getCoordinateSystem();
+ for (int i=0; i<dimension; i++) {
+ double ordinate = getOrdinate(i);
+ final CoordinateSystemAxis axis = cs.getAxis(i);
+ final double minimum = axis.getMinimumValue();
+ final double maximum = axis.getMaximumValue();
+ final RangeMeaning rm = axis.getRangeMeaning();
+ if (RangeMeaning.EXACT.equals(rm)) {
+ if (ordinate < minimum) ordinate = minimum;
+ else if (ordinate > maximum) ordinate = maximum;
+ else continue;
+ } else if (RangeMeaning.WRAPAROUND.equals(rm)) {
+ final double csSpan = maximum - minimum;
+ final double shift = Math.floor((ordinate - minimum) / csSpan) * csSpan;
+ if (shift == 0) {
+ continue;
+ }
+ ordinate -= shift;
+ }
+ setOrdinate(i, ordinate);
+ changed = true;
+ }
}
- return ordinates;
+ return changed;
}
/**
Modified: sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java (original)
+++ sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java Fri Dec 21 08:10:37 2012
@@ -87,6 +87,12 @@ import java.util.Objects;
* </ul>
* </td></tr></table>
*
+ * {@section Choosing the range of longitude values}
+ * Geographic CRS typically have longitude values in the [-180 ⦠+180]° range, but the [0 ⦠360]°
+ * range is also occasionally used. Users of this class need to ensure that this envelope CRS is
+ * associated to axes having the desired {@linkplain CoordinateSystemAxis#getMinimumValue() minimum}
+ * and {@linkplain CoordinateSystemAxis#getMaximumValue() maximum value}.
+ *
* {@section Note on positive and negative zeros}
* The IEEE 754 standard defines two different values for positive zero and negative zero.
* When used with SIS envelopes and keeping in mind the above discussion, those zeros have
Modified: sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java (original)
+++ sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java Fri Dec 21 08:10:37 2012
@@ -24,6 +24,9 @@ package org.apache.sis.geometry;
import java.util.Arrays;
import java.io.Serializable;
import java.lang.reflect.Field;
+import org.opengis.referencing.cs.RangeMeaning;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
@@ -344,22 +347,6 @@ public class GeneralEnvelope extends Arr
final int mid = ordinates.length >>> 1;
Arrays.fill(ordinates, 0, mid, Double.NEGATIVE_INFINITY);
Arrays.fill(ordinates, mid, ordinates.length, Double.POSITIVE_INFINITY);
- assert isInfinite() : this;
- }
-
- /**
- * Returns {@code true} if at least one ordinate has an
- * {@linkplain Double#isInfinite infinite} value.
- *
- * @return {@code true} if this envelope has infinite value.
- */
- public boolean isInfinite() {
- for (int i=0; i<ordinates.length; i++) {
- if (Double.isInfinite(ordinates[i])) {
- return true;
- }
- }
- return false;
}
/**
@@ -720,6 +707,157 @@ public class GeneralEnvelope extends Arr
}
/**
+ * Ensures that the envelope is contained in the coordinate system domain.
+ * For each dimension, this method compares the ordinate values against the
+ * limits of the coordinate system axis for that dimension.
+ * If some ordinates are out of range, then there is a choice depending on the
+ * {@linkplain CoordinateSystemAxis#getRangeMeaning() axis range meaning}:
+ *
+ * <ul class="verbose">
+ * <li>If {@link RangeMeaning#EXACT} (typically <em>latitudes</em> ordinates), then values
+ * greater than the {@linkplain CoordinateSystemAxis#getMaximumValue() axis maximal value}
+ * are replaced by the axis maximum, and values smaller than the
+ * {@linkplain CoordinateSystemAxis#getMinimumValue() axis minimal value}
+ * are replaced by the axis minimum.</li>
+ *
+ * <li>If {@link RangeMeaning#WRAPAROUND} (typically <em>longitudes</em> ordinates), then
+ * a multiple of the axis range (e.g. 360° for longitudes) is added or subtracted.
+ * Example:
+ * <ul>
+ * <li>the [190 â¦Â 200]° longitude range is converted to [-170 â¦Â -160]°,</li>
+ * <li>the [170 â¦Â 200]° longitude range is converted to [+170 â¦Â -160]°.</li>
+ * </ul>
+ * See <cite>Spanning the anti-meridian of a Geographic CRS</cite> in the
+ * class javadoc for more information about the meaning of such range.</li>
+ * </ul>
+ *
+ * {@section Spanning the anti-meridian of a Geographic CRS}
+ * If the envelope is spanning the anti-meridian, then some {@linkplain #getLower(int) lower}
+ * ordinate values may become greater than their {@linkplain #getUpper(int) upper} counterpart
+ * as a result of this method call. If such effect is undesirable, then this method may be
+ * combined with {@link #simplify()} as below:
+ *
+ * {@preformat java
+ * if (envelope.normalize()) {
+ * envelope.simplify();
+ * }
+ * }
+ *
+ * {@section Choosing the range of longitude values}
+ * Geographic CRS typically have longitude values in the [-180 â¦Â +180]° range, but the [0 â¦Â 360]°
+ * range is also occasionally used. Callers need to ensure that this envelope CRS is associated
+ * to axes having the desired {@linkplain CoordinateSystemAxis#getMinimumValue() minimum} and
+ * {@linkplain CoordinateSystemAxis#getMaximumValue() maximum value}.
+ *
+ * {@section Usage}
+ * This method is sometime useful before to compute the {@linkplain #add(Envelope) union}
+ * or {@linkplain #intersect(Envelope) intersection} of envelopes, in order to ensure that
+ * both envelopes are defined in the same domain. This method may also be invoked before
+ * to project an envelope, since some projections produce {@link Double#NaN} numbers when
+ * given an ordinate value out of bounds.
+ *
+ * @return {@code true} if this envelope has been modified as a result of this method call,
+ * or {@code false} if no change has been done.
+ */
+ public boolean normalize() {
+ boolean changed = false;
+ if (crs != null) {
+ final int dimension = ordinates.length >>> 1;
+ final CoordinateSystem cs = crs.getCoordinateSystem();
+ for (int i=0; i<dimension; i++) {
+ final int j = i + dimension;
+ final CoordinateSystemAxis axis = cs.getAxis(i);
+ final double minimum = axis.getMinimumValue();
+ final double maximum = axis.getMaximumValue();
+ final RangeMeaning rm = axis.getRangeMeaning();
+ if (RangeMeaning.EXACT.equals(rm)) {
+ if (ordinates[i] < minimum) {ordinates[i] = minimum; changed = true;}
+ if (ordinates[j] > maximum) {ordinates[j] = maximum; changed = true;}
+ } else if (RangeMeaning.WRAPAROUND.equals(rm)) {
+ final double csSpan = maximum - minimum;
+ if (csSpan > 0 && csSpan < Double.POSITIVE_INFINITY) {
+ double o1 = ordinates[i];
+ double o2 = ordinates[j];
+ if (Math.abs(o2-o1) >= csSpan) {
+ /*
+ * If the range exceed the CS span, then we have to replace it by the
+ * full span, otherwise the range computed by the "else" block is too
+ * small. The full range will typically be [-180 â¦Â 180]°. However we
+ * make a special case if the two bounds are multiple of the CS span,
+ * typically [0 â¦Â 360]°. In this case the [0 â¦Â -0]° range matches the
+ * original values and is understood by GeneralEnvelope as a range
+ * spanning all the world.
+ */
+ if (o1 != minimum || o2 != maximum) {
+ if ((o1 % csSpan) == 0 && (o2 % csSpan) == 0) {
+ ordinates[i] = +0.0;
+ ordinates[j] = -0.0;
+ } else {
+ ordinates[i] = minimum;
+ ordinates[j] = maximum;
+ }
+ changed = true;
+ }
+ } else {
+ o1 = Math.floor((o1 - minimum) / csSpan) * csSpan;
+ o2 = Math.floor((o2 - minimum) / csSpan) * csSpan;
+ if (o1 != 0) {ordinates[i] -= o1; changed = true;}
+ if (o2 != 0) {ordinates[j] -= o2; changed = true;}
+ }
+ }
+ }
+ }
+ }
+ return changed;
+ }
+
+ // Note: As of JDK 1.6.0_31, using {@linkplain #getLower(int)} in the first line crash the
+ // Javadoc tools, maybe because getLower/getUpper are defined in a non-public parent class.
+ /**
+ * Ensures that <var>lower</var> <= <var>upper</var> for every dimensions.
+ * If a {@linkplain #getUpper(int) upper ordinate value} is less than a
+ * {@linkplain #getLower(int) lower ordinate value}, then there is a choice:
+ *
+ * <ul>
+ * <li>If the axis has {@link RangeMeaning#WRAPAROUND}, then the lower ordinate value is
+ * set to the {@linkplain CoordinateSystemAxis#getMinimumValue() axis minimum value}
+ * and the upper ordinate value is set to the
+ * {@linkplain CoordinateSystemAxis#getMaximumValue() axis maimum value}.</li>
+ * <li>Otherwise an {@link IllegalStateException} is thrown.</li>
+ * </ul>
+ *
+ * This method is useful when the envelope needs to be used with libraries that do not support
+ * envelopes spanning the anti-meridian.
+ *
+ * @return {@code true} if this envelope has been modified as a result of this method call,
+ * or {@code false} if no change has been done.
+ * @throws IllegalStateException If a upper ordinate value is less than a lower ordinate
+ * value on an axis which does not have the {@code WRAPAROUND} range meaning.
+ */
+ public boolean simplify() throws IllegalStateException {
+ boolean changed = false;
+ final int dimension = ordinates.length >>> 1;
+ for (int i=0; i<dimension; i++) {
+ final int j = i+dimension;
+ final double lower = ordinates[i];
+ final double upper = ordinates[j];
+ if (isNegative(upper - lower)) {
+ final CoordinateSystemAxis axis = getAxis(crs, i);
+ if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
+ ordinates[i] = axis.getMinimumValue();
+ ordinates[j] = axis.getMaximumValue();
+ changed = true;
+ } else {
+ throw new IllegalStateException(Errors.format(
+ Errors.Keys.IllegalOrdinateRange_3, lower, upper,
+ (axis != null) ? axis.getName() : i));
+ }
+ }
+ }
+ return changed;
+ }
+
+ /**
* Returns a deep copy of this envelope.
*
* @return A clone of this envelope.
Modified: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java (original)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java Fri Dec 21 08:10:37 2012
@@ -19,10 +19,12 @@ package org.apache.sis.geometry;
import java.util.Arrays;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
+import org.junit.Ignore;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
import static org.opengis.test.Validators.*;
+import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
/**
@@ -36,6 +38,19 @@ import static org.opengis.test.Validator
@DependsOn(AbstractDirectPositionTest.class)
public final strictfp class GeneralDirectPositionTest extends TestCase {
/**
+ * Tests the {@link GeneralDirectPosition#normalize()} method.
+ */
+ @Test
+ @Ignore("The tested position needs to be associated to CRS:84")
+ public void testNormalize() {
+ final GeneralDirectPosition position = new GeneralDirectPosition(WGS84);
+ position.setCoordinate(300, -100);
+ assertTrue(position.normalize());
+ assertEquals(-90.0, position.getOrdinate(1), 0.0);
+ assertEquals(-60.0, position.getOrdinate(0), 0.0);
+ }
+
+ /**
* Tests the {@link GeneralDirectPosition#toString()} method.
*/
@Test
Modified: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java (original)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java Fri Dec 21 08:10:37 2012
@@ -356,6 +356,64 @@ public final strictfp class GeneralEnvel
}
/**
+ * Tests the {@link GeneralEnvelope#normalize()} method.
+ */
+ @Test
+ @Ignore("The tested envelope needs to be associated to CRS:84")
+ public void testNormalize() {
+ GeneralEnvelope e = create(-100, -100, +100, +100);
+ assertTrue(e.normalize());
+ assertEnvelopeEquals(e, -100, -90, +100, +90);
+
+ e = create(185, 10, 190, 20);
+ assertTrue(e.normalize());
+ assertEnvelopeEquals(e, -175, 10, -170, 20);
+
+ e = create(175, 10, 185, 20);
+ assertTrue(e.normalize());
+ assertEnvelopeEquals(e, 175, 10, -175, 20);
+
+ e = create(0, 10, 360, 20);
+ assertTrue(e.normalize());
+ assertEquals("Expect positive zero", Double.doubleToLongBits(+0.0), Double.doubleToLongBits(e.getLower(0)));
+ assertEquals("Expect negative zero", Double.doubleToLongBits(-0.0), Double.doubleToLongBits(e.getUpper(0)));
+ }
+
+ /**
+ * Tests the {@link GeneralEnvelope#normalize()} method
+ * with an envelope having more then 360° of longitude.
+ */
+ @Test
+ @Ignore("The tested envelope needs to be associated to CRS:84")
+ public void testNormalizeWorld() {
+ GeneralEnvelope e = create(-195, -90, +170, +90); // -195° is equivalent to 165°
+ assertTrue(e.normalize());
+ assertEnvelopeEquals(e, -180, -90, +180, +90);
+ }
+
+ /**
+ * Tests the {@link GeneralEnvelope#simplify()}.
+ */
+ @Test
+ @Ignore("The tested envelope needs to be associated to CRS:84")
+ public void testSimplify() {
+ // Normal envelope: no change expected.
+ GeneralEnvelope e = create(-100, -10, +100, +10);
+ assertFalse(e.simplify());
+ assertEnvelopeEquals(e, -100, -10, +100, +10);
+
+ // Anti-meridian spanning: should substitute [-180 ⦠180]°
+ e = create(30, -10, -60, 10);
+ assertTrue(e.simplify());
+ assertEnvelopeEquals(e, -180, -10, 180, 10);
+
+ // Anti-meridian spanning using positive and negative zero.
+ e = create(0.0, -10, -0.0, 10);
+ assertTrue(e.simplify());
+ assertEnvelopeEquals(e, -180, -10, 180, 10);
+ }
+
+ /**
* Tests modifying the corner of an envelope.
*/
@Test
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java Fri Dec 21 08:10:37 2012
@@ -151,6 +151,11 @@ public final class Errors extends Indexe
public static final int IllegalLanguageCode_1 = 12;
/**
+ * The [{0} ⦠{1}] range of ordinate values is not valid for the â{2}â axis.
+ */
+ public static final int IllegalOrdinateRange_3 = 63;
+
+ /**
* Property â{0}â can be associated to an instance of â{1}â.
*/
public static final int IllegalPropertyClass_2 = 62;
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties Fri Dec 21 08:10:37 2012
@@ -32,6 +32,7 @@ IllegalBitsPattern_1 = Illega
IllegalClass_2 = Class \u2018{0}\u2019 is illegal. It must be \u2018{1}\u2019 or a derived class.
IllegalFormatPatternForClass_2 = The \u201c{0}\u201d pattern can not be applied to formating of objects of type \u2018{1}\u2019.
IllegalLanguageCode_1 = The \u201c{0}\u201d language is not recognized.
+IllegalOrdinateRange_3 = The [{0} \u2026 {1}] range of ordinate values is not valid for the \u201c{2}\u201d axis.
IllegalPropertyClass_2 = Property \u2018{0}\u2019 can be associated to an instance of \u2018{1}\u2019.
IllegalRange_2 = Range [{0} \u2026 {1}] is not valid.
InconsistentAttribute_2 = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent with other attributes.
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties Fri Dec 21 08:10:37 2012
@@ -32,6 +32,7 @@ IllegalBitsPattern_1 = Patter
IllegalClass_2 = La classe \u2018{0}\u2019 est ill\u00e9gale. Il doit s\u2019agir d\u2019une classe \u2018{1}\u2019 ou d\u00e9riv\u00e9e.
IllegalFormatPatternForClass_2 = Le mod\u00e8le \u201c{0}\u201d ne peut pas \u00eatre appliqu\u00e9 au formatage d\u2019objets de type \u2018{1}\u2019.
IllegalLanguageCode_1 = Le code de langue \u201c{0}\u201d n\u2019est pas reconnu.
+IllegalOrdinateRange_3 = La plage de valeurs de coordonn\u00e9es [{0} \u2026 {1}] n\u2019est pas valide pour l\u2019axe \u201c{2}\u201d.
IllegalPropertyClass_2 = La propri\u00e9t\u00e9 \u2018{0}\u2019 ne peut pas \u00eatre associ\u00e9e \u00e0 une valeur de type \u2018{1}\u2019.
IllegalRange_2 = La plage [{0} \u2026 {1}] n\u2019est pas valide.
InconsistentAttribute_2 = La valeur \u201c{1}\u201d de l\u2019attribut \u2018{0}\u2019 n\u2019est pas coh\u00e9rente avec celles des autres attributs.
Modified: sis/branches/JDK7/src/main/docbook/fr/geometry.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/src/main/docbook/fr/geometry.xml?rev=1424819&r1=1424818&r2=1424819&view=diff
==============================================================================
--- sis/branches/JDK7/src/main/docbook/fr/geometry.xml (original)
+++ sis/branches/JDK7/src/main/docbook/fr/geometry.xml Fri Dec 21 08:10:37 2012
@@ -155,17 +155,34 @@
</para>
</sidebar>
<para>
- Une dernière note: le Java (ou de manière plus générale, la norme <acronym>IEEE</acronym> 754) définit deux valeurs distinctes de zéro:
- un zéro positif et un zéro négatif. Ces deux valeurs sont considérées égales lorsquâon les compares avec lâopérateur <literal>==</literal> du Java.
- Mais dans les enveloppes de <acronym>SIS</acronym>, ils peuvent mener à des résultats opposés pour les axes ayant <constant role="GeoAPI">RangeMeaning.WRAPAROUND</constant>.
- Une enveloppe dont la plage est [0â¦0], [-0â¦-0] ou [-0â¦+0] sera bien considérée comme une enveloppe vide,
- mais la page [+0â¦-0] sera au contraire considérée comme incluant la totalité des valeurs, jusquâà lâinfini.
- Ce comportement est conforme à la définition de <function role="SIS">lowerCorner</function> et <function role="SIS">upperCorner</function>
- qui considère +0 comme le point de départ, et -0 comme le point dâarrivé après avoir fait le tour des valeurs possibles.
- Un tel comportement ne se produit que pour la paire de valeurs +0 et -0, et seulement dans cet ordre.
- Pour toutes les autres valeurs réelles, si la condition <literal>lower</literal> <literal>==</literal> <literal>upper</literal>
- est vrai, alors il est garanti que lâenveloppe est vide.
+ Pour que les fonctions telles que <function role="SIS">add(â¦)</function> fonctionnent correctement,
+ tous les objets impliqués doivent utiliser le même système de référence des coordonnées, y compris
+ la même plage de valeurs. Ainsi, une enveloppe exprimant les longitudes dans la plage [-180 â¦Â +180]°
+ nâest pas compatible avec une enveloppe exprimant les longitudes dans la plage [0 â¦Â 360]°.
+ Les conversions, si nécessaires, sont à la charge de lâutilisateur
+ (la classe <classname role="SIS">Envelopes</classname> fournit des méthodes de commodités pour ce faire).
+ En outre, les coordonnées de lâenveloppe doivent être comprises dans les limites du système de coordonnées,
+ sauf si le développeur souhaite volontairement considérer (par exemple) 300° de longitude
+ comme un position distincte de -60°. La classe <classname role="SIS">GeneralEnvelope</classname>
+ fournit une méthode <function role="SIS">normalize()</function> pour ramener les coordonnées
+ dans les limites attendues, au prix parfois de valeurs <quote><foreignphrase>lower</foreignphrase></quote>
+ supérieures à la valeur <quote><foreignphrase>upper</foreignphrase></quote>.
</para>
+ <sidebar>
+ <title>Le cas particulier de la plage [+0 â¦Â -0]</title>
+ <para>
+ le Java (ou de manière plus générale, la norme <acronym>IEEE</acronym> 754) définit deux valeurs distinctes de zéro:
+ un zéro positif et un zéro négatif. Ces deux valeurs sont considérées égales lorsquâon les compares avec lâopérateur <literal>==</literal> du Java.
+ Mais dans les enveloppes de <acronym>SIS</acronym>, ils peuvent mener à des résultats opposés pour les axes ayant <constant role="GeoAPI">RangeMeaning.WRAPAROUND</constant>.
+ Une enveloppe dont la plage est [0 â¦Â 0], [-0 â¦Â -0] ou [-0 â¦Â +0] sera bien considérée comme une enveloppe vide,
+ mais la page [+0 â¦Â -0] sera au contraire considérée comme incluant la totalité des valeurs, jusquâà lâinfini.
+ Ce comportement est conforme à la définition de <function role="SIS">lowerCorner</function> et <function role="SIS">upperCorner</function>
+ qui considère +0 comme le point de départ, et -0 comme le point dâarrivé après avoir fait le tour des valeurs possibles.
+ Un tel comportement ne se produit que pour la paire de valeurs +0 et -0, et seulement dans cet ordre.
+ Pour toutes les autres valeurs réelles, si la condition <literal>lower</literal> <literal>==</literal> <literal>upper</literal>
+ est vrai, alors il est garanti que lâenveloppe est vide.
+ </para>
+ </sidebar>
</section>
</section>
</section>