Author: desruisseaux
Date: Mon Jul 18 16:15:13 2016
New Revision: 1753261
URL: http://svn.apache.org/viewvc?rev=1753261&view=rev
Log:
Merge from JDK8 branch: contains feature work an new map projection.
Added:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/builder/
- copied from r1753248,
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/builder/
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/builder/
- copied from r1753248,
sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/builder/
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
- copied unchanged from r1753248,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java
- copied unchanged from r1753248,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
- copied unchanged from r1753248,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
- copied unchanged from r1753248,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
- copied unchanged from r1753248,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/UncheckedIOException.java
(with props)
Removed:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Builder.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-build-helper/src/main/ant/prepare-release.xml
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/StringJoinOperation.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/AbstractOperationTest.java
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractStereographic.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicSouth.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/package-info.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
sis/branches/JDK7/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransformTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/HTMLGenerator.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/package-info.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
sis/branches/JDK7/ide-project/NetBeans/build.xml
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 18 16:15:13 2016
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1750763
+/sis/branches/JDK8:1584960-1753248
/sis/trunk:1394364-1508466,1519089-1519674
Modified:
sis/branches/JDK7/core/sis-build-helper/src/main/ant/prepare-release.xml
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-build-helper/src/main/ant/prepare-release.xml?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-build-helper/src/main/ant/prepare-release.xml
(original)
+++ sis/branches/JDK7/core/sis-build-helper/src/main/ant/prepare-release.xml
Mon Jul 18 16:15:13 2016
@@ -32,7 +32,7 @@
<!-- Ensure that the "sis-build-helper" plugin used by the build is the
released version. -->
<replaceregexp file = "${user.dir}/pom.xml"
match =
"<sis\.plugin\.version>.+</sis\.plugin\.version>"
- replace =
"<sis.plugin.version>${sis.version}-SNAPSHOT</sis.plugin.version>"/>
+ replace =
"<sis.plugin.version>${branch.version}-SNAPSHOT</sis.plugin.version>"/>
<!-- The -SNAPSHOT part will be removed later, at tag
creation. -->
<!-- Replace the version number in Java code. -->
@@ -44,9 +44,9 @@
<replace dir="${user.dir}" failOnNoReplacements="true">
<include name="**/pom.xml"/>
<replacefilter token="svn.apache.org/repos/asf/sis/trunk"
-
value="svn.apache.org/repos/asf/sis/branches/${sis.version}"/>
+
value="svn.apache.org/repos/asf/sis/branches/${branch.version}"/>
<replacefilter token="svn.apache.org/viewvc/sis/trunk"
-
value="svn.apache.org/viewvc/sis/branches/${sis.version}"/>
+
value="svn.apache.org/viewvc/sis/branches/${branch.version}"/>
</replace>
</target>
@@ -58,18 +58,18 @@
<!-- Replace URL to branch by URL to the branch on Subversion. -->
<replace dir="${user.dir}" failOnNoReplacements="true">
<include name="**/pom.xml"/>
- <replacefilter
token="svn.apache.org/repos/asf/sis/branches/${sis.version}"
+ <replacefilter
token="svn.apache.org/repos/asf/sis/branches/${branch.version}"
value="svn.apache.org/repos/asf/sis/tags/${sis.version}"/>
- <replacefilter token="svn.apache.org/viewvc/sis/branches/${sis.version}"
+ <replacefilter
token="svn.apache.org/viewvc/sis/branches/${branch.version}"
value="svn.apache.org/viewvc/sis/tags/${sis.version}"/>
</replace>
<!-- Replace version numbers. Note that no snapshot other than SIS can
exist at this point. -->
<replace dir="${user.dir}" failOnNoReplacements="true">
<include name="**/pom.xml"/>
- <replacefilter
token="<version>${sis.version}-SNAPSHOT</version>"
+ <replacefilter
token="<version>${branch.version}-SNAPSHOT</version>"
value="<version>${sis.version}</version>"/>
- <replacefilter
token="<sis.plugin.version>${sis.version}-SNAPSHOT</sis.plugin.version>"
+ <replacefilter
token="<sis.plugin.version>${branch.version}-SNAPSHOT</sis.plugin.version>"
value="<sis.plugin.version>${sis.version}</sis.plugin.version>"/>
</replace>
</target>
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -52,7 +52,8 @@ import org.opengis.feature.MultiValuedPr
* @version 0.6
* @module
*
- * @see DefaultAssociationRole#newInstance()
+ * @see AbstractFeature
+ * @see DefaultAssociationRole
*/
public abstract class AbstractAssociation extends Field<Feature> implements
FeatureAssociation, Cloneable, Serializable {
/**
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -72,7 +72,8 @@ import org.opengis.feature.MultiValuedPr
* @version 0.6
* @module
*
- * @see DefaultAttributeType#newInstance()
+ * @see AbstractFeature
+ * @see DefaultAttributeType
*/
public abstract class AbstractAttribute<V> extends Field<V> implements
Attribute<V>, Cloneable, Serializable {
/**
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -230,7 +230,7 @@ public class AbstractIdentifiedType impl
* Returns a natural language designator for the element.
* This can be used as an alternative to the {@linkplain #getName() name}
in user interfaces.
*
- * @return Natural language designator for the element.
+ * @return Natural language designator for the element, or {@code null} if
none.
*/
@Override
public InternationalString getDesignation() {
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -25,11 +25,13 @@ import org.opengis.parameter.GeneralPara
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.util.Classes;
import org.apache.sis.util.Debug;
// Branch-dependent imports
import java.util.Objects;
import org.opengis.feature.Attribute;
+import org.opengis.feature.AttributeType;
import org.opengis.feature.Feature;
import org.opengis.feature.FeatureAssociation;
import org.opengis.feature.IdentifiedType;
@@ -57,8 +59,10 @@ import org.opengis.feature.Property;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
+ *
+ * @see DefaultFeatureType
*/
public abstract class AbstractOperation extends AbstractIdentifiedType
implements Operation {
/**
@@ -84,7 +88,11 @@ public abstract class AbstractOperation
/**
* Returns a map that can be used for creating the {@link #getResult()}
type.
- * This method can be invoked for subclass constructor.
+ * This method can be invoked for subclass constructor with the
user-supplied map in argument.
+ * If the given map contains at least one key prefixed by {@value
#RESULT_PREFIX}, then the values
+ * associated to those keys will be used.
+ *
+ * @param identification the map given by user to sub-class constructor.
*/
final Map<String,Object> resultIdentification(final Map<String,?>
identification) {
final Map<String,Object> properties = new HashMap<>(6);
@@ -205,12 +213,12 @@ public abstract class AbstractOperation
* Returns a string representation of this operation.
* The returned string is for debugging purpose and may change in any
future SIS version.
*
- * @return A string representation of this operation for debugging purpose.
+ * @return a string representation of this operation for debugging purpose.
*/
@Debug
@Override
public String toString() {
- final StringBuilder buffer = new
StringBuilder(40).append("Operation").append('[');
+ final StringBuilder buffer = new
StringBuilder(40).append(Classes.getShortClassName(this)).append('[');
final GenericName name = getName();
if (name != null) {
buffer.append('“');
@@ -224,13 +232,31 @@ public abstract class AbstractOperation
buffer.append(separator).append(IdentifiedObjects.toString(param.getName()));
separator = ", ";
}
- if (separator == ", ") { // Identity comparaison is okay here.
+ if (separator == ", ") { // Identity comparaison is
okay here.
buffer.append(')');
}
final IdentifiedType result = getResult();
if (result != null) {
- buffer.append(" : ").append(result.getName());
+ final Object type;
+ if (result instanceof AttributeType<?>) {
+ type = Classes.getShortName(((AttributeType<?>)
result).getValueClass());
+ } else {
+ type = result.getName();
+ }
+ buffer.append(" : ").append(type);
}
- return buffer.append(']').toString();
+ formatResultFormula(buffer.append(']'));
+ return buffer.toString();
+ }
+
+ /**
+ * Appends a string representation of the "formula" used for computing the
result.
+ * The "formula" may be for example a link to another property.
+ *
+ * @param buffer where to format the "formula".
+ * @return {@code true} if this method has formatted a formula, or {@code
false} otherwise.
+ */
+ boolean formatResultFormula(Appendable buffer) {
+ return false;
}
}
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -57,6 +57,7 @@ import org.opengis.feature.FeatureAssoci
* @version 0.5
* @module
*
+ * @see DefaultFeatureType
* @see AbstractAssociation
*/
public class DefaultAssociationRole extends FieldType implements
FeatureAssociationRole {
@@ -120,6 +121,8 @@ public class DefaultAssociationRole exte
* @param minimumOccurs The minimum number of occurrences of the
association within its containing entity.
* @param maximumOccurs The maximum number of occurrences of the
association within its containing entity,
* or {@link Integer#MAX_VALUE} if there is no
restriction.
+ *
+ * @see org.apache.sis.feature.builder.AssociationRoleBuilder
*/
public DefaultAssociationRole(final Map<String,?> identification, final
FeatureType valueType,
final int minimumOccurs, final int maximumOccurs)
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -102,6 +102,7 @@ import org.opengis.feature.AttributeType
* @version 0.5
* @module
*
+ * @see DefaultFeatureType
* @see AbstractAttribute
*/
public class DefaultAttributeType<V> extends FieldType implements
AttributeType<V> {
@@ -176,6 +177,8 @@ public class DefaultAttributeType<V> ext
* For example if this new {@code
DefaultAttributeType} describes a measurement,
* then {@code characterizedBy} could holds the
measurement accuracy.
* See <cite>"Attribute characterization"</cite> in
class Javadoc for more information.
+ *
+ * @see org.apache.sis.feature.builder.AttributeTypeBuilder
*/
public DefaultAttributeType(final Map<String,?> identification, final
Class<V> valueClass,
final int minimumOccurs, final int maximumOccurs, final V
defaultValue,
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -83,6 +83,12 @@ import org.opengis.feature.PropertyNotFo
* which are implicitly <cite>covariant</cite> (i.e. {@code String[]} can be
casted to {@code CharSequence[]}, which
* is safe for read operations but not for write operations — the later may
throw {@link ArrayStoreException}).</div>
*
+ * <div class="section">Instantiation</div>
+ * {@code DefaultFeatureType} can be instantiated directly by a call to its
{@linkplain #DefaultFeatureType constructor}.
+ * But a more convenient approach may be to use the {@link
org.apache.sis.feature.builder.FeatureTypeBuilder} instead,
+ * which provides shortcuts for frequently-used operations like creating
various {@link org.opengis.util.GenericName}
+ * instances sharing the same namespace.
+ *
* <div class="section">Immutability and thread safety</div>
* Instances of this class are immutable if all properties ({@link
GenericName} and {@link InternationalString}
* instances) and all arguments ({@link AttributeType} instances) given to the
constructor are also immutable.
@@ -94,6 +100,8 @@ import org.opengis.feature.PropertyNotFo
* @version 0.6
* @module
*
+ * @see DefaultAttributeType
+ * @see DefaultAssociationRole
* @see AbstractFeature
*/
public class DefaultFeatureType extends AbstractIdentifiedType implements
FeatureType {
@@ -234,6 +242,8 @@ public class DefaultFeatureType extends
* @param superTypes The parents of this feature type, or {@code null}
or empty if none.
* @param properties Any feature operation, any feature attribute type
and any feature
* association role that carries characteristics of
a feature type.
+ *
+ * @see org.apache.sis.feature.builder.FeatureTypeBuilder
*/
@SuppressWarnings("ThisEscapedInObjectConstruction")
public DefaultFeatureType(final Map<String,?> identification, final
boolean isAbstract,
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -143,7 +143,7 @@ final class EnvelopeOperation extends Ab
final GenericName name = property.getName();
final String attributeName = (property instanceof
LinkOperation)
? ((LinkOperation)
property).referentName : name.toString();
- final boolean isDefault =
AttributeConvention.DEFAULT_GEOMETRY_PROPERTY.equals(name.tip());
+ final boolean isDefault =
AttributeConvention.GEOMETRY_PROPERTY.equals(name.tip());
if (isDefault) {
defaultGeometry = attributeName;
}
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -47,6 +47,7 @@ import org.opengis.feature.Feature;
import org.opengis.feature.FeatureType;
import org.opengis.feature.FeatureAssociationRole;
import org.opengis.feature.Operation;
+import org.apache.sis.util.CharSequences;
/**
@@ -229,7 +230,7 @@ header: for (int i=0; ; i++) {
final StringBuffer buffer = new StringBuffer();
final FieldPosition dummyFP = new FieldPosition(-1);
for (final PropertyType propertyType :
featureType.getProperties(true)) {
- Object value;
+ Object value = null;
if (feature != null) {
value =
feature.getPropertyValue(propertyType.getName().toString());
if (value == null) {
@@ -246,8 +247,11 @@ header: for (int i=0; ; i++) {
}
} else if (propertyType instanceof AttributeType<?>) {
value = ((AttributeType<?>) propertyType).getDefaultValue();
- } else {
- value = null;
+ } else if (propertyType instanceof AbstractOperation) {
+ if (((AbstractOperation)
propertyType).formatResultFormula(buffer)) {
+ value = CharSequences.trimWhitespaces(buffer).toString();
+ buffer.setLength(0);
+ }
}
/*
* Column 0 - Name.
@@ -257,31 +261,31 @@ header: for (int i=0; ; i++) {
/*
* Column 1 and 2 - Type and cardinality.
*/
- final String valueType;
- final Class<?> valueClass;
- final int minimumOccurs, maximumOccurs;
- if (propertyType instanceof AttributeType<?>) {
- final AttributeType<?> pt = (AttributeType<?>) propertyType;
+ final String valueType; // The value to
write in the type column.
+ final Class<?> valueClass; //
AttributeType.getValueClass() if applicable.
+ final int minimumOccurs, maximumOccurs; // Negative values
mean no cardinality.
+ final IdentifiedType resultType; // Result of
operation if applicable.
+ if (propertyType instanceof Operation) {
+ resultType = ((Operation) propertyType).getResult();
+ } else {
+ resultType = propertyType;
+ }
+ if (resultType instanceof AttributeType<?>) {
+ final AttributeType<?> pt = (AttributeType<?>) resultType;
minimumOccurs = pt.getMinimumOccurs();
maximumOccurs = pt.getMaximumOccurs();
valueClass = pt.getValueClass();
valueType = getFormat(Class.class).format(valueClass,
buffer, dummyFP).toString();
buffer.setLength(0);
- } else if (propertyType instanceof FeatureAssociationRole) {
- final FeatureAssociationRole pt = (FeatureAssociationRole)
propertyType;
+ } else if (resultType instanceof FeatureAssociationRole) {
+ final FeatureAssociationRole pt = (FeatureAssociationRole)
resultType;
minimumOccurs = pt.getMinimumOccurs();
maximumOccurs = pt.getMaximumOccurs();
valueType =
toString(DefaultAssociationRole.getValueTypeName(pt));
valueClass = Feature.class;
- } else if (propertyType instanceof Operation) {
- final IdentifiedType resultType = ((Operation)
propertyType).getResult();
- valueType = toString(resultType.getName());
- valueClass = null;
- minimumOccurs = -1;
- maximumOccurs = -1;
} else {
- valueType = "";
- valueClass = null;
+ valueType = toString(resultType.getName());
+ valueClass = null;
minimumOccurs = -1;
maximumOccurs = -1;
}
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -131,7 +131,7 @@ public final class FeatureOperations ext
* For example features of type <b>Country</b> may have identifiers named
“ISO country code”
* while features of type <b>Car</b> may have identifiers named “license
plate number”.
* In order to simplify identifier usages regardless of their name,
- * an application could choose to add in all features a virtual property
named {@code "@id"}
+ * an application could choose to add in all features a virtual property
named {@code "identifier"}
* which links to whatever property is used as an identifier in an
arbitrary feature.
* So the definition of the <b>Car</b> feature could contain the following
code:
*
@@ -139,7 +139,7 @@ public final class FeatureOperations ext
* AttributeType licensePlateNumber = ...; // Attribute
creation omitted for brevity
* FeatureType car = new DefaultFeatureType(..., // Arguments
omitted for brevity
* licensePlateNumber, model, owner,
- * FeatureOperations.link(singletonMap(NAME_KEY, "@id"),
licensePlateNumber);
+ * FeatureOperations.link(singletonMap(NAME_KEY, "identifier"),
licensePlateNumber);
* }
* </div>
*
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -20,6 +20,7 @@ import java.util.Set;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.io.IOException;
import org.opengis.metadata.Identifier;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptor;
@@ -29,6 +30,7 @@ import org.apache.sis.metadata.iso.citat
import org.apache.sis.util.ArgumentChecks;
// Branch-dependent imports
+import org.apache.sis.internal.jdk8.UncheckedIOException;
import org.opengis.feature.Feature;
import org.opengis.feature.IdentifiedType;
import org.opengis.feature.Property;
@@ -151,4 +153,20 @@ final class LinkOperation extends Abstra
// 'this.result' is compared (indirectly) by the super class.
return super.equals(obj) && referentName.equals(((LinkOperation)
obj).referentName);
}
+
+ /**
+ * Appends a string representation of the "formula" used for computing the
result.
+ *
+ * @param buffer where to format the "formula".
+ * @return {@code true} since this method has formatted a formula.
+ */
+ @Override
+ boolean formatResultFormula(final Appendable buffer) {
+ try {
+ buffer.append(" → ").append(referentName);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ return true;
+ }
}
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/StringJoinOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/StringJoinOperation.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/StringJoinOperation.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/StringJoinOperation.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -19,6 +19,7 @@ package org.apache.sis.feature;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
+import java.io.IOException;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.util.GenericName;
@@ -33,6 +34,7 @@ import org.apache.sis.util.Classes;
// Branch-dependent imports
import java.util.Objects;
+import org.apache.sis.internal.jdk8.UncheckedIOException;
import org.opengis.feature.AttributeType;
import org.opengis.feature.Feature;
import org.opengis.feature.IdentifiedType;
@@ -421,4 +423,26 @@ final class StringJoinOperation extends
}
return false;
}
+
+ /**
+ * Appends a string representation of the "formula" used for computing the
result.
+ *
+ * @param buffer where to format the "formula".
+ * @return {@code true} since this method has formatted a formula.
+ */
+ @Override
+ boolean formatResultFormula(final Appendable buffer) {
+ try {
+ buffer.append(" → ");
+ String separator = "(";
+ for (final String element : attributeNames) {
+ buffer.append(separator).append(element);
+ separator = ", ";
+ }
+ buffer.append(')');
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ return true;
+ }
}
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -72,17 +72,29 @@
* {@code ├─} {@linkplain org.apache.sis.feature.DefaultAssociationRole
Feature association role}<br>
* {@code └─} {@linkplain org.apache.sis.feature.AbstractOperation
Operation}<br>
* </td><td class="sep" style="width: 50%; white-space: nowrap">
- * {@linkplain org.apache.sis.feature.AbstractFeature Feature}
(<cite>sparse</cite> or <cite>dense</cite>)<br>
- *
Property<br>
- * {@code ├─} {@linkplain org.apache.sis.feature.AbstractAttribute
Attribute} (<cite>singleton</cite> or <cite>multi-valued</cite>)<br>
- * {@code └─} {@linkplain org.apache.sis.feature.AbstractAssociation Feature
association} (<cite>singleton</cite> or <cite>multi-valued</cite>)<br>
+ * Object<br>
+ * {@code ├─} {@linkplain org.apache.sis.feature.AbstractFeature
Feature} (<cite>sparse</cite> or <cite>dense</cite>)<br>
+ * {@code └─}
Property<br>
+ * {@code ├─} {@linkplain org.apache.sis.feature.AbstractAttribute
Attribute} (<cite>singleton</cite> or <cite>multi-valued</cite>)<br>
+ * {@code └─} {@linkplain org.apache.sis.feature.AbstractAssociation
Feature association} (<cite>singleton</cite> or <cite>multi-valued</cite>)<br>
* </td></tr></table>
*
+ * <div class="section">Instantiation</div>
+ * Classes defined in this package are rarely instantiated directly (by a
{@code new} statement).
+ * Instead those classes are instantiated indirectly by invoking a method on a
parent container,
+ * or by using a builder. The starting point is {@code FeatureType}, which may
be created by a
+ * {@link org.apache.sis.feature.builder.FeatureTypeBuilder} or may be
provided by a
+ * {@link org.apache.sis.storage.DataStore} reading a data file.
+ * Once a {@code FeatureType} has been obtained, {@code Feature}s can be
instantiated by calls to the
+ * {@link org.apache.sis.feature.DefaultFeatureType#newInstance()
FeatureType.newInstance()} method.
+ * Once a {@code Feature} instance has been obtained, {@code Attribute}s can
be instantiated indirectly
+ * by calls to the {@link
org.apache.sis.feature.AbstractFeature#setPropertyValue
Feature.setPropertyValue(…)} method.
+ *
* @author Travis L. Pinney
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.8
* @module
*/
package org.apache.sis.feature;
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -41,10 +41,10 @@ import org.opengis.feature.Property;
* appropriate "real" property in the feature.
*
* <div class="note"><b>Example:</b>
- * one of the most frequently used synthetic property is {@code "@id"}, which
contains a unique
+ * one of the most frequently used synthetic property is {@code
"@identifier"}, which contains a unique
* identifier (or primary key) for the feature. This property is usually (but
not necessarily)
* a {@linkplain org.apache.sis.feature.FeatureOperations#link link to an
existing attribute}.
- * By using the {@code "@id"} alias, users do not need to know the name of the
"real" attribute.
+ * By using the {@code "@identifier"} alias, users do not need to know the
name of the "real" attribute.
* </div>
*
* This class defines names for two kinds of usage:
@@ -61,7 +61,7 @@ import org.opengis.feature.Property;
* but we may refactor this class in future SIS versions if there is a need to
support different conventions.
*
* <p>In order to reduce the risk of name collision with properties in
user-defined features
- * (e.g. the user may already have an attribute named {@code "id"} for his own
purpose),
+ * (e.g. the user may already have an attribute named {@code "identifier"} for
his own purpose),
* all names defined in this class begin with the {@code "@"} character.</p>
*
* @author Johann Sorel (Geomatys)
@@ -90,7 +90,7 @@ public final class AttributeConvention e
* <p>The {@linkplain
org.apache.sis.feature.DefaultAttributeType#getValueClass() value class} is
usually
* {@link String}, {@link Integer}, {@link java.util.UUID} or other types
commonly used as identifiers.</p>
*/
- public static final LocalName ID_PROPERTY;
+ public static final LocalName IDENTIFIER_PROPERTY;
/**
* Conventional name for a property containing the geometric object to use
by default.
@@ -107,11 +107,11 @@ public final class AttributeConvention e
*
* @see #isGeometryAttribute(IdentifiedType)
*/
- public static final LocalName DEFAULT_GEOMETRY_PROPERTY;
+ public static final LocalName GEOMETRY_PROPERTY;
/**
* Conventional name for fetching the envelope encompassing all geometries
in a feature. Most {@code FeatureType}s
- * have at most one geometry, which is also the {@linkplain
#DEFAULT_GEOMETRY_PROPERTY default geometry}.
+ * have at most one geometry, which is also the {@link #GEOMETRY_PROPERTY
default geometry}.
* But if several geometries exist, then the value for this synthetic
property is the union of all geometries.
*
* <p>Properties of this name are usually
@@ -126,10 +126,10 @@ public final class AttributeConvention e
* Conventional name for fetching the Coordinate Reference System (CRS) of
a geometry or a coverage.
* This characteristic is typically an entry in the map returned by a call
to the
* {@link org.apache.sis.feature.DefaultAttributeType#characteristics()}
method
- * on the attribute referenced by {@link #DEFAULT_GEOMETRY_PROPERTY}.
+ * on the attribute referenced by {@link #GEOMETRY_PROPERTY}.
*
* <p>While it is technically possible to have different CRS for different
feature instances,
- * in most cases the CRS is the same for all geometries found in {@code
DEFAULT_GEOMETRY_PROPERTY}.
+ * in most cases the CRS is the same for all geometries found in {@code
GEOMETRY_PROPERTY}.
* In such cases, the CRS can be specified only once as the
* {@linkplain
org.apache.sis.feature.DefaultAttributeType#getDefaultValue() default value}
* of this {@code CRS_CHARACTERISTIC}.</p>
@@ -168,8 +168,8 @@ public final class AttributeConvention e
final NameFactory factory =
DefaultFactories.forBuildin(NameFactory.class);
NAMESPACE = factory.createGenericName(null,
"Apache", Constants.SIS);
NameSpace ns = factory.createNameSpace(NAMESPACE,
null);
- ID_PROPERTY = factory.createLocalName(ns,
"@identifier");
- DEFAULT_GEOMETRY_PROPERTY = factory.createLocalName(ns,
"@geometry");
+ IDENTIFIER_PROPERTY = factory.createLocalName(ns,
"@identifier");
+ GEOMETRY_PROPERTY = factory.createLocalName(ns,
"@geometry");
ENVELOPE_PROPERTY = factory.createLocalName(ns,
"@envelope");
CRS_CHARACTERISTIC = factory.createLocalName(ns, "@crs");
MAXIMAL_LENGTH_CHARACTERISTIC = factory.createLocalName(ns,
"@maximalLength");
@@ -223,7 +223,7 @@ public final class AttributeConvention e
* @return {@code true} if the given type is (directly or indirectly) an
attribute type
* for one of the recognized geometry types.
*
- * @see #DEFAULT_GEOMETRY_PROPERTY
+ * @see #GEOMETRY_PROPERTY
*/
public static boolean isGeometryAttribute(IdentifiedType type) {
while (type instanceof Operation) {
@@ -253,7 +253,7 @@ public final class AttributeConvention e
* @throws ClassCastException if {@link #CRS_CHARACTERISTIC} has been
found but is associated
* to an object which is not a {@link CoordinateReferenceSystem}
instance.
*
- * @see
org.apache.sis.internal.feature.FeatureTypeBuilder.Property#setCRSCharacteristic(CoordinateReferenceSystem)
+ * @see
org.apache.sis.feature.builder.AttributeTypeBuilder#setCRS(CoordinateReferenceSystem)
*/
public static CoordinateReferenceSystem getCRSCharacteristic(final
Property attribute) {
return (CoordinateReferenceSystem) getCharacteristic(attribute,
CRS_CHARACTERISTIC.toString());
@@ -280,7 +280,7 @@ public final class AttributeConvention e
* @throws ClassCastException if {@link #MAXIMAL_LENGTH_CHARACTERISTIC}
has been found but is associated
* to an object which is not an {@link Integer} instance.
*
- * @see
org.apache.sis.internal.feature.FeatureTypeBuilder.Property#setMaximalLengthCharacteristic(Integer)
+ * @see
org.apache.sis.feature.builder.AttributeTypeBuilder#setMaximalLength(Integer)
*/
public static Integer getMaximalLengthCharacteristic(final Property
attribute) {
return (Integer) getCharacteristic(attribute,
MAXIMAL_LENGTH_CHARACTERISTIC.toString());
Modified:
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -16,10 +16,15 @@
*/
package org.apache.sis.internal.feature;
+import java.util.logging.Level;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.Envelope2D;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.util.Static;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.internal.system.Loggers;
/**
@@ -32,11 +37,52 @@ import org.apache.sis.util.Static;
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public final class Geometries extends Static {
/**
+ * The geometry object from Java Topology Suite (JTS),
+ * or {@code null} if the JTS library is not on the classpath.
+ */
+ private static final Class<?> JTS;
+
+ /**
+ * Getter methods on JTS envelopes, or {@code null} if the JTS library is
not on the classpath.
+ * Each methods take no argument and return a {@code double} value.
+ */
+ private static final Method INTERNAL, MIN_X, MIN_Y, MAX_X, MAX_Y;
+
+ static {
+ Class<?> type;
+ Method genv, xmin, ymin, xmax, ymax;
+ try {
+ final Class<?> envt;
+ type = Class.forName("com.vividsolutions.jts.geom.Geometry");
+ genv = type.getMethod("getEnvelopeInternal", (Class[]) null);
+ envt = genv.getReturnType();
+ xmin = envt.getMethod("getMinX", (Class[]) null);
+ ymin = envt.getMethod("getMinY", (Class[]) null);
+ xmax = envt.getMethod("getMaxX", (Class[]) null);
+ ymax = envt.getMethod("getMaxY", (Class[]) null);
+ } catch (ClassNotFoundException | NoSuchMethodException e) {
+ Logging.getLogger(Loggers.GEOMETRY).log(Level.CONFIG,
e.toString());
+ type = null;
+ genv = null;
+ xmin = null;
+ xmax = null;
+ ymin = null;
+ ymax = null;
+ }
+ JTS = type;
+ INTERNAL = genv;
+ MIN_X = xmin;
+ MIN_Y = ymin;
+ MAX_X = xmax;
+ MAX_Y = ymax;
+ }
+
+ /**
* Do not allow instantiation of this class.
*/
private Geometries() {
@@ -49,7 +95,7 @@ public final class Geometries extends St
* @return {@code true} if the given type is one of the geometry type
known to SIS.
*/
public static boolean isKnownType(final Class<?> type) {
- return Geometry.class.isAssignableFrom(type);
+ return Geometry.class.isAssignableFrom(type) || (JTS != null &&
JTS.isAssignableFrom(type));
}
/**
@@ -61,16 +107,43 @@ public final class Geometries extends St
* a recognized geometry or its envelope is empty.
*/
public static GeneralEnvelope getEnvelope(final Object geometry) {
+ final double xmin, ymin, xmax, ymax;
if (geometry instanceof Geometry) {
final Envelope2D bounds = new Envelope2D();
((Geometry) geometry).queryEnvelope2D(bounds);
- if (!bounds.isEmpty()) { //
Test if there is NaN values.
- final GeneralEnvelope env = new GeneralEnvelope(2);
- env.setRange(0, bounds.xmin, bounds.xmax);
- env.setRange(1, bounds.ymin, bounds.ymax);
- return env;
+ if (bounds.isEmpty()) { //
Test if there is NaN values.
+ return null;
+ }
+ xmin = bounds.xmin;
+ ymin = bounds.ymin;
+ xmax = bounds.xmax;
+ ymax = bounds.ymax;
+ } else if (JTS != null && JTS.isInstance(geometry)) {
+ try {
+ final Object env = INTERNAL.invoke(geometry, (Object[]) null);
+ xmin = (Double) MIN_X.invoke(env, (Object[]) null);
+ ymin = (Double) MIN_Y.invoke(env, (Object[]) null);
+ xmax = (Double) MAX_X.invoke(env, (Object[]) null);
+ ymax = (Double) MAX_Y.invoke(env, (Object[]) null);
+ } catch (ReflectiveOperationException e) {
+ if (e instanceof InvocationTargetException) {
+ final Throwable cause = e.getCause();
+ if (cause instanceof RuntimeException) {
+ throw (RuntimeException) cause;
+ }
+ if (cause instanceof Error) {
+ throw (Error) cause;
+ }
+ }
+ // Should never happen unless JTS's API changed.
+ throw (Error) new
IncompatibleClassChangeError(e.toString()).initCause(e);
}
+ } else {
+ return null;
}
- return null;
+ final GeneralEnvelope env = new GeneralEnvelope(2);
+ env.setRange(0, xmin, xmax);
+ env.setRange(1, ymin, ymax);
+ return env;
}
}
Modified:
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/AbstractOperationTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/AbstractOperationTest.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/AbstractOperationTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/AbstractOperationTest.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -31,7 +31,7 @@ import static org.apache.sis.test.Assert
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@DependsOn(SingletonAttributeTest.class)
@@ -62,6 +62,6 @@ public final strictfp class AbstractOper
*/
@Test
public void testToString() {
- assertEquals("Operation[“found city” (founder) : city]",
foundCity().toString());
+ assertEquals("NoOperation[“found city” (founder) : String]",
foundCity().toString());
}
}
Modified:
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -81,7 +81,7 @@ public final strictfp class EnvelopeOper
null,
null
};
- attributes[4] =
FeatureOperations.link(name(AttributeConvention.DEFAULT_GEOMETRY_PROPERTY),
attributes[defaultGeometry]);
+ attributes[4] =
FeatureOperations.link(name(AttributeConvention.GEOMETRY_PROPERTY),
attributes[defaultGeometry]);
attributes[5] = FeatureOperations.envelope(name("bounds"), null,
attributes);
return new DefaultFeatureType(name("school"), false, null, attributes);
}
Modified:
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -49,7 +49,7 @@ import org.junit.BeforeClass;
org.apache.sis.feature.FeatureFormatTest.class,
org.apache.sis.feature.FeaturesTest.class,
org.apache.sis.internal.feature.AttributeConventionTest.class,
- org.apache.sis.internal.feature.FeatureTypeBuilderTest.class
+ org.apache.sis.feature.builder.FeatureTypeBuilderTest.class
})
public final strictfp class FeatureTestSuite extends TestSuite {
/**
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -351,6 +351,11 @@ public class DefaultMetadata extends ISO
/**
* Returns a unique identifier for this metadata record.
*
+ * <div class="note"><b>Note:</b>
+ * OGC 07-045 (Catalog Service Specification — ISO metadata application
profile) recommends usage
+ * of a UUID (Universal Unique Identifier) as specified by <a
href="http://www.ietf.org">IETF</a>
+ * to ensure identifier’s uniqueness.</div>
+ *
* @return Unique identifier for this metadata record, or {@code null}.
*
* @since 0.5
@@ -587,7 +592,7 @@ public class DefaultMetadata extends ISO
/**
* Returns an identification of the parent metadata record.
- * This is non-null if this metadata is a subset (child) of another
metadata.
+ * This is non-null if this metadata is a subset (child) of another
metadata that is described elsewhere.
*
* @return Identification of the parent metadata record, or {@code null}
if none.
*
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractStereographic.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractStereographic.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractStereographic.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractStereographic.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -31,7 +31,7 @@ import org.apache.sis.referencing.operat
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@XmlTransient
@@ -42,12 +42,6 @@ abstract class AbstractStereographic ext
private static final long serialVersionUID = -8797654778436582119L;
/**
- * The operation parameter descriptor for the <cite>Scale factor at
natural origin</cite> (k₀) parameter value.
- * Valid values range is (0 … ∞) and default value is 1.
- */
- public static final ParameterDescriptor<Double> SCALE_FACTOR =
Mercator1SP.SCALE_FACTOR;
-
- /**
* The operation parameter descriptor for the <cite>False easting</cite>
(FE) parameter value.
* Valid values range is unrestricted and default value is 0 metre.
*/
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -128,13 +128,13 @@ public abstract class GeocentricAffine e
static final ParameterDescriptor<Double> DS;
static {
final ParameterBuilder builder = builder();
- TX = createShift(builder.addName("X-axis
translation").addName(Citations.OGC, "dx"));
- TY = createShift(builder.addName("Y-axis
translation").addName(Citations.OGC, "dy"));
- TZ = createShift(builder.addName("Z-axis
translation").addName(Citations.OGC, "dz"));
- RX = createRotation(builder, "X-axis rotation", "ex");
- RY = createRotation(builder, "Y-axis rotation", "ey");
- RZ = createRotation(builder, "Z-axis rotation", "ez");
- DS = builder.addName("Scale difference").addName(Citations.OGC,
"ppm").create(1, Units.PPM);
+ TX = createShift(builder.addIdentifier("8605").addName("X-axis
translation").addName(Citations.OGC, "dx"));
+ TY = createShift(builder.addIdentifier("8606").addName("Y-axis
translation").addName(Citations.OGC, "dy"));
+ TZ = createShift(builder.addIdentifier("8607").addName("Z-axis
translation").addName(Citations.OGC, "dz"));
+ RX = createRotation(builder.addIdentifier("8608"), "X-axis rotation",
"ex");
+ RY = createRotation(builder.addIdentifier("8609"), "Y-axis rotation",
"ey");
+ RZ = createRotation(builder.addIdentifier("8610"), "Z-axis rotation",
"ez");
+ DS = builder.addIdentifier("8611").addName("Scale
difference").addName(Citations.OGC, "ppm").create(1, Units.PPM);
}
/**
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -107,9 +107,8 @@ public final class LambertConformal2SP e
* NetCDF: longitude_of_central_meridian
* GeoTIFF: FalseOriginLong
*/
- LONGITUDE_OF_FALSE_ORIGIN =
createLongitude(exceptEPSG(LambertConformal1SP.LONGITUDE_OF_ORIGIN, builder
- .addIdentifier("8822")
- .addName("Longitude of false origin"))
+ LONGITUDE_OF_FALSE_ORIGIN = createLongitude(
+ rename(LambertConformal1SP.LONGITUDE_OF_ORIGIN, "8822",
"Longitude of false origin", builder)
.rename(Citations.NETCDF, "longitude_of_central_meridian")
.rename(Citations.GEOTIFF, "FalseOriginLong"));
/*
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -57,7 +57,7 @@ import static org.opengis.metadata.Ident
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*/
@XmlTransient
@@ -244,47 +244,105 @@ public abstract class MapProjection exte
}
/**
- * Copies all aliases and identifiers except the ones for the given
authority.
- * If the given replacement is non-null, then it will be used instead of
the
- * first occurrence of the omitted name.
+ * Rename the primary name and identifier of the given descriptor. Aliases
are copied as-is.
*
- * <p>This method does not copy the primary name. It is caller's
responsibility to add it first.</p>
+ * @param template the parameter from which to copy the aliases.
+ * @param identifier the new EPSG identifier.
+ * @param name the new EPSG name.
+ * @param builder an initially clean builder where to add the names.
+ * @return the given {@code builder}, for method call chaining.
+ *
+ * @since 0.8
+ */
+ static ParameterBuilder rename(final ParameterDescriptor<?> template,
final String identifier, final String name,
+ final ParameterBuilder builder)
+ {
+ return exceptEPSG(template,
builder.addIdentifier(identifier).addName(name));
+ }
+
+ /**
+ * Copies name, aliases and identifiers of the given {@code template},
except the alias of the given authority
+ * which is replaced by the alias of the same authority in {@code
replacement}.
*
- * @param source The parameter from which to copy the names.
- * @param except The authority of the name to omit. Can not be EPSG.
- * @param replacement The name to use instead of the omitted one, or
{@code null} if none.
- * @param builder Where to add the names.
- * @return The given {@code builder}, for method call chaining.
+ * @param template the parameter from which to copy names and
identifiers.
+ * @param toRename authority of the alias to rename.
+ * @param replacement the parameter from which to get the new name for
the alias to rename.
+ * @param builder an initially clean builder where to add the names
and identifiers.
+ * @return the given {@code builder}, for method call chaining.
*
- * @since 0.7
+ * @since 0.8
*/
- static ParameterBuilder except(final ParameterDescriptor<Double> source,
final Citation except,
+ static ParameterBuilder renameAlias(final ParameterDescriptor<Double>
template, final Citation toRename,
+ final ParameterDescriptor<Double> replacement, final
ParameterBuilder builder)
+ {
+ copyAliases(template, toRename, sameNameAs(toRename, replacement),
builder.addName(template.getName()));
+ for (final Identifier id : template.getIdentifiers()) {
+ builder.addIdentifier(id);
+ }
+ return builder;
+ }
+
+ /**
+ * Copies all aliases except the ones for the given authority. If the
given replacement is non-null,
+ * then it will be used instead of the first occurrence of the omitted
name.
+ *
+ * <p>This method does not copy the primary name. It is caller's
responsibility to add it first.</p>
+ *
+ * @param template the parameter from which to copy the aliases.
+ * @param exclude the authority of the alias to omit. Can not be
EPSG.
+ * @param replacement the alias to use instead of the omitted one, or
{@code null} if none.
+ * @param builder where to add the aliases.
+ * @return the given {@code builder}, for method call chaining.
+ */
+ private static ParameterBuilder copyAliases(final
ParameterDescriptor<Double> template, final Citation exclude,
GenericName replacement, final ParameterBuilder builder)
{
- for (GenericName alias : source.getAlias()) {
- if (((Identifier) alias).getAuthority() == except) {
+ for (GenericName alias : template.getAlias()) {
+ if (((Identifier) alias).getAuthority() == exclude) {
if (replacement == null) continue;
alias = replacement;
replacement = null;
}
builder.addName(alias);
}
- for (final Identifier id : source.getIdentifiers()) {
- builder.addIdentifier(id);
- }
return builder;
}
/**
+ * Copies all aliases and identifiers, but using the alias specified by
the given authority as the primary name.
+ * The old primary name (usually the EPSG name) is discarded. Identifier
are <strong>not</strong> copied, which
+ * usually implies that only the EPSG identifier is ignored (because it is
usually the only parameter identifier).
+ *
+ * <p>This is a convenience method for defining the parameters of an
ESRI-specific (or any other authority)
+ * projection using the EPSG parameters as template. Note that in the
particular case where the desired
+ * authority is OGC, {@link #exceptEPSG(ParameterDescriptor,
ParameterBuilder)} is more efficient.</p>
+ *
+ * @param template the parameter from which to copy the names.
+ * @param authority the authority to use for the primary name.
+ * @param builder an initially clean builder where to add the names.
+ * @return the given {@code builder}, for method call chaining.
+ *
+ * @since 0.8
+ */
+ static ParameterBuilder alternativeAuthority(final
ParameterDescriptor<Double> template,
+ final Citation authority, final ParameterBuilder builder)
+ {
+ return copyAliases(template, authority, null,
builder.addName(sameNameAs(authority, template)));
+ }
+
+ /**
* Copies all names except the EPSG one from the given parameter into the
builder.
- * The EPSG name is presumed the first name and identifier (this is not
verified).
+ * The EPSG information are presumed to be the primary name and the only
identifier (this is not verified).
+ *
+ * <p>If this method is invoking with a "clean" builder, then the result
is to promote the first alias as
+ * the primary name. The first alias is usually the OGC name.</p>
*
- * @param source The parameter from which to copy the names.
- * @param builder Where to add the names.
- * @return The given {@code builder}, for method call chaining.
+ * @param template the parameter from which to copy the names.
+ * @param builder where to add the names.
+ * @return the given {@code builder}, for method call chaining.
*/
- static ParameterBuilder exceptEPSG(final ParameterDescriptor<?> source,
final ParameterBuilder builder) {
- for (final GenericName alias : source.getAlias()) {
+ static ParameterBuilder exceptEPSG(final ParameterDescriptor<?> template,
final ParameterBuilder builder) {
+ for (final GenericName alias : template.getAlias()) {
builder.addName(alias);
}
return builder;
@@ -293,8 +351,8 @@ public abstract class MapProjection exte
/**
* Creates a remarks for parameters that are not formally EPSG parameter.
*
- * @param origin The name of the projection for where the parameter is
formally used.
- * @return A remarks saying that the parameter is actually defined in
{@code origin}.
+ * @param origin the name of the projection for where the parameter is
formally used.
+ * @return a remarks saying that the parameter is actually defined in
{@code origin}.
*/
static InternationalString notFormalParameter(final String origin) {
return
Messages.formatInternational(Messages.Keys.NotFormalProjectionParameter_1,
origin);
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -105,9 +105,9 @@ public final class Mercator2SP extends A
.addIdentifier(Citations.S57, "8")
.createGroupForMapProjection(
STANDARD_PARALLEL,
- latitudeOfOrigin, // Not formally a Mercator2SP
parameter.
+ latitudeOfOrigin, // Not formally a
Mercator2SP parameter.
Mercator1SP.LONGITUDE_OF_ORIGIN,
- SCALE_FACTOR, // Not formally a Mercator2SP
parameter.
+ SCALE_FACTOR, // Not formally a
Mercator2SP parameter.
FALSE_EASTING,
FALSE_NORTHING);
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -92,8 +92,8 @@ public final class Molodensky extends Ge
public static final ParameterDescriptorGroup PARAMETERS;
static {
final ParameterBuilder builder = builder();
- AXIS_LENGTH_DIFFERENCE = builder.addName("Semi-major axis length
difference").create(Double.NaN, SI.METRE);
- FLATTENING_DIFFERENCE = builder.addName("Flattening
difference").createBounded(-1, +1, Double.NaN, Unit.ONE);
+ AXIS_LENGTH_DIFFERENCE =
builder.addIdentifier("8654").addName("Semi-major axis length
difference").create(Double.NaN, SI.METRE);
+ FLATTENING_DIFFERENCE =
builder.addIdentifier("8655").addName("Flattening
difference").createBounded(-1, +1, Double.NaN, Unit.ONE);
PARAMETERS = builder.setRequired(true)
.addIdentifier("9604")
.addName("Molodensky")
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -31,7 +31,7 @@ import org.apache.sis.referencing.operat
* @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*
* @see <a
href="http://www.remotesensing.org/geotiff/proj_list/oblique_stereographic.html">Oblique
Stereographic on RemoteSensing.org</a>
@@ -56,6 +56,12 @@ public final class ObliqueStereographic
public static final ParameterDescriptor<Double> LONGITUDE_OF_ORIGIN =
Mercator1SP.LONGITUDE_OF_ORIGIN;
/**
+ * The operation parameter descriptor for the <cite>Scale factor at
natural origin</cite> (k₀) parameter value.
+ * Valid values range is (0 … ∞) and default value is 1.
+ */
+ public static final ParameterDescriptor<Double> SCALE_FACTOR =
Mercator1SP.SCALE_FACTOR; // Same as PolarStereographicA.
+
+ /**
* The group of all parameters expected by this coordinate operation.
*/
private static final ParameterDescriptorGroup PARAMETERS;
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -29,7 +29,7 @@ import org.apache.sis.parameter.Paramete
* @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*
* @see <a
href="http://www.remotesensing.org/geotiff/proj_list/polar_stereographic.html">Polar
Stereographic on RemoteSensing.org</a>
@@ -64,6 +64,12 @@ public final class PolarStereographicA e
public static final ParameterDescriptor<Double> LONGITUDE_OF_ORIGIN;
/**
+ * The operation parameter descriptor for the <cite>Scale factor at
natural origin</cite> (k₀) parameter value.
+ * Valid values range is (0 … ∞) and default value is 1.
+ */
+ public static final ParameterDescriptor<Double> SCALE_FACTOR =
Mercator1SP.SCALE_FACTOR;
+
+ /**
* The group of all parameters expected by this coordinate operation.
*/
private static final ParameterDescriptorGroup PARAMETERS;
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicB.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -31,7 +31,7 @@ import org.apache.sis.parameter.Paramete
* @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
@XmlTransient
@@ -67,7 +67,6 @@ public final class PolarStereographicB e
* because it is sometime used in Well Known Text (WKT). However it shall
be interpreted as a
* <cite>Scale factor at the standard parallel</cite> rather than at the
natural origin.</p>
*/
- @SuppressWarnings("FieldNameHidesFieldInSuperclass")
static final ParameterDescriptor<Double> SCALE_FACTOR;
/**
@@ -77,8 +76,7 @@ public final class PolarStereographicB e
static {
final ParameterBuilder builder = builder();
LONGITUDE_OF_ORIGIN = createLongitude(
- exceptEPSG(PolarStereographicA.LONGITUDE_OF_ORIGIN,
- builder.addIdentifier("8833").addName("Longitude of origin")));
+ rename(PolarStereographicA.LONGITUDE_OF_ORIGIN, "8833",
"Longitude of origin", builder));
STANDARD_PARALLEL = createMandatoryLatitude(builder
.addIdentifier("8832").addName("Latitude of standard parallel")
@@ -98,7 +96,7 @@ public final class PolarStereographicB e
.createGroupForMapProjection(
STANDARD_PARALLEL,
LONGITUDE_OF_ORIGIN,
- SCALE_FACTOR, // Not formally a parameter of
this projection.
+ SCALE_FACTOR, // Not formally a
parameter of this projection.
FALSE_EASTING,
FALSE_NORTHING);
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicSouth.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicSouth.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicSouth.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicSouth.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -44,22 +44,18 @@ public final class PolarStereographicSou
private static final long serialVersionUID = -6173635411676914083L;
/**
- * Copies all names and identifiers, but using the ESRI authority as the
primary name.
- * This is a convenience method for defining the parameters of an
ESRI-specific projection
- * using the EPSG parameters as template.
- */
- private static ParameterBuilder addNamesAndIdentifiers(final
ParameterDescriptor<Double> source, final ParameterBuilder builder) {
- return except(source, Citations.ESRI, null,
builder.addName(sameNameAs(Citations.ESRI, source)).addName(source.getName()));
- }
-
- /**
- * Returns the same parameter than the given one, except that the primary
name is the ESRI name
- * instead than the EPSG one.
+ * Returns the same parameter than the given one, except that the alias of
the ESRI authority
+ * is promoted as the primary name. The old primary name and identifiers
(which are usually the
+ * EPSG ones) are discarded.
+ *
+ * @param template the parameter from which to copy the names and
identifiers.
+ * @param builder an initially clean builder where to add the names.
+ * @return the given {@code builder}, for method call chaining.
*/
@SuppressWarnings("unchecked")
- private static ParameterDescriptor<Double> forESRI(final
ParameterDescriptor<Double> source, final ParameterBuilder builder) {
- return addNamesAndIdentifiers(source,
builder).createBounded((MeasurementRange<Double>)
- ((DefaultParameterDescriptor<Double>)
source).getValueDomain(), source.getDefaultValue());
+ private static ParameterDescriptor<Double> forESRI(final
ParameterDescriptor<Double> template, final ParameterBuilder builder) {
+ return alternativeAuthority(template, Citations.ESRI,
builder).createBounded((MeasurementRange<Double>)
+ ((DefaultParameterDescriptor<Double>)
template).getValueDomain(), template.getDefaultValue());
}
/**
@@ -69,13 +65,13 @@ public final class PolarStereographicSou
static {
final ParameterBuilder builder = builder();
final ParameterDescriptor<?>[] parameters = {
- addNamesAndIdentifiers(PolarStereographicB.STANDARD_PARALLEL,
builder)
+ alternativeAuthority(PolarStereographicB.STANDARD_PARALLEL,
Citations.ESRI, builder)
.createBounded(Latitude.MIN_VALUE, 0, Latitude.MIN_VALUE,
NonSI.DEGREE_ANGLE),
forESRI(PolarStereographicB.LONGITUDE_OF_ORIGIN, builder),
- forESRI(PolarStereographicB.SCALE_FACTOR, builder),
- forESRI(PolarStereographicB.FALSE_EASTING, builder),
- forESRI(PolarStereographicB.FALSE_NORTHING, builder)
+ PolarStereographicB.SCALE_FACTOR, // Not
formally a parameter of this projection.
+ forESRI(LambertCylindricalEqualArea.FALSE_EASTING, builder),
+ forESRI(LambertCylindricalEqualArea.FALSE_NORTHING, builder)
};
PARAMETERS = builder
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -74,19 +74,16 @@ public class RegionalMercator extends Ab
static {
final ParameterBuilder builder = builder();
- LATITUDE_OF_FALSE_ORIGIN =
createLatitude(exceptEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder
- .addIdentifier("8821")
- .addName("Latitude of false origin"))
+ LATITUDE_OF_FALSE_ORIGIN = createLatitude(
+ rename(Mercator1SP.LATITUDE_OF_ORIGIN, "8821", "Latitude of
false origin", builder)
.rename(Citations.GEOTIFF, "FalseOriginLat"), false);
- EASTING_AT_FALSE_ORIGIN = createShift(exceptEPSG(FALSE_EASTING, builder
- .addIdentifier("8826")
- .addName("Easting at false origin"))
+ EASTING_AT_FALSE_ORIGIN = createShift(
+ rename(FALSE_EASTING, "8826", "Easting at false origin",
builder)
.rename(Citations.GEOTIFF, "FalseOriginEasting"));
- NORTHING_AT_FALSE_ORIGIN = createShift(exceptEPSG(FALSE_NORTHING,
builder
- .addIdentifier("8827")
- .addName("Northing at false origin"))
+ NORTHING_AT_FALSE_ORIGIN = createShift(
+ rename(FALSE_NORTHING, "8827", "Northing at false origin",
builder)
.rename(Citations.GEOTIFF, "FalseOriginNorthing"));
PARAMETERS = builder
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -90,9 +90,8 @@ public final class TransverseMercator ex
LATITUDE_OF_ORIGIN = createLatitude(builder
.addNamesAndIdentifiers(Mercator1SP.LATITUDE_OF_ORIGIN), true);
- builder.addName(Mercator1SP.LONGITUDE_OF_ORIGIN.getName());
- LONGITUDE_OF_ORIGIN =
createLongitude(except(Mercator1SP.LONGITUDE_OF_ORIGIN, Citations.NETCDF,
- sameNameAs(Citations.NETCDF,
LambertConformal2SP.LONGITUDE_OF_FALSE_ORIGIN), builder));
+ LONGITUDE_OF_ORIGIN =
createLongitude(renameAlias(Mercator1SP.LONGITUDE_OF_ORIGIN,
+ Citations.NETCDF,
LambertConformal2SP.LONGITUDE_OF_FALSE_ORIGIN, builder));
SCALE_FACTOR = createScale(builder
.addNamesAndIdentifiers(Mercator1SP.SCALE_FACTOR)
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/package-info.java?rev=1753261&r1=1753260&r2=1753261&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/package-info.java
[UTF-8] Mon Jul 18 16:15:13 2016
@@ -22,7 +22,7 @@
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*
* @see org.apache.sis.referencing.operation.transform.MathTransformProvider