Author: desruisseaux Date: Sun Aug 20 15:45:33 2017 New Revision: 1805566 URL: http://svn.apache.org/viewvc?rev=1805566&view=rev Log: Merge from JDK8 branch.
Modified: sis/branches/JDK7/ (props changed) sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java sis/branches/JDK7/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java Propchange: sis/branches/JDK7/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Aug 20 15:45:33 2017 @@ -1,5 +1,5 @@ /sis/branches/Android:1430670-1480699 /sis/branches/JDK6:1394913-1508480 -/sis/branches/JDK8:1584960-1804426 +/sis/branches/JDK8:1584960-1804582 /sis/branches/JDK9:1773327-1803064 /sis/trunk:1394364-1508466,1519089-1519674 Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -146,6 +146,7 @@ public final strictfp class CoordinateRe rd("Deutsches Haupthoehennetz 1912", "Deutsches Haupthoehennetz"); rd("Deutsches Haupthoehennetz 1985", "Deutsches Haupthoehennetz"); rd("Deutsches Haupthoehennetz 1992", "Deutsches Haupthoehennetz"); + rd("Deutsches Haupthoehennetz 2016", "Deutsches Haupthoehennetz"); rd("Douala 1948", "Douala"); rd("Dunedin 1958", "Dunedin"); rd("Dunedin-Bluff 1960", "Dunedin"); @@ -162,6 +163,15 @@ public final strictfp class CoordinateRe rd("European Datum 1950(1977)", "European Datum"); rd("European Datum 1979", "European Datum"); rd("European Datum 1987", "European Datum"); + rd("European Terrestrial Reference Frame 1989", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1990", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1991", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1992", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1993", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1994", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1996", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 1997", "European Terrestrial Reference Frame"); + rd("European Terrestrial Reference Frame 2000", "European Terrestrial Reference Frame"); rd("European Vertical Reference Frame 2000", "European Vertical Reference Frame"); rd("European Vertical Reference Frame 2007", "European Vertical Reference Frame"); rd("Fahud Height Datum", "Fahud"); @@ -223,8 +233,11 @@ public final strictfp class CoordinateRe rd("International Terrestrial Reference Frame 2000", "International Terrestrial Reference Frame"); rd("International Terrestrial Reference Frame 2005", "International Terrestrial Reference Frame"); rd("International Terrestrial Reference Frame 2008", "International Terrestrial Reference Frame"); + rd("International Terrestrial Reference Frame 2014", "International Terrestrial Reference Frame"); rd("Islands Net 1993", "Islands Net"); rd("Islands Net 2004", "Islands Net"); + rd("Israeli Geodetic Datum 2005", "Israeli Geodetic Datum"); + rd("Israeli Geodetic Datum 2005(2012)", "Israeli Geodetic Datum"); rd("Jamaica 1875", "Jamaica"); rd("Jamaica 1969", "Jamaica"); rd("Jamaica 2001", "Jamaica"); @@ -297,16 +310,24 @@ public final strictfp class CoordinateRe rd("NAD83 (National Spatial Reference System 2011)", "North American Datum 1983 — National Spatial Reference System 2011"); rd("NAD83 (National Spatial Reference System MA11)", "North American Datum 1983 — National Spatial Reference System MA11 / PA11"); rd("NAD83 (National Spatial Reference System PA11)", "North American Datum 1983 — National Spatial Reference System MA11 / PA11"); + rd("New Zealand Vertical Datum 2009", "New Zealand Vertical Datum"); + rd("New Zealand Vertical Datum 2016", "New Zealand Vertical Datum"); rd("Norway Normal Null 1954", "Norway Normal Null"); rd("Norway Normal Null 2000", "Norway Normal Null"); + rd("Ordnance Datum Newlyn (Offshore)", "Ordnance Datum Newlyn"); rd("Ordnance Datum Newlyn (Orkney Isles)", "Ordnance Datum Newlyn"); rd("OSGB 1936", "OSGB"); rd("OSGB 1970 (SN)", "OSGB"); rd("Padang 1884 (Jakarta)", "Padang 1884"); + rd("Parametry Zemli 1990", "Parametry Zemli 1990"); + rd("Parametry Zemli 1990.02", "Parametry Zemli 1990"); + rd("Parametry Zemli 1990.11", "Parametry Zemli 1990"); rd("PDO Height Datum 1993", "PDO Survey / Height Datum 1993"); rd("PDO Survey Datum 1993", "PDO Survey / Height Datum 1993"); rd("Pitcairn 1967", "Pitcairn"); rd("Pitcairn 2006", "Pitcairn"); + rd("Port Moresby 1996", "Port Moresby"); + rd("Port Moresby 2008", "Port Moresby"); rd("Porto Santo 1936", "Porto Santo"); rd("Porto Santo 1995", "Porto Santo"); rd("Posiciones Geodésicas Argentinas 1994", "Posiciones Geodésicas Argentinas"); @@ -426,10 +447,10 @@ public final strictfp class CoordinateRe " tm", // "ETRS89 / TM35FIN(E,N)" — we want to not interleave them between "TM35" and "TM36". " dktm", // "ETRS89 / DKTM1 + DVR90 height" "-gk", // "ETRS89 / ETRS-GK19FIN" -// " philippines zone ", // "Luzon 1911 / Philippines zone IV" -// " california zone ", // "NAD27 / California zone V" -// " ngo zone ", // "NGO 1948 (Oslo) / NGO zone I" -// " lambert zone ", // "NTF (Paris) / Lambert zone II + NGF IGN69 height" + " philippines zone ", // "Luzon 1911 / Philippines zone IV" + " california zone ", // "NAD27 / California zone V" + " ngo zone ", // "NGO 1948 (Oslo) / NGO zone I" + " lambert zone ", // "NTF (Paris) / Lambert zone II + NGF IGN69 height" "fiji 1956 / utm zone " // Two zones: 60S and 1S with 60 before 1. }; @@ -462,7 +483,7 @@ public final strictfp class CoordinateRe properties.setProperty("PRODUCT.URL", "http://sis.apache.org"); properties.setProperty("JAVADOC.GEOAPI", "http://www.geoapi.org/snapshot/javadoc"); properties.setProperty("FACTORY.NAME", "EPSG"); - properties.setProperty("FACTORY.VERSION", "9.0"); + properties.setProperty("FACTORY.VERSION", "9.1"); properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources"); properties.setProperty("PRODUCT.VERSION.SUFFIX", " (provided that <a href=\"http://sis.apache.org/epsg.html\">a connection to an EPSG database exists</a>)"); properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n" + @@ -472,7 +493,7 @@ public final strictfp class CoordinateRe " <li>The <del>codes with a strike</del> (${PERCENT.DEPRECATED} of them) identify deprecated CRS." + " In some cases, the remarks column indicates the replacement.</li>\n" + "</ul>"); - factory = org.apache.sis.referencing.CRS.getAuthorityFactory(null); + factory = CRS.getAuthorityFactory(null); add(factory); } Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -26,7 +26,7 @@ import org.apache.sis.internal.jaxb.XmlU /** * JAXB adapter wrapping the date value (as milliseconds elapsed since January 1st, 1970) in a - * {@link XMLGregorianCalendar} for the {@code xsd:date} type. Hours, minutes and seconds are + * {@link XMLGregorianCalendar} for the {@code xs:date} type. Hours, minutes and seconds are * discarded. * * <p>Using this adapter is equivalent to apply the following annotation on a {@code Date} field:</p> @@ -81,7 +81,7 @@ public final class DateAdapter extends X final Context context = Context.current(); try { final XMLGregorianCalendar gc = XmlUtilities.toXML(context, value); - XmlUtilities.trimTime(gc, true); // Type is xsd:date without time. + XmlUtilities.trimTime(gc, true); // Type is xs:date without time. return gc; } catch (DatatypeConfigurationException e) { Context.warningOccured(context, XmlAdapter.class, "marshal", e, true); Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -58,7 +58,7 @@ import org.apache.sis.measure.Units; * <gml:semiMajorAxis uom="urn:ogc:def:uom:EPSG::9001">6378137</gml:semiMajorAxis> * } * - * Both have a value of type {@code xsd:double} and a {@code uom} attribute (without namespace) + * Both have a value of type {@code xs:double} and a {@code uom} attribute (without namespace) * of type {@code gml:UomIdentifier}. Those two informations are represented by this class. * * @author Cédric Briançon (Geomatys) Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -32,7 +32,7 @@ import static org.apache.sis.internal.ja /** * JAXB adapter wrapping the date value (as milliseconds elapsed since January 1st, 1970) in a - * {@link XMLGregorianCalendar} for the {@code xsd:dateTime} type with the timezone forced to UTC. + * {@link XMLGregorianCalendar} for the {@code xs:dateTime} type with the timezone forced to UTC. * The milliseconds are omitted if not different than zero. * * @author Martin Desruisseaux (Geomatys) Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -21,6 +21,7 @@ import java.util.Locale; import java.util.Objects; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.XmlRootElement; import org.opengis.util.InternationalString; import org.apache.sis.xml.XLink; @@ -36,11 +37,13 @@ import org.apache.sis.xml.XLink; * * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.3 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * @since 0.3 * @module */ @XmlType(name = "Anchor_Type") +@XmlRootElement(name = "Anchor") public final class Anchor extends XLink implements InternationalString { /** * Defined as a matter of principle (this class is not expected to be serialized). Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -46,14 +46,14 @@ public final class Utilities extends Sta * * <div class="section">Relationship with {@code gml:id}</div> * This method may be invoked for building {@code gml:id} values. Strictly speaking this is not appropriate - * since the {@code xsd:ID} type defines valid identifiers as containing only letters, digits, underscores, + * since the {@code xs:ID} type defines valid identifiers as containing only letters, digits, underscores, * hyphens, and periods. This differ from Unicode identifier in two ways: * * <ul> * <li>Unicode identifiers accept Japanese or Chinese ideograms for instance, which are considered as letters.</li> * <li>Unicode identifiers do not accept the {@code '-'} and {@code ':'} characters. However this restriction * fits well our need, since those characters are typical values for the {@code separator} argument.</li> - * <li>Note that {@code '_'} is valid both in {@code xsd:ID} and Unicode identifier.</li> + * <li>Note that {@code '_'} is valid both in {@code xs:ID} and Unicode identifier.</li> * </ul> * * @param appendTo the buffer where to append the valid characters. Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -46,7 +46,8 @@ import static org.apache.sis.util.collec * } * * @author Martin Desruisseaux (IRD, Geomatys) - * @version 0.4 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * @since 0.3 * @module */ @@ -275,11 +276,11 @@ filter: for (final Locale locale : local return unique(new Locale.Builder().setLanguageTag(code).build()); } /* - * Old syntax (e.g. "en_US"). Split in (language, country, variant) components, + * Old syntax (e.g. "en_US" or "eng; USA"). Split in (language, country, variant) components, * then convert the 3-letters codes to the 2-letters ones. */ String language, country = "", variant = ""; - if (p1 < 0) { + if (p1 < 0 && (p1 = code.indexOf(';', fromIndex)) < 0) { p1 = code.length(); } else { final int s = p1 + 1; Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -53,7 +53,8 @@ import org.apache.sis.internal.util.Abst * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * * @see DefaultRecordType * @see DefaultRecordSchema @@ -96,6 +97,59 @@ public class DefaultRecord implements Re } /** + * Creates a new record initialized to a shallow copy of the given record. + * The members contained in the given record are <strong>not</strong> recursively copied. + * + * @param record the record to copy (can not be null). + * + * @since 0.8 + */ + public DefaultRecord(final Record record) { + this(record.getRecordType()); + for (final Map.Entry<MemberName,Integer> entry : definition.memberIndices().entrySet()) { + final MemberName name = entry.getKey(); + final Object value = record.locate(name); + if (value != null) { + final int index = entry.getValue(); + final Class<?> valueClass = definition.getValueClass(index); + if (valueClass != null && !valueClass.isInstance(value)) { + throw new ClassCastException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3, + name, valueClass, value.getClass())); + } + Array.set(values, index, value); + } + } + } + + /** + * Returns a SIS implementation with the name and members of the given arbitrary implementation. + * This method performs the first applicable action in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of {@code DefaultRecord}, + * then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultRecord} instance is created using the + * {@linkplain #DefaultRecord(Record) copy constructor} and returned. + * Note that this is a shallow copy operation, since the members contained + * in the given object are not recursively copied.</li> + * </ul> + * + * @param other The object to get as a SIS implementation, or {@code null} if none. + * @return A SIS implementation containing the members of the given object + * (may be the given object itself), or {@code null} if the argument was {@code null}. + * + * @since 0.8 + */ + public static DefaultRecord castOrCopy(final Record other) { + if (other == null || other instanceof DefaultRecord) { + return (DefaultRecord) other; + } else { + return new DefaultRecord(other); + } + } + + /** * Returns the type definition of this record. * * @return the type definition of this record. Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -446,6 +446,7 @@ public class DefaultRecordType extends R /** * Empty constructor only used by JAXB. */ + @SuppressWarnings("unused") private DefaultRecordType() { typeName = null; container = null; Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -189,7 +189,7 @@ public final class Namespaces extends St private static final Map<String,String> SPECIFIC_URLS; static { final Map<String,String> p = new HashMap<>(40); - p.put(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd"); + p.put(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd"); // TODO: should be "xs". p.put(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi"); p.put("http://www.w3.org/2004/02/skos/core#", "skos"); p.put("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -30,7 +30,7 @@ import static org.junit.Assert.*; * Tests the {@link Locales} class. * * @author Martin Desruisseaux (Geomatys) - * @version 0.4 + * @version 0.8 * @since 0.3 * @module */ @@ -82,6 +82,7 @@ public final strictfp class LocalesTest assertSame(Locale.CANADA_FRENCH, Locales.parse("fr_CAN")); assertSame(Locale.CANADA_FRENCH, Locales.parse("fra_CAN")); assertSame(Locale.JAPAN, Locales.parse("ja_JP")); + assertSame(Locale.US, Locales.parse("en; USA")); assertEquals(new Locale("de", "DE"), Locales.parse("de_DE")); assertEquals(new Locale("", "GB"), Locales.parse("_GB")); Modified: sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] (original) +++ sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -16,6 +16,7 @@ */ package org.apache.sis.storage.gdal; +import java.util.Arrays; import java.util.Map; import java.util.Set; import java.util.HashMap; @@ -274,7 +275,7 @@ public class Proj4Factory extends Geodet /** * Returns the set of authority codes for objects of the given type. * Current implementation can not return complete Proj.4 definition strings. - * Instead, this method currently returns only fragments (e.g. {@code "+init="}). + * Instead, this method currently returns only fragments (e.g. {@code "+proj=lcc"}). * * @param type the spatial reference objects type. * @return fragments of definition strings for spatial reference objects of the given type. @@ -282,19 +283,21 @@ public class Proj4Factory extends Geodet */ @Override public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException { - final String method; - if (type.isAssignableFrom(ProjectedCRS.class)) { // Must be tested first. - method = ""; - } else if (type.isAssignableFrom(GeographicCRS.class)) { // Should be tested before GeocentricCRS. - method = "latlon"; - } else if (type.isAssignableFrom(GeocentricCRS.class)) { - method = "geocent"; - } else { - return Collections.emptySet(); + final Set<String> codes = new LinkedHashSet<>(10); + if (type.isAssignableFrom(GeographicCRS.class)) { + codes.add("latlon"); + } + if (type.isAssignableFrom(GeocentricCRS.class)) { + codes.add("geocent"); + } + if (type.isAssignableFrom(ProjectedCRS.class)) { + codes.addAll(Arrays.asList("lcc", "merc", "tmerc", "stere")); // Only a subset of supported projections. + } + final String[] methods = codes.toArray(new String[codes.size()]); + codes.clear(); + for (final String method : methods) { + codes.add(PROJ_PARAM.concat(method)); } - final Set<String> codes = new LinkedHashSet<>(4); - codes.add("+init="); - codes.add(PROJ_PARAM.concat(method)); return codes; } @@ -582,16 +585,22 @@ public class Proj4Factory extends Geodet private CoordinateReferenceSystem createCRS(final PJ pj, final boolean withHeight) throws FactoryException { final PJ.Type type = pj.getType(); final boolean geographic = PJ.Type.GEOGRAPHIC.equals(type); + final boolean geocentric = PJ.Type.GEOCENTRIC.equals(type); final Proj4Parser parser = new Proj4Parser(pj.getCode()); final String dir = parser.value("axis", "enu"); - final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[withHeight ? dir.length() : 2]; + final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[geocentric | withHeight ? dir.length() : 2]; for (int i=0; i<axes.length; i++) { final char d = Character.toLowerCase(dir.charAt(i)); char abbreviation = Character.toUpperCase(d); boolean vertical = false; final AxisDirection c; final String name; - switch (d) { + if (geocentric) switch (d) { + case 'e': c = AxisDirection.GEOCENTRIC_X; name = "Geocentric X"; break; + case 'n': c = AxisDirection.GEOCENTRIC_Y; name = "Geocentric Y"; break; + case 'u': c = AxisDirection.GEOCENTRIC_Z; name = "Geocentric Z"; break; + default: c = AxisDirection.OTHER; name = "Unknown"; break; + } else switch (d) { case 'e': c = AxisDirection.EAST; name = geographic ? "Geodetic longitude" : "Easting"; break; case 'w': c = AxisDirection.WEST; name = geographic ? "Geodetic longitude" : "Westing"; break; case 'n': c = AxisDirection.NORTH; name = geographic ? "Geodetic latitude" : "Northing"; break; Modified: sis/branches/JDK7/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java [UTF-8] (original) +++ sis/branches/JDK7/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -64,8 +64,10 @@ public final strictfp class Proj4Factory @Test public void testGetAuthorityCodes() throws FactoryException { final Proj4Factory factory = Proj4Factory.INSTANCE; - assertTrue(factory.getAuthorityCodes(GeographicCRS.class).containsAll(Arrays.asList("+init=", "+proj=latlon"))); - assertTrue(factory.getAuthorityCodes(CoordinateReferenceSystem.class).containsAll(Arrays.asList("+init=", "+proj="))); + assertTrue(factory.getAuthorityCodes(GeographicCRS.class).containsAll(Arrays.asList("+proj=latlon"))); + assertTrue(factory.getAuthorityCodes(ProjectedCRS.class).containsAll(Arrays.asList("+proj=merc", "+proj=lcc"))); + assertTrue(factory.getAuthorityCodes(CoordinateReferenceSystem.class).containsAll( + Arrays.asList("+proj=latlon", "+proj=merc", "+proj=lcc"))); } /** Modified: sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original) +++ sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -110,12 +110,24 @@ public final class Store extends DataSto static final char ORDINATE_SEPARATOR = ' '; /** - * The prefix for elements in the {@code @columns} line that specify the data type. + * The prefix for elements in the {@code @columns} line that specify the data type, + * as required by the OGC CSV encoding specification. * Examples: {@code xsd:boolean}, {@code xsd:decimal}, {@code xsd:integer}, <i>etc</i>. + * + * <p>Note that this prefix is slightly different than the {@code "xs:"} prefix used + * in {@code https://www.w3.org/2009/XMLSchema/XMLSchema.xsd} file. This data store + * implementation accepts both.</p> */ private static final String TYPE_PREFIX = "xsd:"; /** + * The prefix used in {@code https://www.w3.org/2009/XMLSchema/XMLSchema.xsd} file. + * This is not the same prefix than the one specified by OGC CSV encoding, but this + * implementation accepts both. + */ + private static final String XS_PREFIX = "xs:"; + + /** * The reader, set by the constructor and cleared when no longer needed. * * @see #readLine() @@ -472,8 +484,11 @@ public final class Store extends DataSto Class<?> type = null; if (++i < size) { String tn = elements.get(i); - if (!tn.isEmpty() && tn.regionMatches(true, 0, TYPE_PREFIX, 0, TYPE_PREFIX.length())) { - String st = tn.substring(TYPE_PREFIX.length()).toLowerCase(Locale.US); + int length; + if (tn.regionMatches(true, 0, TYPE_PREFIX, 0, length = TYPE_PREFIX.length()) || + tn.regionMatches(true, 0, XS_PREFIX, 0, length = XS_PREFIX.length())) + { + String st = tn.substring(length).toLowerCase(Locale.US); switch (st) { case "boolean": type = Boolean.class; break; case "decimal": type = Double .class; break; Modified: sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1805566&r1=1805565&r2=1805566&view=diff ============================================================================== --- sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original) +++ sis/branches/JDK7/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Sun Aug 20 15:45:33 2017 @@ -155,31 +155,31 @@ final class Types { parent = builder.build(); /* * WayPoint ⇾ GPXEntity - * ┌──────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├──────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Point │ (lat,lon) attributes │ [1 … 1] │ - * │ ele │ Double │ xsd:decimal │ [0 … 1] │ - * │ time │ Temporal │ xsd:dateTime │ [0 … 1] │ - * │ magvar │ Double │ gpx:degreesType │ [0 … 1] │ - * │ geoidheight │ Double │ xsd:decimal │ [0 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ sym │ String │ xsd:string │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ fix │ Fix │ gpx:fixType │ [0 … 1] │ - * │ sat │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ hdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ vdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ pdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ ageofdgpsdata │ Double │ xsd:decimal │ [0 … 1] │ - * │ dgpsid │ Integer │ gpx:dgpsStationType │ [0 … 1] │ - * └──────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌──────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├──────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Point │ (lat,lon) attributes │ [1 … 1] │ + * │ ele │ Double │ xs:decimal │ [0 … 1] │ + * │ time │ Temporal │ xs:dateTime │ [0 … 1] │ + * │ magvar │ Double │ gpx:degreesType │ [0 … 1] │ + * │ geoidheight │ Double │ xs:decimal │ [0 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ sym │ String │ xs:string │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ fix │ Fix │ gpx:fixType │ [0 … 1] │ + * │ sat │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ hdop │ Double │ xs:decimal │ [0 … 1] │ + * │ vdop │ Double │ xs:decimal │ [0 … 1] │ + * │ pdop │ Double │ xs:decimal │ [0 … 1] │ + * │ ageofdgpsdata │ Double │ xs:decimal │ [0 … 1] │ + * │ dgpsid │ Integer │ gpx:dgpsStationType │ [0 … 1] │ + * └──────────────────┴────────────────┴───────────────────────┴─────────────┘ */ builder.clear().setSuperTypes(parent).setNameSpace(Tags.PREFIX).setName("WayPoint"); builder.addAttribute(GeometryType.POINT).setName(geomName) @@ -207,21 +207,21 @@ final class Types { wayPoint = create(builder, resources); /* * Route ⇾ GPXEntity - * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Polyline │ │ [1 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ number │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ rtept │ WayPoint │ gpx:wptType │ [0 … ∞] │ - * └────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Polyline │ │ [1 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ number │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ rtept │ WayPoint │ gpx:wptType │ [0 … ∞] │ + * └────────────────┴────────────────┴───────────────────────┴─────────────┘ */ final AttributeType<?> groupResult = GroupAsPolylineOperation.getResult(geometries); GroupAsPolylineOperation groupOp = new GroupAsPolylineOperation(geomInfo, Tags.ROUTE_POINTS, groupResult); @@ -258,21 +258,21 @@ final class Types { trackSegment = create(builder, resources); /* * Track ⇾ GPXEntity - * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Polyline │ │ [1 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ number │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ trkseg │ TrackSegment │ gpx:trksegType │ [0 … ∞] │ - * └────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Polyline │ │ [1 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ number │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ trkseg │ TrackSegment │ gpx:trksegType │ [0 … ∞] │ + * └────────────────┴────────────────┴───────────────────────┴─────────────┘ */ groupOp = new GroupAsPolylineOperation(geomInfo, Tags.TRACK_SEGMENTS, groupResult); builder.clear().setSuperTypes(parent).setNameSpace(Tags.PREFIX).setName("Track");