Changeset 34596 in osm
- Timestamp:
- 2018-08-23T02:02:04+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/imagery_offset_db
- Files:
-
- 4 added
- 20 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/.project
r32528 r34596 16 16 </arguments> 17 17 </buildCommand> 18 <buildCommand>19 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>20 <arguments>21 </arguments>22 </buildCommand>23 18 </buildSpec> 24 19 <natures> 25 20 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>27 21 </natures> 28 22 </projectDescription> -
applications/editors/josm/plugins/imagery_offset_db/.settings/org.eclipse.jdt.core.prefs
r32699 r34596 9 9 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 10 10 org.eclipse.jdt.core.compiler.compliance=1.8 11 org.eclipse.jdt.core.compiler.doc.comment.support=enabled 11 12 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 12 13 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error … … 32 33 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning 33 34 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore 35 org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning 36 org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled 37 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled 38 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled 39 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private 34 40 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 35 41 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning … … 38 44 org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled 39 45 org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore 46 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore 47 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled 48 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public 49 org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags 50 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning 51 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled 52 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled 53 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private 40 54 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 41 55 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -
applications/editors/josm/plugins/imagery_offset_db/build.xml
r34466 r34596 9 9 10 10 <property name="plugin.author" value="Ilya Zverev"/> 11 <property name="plugin.class" value=" iodb.ImageryOffsetPlugin"/>11 <property name="plugin.class" value="org.openstreetmap.josm.plugins.imagery_offset_db.ImageryOffsetPlugin"/> 12 12 <property name="plugin.description" value="Database of imagery offsets: share and aquire imagery offsets with one button."/> 13 13 <property name="plugin.icon" value="images/iodb.png"/> -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/CalibrationLayer.java
r33547 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/CalibrationObject.java
r32528 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.util.Map; … … 22 22 /** 23 23 * Initialize a calibration object from the array of nodes. 24 * @param geometry array of lat/lon coordinates forming the geometry 24 25 */ 25 26 public CalibrationObject(LatLon[] geometry) { … … 29 30 /** 30 31 * Initialize a calibration object from OSM primitive. 32 * @param p OSM primitive 31 33 */ 32 34 public CalibrationObject(OsmPrimitive p) { … … 44 46 /** 45 47 * Get an array of points for this geometry. 48 * @return array of lat/lon coordinates forming the geometry 46 49 */ 47 50 public LatLon[] getGeometry() { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/DeprecateOffsetAction.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 28 28 /** 29 29 * Initialize an action with an offset object. 30 * @param offset offset object 30 31 */ 31 32 public DeprecateOffsetAction(ImageryOffsetBase offset) { … … 39 40 * Asks a user if they really want to deprecate an offset (since this 40 41 * action is virtually irreversible) and calls 41 * {@link #deprecateOffset( iodb.ImageryOffsetBase, iodb.QuerySuccessListener)}42 * {@link #deprecateOffset(ImageryOffsetBase, QuerySuccessListener)} 42 43 * on a positive answer. 43 44 */ … … 60 61 /** 61 62 * Installs a listener to process successful deprecation event. 63 * @param listener success listener 62 64 */ 63 65 public void setListener(QuerySuccessListener listener) { … … 67 69 /** 68 70 * Deprecate the given offset. 69 * @see #deprecateOffset(iodb.ImageryOffsetBase, iodb.QuerySuccessListener) 71 * @param offset offset object 72 * @see #deprecateOffset(ImageryOffsetBase, QuerySuccessListener) 70 73 */ 71 74 public static void deprecateOffset(ImageryOffsetBase offset) { … … 76 79 * Deprecate the given offset and call listener on success. Asks user the reason 77 80 * and executes {@link SimpleOffsetQueryTask} with a query to deprecate the offset. 81 * @param offset offset object 82 * @param listener success listener 78 83 */ 79 84 public static void deprecateOffset(ImageryOffsetBase offset, QuerySuccessListener listener) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/GetImageryOffsetAction.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 158 158 * Parses the response with {@link IODBReader}. 159 159 * @param inp Response input stream. 160 * @throws iodb.SimpleOffsetQueryTask.UploadException Thrown on XML parsing error.160 * @throws org.openstreetmap.josm.plugins.imagery_offset_db.SimpleOffsetQueryTask.UploadException Thrown on XML parsing error. 161 161 */ 162 162 @Override -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/IODBReader.java
r33547 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.io.IOException; … … 88 88 * the resulting object is valid: it may not be, especially 89 89 * for locations near the Poles and 180th meridian. 90 * @param atts attributes 91 * @return lat/lon object 90 92 */ 91 93 private LatLon parseLatLon(Attributes atts) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryIdGenerator.java
r34370 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.util.Arrays; -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryOffset.java
r33774 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.util.Map; -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryOffsetBase.java
r33774 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.util.Date; … … 30 30 * Initialize object with the basic information. It's offset location, author, date 31 31 * and description. 32 * @param position offset location 33 * @param author author name 34 * @param description description 35 * @param date creation date 32 36 */ 33 37 public void setBasicInfo(LatLon position, String author, String description, Date date) { … … 51 55 * Mark the offset as deprecated. Though there is no exact field for "isDeprecated", 52 56 * it is deduced from abandonDate, author and reason being not null. 57 * @param abandonDate abandon date 58 * @param author author name 59 * @param reason reason why 53 60 */ 54 61 public void setDeprecated(Date abandonDate, String author, String reason) { … … 81 88 * Check that {@link #getAbandonDate()} is not null. Note that 82 89 * is doesn't say anything about abandonAuthor or abandonReason. 90 * @return {@code true} if this is deprecated (abandoned) 83 91 */ 84 92 public boolean isDeprecated() { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryOffsetPlugin.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 32 32 * losing all changes, and other menus are either too long already, 33 33 * or completely unsuitable for imagery offset actions. 34 * @param info Plugin information 34 35 */ 35 36 public ImageryOffsetPlugin(PluginInformation info) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryOffsetTools.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 36 36 * @return the layer, or null if it hasn't been found. 37 37 */ 38 public static AbstractTileSourceLayer getTopImageryLayer() {38 public static AbstractTileSourceLayer<?> getTopImageryLayer() { 39 39 if (!MainApplication.isDisplayingMapView()) 40 40 return null; 41 @SuppressWarnings("rawtypes") 41 42 List<AbstractTileSourceLayer> layers = MainApplication.getLayerManager().getLayersOfType(AbstractTileSourceLayer.class); 42 for (AbstractTileSourceLayer layer : layers) {43 for (AbstractTileSourceLayer<?> layer : layers) { 43 44 String url = layer.getInfo().getUrl(); 44 45 if (layer.isVisible() && url != null && !url.contains("gps-")) { … … 61 62 /** 62 63 * Calculates an imagery layer offset. 64 * @param layer imagery layer 63 65 * @param center The center of a visible map area. 64 66 * @return Coordinates of a point on the imagery which correspond to the … … 66 68 * @see #applyLayerOffset 67 69 */ 68 public static LatLon getLayerOffset(AbstractTileSourceLayer layer, LatLon center) {70 public static LatLon getLayerOffset(AbstractTileSourceLayer<?> layer, LatLon center) { 69 71 Projection proj = ProjectionRegistry.getProjection(); 70 72 EastNorth offsetCenter = MainApplication.getMap().mapView.getCenter(); … … 77 79 /** 78 80 * Applies the offset to the imagery layer. 79 * @see #calculateOffset(iodb.ImageryOffset) 81 * @param layer imagery layer 82 * @param offset offset object 83 * @see #calculateOffset(ImageryOffset) 80 84 * @see #getLayerOffset 81 85 */ 82 public static void applyLayerOffset(AbstractTileSourceLayer layer, ImageryOffset offset) {86 public static void applyLayerOffset(AbstractTileSourceLayer<?> layer, ImageryOffset offset) { 83 87 OffsetBookmark bookmark = calculateOffset(offset); 84 88 layer.getDisplaySettings().setOffsetBookmark(bookmark); … … 87 91 /** 88 92 * Calculate dx and dy for imagery offset. 93 * @param offset offset object 89 94 * @return An array of [dx, dy]. 90 95 * @see #applyLayerOffset … … 105 110 * @return imagery id. 106 111 */ 107 public static String getImageryID(AbstractTileSourceLayer layer) {112 public static String getImageryID(AbstractTileSourceLayer<?> layer) { 108 113 return layer == null ? null : 109 114 ImageryIdGenerator.getImageryID(layer.getInfo().getUrl(), layer.getInfo().getImageryType()); … … 146 151 /** 147 152 * Converts distance in meters to a human-readable string. 153 * @param d distance in meters 154 * @return d as a human-readable string 148 155 */ 149 156 public static String formatDistance(double d) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/ImageryOffsetWatcher.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import java.util.ArrayList; … … 73 73 * This class is a singleton, this method returns the instance, 74 74 * creating it if neccessary. 75 * @return unique instance 75 76 */ 76 77 public static ImageryOffsetWatcher getInstance() { … … 83 84 /** 84 85 * Register an offset state listener. 86 * @param listener offset state listener 85 87 */ 86 88 public void register(OffsetStateListener listener) { … … 91 93 /** 92 94 * Unregister an offset state listener. 95 * @param listener offset state listener 93 96 */ 94 97 public void unregister(OffsetStateListener listener) { … … 98 101 /** 99 102 * Change stored offset state, notify listeners if needed. 103 * @param good offset state 100 104 */ 101 105 private void setOffsetGood(boolean good) { … … 222 226 * collection of ':'-separated strings: imagery_id:lat:lon:dx:dy. No need for 223 227 * projections: nobody uses them anyway. 228 * @param layer imagery layer 224 229 */ 225 230 private void storeLayerOffset(AbstractTileSourceLayer<?> layer) { … … 241 246 /** 242 247 * Loads the current imagery layer offset from preferences. 248 * @param layer imagery layer 243 249 */ 244 250 private void loadLayerOffset(AbstractTileSourceLayer<?> layer) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/OffsetDialog.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 161 161 * Make a filtered offset list out of the full one. Takes into 162 162 * account both checkboxes. 163 * @return filtered offset list 163 164 */ 164 165 private List<ImageryOffsetBase> filterOffsets() { … … 305 306 /** 306 307 * Initialize the listener with an offset. 308 * @param offset offset object 307 309 */ 308 310 DeprecateOffsetListener(ImageryOffsetBase offset) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/OffsetDialogButton.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 14 14 import java.awt.Point; 15 15 import java.awt.RenderingHints; 16 import java.text.DateFormat; 16 17 17 18 import javax.swing.Box; … … 30 31 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 31 32 import org.openstreetmap.josm.tools.ImageProvider; 33 import org.openstreetmap.josm.tools.date.DateUtils; 32 34 33 35 /** … … 56 58 /** 57 59 * Returns the offset associated with this button. 60 * @return the offset associated with this button 58 61 */ 59 62 public ImageryOffsetBase getOffset() { … … 77 80 String authorAndDate = offset.isDeprecated() 78 81 ? tr("Deprecated by {0} on {1}", offset.getAbandonAuthor(), 79 OffsetInfoAction.DATE_FORMAT.format(offset.getAbandonDate()))82 DateUtils.formatDate(offset.getAbandonDate(), DateFormat.DEFAULT)) 80 83 : tr("Created by {0} on {1}", offset.getAuthor(), 81 OffsetInfoAction.DATE_FORMAT.format(offset.getDate()));84 DateUtils.formatDate(offset.getDate(), DateFormat.DEFAULT)); 82 85 JLabel authorAndDateLabel = new JLabel(authorAndDate); 83 86 Font authorFont = new Font(authorAndDateLabel.getFont().getName(), Font.ITALIC, authorAndDateLabel.getFont().getSize()); … … 124 127 /** 125 128 * Calculates length and direction for two points in the imagery offset object. 126 * @see #getLengthAndDirection(iodb.ImageryOffset, double, double) 129 * @param offset offset object 130 * @return length and direction 131 * @see #getLengthAndDirection(ImageryOffset, double, double) 127 132 */ 128 133 private double[] getLengthAndDirection(ImageryOffset offset) { 129 134 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 130 135 double[] dxy = layer == null ? new double[] {0.0, 0.0} : 131 136 new double[] {layer.getDisplaySettings().getDx(), layer.getDisplaySettings().getDy()}; 132 137 return getLengthAndDirection(offset, dxy[0], dxy[1]); 133 138 } … … 136 141 * Calculates length and direction for two points in the imagery offset object 137 142 * taking into account an existing imagery layer offset. 143 * @param offset offset object 144 * @param dx X offset 145 * @param dy Y offset 146 * @return length and direction 138 147 * 139 * @see #getLengthAndDirection( iodb.ImageryOffset)148 * @see #getLengthAndDirection(ImageryOffset) 140 149 */ 141 150 public static double[] getLengthAndDirection(ImageryOffset offset, double dx, double dy) { … … 179 188 * Initialize the icon with an offset object. Calculates length and direction 180 189 * of an arrow if they're needed. 190 * @param offset offset object 181 191 */ 182 192 OffsetIcon(ImageryOffsetBase offset) { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/OffsetInfoAction.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 7 7 import java.io.UnsupportedEncodingException; 8 8 import java.net.URLEncoder; 9 import java.text. SimpleDateFormat;9 import java.text.DateFormat; 10 10 11 11 import javax.swing.AbstractAction; … … 15 15 import org.openstreetmap.josm.tools.ImageProvider; 16 16 import org.openstreetmap.josm.tools.Logging; 17 import org.openstreetmap.josm.tools.date.DateUtils; 17 18 18 19 /** … … 23 24 */ 24 25 public class OffsetInfoAction extends AbstractAction { 25 public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd MMMM yyyy");26 26 27 27 ImageryOffsetBase offset; … … 29 29 /** 30 30 * Initializes the action with an offset object. 31 * Calls {@link #getInformationObject(iodb.ImageryOffsetBase)}. 31 * Calls {@link #getInformationObject(ImageryOffsetBase)}. 32 * @param offset offset object 32 33 */ 33 34 public OffsetInfoAction(ImageryOffsetBase offset) { … … 73 74 /** 74 75 * Constructs a string with all information about the given offset. 76 * @param offset offset object 77 * @return string with all information about the given offset 75 78 */ 76 79 public static Object getInformationObject(ImageryOffsetBase offset) { … … 91 94 sb.append("\n\n"); 92 95 sb.append(tr("Created by {0} on {1}", offset.getAuthor(), 93 D ATE_FORMAT.format(offset.getDate()))).append('\n');96 DateUtils.formatDate(offset.getDate(), DateFormat.DEFAULT))).append('\n'); 94 97 sb.append(tr("Description")).append(": ").append(offset.getDescription()); 95 98 … … 97 100 sb.append("\n\n"); 98 101 sb.append(tr("Deprecated by {0} on {1}", offset.getAbandonAuthor(), 99 D ATE_FORMAT.format(offset.getAbandonDate()))).append('\n');102 DateUtils.formatDate(offset.getAbandonDate(), DateFormat.DEFAULT))).append('\n'); 100 103 sb.append(tr("Reason")).append(": ").append(offset.getAbandonReason()); 101 104 } -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/QuerySuccessListener.java
r32528 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 /** -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/SimpleOffsetQueryTask.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 48 48 * In case a query was not specified when the object was constructed, 49 49 * it can be set with this method. 50 * @see #SimpleOffsetQueryTask(java.lang.String, java.lang.String) 50 * @param query A query string, usually starting with an action word and a question mark. 51 * @see #SimpleOffsetQueryTask(String, String) 51 52 */ 52 53 public void setQuery(String query) { … … 56 57 /** 57 58 * Install a listener for successful responses. There can be only one. 59 * @param listener success listener 58 60 */ 59 61 public void setListener(QuerySuccessListener listener) { … … 87 89 * Sends a request to the imagery offset server. Processes exceptions and 88 90 * return codes, calls {@link #processResponse(java.io.InputStream)} on success. 91 * @param query A query string, usually starting with an action word and a question mark. 92 * @throws UploadException in case of upload error 93 * @throws IOException in case of other I/O error 89 94 */ 90 95 private void doQuery(String query) throws UploadException, IOException { … … 136 141 * Parse the response input stream and determine whether an operation 137 142 * was successful or not. 138 * @throws iodb.SimpleOffsetQueryTask.UploadException Thrown if an error message was found. 143 * @param inp input stream 144 * @throws UploadException Thrown if an error message was found. 139 145 */ 140 146 protected void processResponse(InputStream inp) throws UploadException { -
applications/editors/josm/plugins/imagery_offset_db/src/org/openstreetmap/josm/plugins/imagery_offset_db/StoreImageryOffsetAction.java
r34466 r34596 1 1 // License: WTFPL. For details, see LICENSE file. 2 package iodb;2 package org.openstreetmap.josm.plugins.imagery_offset_db; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr;
Note:
See TracChangeset
for help on using the changeset viewer.