Changeset 10577 in josm


Ignore:
Timestamp:
2016-07-20T22:41:37+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13176 - Document ImageryInfo (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r10462 r10577  
    168168    private ImageryBounds bounds;
    169169    /** projections supported by WMS servers */
    170     private List<String> serverProjections;
     170    private List<String> serverProjections = Collections.emptyList();
    171171    /** description of the imagery entry, should contain notes what type of data it is */
    172172    private String description;
     
    271271                }
    272272            }
    273             if (i.serverProjections != null && !i.serverProjections.isEmpty()) {
     273            if (!i.serverProjections.isEmpty()) {
    274274                StringBuilder val = new StringBuilder();
    275275                for (String p : i.serverProjections) {
     
    537537    }
    538538
     539    /**
     540     * Sets the pixel per degree value.
     541     * @param ppd The ppd value
     542     * @see #getPixelPerDegree()
     543     */
    539544    public void setPixelPerDegree(double ppd) {
    540545        this.pixelPerDegree = ppd;
     
    612617    }
    613618
     619    /**
     620     * Set the attribution text
     621     * @param text The text
     622     * @see #getAttributionText(int, ICoordinate, ICoordinate)
     623     */
    614624    public void setAttributionText(String text) {
    615625        attributionText = text;
    616626    }
    617627
    618     public void setAttributionImageURL(String text) {
    619         attributionImageURL = text;
    620     }
    621 
    622     public void setAttributionImage(String text) {
    623         attributionImage = text;
    624     }
    625 
    626     public void setAttributionLinkURL(String text) {
    627         attributionLinkURL = text;
    628     }
    629 
     628    /**
     629     * Set the attribution image
     630     * @param url The url of the image.
     631     * @see #getAttributionImageURL()
     632     */
     633    public void setAttributionImageURL(String url) {
     634        attributionImageURL = url;
     635    }
     636
     637    /**
     638     * Set the image for the attribution
     639     * @param res The image resource
     640     * @see #getAttributionImage()
     641     */
     642    public void setAttributionImage(String res) {
     643        attributionImage = res;
     644    }
     645
     646    /**
     647     * Sets the URL the attribution should link to.
     648     * @param url The url.
     649     * @see #getAttributionLinkURL()
     650     */
     651    public void setAttributionLinkURL(String url) {
     652        attributionLinkURL = url;
     653    }
     654
     655    /**
     656     * Sets the text to display to the user as terms of use.
     657     * @param text The text
     658     * @see #getTermsOfUseText()
     659     */
    630660    public void setTermsOfUseText(String text) {
    631661        termsOfUseText = text;
    632662    }
    633663
     664    /**
     665     * Sets a url that links to the terms of use text.
     666     * @param text The url.
     667     * @see #getTermsOfUseURL()
     668     */
    634669    public void setTermsOfUseURL(String text) {
    635670        termsOfUseURL = text;
     
    664699        }
    665700
    666         if (serverProjections == null || serverProjections.isEmpty()) {
     701        if (serverProjections.isEmpty()) {
    667702            serverProjections = new ArrayList<>();
    668703            Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH));
     
    701736    }
    702737
     738    /**
     739     * Store the id of this info to the preferences and clear it afterwards.
     740     */
    703741    public void clearId() {
    704742        if (this.id != null) {
     
    735773    }
    736774
     775    /**
     776     * Gets the pixel per degree value
     777     * @return The ppd value.
     778     */
    737779    public double getPixelPerDegree() {
    738780        return this.pixelPerDegree;
     
    848890     */
    849891    public List<String> getServerProjections() {
    850         if (serverProjections == null)
    851             return Collections.emptyList();
    852892        return Collections.unmodifiableList(serverProjections);
    853893    }
    854894
     895    /**
     896     * Sets the list of collections the server supports
     897     * @param serverProjections The list of supported projections
     898     */
    855899    public void setServerProjections(Collection<String> serverProjections) {
     900        CheckParameterUtil.ensureParameterNotNull(serverProjections, "serverProjections");
    856901        this.serverProjections = new ArrayList<>(serverProjections);
    857902    }
     
    866911    }
    867912
     913    /**
     914     * Gets a unique toolbar key to store this layer as toolbar item
     915     * @return The kay.
     916     */
    868917    public String getToolbarName() {
    869918        String res = name;
     
    874923    }
    875924
     925    /**
     926     * Gets the name that should be displayed in the menu to add this imagery layer.
     927     * @return The text.
     928     */
    876929    public String getMenuName() {
    877930        String res = name;
     
    10201073    }
    10211074
     1075    /**
     1076     * Gets the flag if epsg 4326 to 3857 is supported
     1077     * @return The flag.
     1078     */
    10221079    public boolean isEpsg4326To3857Supported() {
    10231080        return isEpsg4326To3857Supported;
    10241081    }
    10251082
     1083    /**
     1084     * Sets the flag that epsg 4326 to 3857 is supported
     1085     * @param isEpsg4326To3857Supported The flag.
     1086     */
    10261087    public void setEpsg4326To3857Supported(boolean isEpsg4326To3857Supported) {
    10271088        this.isEpsg4326To3857Supported = isEpsg4326To3857Supported;
    10281089    }
    10291090
     1091    /**
     1092     * Gets the flag if the georeference is valid.
     1093     * @return <code>true</code> if it is valid.
     1094     */
    10301095    public boolean isGeoreferenceValid() {
    10311096        return isGeoreferenceValid;
    10321097    }
    10331098
     1099    /**
     1100     * Sets an indicator that the georeference is valid
     1101     * @param isGeoreferenceValid <code>true</code> if it is marked as valid.
     1102     */
    10341103    public void setGeoreferenceValid(boolean isGeoreferenceValid) {
    10351104        this.isGeoreferenceValid = isGeoreferenceValid;
     
    10671136                   n.defaultMinZoom = i.defaultMinZoom;
    10681137               }
    1069                if (i.serverProjections != null) {
    1070                    n.serverProjections = i.serverProjections;
    1071                }
     1138               n.setServerProjections(i.getServerProjections());
    10721139               n.url = i.url;
    10731140               n.imageryType = i.imageryType;
Note: See TracChangeset for help on using the changeset viewer.