Ignore:
Timestamp:
2016-05-15T17:45:55+02:00 (9 years ago)
Author:
donvip
Message:

fix some sonar issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java

    r32180 r32181  
    3737import org.xml.sax.SAXException;
    3838
     39/**
     40 * Tile source for the Bing Maps REST Imagery API.
     41 * @see <a href="https://msdn.microsoft.com/en-us/library/ff701724.aspx">MSDN</a>
     42 */
    3943public class BingAerialTileSource extends TMSTileSource {
    4044
     
    6670
    6771    protected static class Attribution {
    68         private String attribution;
     72        private String attributionText;
    6973        private int minZoom;
    7074        private int maxZoom;
     
    102106            XPathFactory xPathFactory = XPathFactory.newInstance();
    103107            XPath xpath = xPathFactory.newXPath();
    104             imageUrlTemplate = xpath.compile("//ImageryMetadata/ImageUrl/text()").evaluate(document);
    105             imageUrlTemplate = imageUrlTemplate.replace(
     108            imageUrlTemplate = xpath.compile("//ImageryMetadata/ImageUrl/text()").evaluate(document).replace(
    106109                    "http://ecn.{subdomain}.tiles.virtualearth.net/",
    107110                    "https://ecn.{subdomain}.tiles.virtualearth.net/");
     
    129132            NodeList imageryProviderNodes = (NodeList) xpath.compile("//ImageryMetadata/ImageryProvider")
    130133                    .evaluate(document, XPathConstants.NODESET);
    131             List<Attribution> attributions = new ArrayList<>(imageryProviderNodes.getLength());
     134            List<Attribution> attributionsList = new ArrayList<>(imageryProviderNodes.getLength());
    132135            for (int i = 0; i < imageryProviderNodes.getLength(); i++) {
    133136                Node providerNode = imageryProviderNodes.item(i);
     
    139142                    Node areaNode = coverageAreaNodes.item(j);
    140143                    Attribution attr = new Attribution();
    141                     attr.attribution = attribution;
     144                    attr.attributionText = attribution;
    142145
    143146                    attr.maxZoom = Integer.parseInt(zoomMaxXpath.evaluate(areaNode));
     
    151154                    attr.max = new Coordinate(northLat, eastLon);
    152155
    153                     attributions.add(attr);
    154                 }
    155             }
    156 
    157             return attributions;
     156                    attributionsList.add(attr);
     157                }
     158            }
     159
     160            return attributionsList;
    158161        } catch (SAXException e) {
    159162            System.err.println("Could not parse Bing aerials attribution metadata.");
     
    182185    @Override
    183186    public String getAttributionLinkURL() {
    184         //return "http://bing.com/maps"
    185         // FIXME: I've set attributionLinkURL temporarily to ToU URL to comply with bing ToU
     187        // Terms of Use URL to comply with Bing Terms of Use
    186188        // (the requirement is that we have such a link at the bottom of the window)
    187         return "http://go.microsoft.com/?linkid=9710837";
     189        return "https://www.microsoft.com/maps/assets/docs/terms.aspx";
    188190    }
    189191
     
    284286                    if (topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon()
    285287                            && topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) {
    286                         a.append(attr.attribution);
     288                        a.append(attr.attributionText);
    287289                        a.append(' ');
    288290                    }
Note: See TracChangeset for help on using the changeset viewer.