Author: desruisseaux
Date: Tue Jan 14 21:04:41 2014
New Revision: 1558191
URL: http://svn.apache.org/r1558191
Log:
First draft of an AbstractCS.forUnits(...) method.
Added:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
(with props)
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -28,6 +28,7 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.referencing.operation.CoordinateOperation;
import org.apache.sis.util.Static;
import org.apache.sis.util.CharSequences;
@@ -61,16 +62,37 @@ public final class IdentifiedObjects ext
/**
* Returns the information provided in the specified identified object as
a map of properties.
- * The returned map contains keys declared in the {@link IdentifiedObject}
interface, for example
- * {@link IdentifiedObject#NAME_KEY}. The values are obtained by calls to
the methods associated
- * to each key, for example {@link IdentifiedObject#getName()} for the
{@code NAME_KEY}.
+ * The returned map contains the following entries for each key not
contained in the {@code excludes} list
+ * and for which the corresponding method returns a non-null and non-empty
value.
+ *
+ * <table class="sis">
+ * <tr><th>Key</th> <th>Value</th></tr>
+ * <tr><td>{@value
org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+ * <td>{@link IdentifiedObject#getName()}</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+ * <td>{@link IdentifiedObject#getAlias()}</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+ * <td>{@link IdentifiedObject#getIdentifiers()}</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+ * <td>{@link IdentifiedObject#getRemarks()}</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.operation.CoordinateOperation#SCOPE_KEY}</td>
+ * <td>{@link CoordinateOperation#getScope()} (also in datum and
reference systems)</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.operation.CoordinateOperation#DOMAIN_OF_VALIDITY_KEY}</td>
+ * <td>{@link CoordinateOperation#getDomainOfValidity()} (also in
datum and reference systems)</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.operation.CoordinateOperation#OPERATION_VERSION_KEY}</td>
+ * <td>{@link CoordinateOperation#getOperationVersion()}</td></tr>
+ * <tr><td>{@value
org.opengis.referencing.operation.CoordinateOperation#COORDINATE_OPERATION_ACCURACY_KEY}</td>
+ * <td>{@link
CoordinateOperation#getCoordinateOperationAccuracy()}</td></tr>
+ * </table>
*
* @param object The identified object to view as a properties map.
+ * @param excludes The keys of properties to exclude from the map.
* @return An view of the identified object as an immutable map.
*/
- public static Map<String,?> getProperties(final IdentifiedObject object) {
+ public static Map<String,?> getProperties(final IdentifiedObject object,
final String... excludes) {
ensureNonNull("object", object);
- return new Properties(object);
+ ensureNonNull("excludes", excludes);
+ return new Properties(object, excludes);
}
/**
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -55,7 +55,7 @@ final class Properties extends AbstractM
/**
* The keys to search for. The index of each element in this array must
matches the index searched
- * by {@link #get(IdentifiedObject, int)}. In other words, this array
performs the reverse mapping
+ * by {@link #getAt(IdentifiedObject, int)}. In other words, this array
performs the reverse mapping
* of {@link #INDICES}.
*/
private static final String[] KEYS = {
@@ -70,7 +70,7 @@ final class Properties extends AbstractM
};
/**
- * The mapping from key names to the index expected by the {@link
#get(IdentifiedObject, int)} method.
+ * The mapping from key names to the index expected by the {@link
#getAt(IdentifiedObject, int)} method.
* This map shall not be modified after construction (for multi-thread
safety without synchronization).
*/
private static final Map<String,Integer> INDICES = new HashMap<>(16);
@@ -83,102 +83,116 @@ final class Properties extends AbstractM
}
/**
+ * The object where all properties come from.
+ */
+ final IdentifiedObject object;
+
+ /**
+ * The bitmask of properties to exclude.
+ */
+ final int excludeMask;
+
+ /**
+ * Creates new properties from the specified identified object.
+ */
+ Properties(final IdentifiedObject object, final String[] excludes) {
+ this.object = object;
+ int excludeMask = 0;
+ for (final String exclude : excludes) {
+ final Integer i = INDICES.get(exclude);
+ if (i != null) {
+ excludeMask |= (1 << i);
+ }
+ }
+ this.excludeMask = excludeMask;
+ }
+
+ /**
* Returns the value to which this map maps the specified index.
* Returns null if the map contains no mapping for the given index.
*
- * @param object The object from which to get the property value.
- * @param key The property index, as one of the values in the {@link
#INDICES} map.
+ * @param key The property index, as one of the values in the {@link
#INDICES} map.
*/
- private static Object get(final IdentifiedObject object, final int key) {
- switch (key) {
- case 0: {
- return object.getName();
- }
- case 1: {
- final Collection<ReferenceIdentifier> c =
object.getIdentifiers();
- if (c != null) {
- final int size = c.size();
- if (size != 0) {
- return c.toArray(new ReferenceIdentifier[size]);
+ final Object getAt(final int key) {
+ if ((excludeMask & (1 << key)) == 0) {
+ switch (key) {
+ case 0: {
+ return object.getName();
+ }
+ case 1: {
+ final Collection<ReferenceIdentifier> c =
object.getIdentifiers();
+ if (c != null) {
+ final int size = c.size();
+ if (size != 0) {
+ return c.toArray(new ReferenceIdentifier[size]);
+ }
}
+ break;
}
- break;
- }
- case 2: {
- final Collection<GenericName> c = object.getAlias();
- if (c != null) {
- final int size = c.size();
- if (size != 0) {
- return c.toArray(new GenericName[size]);
+ case 2: {
+ final Collection<GenericName> c = object.getAlias();
+ if (c != null) {
+ final int size = c.size();
+ if (size != 0) {
+ return c.toArray(new GenericName[size]);
+ }
}
+ break;
}
- break;
- }
- case 3: {
- return object.getRemarks();
- }
- case 4: {
- if (object instanceof ReferenceSystem) {
- return ((ReferenceSystem) object).getScope();
- } else if (object instanceof Datum) {
- return ((Datum) object).getScope();
- } else if (object instanceof CoordinateOperation) {
- return ((CoordinateOperation) object).getScope();
+ case 3: {
+ return object.getRemarks();
}
- break;
- }
- case 5: {
- if (object instanceof ReferenceSystem) {
- return ((ReferenceSystem) object).getDomainOfValidity();
- } else if (object instanceof Datum) {
- return ((Datum) object).getDomainOfValidity();
- } else if (object instanceof CoordinateOperation) {
- return ((CoordinateOperation)
object).getDomainOfValidity();
+ case 4: {
+ if (object instanceof ReferenceSystem) {
+ return ((ReferenceSystem) object).getScope();
+ } else if (object instanceof Datum) {
+ return ((Datum) object).getScope();
+ } else if (object instanceof CoordinateOperation) {
+ return ((CoordinateOperation) object).getScope();
+ }
+ break;
}
- break;
- }
- case 6: {
- if (object instanceof CoordinateOperation) {
- return ((CoordinateOperation)
object).getOperationVersion();
+ case 5: {
+ if (object instanceof ReferenceSystem) {
+ return ((ReferenceSystem)
object).getDomainOfValidity();
+ } else if (object instanceof Datum) {
+ return ((Datum) object).getDomainOfValidity();
+ } else if (object instanceof CoordinateOperation) {
+ return ((CoordinateOperation)
object).getDomainOfValidity();
+ }
+ break;
}
- break;
- }
- case 7: {
- if (object instanceof CoordinateOperation) {
- final Collection<PositionalAccuracy> c =
((CoordinateOperation) object).getCoordinateOperationAccuracy();
- if (c != null) {
- final int size = c.size();
- if (size != 0) {
- return c.toArray(new PositionalAccuracy[size]);
+ case 6: {
+ if (object instanceof CoordinateOperation) {
+ return ((CoordinateOperation)
object).getOperationVersion();
+ }
+ break;
+ }
+ case 7: {
+ if (object instanceof CoordinateOperation) {
+ final Collection<PositionalAccuracy> c =
((CoordinateOperation) object).getCoordinateOperationAccuracy();
+ if (c != null) {
+ final int size = c.size();
+ if (size != 0) {
+ return c.toArray(new PositionalAccuracy[size]);
+ }
}
}
+ break;
}
- break;
+ default: throw new AssertionError(key);
}
- default: throw new AssertionError(key);
}
return null;
}
/**
- * The object where all properties come from.
- */
- final IdentifiedObject object;
-
- /**
- * Creates new properties from the specified identified object.
- */
- Properties(final IdentifiedObject object) {
- this.object = object;
- }
-
- /**
* Returns {@code false} if this map contains at least one element, or
{@code true} otherwise.
*/
@Override
public boolean isEmpty() {
for (int i=0; i<KEYS.length; i++) {
- if (get(object, i) != null) {
+ if (getAt(i) != null) {
return false;
}
}
@@ -192,7 +206,7 @@ final class Properties extends AbstractM
public int size() {
int n = 0;
for (int i=0; i<KEYS.length; i++) {
- if (get(object, i) != null) {
+ if (getAt(i) != null) {
n++;
}
}
@@ -214,7 +228,7 @@ final class Properties extends AbstractM
@Override
public Object get(final Object key) {
final Integer i = INDICES.get(key);
- return (i != null) ? get(object, i) : null;
+ return (i != null) ? getAt(i) : null;
}
/**
@@ -248,19 +262,14 @@ final class Properties extends AbstractM
/** Iterates over the {@link #KEYS}, returning only the entry having a
non-null value. */
@Override
public Iterator<Entry<String, Object>> iterator() {
- return new Iter(object);
+ return new Iter();
}
}
/**
* The iterator returned by {@link EntrySet#iterator()}.
*/
- private static final class Iter implements Iterator<Entry<String,Object>> {
- /**
- * A copy of the {@link Properties#object} reference.
- */
- private final IdentifiedObject object;
-
+ private final class Iter implements Iterator<Entry<String,Object>> {
/**
* Index of the next element to return.
*/
@@ -272,10 +281,9 @@ final class Properties extends AbstractM
private Object value;
/**
- * Creates a new iterator wrapping the given object.
+ * Creates a new iterator.
*/
- Iter(final IdentifiedObject object) {
- this.object = object;
+ Iter() {
}
/**
@@ -287,7 +295,7 @@ final class Properties extends AbstractM
if (nextIndex == KEYS.length) {
return false;
}
- value = get(object, nextIndex++);
+ value = getAt(nextIndex++);
}
return true;
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -22,6 +22,7 @@ import java.util.Arrays;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.measure.unit.NonSI;
+import javax.measure.converter.ConversionException;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -33,6 +34,7 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
@@ -319,6 +321,44 @@ public class AbstractCS extends Abstract
}
/**
+ * Returns a coordinate system with the same properties than this one
(except identifiers)
+ * but different units of measurement. If this coordinate system already
uses the given units,
+ * then this method returns {@code this}.
+ *
+ * @param units The desired units of measurement for each axis. If this
array length is smaller
+ * than the coordinate system {@linkplain #getDimension()
dimension}, then the last unit
+ * is repeated for all remaining axes.
+ * @return A coordinate system with axis using the given units, or {@code
this}.
+ * @throws ConversionException If at least one unit is incompatible with
the existing ones.
+ */
+ public AbstractCS forUnits(final Unit<?>... units) throws
ConversionException {
+ ensureNonNull("units", units);
+ if (units.length == 0 || units.length > axes.length) {
+ throw new
IllegalArgumentException(Errors.format(Errors.Keys.MismatchedDimension_3,
+ "units", axes.length, units.length));
+ }
+ CoordinateSystemAxis[] newAxes = null;
+ for (int i=0; i<axes.length; i++) {
+ final CoordinateSystemAxis axis = axes[i];
+ final Unit<?> unit = axis.getUnit();
+ final Unit<?> newUnit = units[Math.min(i, units.length - 1)];
+ if (!unit.equals(newUnit)) {
+ final DefaultCoordinateSystemAxis c =
DefaultCoordinateSystemAxis.castOrCopy(axis).forUnit(newUnit);
+ if (c != axis) {
+ if (newAxes == null) {
+ newAxes = axes.clone();
+ }
+ newAxes[i] = c;
+ }
+ }
+ }
+ if (newAxes != null) {
+ return createSameType(IdentifiedObjects.getProperties(this,
IDENTIFIERS_KEY), newAxes);
+ }
+ return this;
+ }
+
+ /**
* Returns a coordinate system equivalent to this one but with axes
rearranged according the given convention.
* If this coordinate system is already compatible with the given
convention, then this method returns
* {@code this}.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.iso.Types;
@@ -125,7 +124,7 @@ public class DefaultCompoundCS extends A
*/
@Workaround(library="JDK", version="1.7")
private DefaultCompoundCS(final CoordinateSystem[] components, final
CoordinateSystemAxis[] axes) {
- super(singletonMap(NAME_KEY, nameFor(new
StringBuilder(60).append("Compound CS"), axes)), axes);
+ super(singletonMap(NAME_KEY, createName(new
StringBuilder(60).append("Compound CS"), axes)), axes);
this.components = UnmodifiableArrayList.wrap(components);
}
@@ -143,10 +142,10 @@ public class DefaultCompoundCS extends A
* @param axes The axes.
* @return A name for the given coordinate system type and axes.
*/
- static String nameFor(final StringBuilder buffer, final
CoordinateSystemAxis[] axes) {
+ static String createName(final StringBuilder buffer, final
CoordinateSystemAxis[] axes) {
String separator = ": ";
for (final CoordinateSystemAxis axis : axes) {
-
buffer.append(separator).append(CharSequences.camelCaseToWords(Types.getCodeLabel(axis.getDirection()),
false));
+
buffer.append(separator).append(Types.getCodeLabel(axis.getDirection()));
separator = ", ";
final Unit<?> unit = axis.getUnit();
if (unit != null) {
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -23,6 +23,7 @@ import javax.measure.unit.Unit;
import javax.measure.unit.NonSI;
import javax.measure.quantity.Angle;
import javax.measure.converter.UnitConverter;
+import javax.measure.converter.ConversionException;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlAttribute;
@@ -672,4 +673,22 @@ public class DefaultCoordinateSystemAxis
formatter.append(direction);
return "AXIS";
}
+
+ /**
+ * Returns a new axis with the same properties (except identifiers) than
current axis,
+ * but with a different unit of measurement.
+ *
+ * @param newUnit The unit of measurement for the new axis.
+ * @return An axis using the given unit, or {@code this} if the current
axis already use the given unit.
+ * @throws ConversionException If the given unit is incompatible with this
axis unit.
+ */
+ final DefaultCoordinateSystemAxis forUnit(final Unit<?> newUnit) throws
ConversionException {
+ if (unit.equals(newUnit)) {
+ return this;
+ }
+ final UnitConverter converter = unit.getConverterToAny(newUnit);
+ return new
DefaultCoordinateSystemAxis(IdentifiedObjects.getProperties(this,
IDENTIFIERS_KEY),
+ abbreviation, direction, newUnit,
converter.convert(minimumValue),
+ converter.convert(maximumValue), rangeMeaning);
+ }
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -104,6 +104,9 @@ final class Normalizer implements Compar
/**
* Reorder the axes in an attempt to get a right-handed system.
* If no axis change is needed, then this method returns {@code cs}
unchanged.
+ *
+ * @param cs The coordinate system to normalize.
+ * @return The normalized coordinate system.
*/
static AbstractCS normalize(final AbstractCS cs) {
final int dimension = cs.getDimension();
@@ -119,6 +122,6 @@ final class Normalizer implements Compar
return cs;
}
final StringBuilder buffer = (StringBuilder)
CharSequences.camelCaseToSentence(cs.getInterface().getSimpleName());
- return cs.createSameType(singletonMap(AbstractCS.NAME_KEY,
DefaultCompoundCS.nameFor(buffer, axes)), axes);
+ return cs.createSameType(singletonMap(AbstractCS.NAME_KEY,
DefaultCompoundCS.createName(buffer, axes)), axes);
}
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -52,7 +52,8 @@ public final strictfp class AbstractCSTe
{
final AbstractCS derived = cs.forConvention(convention);
assertNotSame("Expected a new instance.", cs, derived);
- assertSame("Should be cached.", derived, cs.forConvention(convention));
+ assertSame("No change expected.", derived,
derived.forConvention(convention));
+ assertSame("Shall be cached.", derived, cs.forConvention(convention));
assertEquals("dimension", expected.length, cs.getDimension());
for (int i=0; i<expected.length; i++) {
assertEquals(expected[i], derived.getAxis(i));
Added:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java?rev=1558191&view=auto
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
(added)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -0,0 +1,46 @@
+/*
+ * 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.referencing.cs;
+
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link DefaultCompoundCS}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class DefaultCompoundCSTest extends TestCase {
+ /**
+ * Tests {@link DefaultCompoundCS#createName(StringBuilder,
CoordinateSystemAxis[])}.
+ */
+ @Test
+ public void testCreateName() {
+ final StringBuilder buffer = new StringBuilder("Compound CS");
+ final String name = DefaultCompoundCS.createName(buffer, new
CoordinateSystemAxis[] {
+ CommonAxes.EASTING, CommonAxes.NORTHING, CommonAxes.HEIGHT_cm,
CommonAxes.TIME
+ });
+ assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).",
name);
+ }
+}
Propchange:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1558191&r1=1558190&r2=1558191&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Tue Jan 14 21:04:41 2014
@@ -67,6 +67,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.cs.AbstractCSTest.class,
org.apache.sis.referencing.cs.DefaultCartesianCSTest.class,
org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
+ org.apache.sis.referencing.cs.DefaultCompoundCSTest.class,
org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,