Skip to content
Commits on Source (23)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="all" name="Compile and build java classes plus jar archives">
<project default="all" name="jmapviewer" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
<target name="all" depends="clean,build,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
<property name="java.lang.version" value="1.8" />
<dirname property="base.dir" file="${ant.file.jmapviewer}"/>
<property name="tools.dir" location="${base.dir}/tools"/>
<property name="jacoco.includes" value="org.openstreetmap.gui.jmapviewer.*" />
<property name="jacoco.inclbootstrapclasses" value="false" />
<property name="jacoco.inclnolocationclasses" value="false" />
<!-- For Java specific stuff by version -->
<condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
<condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
<condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
<condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
<condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
<!-- Disable jacoco on Java 13+, see https://github.com/jacoco/jacoco/pull/738 -->
<condition property="coverageByDefault">
<not>
<isset property="isJava13"/>
</not>
</condition>
<path id="test.classpath">
<fileset dir="${tools.dir}/testlib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="bin"/>
</path>
<target name="all" depends="clean,build,test,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
<target name="clean">
<mkdir dir="bin" />
<mkdir dir="bintest" />
<mkdir dir="javadoc" />
<mkdir dir="report" />
<delete>
<fileset dir="bin">
<include name="**" />
</fileset>
<fileset dir="." includes="*.jar"/>
<fileset dir="bintest">
<include name="**" />
</fileset>
<fileset dir="javadoc">
<include name="**" />
</fileset>
<fileset dir="report">
<include name="**" />
</fileset>
<fileset dir="." includes="*.jar,*.exec"/>
</delete>
</target>
<target name="build">
<javac srcdir="src" destdir="bin" source="1.8" target="1.8" debug="true" includeantruntime="false" encoding="UTF-8">
<target name="build" depends="clean">
<javac srcdir="src" destdir="bin" source="${java.lang.version}" target="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
<include name="org/openstreetmap/gui/jmapviewer/**" />
</javac>
......@@ -116,7 +153,36 @@
<link href="http://docs.oracle.com/javase/8/docs/api"/>
<doctitle><![CDATA[<h2>JMapViewer - Javadoc</h2>]]></doctitle>
<bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JMapViewer</a>]]></bottom>
<arg value="-html5" if:set="isJava9" />
</javadoc>
</target>
<target name="test" depends="clean, build">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
<javac srcdir="test" destdir="bintest"
target="${java.lang.version}" source="${java.lang.version}" debug="on"
includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-serial"/>
<classpath>
<path refid="test.classpath"/>
</classpath>
</javac>
<jacoco:coverage enabled="@{coverage}" includes="${jacoco.includes}"
inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
<junit printsummary="yes" fork="true" forkmode="once">
<jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath>
<path refid="test.classpath"/>
<pathelement location="bintest"/>
</classpath>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="report">
<fileset dir="bintest" includes="**/*Test.class"/>
</batchtest>
</junit>
</jacoco:coverage>
</target>
</project>
JMapViewer-1.0-Source.tar.gz is generated by 'get-orig-source' target.
+dfsg1 suffix has been added because bing_maps.png shall be removed at import:
gbp import-orig --filter bing_maps.png --filter-pristine-tar --pristine-tar -u1.0+dfsg1 \
../JMapViewer-1.0-Source.tar.gz
As an alternative, you can use the result of uscan (get-orig-source target),
which is also configured for removal of bing_maps.png (by means of Files-Excluded:
in debian/copyright).
\ No newline at end of file
jmapviewer (2.8+dfsg-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
-- Bas Couwenberg <sebastic@debian.org> Fri, 07 Dec 2018 07:05:43 +0100
jmapviewer (2.8+dfsg-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.2.1, no changes.
* Update copyright file, changes:
- Add Robert Scott to copyright holders.
- Add license & copyright for ScanexTileSource.java.
* Refresh patches.
-- Bas Couwenberg <sebastic@debian.org> Sun, 02 Dec 2018 11:47:36 +0100
jmapviewer (2.7+dfsg-4) unstable; urgency=medium
* Remove .gitigore file.
* Bump Standards-Version to 4.2.0, no changes.
* Update watch file to handle changed HTML.
-- Bas Couwenberg <sebastic@debian.org> Sat, 18 Aug 2018 19:13:56 +0200
jmapviewer (2.7+dfsg-3) unstable; urgency=medium
* Drop autopkgtest to test installability.
* Add lintian override for testsuite-autopkgtest-missing.
-- Bas Couwenberg <sebastic@debian.org> Tue, 31 Jul 2018 19:22:25 +0200
jmapviewer (2.7+dfsg-2) unstable; urgency=medium
* Update Vcs-* URLs for Salsa.
* Drop override for vcs-deprecated-in-debian-infrastructure.
* Bump Standards-Version to 4.1.5, no changes.
* Document repacking in copyright file, drop obsolete README.source &
get-orig-source target.
* Strip trailing whitespace from control & rules files.
-- Bas Couwenberg <sebastic@debian.org> Thu, 19 Jul 2018 16:34:23 +0200
jmapviewer (2.7+dfsg-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
......
......@@ -12,9 +12,9 @@ Build-Depends: debhelper (>= 9~),
docbook-xsl,
docbook-xml,
xsltproc
Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-grass/jmapviewer.git
Vcs-Git: https://anonscm.debian.org/git/pkg-grass/jmapviewer.git -b stretch-backports
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/debian-gis-team/jmapviewer
Vcs-Git: https://salsa.debian.org/debian-gis-team/jmapviewer.git -b stretch-backports
Homepage: https://wiki.openstreetmap.org/wiki/JMapViewer
Package: jmapviewer
......@@ -28,4 +28,3 @@ Description: Java OpenStreetMap Tile Viewer
specific location on the map.
.
This package includes both the library and a demo application.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: JMapViewer
Source: https://svn.openstreetmap.org/applications/viewer/jmapviewer
Comment: The upstream source is repacked to exclude the Bing logo which is
non-free, see: https://lists.debian.org/debian-gis/2014/10/msg00147.html
Files-Excluded: src/org/openstreetmap/gui/jmapviewer/images/bing_maps.png
Files: *
......@@ -21,10 +23,15 @@ Copyright: 2007, Tim Haussmann
2012-2016, Simon Legner
2015-2016, Wiktor Niesiobędzki
2011-2017, Paul Hartmann
2017, Robert Scott
2009-2018, Dirk Stöcker
2011-2018, Vincent Privat
License: GPL-2+
Files: src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
Copyright: 2011-2016, Gleb Smirnoff & Andrey Boltenkov
License: BSD-2-Clause or GPL-2+
Files: debian/*
Copyright: 2011-2013, Andrew Harvey <andrew.harvey4@gmail.com>
2013, Felix Natter <fnatter@gmx.net>
......
From: Andrew Harvey <andrew.harvey4@gmail.com>
Subject: Adjustments to the ant build file
Description: Adjustments to the ant build file.
Only build the components required for the Debian package.
Author: Andrew Harvey <andrew.harvey4@gmail.com>
Forwarded: not-needed
Last-Update: 2011-11-19
Adjustment to the ant build.xml file. Only building the components required for
this Debian package.
--- a/build.xml
+++ b/build.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="all" name="Compile and build java classes plus jar archives">
@@ -26,7 +26,7 @@
<pathelement location="bin"/>
</path>
- <target name="all" depends="clean,build,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
+ <target name="all" depends="clean,build,svn_info,pack,create_run_jar" />
- <target name="all" depends="clean,build,test,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
+ <target name="all" depends="clean,build,test,svn_info,pack,create_run_jar" />
<target name="clean">
<mkdir dir="bin" />
From: Andrew Harvey <andrew.harvey4@gmail.com>
Subject: Use installed library for the demo application
Description: Use installed library for the demo application.
Author: Andrew Harvey <andrew.harvey4@gmail.com>
Forwarded: not-needed
Last-Update: 2013-03-15
Adjustment to the ant build.xml file. Using the system wide jmapviewer.jar
library for the JMapViewer_Demo application.
--- a/build.xml
+++ b/build.xml
@@ -50,7 +50,7 @@
@@ -87,7 +87,7 @@
<jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
......
......@@ -32,7 +32,3 @@ override_dh_auto_install:
install -m 644 $(CURDIR)/JMapViewer_Demo.jar $(CURDIR)/debian/jmapviewer/usr/share/jmapviewer/JMapViewer_Demo.jar
install -m 755 $(CURDIR)/debian/jmapviewer_demo.sh $(CURDIR)/debian/jmapviewer/usr/bin/jmapviewer
get-orig-source:
uscan --verbose --force-download --repack --compress xz --destdir ..
# Package not officially migrated to Salsa yet.
jmapviewer source: vcs-deprecated-in-debian-infrastructure * https://anonscm.debian.org/*
# Not worth the effort
testsuite-autopkgtest-missing
# Test installability
Depends: @
Test-Command: /bin/true
version=3
opts=dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,repacksuffix=+dfsg \
https://svn.openstreetmap.org/applications/viewer/jmapviewer/releases/(\d+(?:\.\d+)*)/JMapViewer-(\d\S*)-Source\.(?:tar\.(?:gz|bz2|xz)|tgz|tbz2|txz|zip)
opts="\
dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
pagemangle=s/<dir\sname="(?:\d+(?:\.\d+)*)\/?"\shref="(\d+(?:\.\d+)*)\/?"\s\/>/<a href="$1">$1<\/a>/g,\
downloadurlmangle=s/(\d+(?:\.\d+)*)/$1\/JMapViewer-$1-Source.zip/,\
filenamemangle=s/(\d+(?:\.\d+)*)/JMapViewer-$1-Source.zip/,\
repacksuffix=+dfsg" \
https://svn.openstreetmap.org/applications/viewer/jmapviewer/releases/ \
(\d+(?:\.\d+)*)
......@@ -19,6 +19,11 @@ import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
public class Coordinate implements ICoordinate {
private transient Point2D.Double data;
/**
* Constructs a new {@code Coordinate}.
* @param lat latitude in degrees
* @param lon longitude in degrees
*/
public Coordinate(double lat, double lon) {
data = new Point2D.Double(lon, lat);
}
......@@ -61,20 +66,16 @@ public class Coordinate implements ICoordinate {
@Override
public int hashCode() {
int hash = 3;
hash = 61 * hash + Objects.hashCode(this.data);
return hash;
return Objects.hashCode(data);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
if (this == obj)
return true;
if (obj == null || !(obj instanceof Coordinate))
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Coordinate other = (Coordinate) obj;
return Objects.equals(this.data, other.data);
return Objects.equals(data, other.data);
}
}
......@@ -4,8 +4,6 @@ package org.openstreetmap.gui.jmapviewer;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
......@@ -79,12 +77,7 @@ public class Demo extends JFrame implements JMapViewerEventListener {
+ "left double click or mouse wheel to zoom.");
helpPanel.add(helpLabel);
JButton button = new JButton("setDisplayToFitMapMarkers");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setDisplayToFitMapMarkers();
}
});
button.addActionListener(e -> map().setDisplayToFitMapMarkers());
JComboBox<TileSource> tileSourceSelector = new JComboBox<>(new TileSource[] {
new OsmTileSource.Mapnik(),
new OsmTileSource.CycleMap(),
......@@ -109,57 +102,27 @@ public class Demo extends JFrame implements JMapViewerEventListener {
panelTop.add(tileLoaderSelector);
final JCheckBox showMapMarker = new JCheckBox("Map markers visible");
showMapMarker.setSelected(map().getMapMarkersVisible());
showMapMarker.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setMapMarkerVisible(showMapMarker.isSelected());
}
});
showMapMarker.addActionListener(e -> map().setMapMarkerVisible(showMapMarker.isSelected()));
panelBottom.add(showMapMarker);
///
final JCheckBox showTreeLayers = new JCheckBox("Tree Layers visible");
showTreeLayers.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
treeMap.setTreeVisible(showTreeLayers.isSelected());
}
});
showTreeLayers.addActionListener(e -> treeMap.setTreeVisible(showTreeLayers.isSelected()));
panelBottom.add(showTreeLayers);
///
final JCheckBox showToolTip = new JCheckBox("ToolTip visible");
showToolTip.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setToolTipText(null);
}
});
showToolTip.addActionListener(e -> map().setToolTipText(null));
panelBottom.add(showToolTip);
///
final JCheckBox showTileGrid = new JCheckBox("Tile grid visible");
showTileGrid.setSelected(map().isTileGridVisible());
showTileGrid.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setTileGridVisible(showTileGrid.isSelected());
}
});
showTileGrid.addActionListener(e -> map().setTileGridVisible(showTileGrid.isSelected()));
panelBottom.add(showTileGrid);
final JCheckBox showZoomControls = new JCheckBox("Show zoom controls");
showZoomControls.setSelected(map().getZoomControlsVisible());
showZoomControls.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setZoomContolsVisible(showZoomControls.isSelected());
}
});
showZoomControls.addActionListener(e -> map().setZoomControlsVisible(showZoomControls.isSelected()));
panelBottom.add(showZoomControls);
final JCheckBox scrollWrapEnabled = new JCheckBox("Scrollwrap enabled");
scrollWrapEnabled.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
map().setScrollWrapEnabled(scrollWrapEnabled.isSelected());
}
});
scrollWrapEnabled.addActionListener(e -> map().setScrollWrapEnabled(scrollWrapEnabled.isSelected()));
panelBottom.add(scrollWrapEnabled);
panelBottom.add(button);
......
......@@ -2,15 +2,21 @@
package org.openstreetmap.gui.jmapviewer;
import java.awt.Desktop;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.Objects;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
public final class FeatureAdapter {
private static BrowserAdapter browserAdapter = new DefaultBrowserAdapter();
private static ImageAdapter imageAdapter = new DefaultImageAdapter();
private static TranslationAdapter translationAdapter = new DefaultTranslationAdapter();
private static LoggingAdapter loggingAdapter = new DefaultLoggingAdapter();
......@@ -31,22 +37,34 @@ public final class FeatureAdapter {
Logger getLogger(String name);
}
public interface ImageAdapter {
BufferedImage read(URL input, boolean readMetadata, boolean enforceTransparency) throws IOException;
}
public static void registerBrowserAdapter(BrowserAdapter browserAdapter) {
FeatureAdapter.browserAdapter = browserAdapter;
FeatureAdapter.browserAdapter = Objects.requireNonNull(browserAdapter);
}
public static void registerImageAdapter(ImageAdapter imageAdapter) {
FeatureAdapter.imageAdapter = Objects.requireNonNull(imageAdapter);
}
public static void registerTranslationAdapter(TranslationAdapter translationAdapter) {
FeatureAdapter.translationAdapter = translationAdapter;
FeatureAdapter.translationAdapter = Objects.requireNonNull(translationAdapter);
}
public static void registerLoggingAdapter(LoggingAdapter loggingAdapter) {
FeatureAdapter.loggingAdapter = loggingAdapter;
FeatureAdapter.loggingAdapter = Objects.requireNonNull(loggingAdapter);
}
public static void openLink(String url) {
browserAdapter.openLink(url);
}
public static BufferedImage readImage(URL url) throws IOException {
return imageAdapter.read(url, false, false);
}
public static String tr(String text, Object... objects) {
return translationAdapter.tr(text, objects);
}
......@@ -72,6 +90,13 @@ public final class FeatureAdapter {
}
}
public static class DefaultImageAdapter implements ImageAdapter {
@Override
public BufferedImage read(URL input, boolean readMetadata, boolean enforceTransparency) throws IOException {
return ImageIO.read(input);
}
}
public static class DefaultTranslationAdapter implements TranslationAdapter {
@Override
public String tr(String text, Object... objects) {
......
......@@ -6,9 +6,8 @@ import java.awt.Font;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
......@@ -18,8 +17,6 @@ import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import org.openstreetmap.gui.jmapviewer.events.JMVCommandEvent;
......@@ -163,18 +160,12 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
zoomSlider.setOrientation(JSlider.VERTICAL);
zoomSlider.setBounds(10, 10, 30, 150);
zoomSlider.setOpaque(false);
zoomSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
setZoom(zoomSlider.getValue());
}
});
zoomSlider.addChangeListener(e -> setZoom(zoomSlider.getValue()));
zoomSlider.setFocusable(false);
add(zoomSlider);
int size = 18;
URL url = JMapViewer.class.getResource("images/plus.png");
if (url != null) {
ImageIcon icon = new ImageIcon(url);
ImageIcon icon = getImageIcon("images/plus.png");
if (icon != null) {
zoomInButton = new JButton(icon);
} else {
zoomInButton = new JButton("+");
......@@ -182,18 +173,11 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
zoomInButton.setMargin(new Insets(0, 0, 0, 0));
}
zoomInButton.setBounds(4, 155, size, size);
zoomInButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
zoomIn();
}
});
zoomInButton.addActionListener(e -> zoomIn());
zoomInButton.setFocusable(false);
add(zoomInButton);
url = JMapViewer.class.getResource("images/minus.png");
if (url != null) {
ImageIcon icon = new ImageIcon(url);
icon = getImageIcon("images/minus.png");
if (icon != null) {
zoomOutButton = new JButton(icon);
} else {
zoomOutButton = new JButton("-");
......@@ -201,17 +185,23 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
zoomOutButton.setMargin(new Insets(0, 0, 0, 0));
}
zoomOutButton.setBounds(8 + size, 155, size, size);
zoomOutButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
zoomOut();
}
});
zoomOutButton.addActionListener(e -> zoomOut());
zoomOutButton.setFocusable(false);
add(zoomOutButton);
}
private static ImageIcon getImageIcon(String name) {
URL url = JMapViewer.class.getResource(name);
if (url != null) {
try {
return new ImageIcon(FeatureAdapter.readImage(url));
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
/**
* Changes the map pane so that it is centered on the specified coordinate
* at the given zoom level.
......
......@@ -3,8 +3,6 @@ package org.openstreetmap.gui.jmapviewer;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
......@@ -93,21 +91,15 @@ public class JMapViewerTree extends JPanel {
} else if (layer.isVisibleTexts()) popup.add(menuItemHide);
else popup.add(menuItemShow);
menuItemShow.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
menuItemShow.addActionListener(e -> {
setVisibleTexts(layer, true);
if (layer.getParent() != null) layer.getParent().calculateVisibleTexts();
map.repaint();
}
});
menuItemHide.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
menuItemHide.addActionListener(e -> {
setVisibleTexts(layer, false);
if (layer.getParent() != null) layer.getParent().calculateVisibleTexts();
map.repaint();
}
});
return popup;
......
......@@ -188,7 +188,7 @@ public class OsmTileLoader implements TileLoader {
/**
* Sets the maximum number of concurrent connections the tile loader will do
* @param num number of conncurent connections
* @param num number of concurrent connections
*/
public static void setConcurrentConnections(int num) {
jobDispatcher.setMaximumPoolSize(num);
......
......@@ -52,21 +52,16 @@ public class Projected implements IProjected {
@Override
public int hashCode() {
int hash = 3;
hash = 61 * hash + Objects.hashCode(this.data);
return hash;
return Objects.hashCode(data);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
if (this == obj)
return true;
if (obj == null || !(obj instanceof Projected))
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Projected other = (Projected) obj;
return Objects.equals(this.data, other.data);
return Objects.equals(data, other.data);
}
}
......@@ -9,6 +9,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
......@@ -80,7 +81,7 @@ public class Tile {
private static BufferedImage loadImage(String path) {
try {
return ImageIO.read(JMapViewer.class.getResourceAsStream(path));
return FeatureAdapter.readImage(JMapViewer.class.getResource(path));
} catch (IOException | IllegalArgumentException ex) {
ex.printStackTrace();
return null;
......@@ -339,18 +340,13 @@ public class Tile {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
if (obj == null || !(obj instanceof Tile))
return false;
if (getClass() != obj.getClass())
return false;
Tile other = (Tile) obj;
if (xtile != other.xtile)
return false;
if (ytile != other.ytile)
return false;
if (zoom != other.zoom)
return false;
return getTileSource().equals(other.getTileSource());
final Tile other = (Tile) obj;
return xtile == other.xtile
&& ytile == other.ytile
&& zoom == other.zoom
&& Objects.equals(source, other.source);
}
public static String getTileKey(TileSource source, int xtile, int ytile, int zoom) {
......@@ -459,5 +455,4 @@ public class Tile {
loading = false;
loaded = false;
}
}