Changeset 16127 in josm


Ignore:
Timestamp:
2020-03-15T00:03:59+01:00 (4 years ago)
Author:
Don-vip
Message:

see #17285 - add privacy-policy-url

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/resources/data/maps.xsd

    r16117 r16127  
    665665                            <!-- The area of use, e.g. <bounds min-lat='45.7' min-lon='5.9' max-lat='55.0' max-lon='17.3'/> -->
    666666                            <xs:element name="bounds" minOccurs="0" maxOccurs="1" type="tns:bounds" />
     667                            <!-- A link to the privacy policy of the operator -->
     668                            <xs:element name="privacy-policy-url" minOccurs="0" maxOccurs="1" type="xs:anyURI" />
    667669                            <!-- Provide a source that this background can be used for OSM. A page on the OSM-wiki with additional explanation and further references is preferred, but other sources (for example the license text) can also be linked. -->
    668670                            <xs:element name="permission-ref" minOccurs="0" maxOccurs="1" type="xs:anyURI" />
  • trunk/scripts/SyncEditorLayerIndex.java

    r16098 r16127  
    442442            if (isNotBlank(t = getPermissionReferenceUrl(e)))
    443443                stream.write("        <permission-ref>"+cdata(t)+"</permission-ref>\n");
     444            if (isNotBlank(t = getPrivacyPolicyUrl(e)))
     445                stream.write("        <privacy-policy-url>"+cdata(t)+"</privacy-policy-url>\n");
    444446            if ((getValidGeoreference(e)))
    445447                stream.write("        <valid-georeference>true</valid-georeference>\n");
     
    757759
    758760            compareDescriptions(e, j);
     761            comparePrivacyPolicyUrls(e, j);
    759762            comparePermissionReferenceUrls(e, j);
    760763            compareAttributionUrls(e, j);
     
    777780            } else if (!optionNoEli) {
    778781                myprintln("+ Missing ELI description ('"+jt+"'): "+getDescription(j));
     782            }
     783        }
     784    }
     785
     786    void comparePrivacyPolicyUrls(JsonObject e, ImageryInfo j) {
     787        String et = getPrivacyPolicyUrl(e);
     788        String jt = getPrivacyPolicyUrl(j);
     789        if (!Objects.equals(et, jt)) {
     790            if (isBlank(jt)) {
     791                myprintln("- Missing JOSM privacy policy URL ("+et+"): "+getDescription(j));
     792            } else if (isNotBlank(et)) {
     793                myprintln("+ Privacy policy URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j));
     794            } else if (!optionNoEli) {
     795                myprintln("+ Missing ELI privacy policy URL ('"+jt+"'): "+getDescription(j));
    779796            }
    780797        }
     
    14491466    }
    14501467
     1468    static String getPrivacyPolicyUrl(Object e) {
     1469        if (e instanceof ImageryInfo) return ((ImageryInfo) e).getPrivacyPolicyURL();
     1470        return ((Map<String, JsonObject>) e).get("properties").getString("privacy_policy_url", null);
     1471    }
     1472
    14511473    static Map<String, Set<String>> getNoTileHeader(Object e) {
    14521474        if (e instanceof ImageryInfo) return ((ImageryInfo) e).getNoTileHeaders();
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r16101 r16127  
    260260    /** Text of a text attribution displayed when using the imagery */
    261261    private String attributionText;
     262    /** Link to the privacy policy of the operator */
     263    private String privacyPolicyURL;
    262264    /** Link to a reference stating the permission for OSM usage */
    263265    private String permissionReferenceURL;
     
    828830    }
    829831
     832    /**
     833     * Return the privacy policy URL.
     834     * @return The url
     835     * @see #setPrivacyPolicyURL
     836     * @since 16127
     837     */
     838    public String getPrivacyPolicyURL() {
     839        return privacyPolicyURL;
     840    }
     841
    830842    @Override
    831843    public Image getAttributionImage() {
     
    905917    public void setPermissionReferenceURL(String url) {
    906918        permissionReferenceURL = url;
     919    }
     920
     921    /**
     922     * Sets the privacy policy URL.
     923     * @param url The url.
     924     * @see #getPrivacyPolicyURL()
     925     * @since 16127
     926     */
     927    public void setPrivacyPolicyURL(String url) {
     928        privacyPolicyURL = url;
    907929    }
    908930
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r15716 r16127  
    220220                        "terms-of-use-text",
    221221                        "terms-of-use-url",
     222                        "privacy-policy-url",
    222223                        "permission-ref",
    223224                        "country-code",
     
    485486                    entry.setTermsOfUseText(accumulator.toString());
    486487                    break;
     488                case "privacy-policy-url":
     489                    entry.setPrivacyPolicyURL(accumulator.toString());
     490                    break;
    487491                case "permission-ref":
    488492                    entry.setPermissionReferenceURL(accumulator.toString());
Note: See TracChangeset for help on using the changeset viewer.