Changeset 34934 in osm for applications/editors/josm/plugins
- Timestamp:
- 2019-03-24T15:58:25+01:00 (5 years ago)
- Location:
- applications/editors/josm/plugins/lakewalker
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/lakewalker/.settings/org.eclipse.jdt.core.prefs
r32699 r34934 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=public 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=public 40 54 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 41 55 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
r32676 r34934 2 2 package org.openstreetmap.josm.plugins.lakewalker; 3 3 4 import java.awt.Component; 4 5 import java.beans.PropertyChangeListener; 5 6 … … 12 13 * */ 13 14 public abstract class Configurer { 14 // FIXME: maybe parameterize this so that value can have the right type 15 // in subclasses? 15 // FIXME: maybe parameterize this so that value can have the right type in subclasses? 16 16 public static final String NAME_PROPERTY = "Configurer.name"; 17 // public static final String VALUE_PROPERTY = "value";18 17 19 18 /** A String the uniquely identifies this property */ … … 44 43 /** 45 44 * Unique identifier 45 * @return Unique identifier 46 46 */ 47 47 public String getKey() { … … 51 51 /** 52 52 * Plain English description of the Object 53 * @return Plain English description of the Object 53 54 */ 54 55 public String getName() { … … 67 68 * The Object value 68 69 * May be null if the Object has not been initialized 70 * @return The Object value 69 71 */ 70 72 public Object getValue() { … … 79 81 /** 80 82 * Set the Object value 83 * @param o the Object value 81 84 */ 82 85 public void setValue(Object o) { … … 90 93 /** 91 94 * If true, then don't fire PropertyChangeEvents when the value is reset 95 * @param val true to disable firing PropertyChangeEvents when the value is reset 92 96 */ 93 97 public void setFrozen(boolean val) { … … 108 112 /** 109 113 * Set the Object value from a String 114 * @param s Object value as String 110 115 */ 111 116 public abstract void setValue(String s); … … 113 118 /** 114 119 * GUI interface for setting the option in an editing window 120 * @return GUI interface for setting the option in an editing window 115 121 */ 116 public abstract java.awt.Component getControls();122 public abstract Component getControls(); 117 123 118 124 /** 119 125 * Add a listener to be notified when the Object state changes 126 * @param l listener to add 120 127 */ 121 public void addPropertyChangeListener( java.beans.PropertyChangeListener l) {128 public void addPropertyChangeListener(PropertyChangeListener l) { 122 129 changeSupport.addPropertyChangeListener(l); 123 130 } -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
r32676 r34934 35 35 36 36 /** 37 * east = 0 38 * northeast = 1 39 * north = 2 40 * northwest = 3 41 * west = 4 42 * southwest = 5 43 * south = 6 44 * southeast = 7 37 * Map direction to index. 38 * @param direction human direction: {@code (north|south)?(east|west)?} 39 * @return direction index as follows: 40 * <ul> 41 * <li>east = 0</li> 42 * <li>northeast = 1</li> 43 * <li>north = 2</li> 44 * <li>northwest = 3</li> 45 * <li>west = 4</li> 46 * <li>southwest = 5</li> 47 * <li>south = 6</li> 48 * <li>southeast = 7</li> 49 * </ul> 45 50 */ 46 51 private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException { … … 70 75 /** 71 76 * Do a trace 72 */ 73 public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, 77 * 78 * @param lat latitude 79 * @param lon longitude 80 * @param tl_lon top/left longitude 81 * @param br_lon bottom/right longitude 82 * @param tl_lat top/left latitude 83 * @param br_lat bottom/right latitude 84 * @param progressMonitor Progress monitor 85 * @return list of node coordinates 86 * @throws LakewalkerException if anything goes wrong 87 */ 88 public List<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, 74 89 ProgressMonitor progressMonitor) throws LakewalkerException { 75 90 … … 83 98 Boolean detect_loop = false; 84 99 85 ArrayList<double[]> nodelist = new ArrayList<>();100 List<double[]> nodelist = new ArrayList<>(); 86 101 87 102 int[] xy = geo_to_xy(lat, lon, this.resolution); … … 201 216 /** 202 217 * Remove duplicate nodes from the list 203 */ 204 public ArrayList<double[]> duplicateNodeRemove(ArrayList<double[]> nodes) { 218 * @param nodes list of node coordinates 219 * @return filtered list without duplicate nodes 220 */ 221 public List<double[]> duplicateNodeRemove(List<double[]> nodes) { 205 222 206 223 if (nodes.size() <= 1) { … … 228 245 /** 229 246 * Reduce the number of vertices based on their proximity to each other 230 */ 231 public ArrayList<double[]> vertexReduce(ArrayList<double[]> nodes, double proximity) { 247 * @param nodes list of node coordinates 248 * @param proximity proximity 249 * @return reduced list 250 */ 251 public List<double[]> vertexReduce(List<double[]> nodes, double proximity) { 232 252 233 253 // Check if node list is empty … … 237 257 238 258 double[] test_v = nodes.get(0); 239 ArrayList<double[]> reducednodes = new ArrayList<>();259 List<double[]> reducednodes = new ArrayList<>(); 240 260 241 261 double prox_sq = Math.pow(proximity, 2); … … 267 287 } 268 288 269 270 public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon) {289 /* 290 public List<double[]> douglasPeuckerNR(List<double[]> nodes, double epsilon) { 271 291 command_stack = [(0, len(nodes) - 1)] 272 292 … … 332 352 */ 333 353 334 public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon, int depth) {354 public List<double[]> douglasPeucker(List<double[]> nodes, double epsilon, int depth) { 335 355 336 356 // Check if node list is empty … … 344 364 double[] last = nodes.get(nodes.size()-1); 345 365 346 ArrayList<double[]> new_nodes = new ArrayList<>();366 List<double[]> new_nodes = new ArrayList<>(); 347 367 348 368 double d = 0; … … 372 392 } 373 393 374 private ArrayList<double[]> sublist(ArrayList<double[]> l, int i, int f) throws ArrayIndexOutOfBoundsException {375 ArrayList<double[]> sub = new ArrayList<>();394 private List<double[]> sublist(List<double[]> l, int i, int f) throws ArrayIndexOutOfBoundsException { 395 List<double[]> sub = new ArrayList<>(); 376 396 377 397 if (f < i || i < 0 || f < 0 || f > l.size()) { -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
r34599 r34934 16 16 import java.util.Comparator; 17 17 import java.util.LinkedList; 18 import java.util.List; 18 19 19 20 import javax.swing.JOptionPane; … … 164 165 progressMonitor.beginTask(null, 3); 165 166 try { 166 ArrayList<double[]> nodelist = new ArrayList<>();167 List<double[]> nodelist = new ArrayList<>(); 167 168 168 169 try { … … 173 174 } 174 175 175 System.out.println(nodelist.size()+" nodes generated"); 176 177 /** 178 * Run the nodelist through a vertex reduction algorithm 179 */ 176 // Run the nodelist through a vertex reduction algorithm 180 177 181 178 progressMonitor.subTask(tr("Running vertex reduction...")); … … 183 180 nodelist = lw.vertexReduce(nodelist, epsilon); 184 181 185 //System.out.println("After vertex reduction "+nodelist.size()+" nodes remain."); 186 187 /** 188 * And then through douglas-peucker approximation 189 */ 182 // And then through douglas-peucker approximation 190 183 191 184 progressMonitor.worked(1); … … 194 187 nodelist = lw.douglasPeucker(nodelist, epsilon, 0); 195 188 196 //System.out.println("After Douglas-Peucker approximation "+nodelist.size()+" nodes remain."); 197 198 /** 199 * And then through a duplicate node remover 200 */ 189 // And then through a duplicate node remover 201 190 202 191 progressMonitor.worked(1); … … 205 194 nodelist = lw.duplicateNodeRemove(nodelist); 206 195 207 //System.out.println("After removing duplicate nodes, "+nodelist.size()+" nodes remain.");208 209 210 196 // if for some reason (image loading failed, ...) nodelist is empty, no more processing required. 211 if (nodelist. size() == 0) {197 if (nodelist.isEmpty()) { 212 198 return; 213 199 } 214 200 215 /** 216 * Turn the arraylist into osm nodes 217 */ 201 // Turn the arraylist into osm nodes 218 202 219 203 Way way = new Way();
Note:
See TracChangeset
for help on using the changeset viewer.