sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1768401 [2/2] - in /sis/branches/JDK8/storage/sis-xmlstore/src: main/java/org/apache/sis/internal/gpx/ test/java/org/apache/sis/internal/gpx/
Date Sun, 06 Nov 2016 23:04:42 GMT
Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Metadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Metadata.java?rev=1768401&r1=1768400&r2=1768401&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Metadata.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Metadata.java [UTF-8] Sun Nov  6 23:04:42 2016
@@ -25,30 +25,25 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
-import java.util.logging.Level;
 import javax.xml.bind.annotation.XmlElement;
 
-import org.opengis.geometry.Envelope;
-import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.CitationDate;
 import org.opengis.metadata.citation.DateType;
 import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.citation.Responsibility;
 import org.opengis.metadata.constraint.Constraints;
 import org.opengis.metadata.extent.Extent;
+import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.metadata.identification.Keywords;
-import org.opengis.referencing.operation.TransformException;
 import org.opengis.util.InternationalString;
 
 import org.apache.sis.internal.simple.SimpleMetadata;
 import org.apache.sis.io.TableAppender;
-import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
 import org.apache.sis.metadata.iso.citation.DefaultOnlineResource;
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.identification.DefaultKeywords;
 import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.util.logging.Logging;
 
 
 /**
@@ -125,9 +120,10 @@ public final class Metadata extends Simp
 
     /**
      * Minimum and maximum coordinates which describe the extent of the coordinates in the file.
+     * The GPX 1.1 specification restricts the coordinate reference system to WGS84.
      */
     @XmlElement
-    public Envelope bounds;
+    public GeographicBoundingBox bounds;
 
     /**
      * Creates an initially empty metadata object.
@@ -135,64 +131,102 @@ public final class Metadata extends Simp
     public Metadata() {
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #name} field.
+     * This is part of the information returned by {@link #getCitation()}.
+     *
+     * @return the cited resource name.
+     */
     @Override
-    public Collection<Identifier> getIdentifiers() {
-        if (name != null) {
-            return Collections.singleton(new DefaultIdentifier(name));
-        }
-        return super.getIdentifiers();
+    public InternationalString getTitle() {
+        return (name != null) ? new SimpleInternationalString(name) : super.getTitle();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #description} field.
+     * This is part of the information returned by {@link #getIdentificationInfo()}.
+     *
+     * @return brief narrative summary of the resource.
+     */
     @Override
     public InternationalString getAbstract() {
-        if (description != null) {
-            return new SimpleInternationalString(description);
-        }
-        return super.getAbstract();
+        return (description != null) ? new SimpleInternationalString(description) : super.getAbstract();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #keywords} field.
+     * This is part of the information returned by {@link #getIdentificationInfo()}.
+     *
+     * @return category keywords, their type, and reference source.
+     */
     @Override
     public Collection<Keywords> getDescriptiveKeywords() {
-        if (keywords != null) {
-            return Collections.singleton(new DefaultKeywords(keywords));
-        }
-        return null;
+        return (keywords != null) ? Collections.singleton(new DefaultKeywords(keywords)) : super.getDescriptiveKeywords();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #author} field.
+     * This is part of the information returned by {@link #getIdentificationInfo()}.
+     *
+     * @return means of communication with person(s) and organisations(s) associated with the resource.
+     */
     @Override
     public Collection<Responsibility> getPointOfContacts() {
-        if (author != null) {
-            return Collections.singletonList(author);
-        }
-        return super.getPointOfContacts();
+        return (author != null) ? Collections.singletonList(author) : super.getPointOfContacts();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #copyright} field.
+     * This is part of the information returned by {@link #getIdentificationInfo()}.
+     *
+     * @return constraints which apply to the resource(s).
+     */
     @Override
     public Collection<Constraints> getResourceConstraints() {
-        if (copyright != null) {
-            return Collections.singleton(copyright);
-        }
-        return super.getResourceConstraints();
+        return (copyright != null) ? Collections.singleton(copyright) : super.getResourceConstraints();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #bounds} field.
+     * This is part of the information returned by {@link #getIdentificationInfo()}.
+     *
+     * @return spatial and temporal extent of the resource.
+     */
     @Override
     public Collection<Extent> getExtents() {
         if (bounds != null) {
-            final DefaultExtent ext = new DefaultExtent();
-            try {
-                ext.addElements(bounds);
-            } catch (TransformException ex) {
-                Logging.getLogger("oeg.apache.storage").log(Level.WARNING, ex.getMessage(),ex);
-            }
-            return Collections.singleton(ext);
+            return Collections.singleton(new DefaultExtent(null, bounds, null, null));
+        } else {
+            return super.getExtents();
+        }
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #time} field.
+     * This is part of the information returned by {@link #getCitation()}.
+     *
+     * @return reference dates for the cited resource.
+     */
+    @Override
+    public Collection<CitationDate> getDates() {
+        if (time != null) {
+            final CitationDate date = new DefaultCitationDate(Date.from(Instant.from(time)), DateType.CREATION);
+            return Collections.singleton(date);
         }
-        return super.getExtents();
+        return super.getDates();
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #bounds} field.
+     * This is part of the information returned by {@link #getCitation()}.
+     *
+     * @return online references to the cited resource.
+     */
     @Override
     public Collection<OnlineResource> getOnlineResources() {
-        if (!links.isEmpty()) {
-            final List<OnlineResource> resources = new ArrayList<>();
+        final int size = links.size();
+        if (size != 0) {
+            final List<OnlineResource> resources = new ArrayList<>(size);
             for (URI uri : links) {
                 resources.add(new DefaultOnlineResource(uri));
             }
@@ -201,15 +235,6 @@ public final class Metadata extends Simp
         return super.getOnlineResources();
     }
 
-    @Override
-    public Collection<CitationDate> getDates() {
-        if (time != null) {
-            final CitationDate date = new DefaultCitationDate(Date.from(Instant.from(time)), DateType.CREATION);
-            return Collections.singleton(date);
-        }
-        return super.getDates();
-    }
-
     /**
      * Compares this {@code Metadata} with the given object for equality.
      *

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java?rev=1768401&r1=1768400&r2=1768401&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java [UTF-8] Sun Nov  6 23:04:42 2016
@@ -20,7 +20,6 @@ import java.net.URI;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Objects;
-import java.util.Set;
 import org.apache.sis.metadata.iso.citation.DefaultOnlineResource;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.opengis.metadata.citation.Address;
@@ -58,7 +57,7 @@ import org.opengis.util.InternationalStr
  * @version 0.8
  * @module
  */
-public final class Person implements Responsibility, Party, Contact, Address {
+public final class Person extends Element implements Responsibility, Party, Contact, Address {
     /**
      * Name of person or organization.
      *
@@ -322,16 +321,6 @@ public final class Person implements Res
     }
 
     /**
-     * Returns the given object as a singleton if the given condition is {@code true},
-     * or an empty set if the given condition is {@code false}.
-     *
-     * @param  obj  the object (usually {@code this}) to return in a singleton if the condition is true.
-     */
-    private static <T> Set<T> thisOrEmpty(final T obj, final boolean condition) {
-        return condition ? Collections.singleton(obj) : Collections.emptySet();
-    }
-
-    /**
      * Compares this {@code Person} with the given object for equality.
      *
      * @param  obj  the object to compare with this {@code Person}.

Copied: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Types.java (from r1768314, sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Types.java?p2=sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Types.java&p1=sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java&r1=1768314&r2=1768401&rev=1768401&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Types.java [UTF-8] Sun Nov  6 23:04:42 2016
@@ -17,13 +17,15 @@
 package org.apache.sis.internal.gpx;
 
 import java.net.URI;
-import java.time.temporal.Temporal;
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Map;
+import java.time.temporal.Temporal;
 import com.esri.core.geometry.Point;
 import org.opengis.util.LocalName;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
+import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.feature.AbstractIdentifiedType;
 import org.apache.sis.feature.DefaultAttributeType;
 import org.apache.sis.feature.DefaultFeatureType;
@@ -33,9 +35,10 @@ import org.apache.sis.feature.builder.Fe
 import org.apache.sis.feature.builder.AttributeRole;
 import org.apache.sis.internal.feature.AttributeConvention;
 import org.apache.sis.internal.system.DefaultFactories;
-import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.util.iso.DefaultNameFactory;
 import org.apache.sis.util.Static;
-import org.apache.sis.util.iso.Names;
+
+import static org.apache.sis.internal.gpx.GPXConstants.*;
 
 // Branch-dependent imports
 import org.opengis.feature.FeatureType;
@@ -43,230 +46,108 @@ import org.opengis.feature.PropertyType;
 
 
 /**
- * GPX XML tags and feature types.
+ * Feature types that may appear in GPX files. All values defined in this class are immutable and can be shared
+ * by many {@link GPXReader} instances. There is usually only one {@code Types} instance for a running JVM, but
+ * we nevertheless allows definition of alternative {@code Types} with names created by different factories.
  *
- * @author Johann Sorel (Geomatys)
- * @since   0.7
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.8
  * @version 0.8
  * @module
  */
-public final class GPXConstants extends Static {
-    /*
-     * Main GPX xml tag.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_GPX = "gpx";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_GPX_VERSION = "version";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_GPX_CREATOR = "creator";
-
-    /**
-     * Attributes used a bit everywhere.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_NAME = "name";
-    /** used in version : 1.0 */
-    public static final String TAG_URL = "url";
-    /** used in version : 1.0 */
-    public static final String TAG_URLNAME = "urlname";
-    /** used in version : 1.1 */
-    public static final String TAG_LINK = "link";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_DESC = "desc";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_CMT = "cmt";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_SRC = "src";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_TYPE = "type";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_NUMBER = "number";
-
-    /*
-     * Metadata tag.
-     */
-    /** used in version : 1.1 */
-    public static final String TAG_METADATA = "metadata";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_METADATA_TIME = "time";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_METADATA_KEYWORDS = "keywords";
-
-    /*
-     * Person tag.
-     */
-    /** used in version : 1.0(as attribut) and 1.1(as tag) */
-    public static final String TAG_AUTHOR = "author";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_AUTHOR_EMAIL = "email";
-
-    /*
-     * Copyright tag.
-     */
-    /** used in version : 1.1 */
-    public static final String TAG_COPYRIGHT = "copyright";
-    /** used in version : 1.1 */
-    public static final String TAG_COPYRIGHT_YEAR = "year";
-    /** used in version : 1.1 */
-    public static final String TAG_COPYRIGHT_LICENSE = "license";
-    /** used in version : 1.1 */
-    public static final String ATT_COPYRIGHT_AUTHOR = "author";
-
-    /*
-     * Bounds tag.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_BOUNDS = "bounds";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_BOUNDS_MINLAT = "minlat";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_BOUNDS_MINLON = "minlon";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_BOUNDS_MAXLAT = "maxlat";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_BOUNDS_MAXLON = "maxlon";
-
-    /*
-     * Link tag.
-     */
-    /** used in version : 1.1 */
-    public static final String TAG_LINK_TEXT = "text";
-    /** used in version : 1.1 */
-    public static final String TAG_LINK_TYPE = "type";
-    /** used in version : 1.1 */
-    public static final String ATT_LINK_HREF = "href";
-
-    /*
-     * WPT tag.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT = "wpt";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_WPT_LAT = "lat";
-    /** used in version : 1.0 and 1.1 */
-    public static final String ATT_WPT_LON = "lon";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_ELE = "ele";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_TIME = "time";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_MAGVAR = "magvar";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_GEOIHEIGHT = "geoidheight";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_SYM = "sym";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_FIX = "fix";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_SAT = "sat";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_HDOP = "hdop";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_VDOP = "vdop";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_PDOP = "pdop";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_AGEOFGPSDATA = "ageofdgpsdata";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_WPT_DGPSID = "dgpsid";
-
-    /*
-     * RTE tag.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_RTE = "rte";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_RTE_RTEPT = "rtept";
-
-    /*
-     * TRK tag.
-     */
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_TRK = "trk";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_TRK_SEG = "trkseg";
-    /** used in version : 1.0 and 1.1 */
-    public static final String TAG_TRK_SEG_PT = "trkpt";
-
-    /**
-     * GPX scope name used for feature type names.
-     */
-    public static final String GPX_NAMESPACE = "http://www.topografix.com";
-
-    /**
-     * GPX 1.1 xml namespace
-     */
-    public static final String GPX_NAMESPACE_V11 = "http://www.topografix.com/GPX/1/1";
-    /**
-     * GPX 1.0 xml namespace
-     */
-    public static final String GPX_NAMESPACE_V10 = "http://www.topografix.com/GPX/1/0";
-
-    /**
-     * Parent feature type of all gpx types.
-     */
-    public static final FeatureType TYPE_GPX_ENTITY;
-
+final class Types extends Static {
     /**
      * Waypoint GPX feature type.
      */
-    public static final FeatureType TYPE_WAYPOINT;
+    final FeatureType wayPoint;
 
     /**
      * Track GPX feature type.
      */
-    public static final FeatureType TYPE_TRACK;
+    final FeatureType track;
 
     /**
      * Route GPX feature type.
      */
-    public static final FeatureType TYPE_ROUTE;
+    final FeatureType route;
 
     /**
      * Track segment GPX feature type.
      */
-    public static final FeatureType TYPE_TRACK_SEGMENT;
+    final FeatureType trackSegment;
 
+    /**
+     * A system-wide instance for {@code FeatureType} instances created using the {@link DefaultNameFactory}.
+     * This is normally the only instance used in an application.
+     */
+    static final Types DEFAULT;
     static {
-        final NameFactory   factory  = DefaultFactories.forBuildin(NameFactory.class);
-        final LocalName     geomName = Names.createTypeName(null, null, "geometry");
-        final Map<String,?> geomInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, geomName);
+        try {
+            DEFAULT = new Types(DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class), null);
+        } catch (FactoryException e) {
+            throw new AssertionError(e);    // Should never happen with DefaultNameFactory implementation.
+        }
+    }
 
-        //-------------------- GENERIC GPX ENTITY ------------------------------
-        FeatureTypeBuilder builder = new FeatureTypeBuilder(null, factory, null);
+    /**
+     * Creates new {@code FeatureTypes} with feature names and property names created using the given factory.
+     *
+     * @param  factory   the factory to use for creating names, or {@code null} for the default factory.
+     * @param  locale    the locale to use for formatting error messages, or {@code null} for the default locale.
+     * @throws FactoryException if an error occurred while creating an "envelope bounds" operation.
+     */
+    Types(final NameFactory factory, final Locale locale) throws FactoryException {
+        final LocalName     geomName = AttributeConvention.GEOMETRY_PROPERTY;
+        final Map<String,?> geomInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, geomName);
+        final Map<String,?> envpInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, AttributeConvention.ENVELOPE_PROPERTY);
+        /*
+         * The parent of all FeatureTypes to be created in this constructor.
+         * This parent has a single property, "@identifier" of type Integer,
+         * which is not part of GPX specification.
+         *
+         * http://www.topografix.com:GPXEntity
+         * ┌─────────────┬─────────┬─────────────┐
+         * │ Name        │ Type    │ Cardinality │
+         * ├─────────────┼─────────┼─────────────┤
+         * │ @identifier │ Integer │   [1 … 1]   │      SIS-specific property
+         * └─────────────┴─────────┴─────────────┘
+         */
+        FeatureTypeBuilder builder = new FeatureTypeBuilder(null, factory, locale);
         builder.setDefaultScope(GPX_NAMESPACE).setName("GPXEntity").setAbstract(true);
-        builder.addAttribute(Integer.class).setName("index").addRole(AttributeRole.IDENTIFIER_COMPONENT);
-        TYPE_GPX_ENTITY = builder.build();
-
-        //------------------- WAY POINT TYPE -----------------------------------
+        builder.addAttribute(Integer.class).setName(AttributeConvention.IDENTIFIER_PROPERTY);
+        final FeatureType parent = builder.build();
         /*
-         * lat="latitudeType [1] ?"
-         * lon="longitudeType [1] ?">
-         * <ele> xsd:decimal </ele> [0..1] ?
-         * <time> xsd:dateTime </time> [0..1] ?
-         * <magvar> degreesType </magvar> [0..1] ?
-         * <geoidheight> xsd:decimal </geoidheight> [0..1] ?
-         * <name> xsd:string </name> [0..1] ?
-         * <cmt> xsd:string </cmt> [0..1] ?
-         * <desc> xsd:string </desc> [0..1] ?
-         * <src> xsd:string </src> [0..1] ?
-         * <link> linkType </link> [0..*] ?
-         * <sym> xsd:string </sym> [0..1] ?
-         * <type> xsd:string </type> [0..1] ?
-         * <fix> fixType </fix> [0..1] ?
-         * <sat> xsd:nonNegativeInteger </sat> [0..1] ?
-         * <hdop> xsd:decimal </hdop> [0..1] ?
-         * <vdop> xsd:decimal </vdop> [0..1] ?
-         * <pdop> xsd:decimal </pdop> [0..1] ?
-         * <ageofdgpsdata> xsd:decimal </ageofdgpsdata> [0..1] ?
-         * <dgpsid> dgpsStationType </dgpsid> [0..1] ?
-         * <extensions> extensionsType </extensions> [0..1] ?
+         * http://www.topografix.com:WayPoint ⇾ GPXEntity
+         * ┌───────────────┬──────────┬────────────────────────┬─────────────┐
+         * │ Name          │ Type     │ XML type               │ Cardinality │
+         * ├───────────────┼──────────┼────────────────────────┼─────────────┤
+         * │ @identifier   │ Integer  │                        │   [1 … 1]   │
+         * │ @envelope     │ Envelope │                        │   [1 … 1]   │
+         * │ @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          │ URI      │ gpx:linkType           │   [0 … ∞]   │
+         * │ sym           │ String   │ xsd:string             │   [0 … 1]   │
+         * │ type          │ String   │ xsd:string             │   [0 … 1]   │
+         * │ fix           │ String   │ 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]   │
+         * └───────────────┴──────────┴────────────────────────┴─────────────┘
          */
-        builder = new FeatureTypeBuilder(null, factory, null);
-        builder.setDefaultScope(GPX_NAMESPACE).setName("WayPoint").setSuperTypes(TYPE_GPX_ENTITY);
+        builder = new FeatureTypeBuilder(null, factory, locale);
+        builder.setDefaultScope(GPX_NAMESPACE).setName("WayPoint").setSuperTypes(parent);
         builder.addAttribute(Point.class).setName(geomName)
-                .setCRS(CommonCRS.defaultGeographic())
+                .setCRS(CommonCRS.WGS84.normalizedGeographic())
                 .addRole(AttributeRole.DEFAULT_GEOMETRY);
         builder.setDefaultCardinality(0, 1);
         builder.addAttribute(Double  .class).setName(TAG_WPT_ELE);
@@ -287,109 +168,102 @@ public final class GPXConstants extends
         builder.addAttribute(Double  .class).setName(TAG_WPT_PDOP);
         builder.addAttribute(Double  .class).setName(TAG_WPT_AGEOFGPSDATA);
         builder.addAttribute(Integer .class).setName(TAG_WPT_DGPSID);
-        TYPE_WAYPOINT = builder.build();
-
-        //------------------- ROUTE TYPE ---------------------------------------
+        wayPoint = builder.build();
         /*
-         * <name> xsd:string </name> [0..1] ?
-         * <cmt> xsd:string </cmt> [0..1] ?
-         * <desc> xsd:string </desc> [0..1] ?
-         * <src> xsd:string </src> [0..1] ?
-         * <link> linkType </link> [0..*] ?
-         * <number> xsd:nonNegativeInteger </number> [0..1] ?
-         * <type> xsd:string </type> [0..1] ?
-         * <extensions> extensionsType </extensions> [0..1] ?
-         * <rtept> wptType </rtept> [0..*] ?
+         * http://www.topografix.com:Route ⇾ GPXEntity
+         * ┌─────────────┬──────────┬────────────────────────┬─────────────┐
+         * │ Name        │ Type     │ XML type               │ Cardinality │
+         * ├─────────────┼──────────┼────────────────────────┼─────────────┤
+         * │ @identifier │ Integer  │                        │   [1 … 1]   │
+         * │ @envelope   │ Envelope │                        │   [1 … 1]   │
+         * │ @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        │ URI      │ gpx:linkType           │   [0 … ∞]   │
+         * │ number      │ Integer  │ xsd:nonNegativeInteger │   [0 … 1]   │
+         * │ type        │ String   │ xsd:string             │   [0 … 1]   │
+         * │ rtept       │ WayPoint │ gpx:wptType            │   [0 … ∞]   │
+         * └─────────────┴──────────┴────────────────────────┴─────────────┘
          */
         final DefaultAssociationRole attWayPoints = new DefaultAssociationRole(
-                identification(factory, TAG_RTE_RTEPT), TYPE_WAYPOINT, 0, Integer.MAX_VALUE);
+                identification(factory, TAG_RTE_RTEPT), wayPoint, 0, Integer.MAX_VALUE);
         PropertyType[] properties = {
-                TYPE_WAYPOINT.getProperty(TAG_NAME),
-                TYPE_WAYPOINT.getProperty(TAG_CMT),
-                TYPE_WAYPOINT.getProperty(TAG_DESC),
-                TYPE_WAYPOINT.getProperty(TAG_SRC),
-                TYPE_WAYPOINT.getProperty(TAG_LINK),
+                wayPoint.getProperty(TAG_NAME),
+                wayPoint.getProperty(TAG_CMT),
+                wayPoint.getProperty(TAG_DESC),
+                wayPoint.getProperty(TAG_SRC),
+                wayPoint.getProperty(TAG_LINK),
                 new DefaultAttributeType<>(identification(factory, TAG_NUMBER), Integer.class, 0, 1, null),
-                TYPE_WAYPOINT.getProperty(TAG_TYPE),
+                wayPoint.getProperty(TAG_TYPE),
                 attWayPoints,
-                new GroupPointsAsPolylineOperation(geomInfo, attWayPoints.getName(), geomName),
+                new GroupPointsAsPolylineOperation(geomInfo, TAG_RTE_RTEPT, geomName.toString()),
                 null
         };
-        final Map<String,?> envelopeInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, AttributeConvention.ENVELOPE_PROPERTY);
-        try {
-            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
-        } catch (FactoryException e) {
-            throw new IllegalStateException(e);
-        }
-        TYPE_ROUTE = new DefaultFeatureType(identification(factory, "Route"), false,
-                new FeatureType[] {TYPE_GPX_ENTITY}, properties);
-
-
-        //------------------- TRACK SEGMENT TYPE -------------------------------
+        properties[properties.length - 1] = FeatureOperations.envelope(envpInfo, null, properties);
+        route = new DefaultFeatureType(identification(factory, "Route"), false,
+                new FeatureType[] {parent}, properties);
         /*
-         * <trkpt> wptType </trkpt> [0..*] ?
-         * <extensions> extensionsType </extensions> [0..1] ?
+         * http://www.topografix.com:TrackSegment ⇾ GPXEntity
+         * ┌─────────────┬──────────┬─────────────┬─────────────┐
+         * │ Name        │ Type     │ XML type    │ Cardinality │
+         * ├─────────────┼──────────┼─────────────┼─────────────┤
+         * │ @identifier │ Integer  │             │   [1 … 1]   │
+         * │ @envelope   │ Envelope │             │   [1 … 1]   │
+         * │ @geometry   │ Polyline │             │   [1 … 1]   │
+         * │ trkpt       │ WayPoint │ gpx:wptType │   [0 … ∞]   │
+         * └─────────────┴──────────┴─────────────┴─────────────┘
          */
         final DefaultAssociationRole attTrackPoints = new DefaultAssociationRole(
-                identification(factory, TAG_TRK_SEG_PT), TYPE_WAYPOINT, 0, Integer.MAX_VALUE);
+                identification(factory, TAG_TRK_SEG_PT), wayPoint, 0, Integer.MAX_VALUE);
         properties = new PropertyType[] {
                 attTrackPoints,
-                new GroupPointsAsPolylineOperation(geomInfo, attTrackPoints.getName(), geomName),
+                new GroupPointsAsPolylineOperation(geomInfo, TAG_TRK_SEG_PT, geomName.toString()),
                 null
         };
-        try {
-            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
-        } catch (FactoryException e) {
-            throw new IllegalStateException(e);
-        }
-        TYPE_TRACK_SEGMENT = new DefaultFeatureType(identification(factory, "TrackSegment"), false,
-                new FeatureType[] {TYPE_GPX_ENTITY}, properties
-        );
-
-        //------------------- TRACK TYPE ---------------------------------------
+        properties[properties.length - 1] = FeatureOperations.envelope(envpInfo, null, properties);
+        trackSegment = new DefaultFeatureType(identification(factory, "TrackSegment"), false,
+                new FeatureType[] {parent}, properties);
         /*
-         * <name> xsd:string </name> [0..1] ?
-         * <cmt> xsd:string </cmt> [0..1] ?
-         * <desc> xsd:string </desc> [0..1] ?
-         * <src> xsd:string </src> [0..1] ?
-         * <link> linkType </link> [0..*] ?
-         * <number> xsd:nonNegativeInteger </number> [0..1] ?
-         * <type> xsd:string </type> [0..1] ?
-         * <extensions> extensionsType </extensions> [0..1] ?
-         * <trkseg> trksegType </trkseg> [0..*] ?
+         * http://www.topografix.com:Track ⇾ GPXEntity
+         * ┌─────────────┬──────────────┬────────────────────────┬─────────────┐
+         * │ Name        │ Type         │ XML type               │ Cardinality │
+         * ├─────────────┼──────────────┼────────────────────────┼─────────────┤
+         * │ @identifier │ Integer      │                        │   [1 … 1]   │
+         * │ @envelope   │ Envelope     │                        │   [1 … 1]   │
+         * │ @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        │ URI          │ gpx:linkType           │   [0 … ∞]   │
+         * │ number      │ Integer      │ xsd:nonNegativeInteger │   [0 … 1]   │
+         * │ type        │ String       │ xsd:string             │   [0 … 1]   │
+         * │ trkseg      │ TrackSegment │ gpx:trksegType         │   [0 … ∞]   │
+         * └─────────────┴──────────────┴────────────────────────┴─────────────┘
          */
         final DefaultAssociationRole attTrackSegments = new DefaultAssociationRole(
-                identification(factory, TAG_TRK_SEG), TYPE_TRACK_SEGMENT, 0, Integer.MAX_VALUE);
+                identification(factory, TAG_TRK_SEG), trackSegment, 0, Integer.MAX_VALUE);
         properties = new PropertyType[] {
-                TYPE_ROUTE.getProperty(TAG_NAME),
-                TYPE_ROUTE.getProperty(TAG_CMT),
-                TYPE_ROUTE.getProperty(TAG_DESC),
-                TYPE_ROUTE.getProperty(TAG_SRC),
-                TYPE_ROUTE.getProperty(TAG_LINK),
-                TYPE_ROUTE.getProperty(TAG_NUMBER),
-                TYPE_ROUTE.getProperty(TAG_TYPE),
+                route.getProperty(TAG_NAME),
+                route.getProperty(TAG_CMT),
+                route.getProperty(TAG_DESC),
+                route.getProperty(TAG_SRC),
+                route.getProperty(TAG_LINK),
+                route.getProperty(TAG_NUMBER),
+                route.getProperty(TAG_TYPE),
                 attTrackSegments,
-                new GroupPolylinesOperation(geomInfo, attTrackSegments.getName(), geomName),
+                new GroupPolylinesOperation(geomInfo, TAG_TRK_SEG, geomName.toString()),
                 null
         };
-        try {
-            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
-        } catch (FactoryException e) {
-            throw new IllegalStateException(e);
-        }
-        TYPE_TRACK = new DefaultFeatureType(identification(factory, "Track"), false,
-                new FeatureType[] {TYPE_GPX_ENTITY}, properties
-        );
+        properties[properties.length - 1] = FeatureOperations.envelope(envpInfo, null, properties);
+        track = new DefaultFeatureType(identification(factory, "Track"), false,
+                new FeatureType[] {parent}, properties);
     }
 
     private static Map<String,?> identification(final NameFactory factory, final String localPart) {
         return Collections.singletonMap(AbstractIdentifiedType.NAME_KEY,
                 factory.createGenericName(null, GPX_NAMESPACE, localPart));
     }
-
-    /**
-     * Do not allow instantiation of this class.
-     */
-    private GPXConstants() {
-    }
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java?rev=1768401&r1=1768400&r2=1768401&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java [UTF-8] Sun Nov  6 23:04:42 2016
@@ -24,11 +24,10 @@ import java.io.IOException;
 import javax.xml.stream.XMLStreamException;
 import com.esri.core.geometry.Point;
 import org.opengis.geometry.Envelope;
-import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.geometry.ImmutableEnvelope;
-import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -38,7 +37,6 @@ import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
-import org.apache.sis.test.TestCase;
 import org.opengis.feature.Feature;
 
 
@@ -74,7 +72,7 @@ public class GPXReaderTest extends TestC
             assertEquals("sample gpx test file", data.description);
             assertEquals(parseTime("2010-03-01"), data.time);
             assertEquals("sample,metadata", data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
 
             assertEquals("Jean-Pierre", data.author.name);
             assertEquals("jean.pierre@test.com", data.author.email);
@@ -101,7 +99,7 @@ public class GPXReaderTest extends TestC
             assertEquals("sample gpx test file", data.description);
             assertEquals(parseTime("2010-03-01"), data.time);
             assertEquals("sample,metadata", data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
 
             assertEquals("Jean-Pierre", data.author.name);
             assertEquals("jean.pierre@test.com", data.author.email);
@@ -133,7 +131,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -162,7 +160,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -192,7 +190,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -257,7 +255,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -324,7 +322,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -394,7 +392,7 @@ public class GPXReaderTest extends TestC
             assertNull(data.description);
             assertNull(data.time);
             assertNull(data.keywords);
-            assertEquals(createEnvelope(-20, 30, 10, 40), data.bounds);
+            assertEquals(new DefaultGeographicBoundingBox(-20, 30, 10, 40), data.bounds);
             assertNull(data.author);
             assertNull(data.copyright);
             assertEquals(0, data.links.size());
@@ -455,7 +453,7 @@ public class GPXReaderTest extends TestC
 
     private void checkPoint(final Feature f, final int num, final boolean v11) throws Exception {
         if (num == 0) {
-            assertEquals(0,                     f.getPropertyValue("index"));
+            assertEquals(0,                     f.getPropertyValue("@identifier"));
             assertEquals(15.0,                  ((Point)f.getPropertyValue("@geometry")).getX(), DELTA);
             assertEquals(10.0,                  ((Point)f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(140.0,                 f.getPropertyValue("ele"));
@@ -494,7 +492,7 @@ public class GPXReaderTest extends TestC
             assertEquals(bbox.getMaximum(1), 10.0d, DELTA);
 
         } else if (num == 1) {
-            assertEquals(1,                     f.getPropertyValue("index"));
+            assertEquals(1,                     f.getPropertyValue("@identifier"));
             assertEquals(25.0,                  ((Point)f.getPropertyValue("@geometry")).getX(), DELTA);
             assertEquals(20.0,                  ((Point)f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(null,                  f.getPropertyValue("ele"));
@@ -525,7 +523,7 @@ public class GPXReaderTest extends TestC
             assertEquals(bbox.getMaximum(1), 20.0d, DELTA);
 
         } else if (num == 2) {
-            assertEquals(2,                     f.getPropertyValue("index"));
+            assertEquals(2,                     f.getPropertyValue("@identifier"));
             assertEquals(35.0,                  ((Point) f.getPropertyValue("@geometry")).getX(), DELTA);
             assertEquals(30.0,                  ((Point) f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(150.0,                 f.getPropertyValue("ele"));
@@ -573,11 +571,4 @@ public class GPXReaderTest extends TestC
         final LocalDate localDate = LocalDate.from(accessor);
         return localDate;
     }
-
-    private static Envelope createEnvelope(double d0, double d1, double d2, double d3) {
-        final GeneralEnvelope envelope = new GeneralEnvelope(CommonCRS.WGS84.normalizedGeographic());
-        envelope.setRange(0, d0, d1);
-        envelope.setRange(1, d2, d3);
-        return new ImmutableEnvelope(envelope);
-    }
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java?rev=1768401&r1=1768400&r2=1768401&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java [UTF-8] Sun Nov  6 23:04:42 2016
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.sis.internal.gpx;
 
 import java.io.File;
@@ -25,18 +24,16 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import com.esri.core.geometry.Point;
 import java.io.IOException;
 import javax.xml.stream.XMLStreamException;
-import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.geometry.ImmutableEnvelope;
-import org.apache.sis.referencing.CommonCRS;
-import org.junit.Test;
-
-import static org.apache.sis.internal.gpx.GPXConstants.*;
+import com.esri.core.geometry.Point;
+import org.opengis.metadata.extent.GeographicBoundingBox;
+import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
 import static org.junit.Assert.*;
 
 // Branch-dependent imports
@@ -81,9 +78,7 @@ public final strictfp class GPXWriterTes
         copyright.year = 2010;
         copyright.license = new URI("http://gnu.org");
 
-        final GeneralEnvelope bounds = new GeneralEnvelope(CommonCRS.defaultGeographic());
-        bounds.setRange(0, -10, 20);
-        bounds.setRange(1, -30, 40);
+        final GeographicBoundingBox bounds = new DefaultGeographicBoundingBox(-10, 20, -30, 40);
 
         final Metadata metaData = new Metadata();
         metaData.name = "name";
@@ -93,7 +88,7 @@ public final strictfp class GPXWriterTes
         metaData.links.addAll(Arrays.asList(new URI("http://adress1.org"),new URI("http://adress2.org")));
         metaData.time = Instant.now();
         metaData.keywords = "test,sample";
-        metaData.bounds = new ImmutableEnvelope(bounds);
+        metaData.bounds = bounds;
 
         writer.writeStartDocument();
         writer.write(metaData, null, null, null);
@@ -114,6 +109,7 @@ public final strictfp class GPXWriterTes
      */
     @Test
     public void testWritingFeatures() throws Exception {
+        final Types types = Types.DEFAULT;
 
         final File f = new File("output.xml");
         f.deleteOnExit();
@@ -121,8 +117,8 @@ public final strictfp class GPXWriterTes
         final GPXWriter110 writer = new GPXWriter110("Apache SIS", f);
 
         //way points -----------------------------------------------------------
-        Feature point1 = TYPE_WAYPOINT.newInstance();
-        point1.setPropertyValue("index", 0);
+        Feature point1 = types.wayPoint.newInstance();
+        point1.setPropertyValue("@identifier", 0);
         point1.setPropertyValue("@geometry", new Point(-10, 10));
         point1.setPropertyValue("ele", 15.6);
         point1.setPropertyValue("time", LocalDate.now());
@@ -142,8 +138,8 @@ public final strictfp class GPXWriterTes
         point1.setPropertyValue("pdop", 14.3);
         point1.setPropertyValue("ageofdgpsdata", 78.9);
         point1.setPropertyValue("dgpsid", 6);
-        Feature point2 = TYPE_WAYPOINT.newInstance();
-        point2.setPropertyValue("index", 1);
+        Feature point2 = types.wayPoint.newInstance();
+        point2.setPropertyValue("@identifier", 1);
         point2.setPropertyValue("@geometry", new Point(-15, 15));
         point2.setPropertyValue("ele", 15.6);
         point2.setPropertyValue("time", LocalDate.now());
@@ -163,8 +159,8 @@ public final strictfp class GPXWriterTes
         point2.setPropertyValue("pdop", 14.3);
         point2.setPropertyValue("ageofdgpsdata", 78.9);
         point2.setPropertyValue("dgpsid", 6);
-        Feature point3 = TYPE_WAYPOINT.newInstance();
-        point3.setPropertyValue("index", 2);
+        Feature point3 = types.wayPoint.newInstance();
+        point3.setPropertyValue("@identifier", 2);
         point3.setPropertyValue("@geometry", new Point(-20, 20));
         point3.setPropertyValue("ele", 15.6);
         point3.setPropertyValue("time", LocalDate.now());
@@ -191,8 +187,8 @@ public final strictfp class GPXWriterTes
         wayPoints.add(point3);
 
         //routes ---------------------------------------------------------------
-        final Feature route1 = TYPE_ROUTE.newInstance();
-        route1.setPropertyValue("index", 0);
+        final Feature route1 = types.route.newInstance();
+        route1.setPropertyValue("@identifier", 0);
         route1.setPropertyValue("name", "tt");
         route1.setPropertyValue("cmt", "cc");
         route1.setPropertyValue("desc", "des");
@@ -201,8 +197,8 @@ public final strictfp class GPXWriterTes
         route1.setPropertyValue("number", 15);
         route1.setPropertyValue("type", "test");
         route1.setPropertyValue("rtept", wayPoints);
-        final Feature route2 = TYPE_ROUTE.newInstance();
-        route2.setPropertyValue("index", 1);
+        final Feature route2 = types.route.newInstance();
+        route2.setPropertyValue("@identifier", 1);
         route2.setPropertyValue("name", "tt2");
         route2.setPropertyValue("cmt", "cc2");
         route2.setPropertyValue("desc", "des2");
@@ -218,18 +214,18 @@ public final strictfp class GPXWriterTes
 
         //tracks ---------------------------------------------------------------
         final List<Feature> segments = new ArrayList<>();
-        final Feature seg1 = TYPE_TRACK_SEGMENT.newInstance();
-        seg1.setPropertyValue("index", 0);
+        final Feature seg1 = types.trackSegment.newInstance();
+        seg1.setPropertyValue("@identifier", 0);
         seg1.setPropertyValue("trkpt", wayPoints);
-        final Feature seg2 = TYPE_TRACK_SEGMENT.newInstance();
-        seg2.setPropertyValue("index", 1);
+        final Feature seg2 = types.trackSegment.newInstance();
+        seg2.setPropertyValue("@identifier", 1);
         seg2.setPropertyValue("trkpt", wayPoints);
-        final Feature seg3 = TYPE_TRACK_SEGMENT.newInstance();
-        seg3.setPropertyValue("index", 2);
+        final Feature seg3 = types.trackSegment.newInstance();
+        seg3.setPropertyValue("@identifier", 2);
         seg3.setPropertyValue("trkpt", wayPoints);
 
-        final Feature track1 = TYPE_TRACK.newInstance();
-        track1.setPropertyValue("index", 0);
+        final Feature track1 = types.track.newInstance();
+        track1.setPropertyValue("@identifier", 0);
         track1.setPropertyValue("name", "tc");
         track1.setPropertyValue("cmt", "cc");
         track1.setPropertyValue("desc", "des");
@@ -238,8 +234,8 @@ public final strictfp class GPXWriterTes
         track1.setPropertyValue("number", 15);
         track1.setPropertyValue("type", "test");
         track1.setPropertyValue("trkseg", segments);
-        final Feature track2 = TYPE_TRACK.newInstance();
-        track2.setPropertyValue("index", 1);
+        final Feature track2 = types.track.newInstance();
+        track2.setPropertyValue("@identifier", 1);
         track2.setPropertyValue("name", "tc2");
         track2.setPropertyValue("cmt", "cc2");
         track2.setPropertyValue("desc", "des2");



Mime
View raw message