[jira] [Commented] (SIS-344) Update EPSG geodetic dataset to version 9.0
[ https://issues.apache.org/jira/browse/SIS-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15961095#comment-15961095 ] Martin Desruisseaux commented on SIS-344: - We will need to revisit SIS-284 (even if marked resolved) after this EPSG dataset upgrade. > Update EPSG geodetic dataset to version 9.0 > --- > > Key: SIS-344 > URL: https://issues.apache.org/jira/browse/SIS-344 > Project: Spatial Information Systems > Issue Type: Task > Components: Referencing >Affects Versions: 0.7 >Reporter: Martin Desruisseaux > Fix For: 0.8 > > > EPSG geodetic dataset version 9.0 has been released on December 15, 2016. We > need to upgrade the {{org.apache.sis.non-free:sis-epsg}} Maven artifact > accordingly. Note that this version introduce 6 news definitions of WGS 84 > geographic CRS. > This update included the following changes in the EPSG schema: > * Data declaration for the {{datum.realization_epoch}} attribute has been > changed from {{char(4)}} to {{char(10)}} to allow dates to be given to day > resolution. > * The length of abbreviations has been changed to a nominal maximum of 32 > characters. > The {{Tables.sql}} file provided in SIS will need to be updated accordingly. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (SIS-284) Geographic2D with Height Offsets (EPSG:9618)
[ https://issues.apache.org/jira/browse/SIS-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15961091#comment-15961091 ] Martin Desruisseaux commented on SIS-284: - Before to close this task, we need to verify that we can decode all the following coordinate operations: {code:java} public class Test { public static void main(String[] args) throws Exception { CoordinateOperationAuthorityFactory factory = (CoordinateOperationAuthorityFactory) CRS.getAuthorityFactory("EPSG"); System.out.println(factory.createCoordinateOperation("15596")); // 3D to 3D System.out.println(factory.createCoordinateOperation("1336")); // 3D to 2D System.out.println(factory.createCoordinateOperation("1335")); // 2D to 2D } } {code} With EPSG geodetic data set 8.9, the first coordinate operation succeed but the next two fails, because the operation method is declared with a {{null}} (meaning arbitrary) source number of dimensions, which is okay, but a target number of dimensions fixed to 3. If the situation is the same in EPSG geodetic dataset 9.0, we may need to force the target dimension to null. > Geographic2D with Height Offsets (EPSG:9618) > > > Key: SIS-284 > URL: https://issues.apache.org/jira/browse/SIS-284 > Project: Spatial Information Systems > Issue Type: Sub-task > Components: Referencing >Reporter: Martin Desruisseaux >Assignee: Martin Desruisseaux >Priority: Minor > Fix For: 0.8 > > > Simplified form of _"Geographic3D to Geographic2D + gravity-related height"_ > transformation used in Japan. > See §2.4.5.3 in IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, > part 2 – April 2015. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
svn commit: r1790582 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ test/java/org/apache/sis/internal/referencing/provider/
Author: desruisseaux Date: Fri Apr 7 16:37:34 2017 New Revision: 1790582 URL: http://svn.apache.org/viewvc?rev=1790582&view=rev Log: Use cases on "Geographic2D with Height Offsets" show that this operation method needs to allow the 'redimension(…)' method. Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java?rev=1790582&r1=1790581&r2=1790582&view=diff == --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java [UTF-8] Fri Apr 7 16:37:34 2017 @@ -30,6 +30,13 @@ import org.apache.sis.measure.Units; * to geoidal height, as can been seen from the difference in parameter name. * For a "Geographic3D offsets" with ellipsoidal heights, see the parent class. * + * Examples of coordinate transformations using this method: + * + * EPSG:1335 from 2D to 2D geographic CRS. + * EPSG:1336 from 3D to 2D geographic CRS. + * EPSG:15596 from 3D to 3D geographic CRS. + * + * * @author Martin Desruisseaux (Geomatys) * @version 0.8 * @since 0.8 @@ -63,7 +70,18 @@ public final class GeographicAndVertical * Constructs a provider with default parameters. */ public GeographicAndVerticalOffsets() { -super(3, 3, PARAMETERS, null); +this(3, 3, new GeographicAndVerticalOffsets[4]); +redimensioned[0] = new GeographicAndVerticalOffsets(2, 2, redimensioned); +redimensioned[1] = new GeographicAndVerticalOffsets(2, 3, redimensioned); +redimensioned[2] = new GeographicAndVerticalOffsets(3, 2, redimensioned); +redimensioned[3] = this; +} + +/** + * For default constructor only. + */ +private GeographicAndVerticalOffsets(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) { +super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned); } /** Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java?rev=1790582&r1=1790581&r2=1790582&view=diff == --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] Fri Apr 7 16:37:34 2017 @@ -87,7 +87,7 @@ public class GeographicOffsets extends G } /** - * For subclasses constructor only. + * For default constructors in this class and subclasses. */ GeographicOffsets(int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters, GeodeticOperation[] redimensioned) Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1790582&r1=1790581&r2=1790582&view=diff == --- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] Fri Apr 7 16:37:34 2017 @@ -117,6 +117,7 @@ public final strictfp class ProvidersTes LongitudeRotation.class, GeographicOffsets.class, GeographicOffsets2D.class, +GeographicAndVerticalOffsets.class, CoordinateFrameRotation2D.class, CoordinateFrameRotation3D.class, PositionVector7Param2D.class,
svn commit: r1790572 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/resources/META-INF/services/ test/java/org/apache/sis/internal/refer
Author: desruisseaux Date: Fri Apr 7 15:49:03 2017 New Revision: 1790572 URL: http://svn.apache.org/viewvc?rev=1790572&view=rev Log: Implement Geographic2D with Height Offsets (EPSG:9618). https://issues.apache.org/jira/browse/SIS-284 Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java - copied, changed from r1790133, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java (from r1790133, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java) URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java&r1=1790133&r2=1790572&rev=1790572&view=diff == --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicAndVerticalOffsets.java [UTF-8] Fri Apr 7 15:49:03 2017 @@ -17,74 +17,60 @@ package org.apache.sis.internal.referencing.provider; import javax.xml.bind.annotation.XmlTransient; -import org.opengis.parameter.ParameterValueGroup; +import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.parameter.ParameterNotFoundException; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.MathTransformFactory; -import org.apache.sis.internal.referencing.j2d.AffineTransform2D; -import org.apache.sis.parameter.Parameters; +import org.apache.sis.parameter.ParameterBuilder; +import org.apache.sis.measure.Units; /** - * The provider for "Geographic2D offsets" (EPSG:9619). + * The provider for "Geographic2D with Height Offsets" (EPSG:9618). + * This is not the same than a "Geographic3D offsets" because this + * operation also performs a simplified transformation from ellipsoidal height + * to geoidal height, as can been seen from the difference in parameter name. + * For a "Geographic3D offsets" with ellipsoidal heights, see the parent class. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 - * @since 0.7 + * @version 0.8 + * @since 0.8 * @module */ @XmlTransient -public final class GeographicOffsets2D extends GeographicOffsets { +public final class GeographicAndVerticalOffsets extends GeographicOffsets { /** * Serial number for inter-operability with different versions. */ -private static final long serialVersionUID = -1611236201346560796L; +private static final long serialVersionUID = 7822664525013018023L; + +/** + * The operation parameter descriptor for the "Geoid undulation" parameter value. + * + * @see #TZ + */ +static final ParameterDescriptor TH; /** * The group of all parameters expected by this coordinate operation. */ private static final ParameterDescriptorGroup PARAMETERS; static { -PARAMETERS = builder().addIdentifier("9619").addName("Geographic2D offsets").createGroup(TY, TX); +final ParameterBuilder builder = builder(); +TH = builder.addIdentifier("8604").addName("Geoid undulation").create(0, Units.METRE); +PARAMETERS = builder().addIdentifier("9618").addName("Geographic2D with Height Offsets").createGroup(TY, TX, TH); } /** * Constructs a provider with default parameters. */ -public GeographicOffsets2D() { -this(null); -} - -/** - * Constructs a provider that can be resized. - */ -GeographicOffsets2D(GeodeticOperation[] redimensioned) { -super(2, 2, PARAMETERS, redimensioned); +public GeographicAndVerticalOffsets() { +super(3, 3, PARAMETERS, null); } /** - * Returns the three-dimensional variant of this operation method. - */ -@Override -Class variant3D()
[jira] [Resolved] (SIS-284) Geographic2D with Height Offsets (EPSG:9618)
[ https://issues.apache.org/jira/browse/SIS-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Desruisseaux resolved SIS-284. - Resolution: Fixed > Geographic2D with Height Offsets (EPSG:9618) > > > Key: SIS-284 > URL: https://issues.apache.org/jira/browse/SIS-284 > Project: Spatial Information Systems > Issue Type: Sub-task > Components: Referencing >Reporter: Martin Desruisseaux >Assignee: Martin Desruisseaux >Priority: Minor > Fix For: 0.8 > > > Simplified form of _"Geographic3D to Geographic2D + gravity-related height"_ > transformation used in Japan. > See §2.4.5.3 in IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, > part 2 – April 2015. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Updated] (SIS-284) Geographic2D with Height Offsets (EPSG:9618)
[ https://issues.apache.org/jira/browse/SIS-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Desruisseaux updated SIS-284: Fix Version/s: 0.8 > Geographic2D with Height Offsets (EPSG:9618) > > > Key: SIS-284 > URL: https://issues.apache.org/jira/browse/SIS-284 > Project: Spatial Information Systems > Issue Type: Sub-task > Components: Referencing >Reporter: Martin Desruisseaux >Assignee: Martin Desruisseaux >Priority: Minor > Fix For: 0.8 > > > Simplified form of _"Geographic3D to Geographic2D + gravity-related height"_ > transformation used in Japan. > See §2.4.5.3 in IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, > part 2 – April 2015. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Assigned] (SIS-284) Geographic2D with Height Offsets (EPSG:9618)
[ https://issues.apache.org/jira/browse/SIS-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Desruisseaux reassigned SIS-284: --- Assignee: Martin Desruisseaux > Geographic2D with Height Offsets (EPSG:9618) > > > Key: SIS-284 > URL: https://issues.apache.org/jira/browse/SIS-284 > Project: Spatial Information Systems > Issue Type: Sub-task > Components: Referencing >Reporter: Martin Desruisseaux >Assignee: Martin Desruisseaux >Priority: Minor > Fix For: 0.8 > > > Simplified form of _"Geographic3D to Geographic2D + gravity-related height"_ > transformation used in Japan. > See §2.4.5.3 in IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, > part 2 – April 2015. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Resolved] (SIS-343) Axis order reversal (EPSG:9843)
[ https://issues.apache.org/jira/browse/SIS-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Desruisseaux resolved SIS-343. - Resolution: Fixed > Axis order reversal (EPSG:9843) > --- > > Key: SIS-343 > URL: https://issues.apache.org/jira/browse/SIS-343 > Project: Spatial Information Systems > Issue Type: Sub-task > Components: Referencing >Affects Versions: 0.7 >Reporter: Martin Desruisseaux >Assignee: Martin Desruisseaux >Priority: Minor > Fix For: 0.8 > > > This trivial coordinate operation method is not listed in the EPSG guidance > note, but nevertheless appear in EPSG geodetic dataset. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
svn commit: r1790568 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/operation/transform/ main/resources/
Author: desruisseaux Date: Fri Apr 7 15:10:31 2017 New Revision: 1790568 URL: http://svn.apache.org/viewvc?rev=1790568&view=rev Log: Implement operation methods for axis order reversal (EPSG:9843 and 9844). Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java (with props) sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java (with props) Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java?rev=1790568&view=auto == --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java (added) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java [UTF-8] Fri Apr 7 15:10:31 2017 @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.internal.referencing.provider; + +import javax.xml.bind.annotation.XmlTransient; +import org.opengis.parameter.ParameterValueGroup; +import org.opengis.parameter.ParameterDescriptorGroup; +import org.opengis.referencing.operation.Conversion; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.MathTransformFactory; +import org.apache.sis.referencing.operation.matrix.Matrices; +import org.apache.sis.referencing.operation.matrix.MatrixSIS; +import org.apache.sis.referencing.operation.transform.MathTransforms; + + +/** + * The provider for "axis order reversal (2D)" (EPSG:9843). + * This is a trivial operation that just swap the two axes. + * The inverse operation is this operation itself. + * + * @author Martin Desruisseaux (Geomatys) + * @version 0.8 + * @since 0.8 + * @module + */ +@XmlTransient +public class AxisOrderReversal extends AbstractProvider { +/** + * Serial number for inter-operability with different versions. + */ +private static final long serialVersionUID = -663548119085488844L; + +/** + * The group of all parameters expected by this coordinate operation (in this case, none). + */ +private static final ParameterDescriptorGroup PARAMETERS = builder() +.addIdentifier("9843").addName("Axis order reversal (2D)").createGroup(); + +/** + * The unique instance, created when first needed. + */ +private transient MathTransform transform; + +/** + * Constructs a provider with default parameters. + */ +public AxisOrderReversal() { +super(2, 2, PARAMETERS); +} + +/** + * For {@link AxisOrderReversal3D} subclass only. + * + * @param dimensions number of dimensions in the source and target CRS of this operation method. + * @param parameters description of parameters expected by this operation. + */ +AxisOrderReversal(final int dimensions, final ParameterDescriptorGroup parameters) { +super(dimensions, dimensions, parameters); +} + +/** + * Returns the operation type. + * + * @return interface implemented by all coordinate operations that use this method. + */ +@Override +public final Class getOperationType() { +return Conversion.class; +} + +/** + * Returns the transform. + * + * @param factory ignored (can be null). + * @param values ignored. + * @return the math transform. + */ +@Override +public synchronized MathTransform createMathTransform(MathTransformFac
svn commit: r1790558 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java sis-referencing-by-identifiers/src/main/java/org/apache/sis/ref
Author: desruisseaux Date: Fri Apr 7 14:08:27 2017 New Revision: 1790558 URL: http://svn.apache.org/viewvc?rev=1790558&view=rev Log: Trivial javadoc. Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java?rev=1790558&r1=1790557&r2=1790558&view=diff == --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java [UTF-8] Fri Apr 7 14:08:27 2017 @@ -39,6 +39,12 @@ import org.apache.sis.internal.jaxb.gmd. */ public final class MD_CharacterSetCode extends XmlAdapter { /** + * Empty constructor for JAXB only. + */ +public MD_CharacterSetCode() { +} + +/** * The value of the {@link org.opengis.util.CodeList}. */ private CodeListUID identifier; Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java?rev=1790558&r1=1790557&r2=1790558&view=diff == --- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java [UTF-8] Fri Apr 7 14:08:27 2017 @@ -230,7 +230,7 @@ final class FinalLocationType extends Ab * * @return property used as the defining characteristic of the location type. * - * @see ReferenceSystemUsingIdentifiers#getTheme() + * @see ReferencingByIdentifiers#getTheme() */ @Override public InternationalString getTheme() {
svn commit: r1790557 - in /sis/branches/JDK8/core/sis-utility/src: main/java/org/apache/sis/util/collection/FrequencySortedSet.java test/java/org/apache/sis/util/collection/FrequencySortedSetTest.java
Author: desruisseaux Date: Fri Apr 7 14:08:15 2017 New Revision: 1790557 URL: http://svn.apache.org/viewvc?rev=1790557&view=rev Log: Complete FrequencySortedSet implementation. Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/collection/FrequencySortedSetTest.java Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java?rev=1790557&r1=1790556&r2=1790557&view=diff == --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java [UTF-8] Fri Apr 7 14:08:15 2017 @@ -31,9 +31,9 @@ import org.apache.sis.util.ArgumentCheck /** * A set with elements ordered by the amount of time they were {@linkplain #add added}. - * Less frequently added elements are first, and most frequently added ones are last. - * If some elements were added the same amount of time, then the iterator will traverse - * them in their insertion order. + * By default, less frequently added elements are first and most frequently added elements are last. + * If some elements were added the same amount of time, then the iterator will traverse them in their + * insertion order. * * An optional boolean argument in the constructor allows the construction of set in reversed order * (most frequently added elements first, less frequently added last). This is similar but not identical @@ -46,7 +46,7 @@ import org.apache.sis.util.ArgumentCheck * @author Martin Desruisseaux (Geomatys) * @version 0.8 * - * @param the type of elements in the set. + * @param the type of elements in the set. * * @since 0.8 * @module @@ -64,8 +64,19 @@ public class FrequencySortedSet exten private final Map count; /** - * {@code +1} if the element should be sorted in the usual order, or {@code -1} + * {@code 0} if the element should be sorted in the usual order, or {@code -1} * if the elements should be sorted in reverse order (most frequent element first). + * This value is XORed with the number of times n that an element is added: {@code n ^ order}. + * The intend is to store negative numbers in the {@link #count} map if this {@code FrequencySortedSet} + * has been created for reverse order. + * + * Implementation note: + * we could have used {@code +1} and {@code -1} for the usual and reverse order respectively, and store the + * multiplication result {@code n * order} in the {@link #count} map. We rather use XOR for two reasons: + * first, XOR is a simpler operation for the CPU than multiplication. Second, XOR guarantees us that all + * negative numbers can be made positive in {@link #frequencies()}, by applying again {@code n ^ order}. + * By contrast, the multiplication approach (or just the {@code -n} negation) would fail to convert + * {@link Integer#MIN_VALUE}. */ private final int order; @@ -84,17 +95,19 @@ public class FrequencySortedSet exten * Creates an initially empty set with less frequent elements first. */ public FrequencySortedSet() { -this(false); +count = new LinkedHashMap<>(); // Default constructor in JDK implementation applies lazy array allocation. +order = 0; } /** * Creates an initially empty set with the default initial capacity. * * @param reversed {@code true} if the elements should be sorted in reverse order - * (most frequent element first, less frequent last). + * (most frequent element first, less frequent element last). */ public FrequencySortedSet(final boolean reversed) { -this(16, reversed); +count = new LinkedHashMap<>(); +order = reversed ? -1 : 0; } /** @@ -102,11 +115,11 @@ public class FrequencySortedSet exten * * @param initialCapacity the initial capacity. * @param reversed {@code true} if the elements should be sorted in reverse order - * (most frequent element first, less frequent last). + * (most frequent element first, less frequent element last). */ public FrequencySortedSet(final int initialCapacity, final boolean reversed) { count = new LinkedHashMap<>(initialCapacity); -order = reversed ? -1 : +1; +order = reversed ? -1 : 0; } /** @@ -126,11 +139,11 @@ public class FrequencySortedSet exten } /** - *
[jira] [Created] (SIS-356) NetCDF reader should recognize Earth Observation metadata
Martin Desruisseaux created SIS-356: --- Summary: NetCDF reader should recognize Earth Observation metadata Key: SIS-356 URL: https://issues.apache.org/jira/browse/SIS-356 Project: Spatial Information Systems Issue Type: Task Components: Storage Affects Versions: 0.7 Reporter: Martin Desruisseaux Priority: Minor The European Space Agency (ESA) published an extension to CF-Convention for Earth Observation (EO) Metadata. This extension would fit nicely in SIS by completing the [AttributeNames|http://sis.apache.org/apidocs/org/apache/sis/storage/netcdf/AttributeNames.html] class, which defines the mapping from NetCDF attributes to ISO 19115 metadata. The process would be: * Get the [NetCDF Earth Observation (EO) Metadata Conventions|https://wiki.services.eoportal.org/tiki-download_wiki_attachment.php?attId=3271&download=y] document (version 1.1.0 published in 2014-03-11). Authors are from CNR - Institute of Atmospheric Pollution Research. * Inspect the NetCDF attributes listed in table and establish a relationship with an equivalent ISO 19115 attribute when possible. Not all attributes have equivalence; it is okay to leave attributes unmapped. * For each mapped attribute, add a constant in Apache SIS {{AttributeNames}} class. * Edit the {{MetadataReader}} class for using those new constants. * Add JUnit tests. -- This message was sent by Atlassian JIRA (v6.3.15#6346)