sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1785682 - /sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java
Date Mon, 06 Mar 2017 16:36:40 GMT
Author: desruisseaux
Date: Mon Mar  6 16:36:40 2017
New Revision: 1785682

URL: http://svn.apache.org/viewvc?rev=1785682&view=rev
Log:
If a property is unspecified, inherit from the enclosing reference system if possible.

Modified:
    sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/FinalLocationType.java

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=1785682&r1=1785681&r2=1785682&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] Mon Mar  6 16:36:40 2017
@@ -22,6 +22,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.io.Serializable;
 import org.opengis.util.InternationalString;
+import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.GeographicExtent;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.metadata.ModifiableMetadata;
@@ -116,6 +117,19 @@ final class FinalLocationType extends Ab
          * exception is thrown, the whole tree (with all 'this' references) will be discarded.
          */
         existing.put(source, this);
+        /*
+         * For the following properties, we will fallback on the given reference system if
the property value
+         * from the source location type is null. We do that because those properties are
mandatory according
+         * ISO 19112 and it happen quite often that they have the same value in the location
type than in the
+         * reference system.
+         */
+        InternationalString theme;
+        GeographicExtent    territoryOfUse;
+        Party               owner;
+        /*
+         * Copy the value from the source location type, make them unmodifiable,
+         * fallback on the ReferenceSystemUsingIdentifiers if necessary.
+         */
         name            = source.getName();
         theme           = source.getTheme();
         identifications = snapshot(source.getIdentifications());
@@ -125,6 +139,19 @@ final class FinalLocationType extends Ab
         parents         = snapshot(source.getParents(),  rs, existing);
         children        = snapshot(source.getChildren(), rs, existing);
         referenceSystem = rs;
+        if (rs != null) {
+            if (theme == null) theme = rs.getTheme();
+            if (owner == null) owner = rs.getOverallOwner();
+            if (territoryOfUse == null) {
+                final Extent domainOfValidity = rs.getDomainOfValidity();
+                if (domainOfValidity instanceof GeographicExtent) {
+                    territoryOfUse = (GeographicExtent) domainOfValidity;
+                }
+            }
+        }
+        this.theme          = theme;
+        this.territoryOfUse = territoryOfUse;
+        this.owner          = owner;
     }
 
     /**



Mime
View raw message