Changeset 18871 in josm
- Timestamp:
- 2023-10-16T19:03:11+02:00 (14 months ago)
- Location:
- trunk
- Files:
-
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r18861 r18871 221 221 <element name="cp-elements" optional="true"/> 222 222 <sequential> 223 <!-- RestrictedApiChecker was removed in error-prone 2.19 --> 224 <local name="errorProne2.10"/> 225 <property name="errorProne2.10" value="-Xep:RestrictedApiChecker:OFF" unless:set="isJava11"/> 226 <local name="errorProne2.22+"/> 227 <!-- LongDoubleConversion is disabled since SonarLint java:S1905 conflicts --> 228 <property name="errorProne2.22+" value="-Xep:LongDoubleConversion:OFF" if:set="isJava11"/> 223 229 <javac sourcepath="@{sourcepath}" srcdir="@{srcdir}" fork="@{fork}" 224 230 includes="@{includes}" excludes="@{excludes}" destdir="@{destdir}" release="@{release}" … … 250 256 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 --> 251 257 <compilerarg value="-XDignore.symbol.file"/> 252 <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:RestrictedApiChecker:OFF -Xep:InlineMeSuggester:OFF" unless:set="noErrorProne"/>258 <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF ${errorProne2.10} -Xep:InlineMeSuggester:OFF ${errorProne2.22+}" unless:set="noErrorProne"/> 253 259 <compilerarg line="-Xmaxwarns 1000"/> 254 260 <compilerarg value="-Xplugin:semanticdb -sourceroot:@{srcdir} -targetroot:${build.dir}/semanticdb" if:set="lsif" /> -
trunk/ivysettings.xml
r17647 r18871 6 6 <ibiblio name="josm-nexus" m2compatible="true" root="https://josm.openstreetmap.de/nexus/content/repositories/public/" /> 7 7 </resolvers> 8 <!-- Remove error_prone 2.10.0 specific statements in build.xml when we drop Java 8 as a build platform --> 9 <property name="versions.error_prone" value="2.10.0" unlessset="isJava11"/> 10 <property name="versions.error_prone" value="2.22.0" ifset="isJava11"/> 8 11 </ivysettings> -
trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
r16505 r18871 36 36 /** 37 37 * User action to close open changesets. 38 * 38 * <p> 39 39 * The list of open changesets will be downloaded from the server and presented 40 40 * to the user. … … 110 110 protected void finish() { 111 111 SwingUtilities.invokeLater(() -> { 112 if (lastException != null) { 113 ExceptionDialogUtil.explainException(lastException); 112 Exception exception = getLastException(); 113 if (exception != null) { 114 ExceptionDialogUtil.explainException(exception); 114 115 } 115 116 ChangesetCache.getInstance().update(changesets); 116 if (! canceled && lastException == null) {117 if (!isCanceled() && exception == null) { 117 118 onPostDownloadOpenChangesets(); 118 119 } -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r17586 r18871 246 246 247 247 /** 248 * This he pler class implements algorithm traversing trough connected ways.248 * This helper class implements algorithm traversing through connected ways. 249 249 * Assumes you are going in clockwise orientation. 250 250 * @author viesturs -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r18332 r18871 275 275 if (Utils.isEmpty(files)) return; 276 276 277 /* *277 /* 278 278 * Find the importer with the chosen file filter 279 279 */ … … 286 286 } 287 287 } 288 /* *288 /* 289 289 * If the filter hasn't been changed in the dialog, chosenImporter is null now. 290 290 * When the filter has been set explicitly to AllFormatsImporter, treat this the same. -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r18707 r18871 269 269 */ 270 270 static Map<String, String> getAnonimicDirectorySymbolMap() { 271 /* *maps the anonymized name to the actual used path */271 /* maps the anonymized name to the actual used path */ 272 272 Map<String, String> map = new LinkedHashMap<>(); 273 273 map.put(PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}", getSystemEnv("JAVA_HOME")); -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r18801 r18871 73 73 74 74 static { 75 /* *75 /* 76 76 * Calls validator before upload. 77 77 */ 78 78 UPLOAD_HOOKS.add(new ValidateUploadHook()); 79 79 80 /* *80 /* 81 81 * Fixes database errors 82 82 */ 83 83 UPLOAD_HOOKS.add(new FixDataHook()); 84 84 85 /* *85 /* 86 86 * Checks server capabilities before upload. 87 87 */ 88 88 UPLOAD_HOOKS.add(new ApiPreconditionCheckerHook()); 89 89 90 /* *90 /* 91 91 * Adjusts the upload order of new relations 92 92 */ 93 93 UPLOAD_HOOKS.add(new RelationUploadOrderHook()); 94 94 95 /* *95 /* 96 96 * Removes discardable tags like created_by on modified objects 97 97 */ -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r18494 r18871 56 56 /** 57 57 * MapMode for making parallel ways. 58 * 58 * <p> 59 59 * All calculations are done in projected coordinates. 60 * 60 * <p> 61 61 * TODO: 62 * <p> 62 63 * == Functionality == 63 * 64 * 1.Use selected nodes as split points for the selected ways.65 * 64 * <ol> 65 * <li>Use selected nodes as split points for the selected ways. 66 * <p> 66 67 * The ways containing the selected nodes will be split and only the "inner" 67 * parts will be copied 68 * 69 * 2. Enter exact offset 70 * 71 * 3. Improve snapping 72 * 73 * 4. Visual cues could be better 74 * 75 * 5. (long term) Parallelize and adjust offsets of existing ways 76 * 68 * parts will be copied</li> 69 * <li>Enter exact offset</li> 70 * <li>Improve snapping</li> 71 * <li>Visual cues could be better</li> 72 * <li>(long term) Parallelize and adjust offsets of existing ways</li> 73 * </ol> 77 74 * == Code quality == 78 * 79 * a) The mode, flags, and modifiers might be updated more than necessary. 80 * 81 * Not a performance problem, but better if they where more centralized 82 * 83 * b) Extract generic MapMode services into a super class and/or utility class 84 * 85 * c) Maybe better to simply draw our own source way highlighting? 86 * 75 * <ol type="a"> 76 * <li>The mode, flags, and modifiers might be updated more than necessary. 77 * <p> 78 * Not a performance problem, but better if they where more centralized</li> 79 * <li>Extract generic MapMode services into a super class and/or utility class</li> 80 * <li>Maybe better to simply draw our own source way highlighting?</li> 81 * </ol> 87 82 * Current code doesn't not take into account that ways might been highlighted 88 83 * by other than us. Don't think that situation should ever happen though. … … 352 347 @Override 353 348 public void mouseDragged(MouseEvent e) { 354 // WTF.. the event passed here doesn't have button info?349 // WTF... the event passed here doesn't have button info? 355 350 // Since we get this event from other buttons too, we must check that 356 351 // _BUTTON1_ is down. … … 456 451 modifiers.add(Modifier.SHIFT); 457 452 } 458 return spec.entrySet().stream().allMatch(entry -> modifiers.contains(entry.getKey()) == entry.getValue() .booleanValue());453 return spec.entrySet().stream().allMatch(entry -> modifiers.contains(entry.getKey()) == entry.getValue()); 459 454 } 460 455 … … 465 460 466 461 private void updateFlagsOnlyChangeableOnPress() { 467 copyTags = COPY_TAGS_DEFAULT.get() .booleanValue()!= matchesCurrentModifiers(COPY_TAGS_MODIFIER_COMBO);462 copyTags = COPY_TAGS_DEFAULT.get() != matchesCurrentModifiers(COPY_TAGS_MODIFIER_COMBO); 468 463 } 469 464 470 465 private void updateFlagsChangeableAlways() { 471 snap = SNAP_DEFAULT.get() .booleanValue()!= matchesCurrentModifiers(SNAP_MODIFIER_COMBO);466 snap = SNAP_DEFAULT.get() != matchesCurrentModifiers(SNAP_MODIFIER_COMBO); 472 467 } 473 468 … … 554 549 555 550 KeyboardModifiersProperty(String key, String defaultValue) { 556 super(key, createFromString(defaultValue));551 this(key, createFromString(defaultValue)); 557 552 } 558 553 -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r18732 r18871 42 42 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 43 43 import org.openstreetmap.josm.gui.tagging.ac.AutoCompComboBoxModel; 44 import org.openstreetmap.josm.gui.widgets.JosmComboBoxModel; 44 45 import org.openstreetmap.josm.spi.preferences.Config; 45 46 import org.openstreetmap.josm.tools.Logging; … … 66 67 private static final String SEARCH_EXPRESSION = "searchExpression"; 67 68 68 private static AutoCompComboBoxModel<SearchSetting> model = new AutoCompComboBoxModel<>();69 private static final AutoCompComboBoxModel<SearchSetting> model = new AutoCompComboBoxModel<>(); 69 70 70 71 /** preferences reader/writer with automatic transmogrification to and from String */ 71 private static AutoCompComboBoxModel<SearchSetting>.Preferences prefs = model.prefs(72 private static final JosmComboBoxModel<SearchSetting>.Preferences prefs = model.prefs( 72 73 SearchSetting::readFromString, SearchSetting::writeToString); 73 74 … … 491 492 @Override 492 493 public List<ActionParameter<?>> getActionParameters() { 493 return Collections. <ActionParameter<?>>singletonList(new SearchSettingsActionParameter(SEARCH_EXPRESSION));494 return Collections.singletonList(new SearchSettingsActionParameter(SEARCH_EXPRESSION)); 494 495 } 495 496 } -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r16800 r18871 61 61 62 62 private void init(Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) { 63 /* *63 /* 64 64 * The topological sort is to avoid missing way nodes and missing 65 65 * relation members when adding primitives back to the dataset on undo. … … 160 160 Set<OsmPrimitive> remainingNodes = new HashSet<>(in.size()); 161 161 162 /* *162 /* 163 163 * First add nodes that have no way referrer. 164 164 */ … … 180 180 } 181 181 182 /* *182 /* 183 183 * Then add all ways, each preceded by its (remaining) nodes. 184 184 */ -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r18801 r18871 553 553 */ 554 554 public String encodeAsString(String separator) { 555 return new StringBuilder() 556 .append(minLat).append(separator).append(minLon).append(separator) 557 .append(maxLat).append(separator).append(maxLon).toString(); 555 return minLat + separator + minLon + separator + 556 maxLat + separator + maxLon; 558 557 } 559 558 -
trunk/src/org/openstreetmap/josm/data/StructUtils.java
r18723 r18871 20 20 import java.util.stream.Collectors; 21 21 22 import org.openstreetmap.josm.spi.preferences.IPreferences; 23 import org.openstreetmap.josm.tools.JosmRuntimeException; 24 import org.openstreetmap.josm.tools.Logging; 25 import org.openstreetmap.josm.tools.MultiMap; 26 import org.openstreetmap.josm.tools.ReflectionUtils; 27 import org.openstreetmap.josm.tools.StringParser; 28 import org.openstreetmap.josm.tools.Utils; 29 22 30 import jakarta.json.Json; 23 31 import jakarta.json.JsonArray; … … 30 38 import jakarta.json.JsonWriter; 31 39 32 import org.openstreetmap.josm.spi.preferences.IPreferences;33 import org.openstreetmap.josm.tools.JosmRuntimeException;34 import org.openstreetmap.josm.tools.Logging;35 import org.openstreetmap.josm.tools.MultiMap;36 import org.openstreetmap.josm.tools.ReflectionUtils;37 import org.openstreetmap.josm.tools.StringParser;38 import org.openstreetmap.josm.tools.Utils;39 40 40 /** 41 41 * Utility methods to convert struct-like classes to a string map and back. 42 * 42 * <p> 43 43 * A "struct" is a class that has some fields annotated with {@link StructEntry}. 44 44 * Those fields will be respected when converting an object to a {@link Map} and back. … … 107 107 /** 108 108 * Convenience method that saves a MapListSetting which is provided as a collection of objects. 109 * 109 * <p> 110 110 * Each object is converted to a <code>Map<String, String></code> using the fields with {@link StructEntry} annotation. 111 111 * The field name is the key and the value will be converted to a string. 112 * 112 * <p> 113 113 * Considers only fields that have the {@code @StructEntry} annotation. 114 114 * In addition it does not write fields with null values. (Thus they are cleared) … … 149 149 /** 150 150 * Convert an object to a String Map, by using field names and values as map key and value. 151 * 151 * <p> 152 152 * The field value is converted to a String. 153 * 153 * <p> 154 154 * Only fields with annotation {@link StructEntry} are taken into account. 155 * 155 * <p> 156 156 * Fields will not be written to the map if the value is null or unchanged 157 157 * (compared to an object created with the no-arg-constructor). … … 164 164 * @return the resulting map (same data content as <code>struct</code>) 165 165 */ 166 public static <T> HashMap<String, String> serializeStruct(T struct, Class<T> klass, SerializeOptions... options) {166 public static <T> Map<String, String> serializeStruct(T struct, Class<T> klass, SerializeOptions... options) { 167 167 List<SerializeOptions> optionsList = Arrays.asList(options); 168 168 T structPrototype; … … 173 173 } 174 174 175 HashMap<String, String> hash = new LinkedHashMap<>();175 Map<String, String> hash = new LinkedHashMap<>(); 176 176 for (Field f : getDeclaredFieldsInClassOrSuperTypes(klass)) { 177 177 if (f.getAnnotation(StructEntry.class) == null) { … … 208 208 * Converts a String-Map to an object of a certain class, by comparing map keys to field names of the class and assigning 209 209 * map values to the corresponding fields. 210 * 210 * <p> 211 211 * The map value (a String) is converted to the field type. Supported types are: boolean, Boolean, int, Integer, double, 212 212 * Double, String, Map<String, String> and Map<String, List<String>>. 213 * 213 * <p> 214 214 * Only fields with annotation {@link StructEntry} are taken into account. 215 215 * @param <T> the class … … 219 219 */ 220 220 public static <T> T deserializeStruct(Map<String, String> hash, Class<T> klass) { 221 T struct = null;221 T struct; 222 222 try { 223 223 struct = klass.getConstructor().newInstance(); … … 284 284 @SuppressWarnings({ "rawtypes", "unchecked" }) 285 285 private static Map mapFromJson(String s) { 286 Map ret = null;286 Map ret; 287 287 try (JsonReader reader = Json.createReader(new StringReader(s))) { 288 288 JsonObject object = reader.readObject(); … … 322 322 @SuppressWarnings({ "rawtypes", "unchecked" }) 323 323 private static MultiMap multiMapFromJson(String s) { 324 MultiMap ret = null;324 MultiMap ret; 325 325 try (JsonReader reader = Json.createReader(new StringReader(s))) { 326 326 JsonObject object = reader.readObject(); -
trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java
r16627 r18871 232 232 233 233 private static String getBboxstr(double x1, double x2, double x3, double x4) { 234 return new StringBuilder(64) 235 .append(LATLON_FORMAT.format(x1)) 236 .append(',') 237 .append(LATLON_FORMAT.format(x2)) 238 .append(',') 239 .append(LATLON_FORMAT.format(x3)) 240 .append(',') 241 .append(LATLON_FORMAT.format(x4)) 242 .toString(); 234 return LATLON_FORMAT.format(x1) + 235 ',' + 236 LATLON_FORMAT.format(x2) + 237 ',' + 238 LATLON_FORMAT.format(x3) + 239 ',' + 240 LATLON_FORMAT.format(x4); 243 241 } 244 242 } -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r18703 r18871 28 28 import java.util.Collections; 29 29 import java.util.Deque; 30 import java.util.HashMap; 30 31 import java.util.LinkedHashSet; 31 32 import java.util.LinkedList; … … 231 232 /** 232 233 * Get title of the layer for user display. 233 * 234 * <p> 234 235 * This is either the content of the Title element (if available) or 235 236 * the layer identifier (as fallback) … … 507 508 */ 508 509 private static Collection<Layer> parseContents(XMLStreamReader reader) throws XMLStreamException { 509 Map<String, TileMatrixSet> matrixSetById = new ConcurrentHashMap<>();510 Map<String, TileMatrixSet> matrixSetById = new HashMap<>(); 510 511 Collection<Layer> layers = new ArrayList<>(); 511 512 for (int event = reader.getEventType(); … … 900 901 .replace("{TileRow}", Integer.toString(tiley)) 901 902 .replace("{TileCol}", Integer.toString(tilex)) 902 .replaceAll("(?i)\\{style \\}", this.currentLayer.style);903 .replaceAll("(?i)\\{style}", this.currentLayer.style); 903 904 904 905 for (Dimension d : currentLayer.dimensions) { 905 url = url.replaceAll("(?i)\\{"+d.identifier+" \\}", d.defaultValue);906 url = url.replaceAll("(?i)\\{"+d.identifier+"}", d.defaultValue); 906 907 } 907 908 -
trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Expression.java
r18723 r18871 20 20 /** An empty expression to use */ 21 21 public static final Expression EMPTY_EXPRESSION = new Expression(JsonValue.NULL); 22 private static final String EMPTY_STRING = "";23 22 24 23 private final String mapcssFilterExpression; … … 38 37 this.mapcssFilterExpression = convertToString(array.get(1)) + array.getString(0) + convertToString(array.get(2)); 39 38 } else { 40 this.mapcssFilterExpression = EMPTY_STRING;39 this.mapcssFilterExpression = ""; 41 40 } 42 41 } else { 43 this.mapcssFilterExpression = EMPTY_STRING;42 this.mapcssFilterExpression = ""; 44 43 } 45 44 } else { 46 this.mapcssFilterExpression = EMPTY_STRING;45 this.mapcssFilterExpression = ""; 47 46 } 48 47 } … … 75 74 case NULL: 76 75 default: 77 return EMPTY_STRING;76 return ""; 78 77 } 79 78 } … … 81 80 @Override 82 81 public String toString() { 83 return ! EMPTY_STRING.equals(this.mapcssFilterExpression) ? '[' + this.mapcssFilterExpression + ']' : EMPTY_STRING;82 return !"".equals(this.mapcssFilterExpression) ? '[' + this.mapcssFilterExpression + ']' : ""; 84 83 } 85 84 -
trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java
r18723 r18871 15 15 import java.util.stream.Stream; 16 16 17 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 18 import org.openstreetmap.josm.tools.Utils; 19 17 20 import jakarta.json.JsonArray; 18 21 import jakarta.json.JsonNumber; … … 20 23 import jakarta.json.JsonString; 21 24 import jakarta.json.JsonValue; 22 23 import org.openstreetmap.josm.gui.mappaint.StyleKeys;24 import org.openstreetmap.josm.tools.Utils;25 25 26 26 /** … … 59 59 } 60 60 61 private static final String EMPTY_STRING = "";62 61 private static final char SEMI_COLON = ';'; 63 62 private static final Pattern CURLY_BRACES = Pattern.compile("(\\{(.*?)})"); … … 148 147 break; 149 148 default: 150 this.paintProperties = EMPTY_STRING;149 this.paintProperties = ""; 151 150 } 152 151 } else { 153 this.paintProperties = EMPTY_STRING;152 this.paintProperties = ""; 154 153 } 155 154 } else { 156 this.paintProperties = EMPTY_STRING;155 this.paintProperties = ""; 157 156 } 158 157 this.sourceLayer = layerInfo.getString("source-layer", null); … … 358 357 if (layoutObject.containsKey("text-field")) { 359 358 sb.append(StyleKeys.TEXT).append(':') 360 .append(layoutObject.getString("text-field").replace("}", EMPTY_STRING).replace("{", EMPTY_STRING))359 .append(layoutObject.getString("text-field").replace("}", "").replace("{", "")) 361 360 .append(SEMI_COLON); 362 361 } … … 461 460 public String toString() { 462 461 if (this.filter.toString().isEmpty() && this.paintProperties.isEmpty()) { 463 return EMPTY_STRING;462 return ""; 464 463 } else if (this.type == Type.BACKGROUND) { 465 464 // AFAIK, paint has no zoom levels, and doesn't accept a layer … … 477 476 zoomSelector = MessageFormat.format("|z{0}-{1}", this.minZoom, this.maxZoom); 478 477 } else { 479 zoomSelector = EMPTY_STRING;478 zoomSelector = ""; 480 479 } 481 480 final String commonData = zoomSelector + this.filter.toString() + "::" + this.id + "{" + this.paintProperties + "}"; -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r18801 r18871 316 316 * @return list of history entries 317 317 */ 318 // This needs to return something like a Sequenced Collection (Java 21) 319 @SuppressWarnings({"NonApiType", "squid:S1319"}) 318 320 public LinkedList<Collection<? extends OsmPrimitive>> getSelectionHistory() { 319 321 return selectionHistory; -
trunk/src/org/openstreetmap/josm/data/osm/NodePair.java
r12463 r18871 76 76 @Override 77 77 public String toString() { 78 return new StringBuilder() 79 .append('[') 80 .append(a.getId()) 81 .append(',') 82 .append(b.getId()) 83 .append(']') 84 .toString(); 78 return "[" + 79 a.getId() + 80 ',' + 81 b.getId() + 82 ']'; 85 83 } 86 84 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r18208 r18871 125 125 this.flags = flags; 126 126 127 long order = 0;127 long styleOrder = 0; 128 128 if ((this.flags & FLAG_DISABLED) == 0) { 129 order |= 1;130 } 131 132 order <<= 24;133 order |= floatToFixed(this.style.majorZIndex, 24);129 styleOrder |= 1; 130 } 131 132 styleOrder <<= 24; 133 styleOrder |= floatToFixed(this.style.majorZIndex, 24); 134 134 135 135 // selected on top of member of selected on top of unselected 136 136 // FLAG_DISABLED bit is the same at this point, but we simply ignore it 137 order <<= 4;138 order |= this.flags & 0xf;139 140 order <<= 24;141 order |= floatToFixed(this.style.zIndex, 24);142 143 order <<= 1;137 styleOrder <<= 4; 138 styleOrder |= this.flags & 0xf; 139 140 styleOrder <<= 24; 141 styleOrder |= floatToFixed(this.style.zIndex, 24); 142 143 styleOrder <<= 1; 144 144 // simple node on top of icons and shapes 145 145 if (DefaultStyles.SIMPLE_NODE_ELEMSTYLE.equals(this.style)) { 146 order |= 1;147 } 148 149 this.order = order;146 styleOrder |= 1; 147 } 148 149 this.order = styleOrder; 150 150 } 151 151 … … 245 245 /** 246 246 * Check, if this System has the GlyphVector double translation bug. 247 * 247 * <p> 248 248 * With this bug, <code>gv.setGlyphTransform(i, trfm)</code> has a different 249 249 * effect than on most other systems, namely the translation components … … 251 251 * they actually are. The rotation is unaffected (scale & shear not tested 252 252 * so far). 253 * 253 * <p> 254 254 * This bug has only been observed on Mac OS X, see #7841. 255 * 255 * <p> 256 256 * After switch to Java 7, this test is a false positive on Mac OS X (see #10446), 257 257 * i.e. it returns true, but the real rendering code does not require any special … … 586 586 * Determine, if partial fill should be turned off for this object, because 587 587 * only a small unfilled gap in the center of the area would be left. 588 * 588 * <p> 589 589 * This is used to get a cleaner look for urban regions with many small 590 590 * areas like buildings, etc. … … 623 623 double x = p.getInViewX() + bs.xOffset; 624 624 double y = p.getInViewY() + bs.yOffset; 625 /* *625 /* 626 626 * 627 627 * left-above __center-above___ right-above … … 1017 1017 INode firstNode = viaWay.firstNode(); 1018 1018 INode lastNode = viaWay.lastNode(); 1019 Boolean onewayvia = Boolean.FALSE;1019 boolean onewayvia = Boolean.FALSE; 1020 1020 1021 1021 String onewayviastr = viaWay.get("oneway"); … … 1423 1423 isOutlineOnly = paintSettings.isOutlineOnly(); 1424 1424 1425 antialiasing = PREFERENCE_ANTIALIASING_USE.get() ?1425 antialiasing = Boolean.TRUE.equals(PREFERENCE_ANTIALIASING_USE.get()) ? 1426 1426 RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; 1427 1427 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialiasing); … … 1484 1484 /** 1485 1485 * Fix the clipping area of unclosed polygons for partial fill. 1486 * 1486 * <p> 1487 1487 * The current algorithm for partial fill simply strokes the polygon with a 1488 1488 * large stroke width after masking the outside with a clipping area. 1489 1489 * This works, but for unclosed polygons, the mask can crop the corners at 1490 1490 * both ends (see #12104). 1491 * 1491 * <p> 1492 1492 * This method fixes the clipping area by sort of adding the corners to the 1493 1493 * clip outline. … … 1532 1532 /** 1533 1533 * Get the point to add to the clipping area for partial fill of unclosed polygons. 1534 * 1534 * <p> 1535 1535 * <code>(p1,p2)</code> is the first or last way segment and <code>p3</code> the 1536 1536 * opposite endpoint. … … 1693 1693 } 1694 1694 1695 for (StyleRecord record : sorted) {1696 paintRecord( record);1695 for (StyleRecord styleRecord : sorted) { 1696 paintRecord(styleRecord); 1697 1697 } 1698 1698 … … 1710 1710 } 1711 1711 1712 private void paintRecord(StyleRecord record) {1712 private void paintRecord(StyleRecord styleRecord) { 1713 1713 try { 1714 record.paintPrimitive(paintSettings, this);1714 styleRecord.paintPrimitive(paintSettings, this); 1715 1715 } catch (RuntimeException e) { 1716 throw BugReport.intercept(e).put("record", record);1716 throw BugReport.intercept(e).put("record", styleRecord); 1717 1717 } 1718 1718 } -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r16466 r18871 311 311 */ 312 312 public String getDetails() { 313 return new StringBuilder(256) 314 .append("Sub Grid : ") 315 .append(subGridName) 316 .append("\nParent : ") 317 .append(parentSubGridName) 318 .append("\nCreated : ") 319 .append(created) 320 .append("\nUpdated : ") 321 .append(updated) 322 .append("\nMin Lat : ") 323 .append(minLat) 324 .append("\nMax Lat : ") 325 .append(maxLat) 326 .append("\nMin Lon : ") 327 .append(minLon) 328 .append("\nMax Lon : ") 329 .append(maxLon) 330 .append("\nLat Intvl: ") 331 .append(latInterval) 332 .append("\nLon Intvl: ") 333 .append(lonInterval) 334 .append("\nNode Cnt : ") 335 .append(nodeCount) 336 .toString(); 313 return "Sub Grid : " + 314 subGridName + 315 "\nParent : " + 316 parentSubGridName + 317 "\nCreated : " + 318 created + 319 "\nUpdated : " + 320 updated + 321 "\nMin Lat : " + 322 minLat + 323 "\nMax Lat : " + 324 maxLat + 325 "\nMin Lon : " + 326 minLon + 327 "\nMax Lon : " + 328 maxLon + 329 "\nLat Intvl: " + 330 latInterval + 331 "\nLon Intvl: " + 332 lonInterval + 333 "\nNode Cnt : " + 334 nodeCount; 337 335 } 338 336 -
trunk/src/org/openstreetmap/josm/data/sources/SourceInfo.java
r18246 r18871 86 86 * creation date of the source (in the form YYYY-MM-DD;YYYY-MM-DD, where 87 87 * DD and MM as well as a second date are optional). 88 * 88 * <p> 89 89 * Also used as time filter for WMS time={time} parameter (such as Sentinel-2) 90 90 * @since 11570 … … 106 106 /** category of the imagery (input string, not saved, copied or used otherwise except for error checks) */ 107 107 protected String categoryOriginalString; 108 /* *when adding a field, also adapt the:108 /* when adding a field, also adapt the: 109 109 * {@link #ImageryPreferenceEntry ImageryPreferenceEntry object} 110 110 * {@link #ImageryPreferenceEntry#ImageryPreferenceEntry(ImageryInfo) ImageryPreferenceEntry constructor} … … 149 149 * Check if this object equals another SourceInfo with respect to the properties 150 150 * that get written to the preference file. 151 * 151 * <p> 152 152 * This should be overridden and called in subclasses. 153 153 * … … 219 219 public String toString() { 220 220 // Used in imagery preferences filtering, so must be efficient 221 return n ew StringBuilder(name)222 .append('[').append(countryCode)221 return name + 222 '[' + countryCode + 223 223 // appending the localized country in toString() allows us to filter imagery preferences table with it! 224 .append("] ('").append(getLocalizedCountry(countryCode)).append(')') 225 .append(" - ").append(url) 226 .append(" - ").append(sourceType) 227 .toString(); 224 "] ('" + getLocalizedCountry(countryCode) + ')' + 225 " - " + url + 226 " - " + sourceType; 228 227 } 229 228 -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r18494 r18871 428 428 if (r.isIncomplete()) 429 429 return; 430 /* *array of country codes for which the test should be performed. For now, only Germany */430 /* array of country codes for which the test should be performed. For now, only Germany */ 431 431 String[] countryCodes = {"DE"}; 432 432 TagMap neededtagsForHouse = new TagMap(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r18208 r18871 602 602 */ 603 603 private static Map<List<Way>, List<WaySegment>> findIntersectingWays(Relation r, boolean findSharedWaySegments) { 604 /* *All way segments, grouped by cells */604 /* All way segments, grouped by cells */ 605 605 final Map<Point2D, List<WaySegment>> cellSegments = new HashMap<>(1000); 606 /* *The detected crossing ways */606 /* The detected crossing ways */ 607 607 final Map<List<Way>, List<WaySegment>> crossingWays = new HashMap<>(50); 608 608 -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r18840 r18871 569 569 570 570 /** 571 * Get the detected segments 571 572 * @return the detected segments 572 573 */ -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r18643 r18871 461 461 * @return true if a reasonable connection was found 462 462 */ 463 private boolean isConnectedTo(Node node, LinkedHashSet<Node> visited, double len, Way parent) {463 private boolean isConnectedTo(Node node, Set<Node> visited, double len, Way parent) { 464 464 if (len > maxLen) { 465 465 return false; … … 480 480 if (visited != null) { 481 481 visited.add(node); 482 List<Way> wantedParents = node.getParentWays().stream().filter( pw -> isWantedWay(pw))482 List<Way> wantedParents = node.getParentWays().stream().filter(UnconnectedWays.this::isWantedWay) 483 483 .collect(Collectors.toList()); 484 484 if (wantedParents.size() > 1 && wantedParents.indexOf(parent) != wantedParents.size() - 1) { -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r18759 r18871 215 215 splitPane.setRightComponent(dialogsPanel); 216 216 217 /* *217 /* 218 218 * All additional space goes to the mapView 219 219 */ 220 220 splitPane.setResizeWeight(1.0); 221 221 222 /* *222 /* 223 223 * Some beautifications. 224 224 */ … … 515 515 panel.add(this, BorderLayout.CENTER); 516 516 517 /* *517 /* 518 518 * sideToolBar: add map modes icons 519 519 */ … … 526 526 } 527 527 528 /* *528 /* 529 529 * sideToolBar: add toggle dialogs icons 530 530 */ … … 538 538 } 539 539 540 /* *540 /* 541 541 * sideToolBar: add dynamic popup menu 542 542 */ … … 545 545 sideToolBar.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1)); 546 546 547 /* *547 /* 548 548 * sideToolBar: decide scroll- and visibility 549 549 */ 550 550 if (Config.getPref().getBoolean("sidetoolbar.scrollable", true)) { 551 final ScrollViewport svp = new ScrollViewport(sideToolBar, ScrollViewport.VERTICAL_DIRECTION); 552 sideToolBar = svp; 551 sideToolBar = new ScrollViewport(sideToolBar, ScrollViewport.VERTICAL_DIRECTION); 553 552 } 554 553 sideToolBar.setVisible(SIDE_TOOLBAR_VISIBLE.get()); … … 556 555 SIDE_TOOLBAR_VISIBLE.addListener(sidetoolbarPreferencesChangedListener); 557 556 558 /* *557 /* 559 558 * sideToolBar: add it to the panel 560 559 */ 561 560 panel.add(sideToolBar, BorderLayout.WEST); 562 561 563 /* *562 /* 564 563 * statusLine: add to panel 565 564 */ -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r18574 r18871 45 45 import org.openstreetmap.josm.data.osm.DataSet; 46 46 import org.openstreetmap.josm.data.osm.IPrimitive; 47 import org.openstreetmap.josm.data.osm.IWaySegment; 47 48 import org.openstreetmap.josm.data.osm.Node; 48 49 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 209 210 // The only events that may move/resize this map view are window movements or changes to the map view size. 210 211 // We can clean this up more by only recalculating the state on repaint. 211 private final transient HierarchyListener hierarchyListener = e -> {212 private final transient HierarchyListener hierarchyListenerNavigatableComponent = e -> { 212 213 long interestingFlags = HierarchyEvent.ANCESTOR_MOVED | HierarchyEvent.SHOWING_CHANGED; 213 214 if ((e.getChangeFlags() & interestingFlags) != 0) { … … 216 217 }; 217 218 218 private final transient ComponentAdapter componentListener = new ComponentAdapter() {219 private final transient ComponentAdapter componentListenerNavigatableComponent = new ComponentAdapter() { 219 220 @Override 220 221 public void componentShown(ComponentEvent e) { … … 254 255 public void addNotify() { 255 256 updateLocationState(); 256 addHierarchyListener(hierarchyListener );257 addComponentListener(componentListener );257 addHierarchyListener(hierarchyListenerNavigatableComponent); 258 addComponentListener(componentListenerNavigatableComponent); 258 259 addPrimitiveHoverMouseListeners(); 259 260 super.addNotify(); … … 262 263 @Override 263 264 public void removeNotify() { 264 removeHierarchyListener(hierarchyListener );265 removeComponentListener(componentListener );265 removeHierarchyListener(hierarchyListenerNavigatableComponent); 266 removeComponentListener(componentListenerNavigatableComponent); 266 267 removePrimitiveHoverMouseListeners(); 267 268 super.removeNotify(); … … 290 291 /** 291 292 * Replies the layer which scale is set to. 292 * @return the current scale layer (may be null)293 * @return the current scale layer (may be {@code null}) 293 294 */ 294 295 public NativeScaleLayer getNativeScaleLayer() { … … 324 325 ScaleList scaleList = nativeScaleLayer.getNativeScales(); 325 326 if (scaleList != null) { 326 if ( PROP_ZOOM_INTERMEDIATE_STEPS.get()) {327 if (Boolean.TRUE.equals(PROP_ZOOM_INTERMEDIATE_STEPS.get())) { 327 328 scaleList = scaleList.withIntermediateSteps(PROP_ZOOM_RATIO.get()); 328 329 } … … 366 367 ScaleList scaleList = nativeScaleLayer.getNativeScales(); 367 368 if (scaleList != null) { 368 if ( PROP_ZOOM_INTERMEDIATE_STEPS.get()) {369 if (Boolean.TRUE.equals(PROP_ZOOM_INTERMEDIATE_STEPS.get())) { 369 370 scaleList = scaleList.withIntermediateSteps(PROP_ZOOM_RATIO.get()); 370 371 } … … 478 479 /** 479 480 * Returns the current center of the viewport. 480 * 481 * <p> 481 482 * (Use {@link #zoomTo(EastNorth)} to the change the center.) 482 483 * … … 489 490 /** 490 491 * Returns the current scale. 491 * 492 * <p> 492 493 * In east/north units per pixel. 493 494 * … … 590 591 /** 591 592 * Return the point on the screen where this Coordinate would be. 592 * 593 * <p> 593 594 * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)} 594 595 * @param latlon The point, where this geopoint would be drawn. … … 605 606 /** 606 607 * Return the point on the screen where this Coordinate would be. 607 * 608 * <p> 608 609 * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)} 609 610 * @param latlon The point, where this geopoint would be drawn. … … 616 617 /** 617 618 * Return the point on the screen where this Node would be. 618 * 619 * <p> 619 620 * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)} 620 621 * @param n The node, where this geopoint would be drawn. … … 827 828 for (int i = 0; i < frames && !doStop; i++) { 828 829 final EastNorth z = oldCenter.interpolate(finalNewCenter, (1.0+i) / frames); 829 GuiHelper.runInEDTAndWait(() -> { 830 zoomTo(z); 831 }); 830 GuiHelper.runInEDTAndWait(() -> zoomTo(z)); 832 831 Thread.sleep(sleepTime); 833 832 } … … 1109 1108 if (!nlist.isEmpty()) { 1110 1109 minDistSq = distSq; 1111 nearestList = new ArrayList<>(); 1112 nearestList.addAll(nlist); 1110 nearestList = new ArrayList<>(nlist); 1113 1111 } 1114 1112 } else { … … 1141 1139 /** 1142 1140 * The *result* depends on the current map selection state IF use_selected is true. 1143 * 1141 * <p> 1144 1142 * If more than one node within node.snap-distance pixels is found, 1145 1143 * the nearest node selected is returned IF use_selected is true. 1146 * 1144 * <p> 1147 1145 * Else the nearest new/id=0 node within about the same distance 1148 1146 * as the true nearest node is returned. 1149 * 1147 * <p> 1150 1148 * If no such node is found either, the true nearest node to p is returned. 1151 * 1152 * Finally, if a node is not found at all, nullis returned.1149 * <p> 1150 * Finally, if a node is not found at all, {@code null} is returned. 1153 1151 * 1154 1152 * @param p the screen point … … 1165 1163 /** 1166 1164 * The *result* depends on the current map selection state IF use_selected is true 1167 * 1165 * <p> 1168 1166 * If more than one node within node.snap-distance pixels is found, 1169 1167 * the nearest node selected is returned IF use_selected is true. 1170 * 1168 * <p> 1171 1169 * If there are no selected nodes near that point, the node that is related to some of the preferredRefs 1172 * 1170 * <p> 1173 1171 * Else the nearest new/id=0 node within about the same distance 1174 1172 * as the true nearest node is returned. 1175 * 1173 * <p> 1176 1174 * If no such node is found either, the true nearest node to p is returned. 1177 * 1178 * Finally, if a node is not found at all, nullis returned.1175 * <p> 1176 * Finally, if a node is not found at all, {@code null} is returned. 1179 1177 * 1180 1178 * @param p the screen point … … 1289 1287 * loose some precision to account for possible deviations in the calculation above 1290 1288 * e.g. if identical (A and B) come about reversed in another way, values may differ 1291 * -- zero out least significant 32 dual digits of mantissa. .1289 * -- zero out least significant 32 dual digits of mantissa. 1292 1290 */ 1293 1291 double perDistSq = Double.longBitsToDouble( 1294 1292 Double.doubleToLongBits(a - (a - b + c) * (a - b + c) / 4 / c) 1295 >> 32 << 32); // resolution in numbers with large exponent not needed here. .1293 >> 32 << 32); // resolution in numbers with large exponent not needed here. 1296 1294 1297 1295 if (perDistSq < snapDistanceSq && a < c + snapDistanceSq && b < c + snapDistanceSq) { … … 1462 1460 .flatMap(Collection::stream) 1463 1461 .filter(ws -> wset.add(ws.getWay())) 1464 .map( ws -> ws.getWay())1462 .map(IWaySegment::getWay) 1465 1463 .collect(Collectors.toList()); 1466 1464 if (ignore != null) { … … 1504 1502 * neither does the result *order*. 1505 1503 * It solely depends on the distance to point p. 1506 * 1504 * <p> 1507 1505 * First, nodes will be searched. If there are nodes within BBox found, 1508 1506 * return a collection of those nodes only. 1509 * 1507 * <p> 1510 1508 * If no nodes are found, search for nearest ways. If there are ways 1511 1509 * within BBox found, return a collection of those ways only. 1512 * 1510 * <p> 1513 1511 * If nothing is found, return an empty collection. 1514 1512 * … … 1574 1572 /** 1575 1573 * The *result* depends on the current map selection state IF use_selected is true. 1576 * 1574 * <p> 1577 1575 * IF use_selected is true, use {@link #getNearestNode(Point, Predicate)} to find 1578 1576 * the nearest, selected node. If not found, try {@link #getNearestWaySegment(Point, Predicate)} 1579 1577 * to find the nearest selected way. 1580 * 1578 * <p> 1581 1579 * IF use_selected is false, or if no selected primitive was found, do the following. 1582 * 1580 * <p> 1583 1581 * If the nearest node found is within 4px of p, simply take it. 1584 1582 * Else, find the nearest way segment. Then, if p is closer to its 1585 1583 * middle than to the node, take the way segment, else take the node. 1586 * 1587 * Finally, if no nearest primitive is found at all, return null.1584 * <p> 1585 * Finally, if no nearest primitive is found at all, return {@code null}. 1588 1586 * 1589 1587 * @param p The point on screen. … … 1637 1635 /** 1638 1636 * if r = 0 returns a, if r=1 returns b, 1639 * if r = 0.5 returns center between a and b, etc. .1637 * if r = 0.5 returns center between a and b, etc. 1640 1638 * 1641 1639 * @param r scale value … … 1673 1671 .flatMap(Collection::stream) 1674 1672 .filter(ws -> wset.add(ws.getWay())) 1675 .map( ws -> ws.getWay())1673 .map(IWaySegment::getWay) 1676 1674 .collect(Collectors.toList()); 1677 1675 … … 1724 1722 1725 1723 /** 1726 * Return a ID which is unique as long as viewport dimensions are the same1724 * Return an ID which is unique as long as viewport dimensions are the same 1727 1725 * @return A unique ID, as long as viewport dimensions are the same 1728 1726 */ 1729 1727 public int getViewID() { 1730 1728 EastNorth center = getCenter(); 1731 String x = new StringBuilder().append(center.east())1732 .append('_').append(center.north())1733 .append('_').append(getScale())1734 .append('_').append(getWidth())1735 .append('_').append(getHeight())1736 .append('_').append(getProjection()).toString();1729 String x = String.valueOf(center.east()) + 1730 '_' + center.north() + 1731 '_' + getScale() + 1732 '_' + getWidth() + 1733 '_' + getHeight() + 1734 '_' + getProjection(); 1737 1735 CRC32 id = new CRC32(); 1738 1736 id.update(x.getBytes(StandardCharsets.UTF_8)); -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r18494 r18871 13 13 import java.util.LinkedHashMap; 14 14 import java.util.List; 15 import java.util.Map; 15 16 import java.util.concurrent.CopyOnWriteArrayList; 16 17 import java.util.stream.Collectors; … … 147 148 } 148 149 149 private static LinkedHashMap<String, TileSource> getAllTileSources() {150 private static Map<String, TileSource> getAllTileSources() { 150 151 // using a LinkedHashMap of <id, TileSource> to retain ordering but provide deduplication 151 152 return providers.stream().flatMap( … … 366 367 */ 367 368 public final void refreshTileSources() { 368 final LinkedHashMap<String, TileSource> newTileSources = getAllTileSources();369 final Map<String, TileSource> newTileSources = getAllTileSources(); 369 370 final TileSource currentTileSource = this.getTileController().getTileSource(); 370 371 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java
r17340 r18871 35 35 // editing cells in the first column 36 36 // 37 mergedEntriesTableModel = this.new EntriesTableModel(ListRole.MERGED_ENTRIES) {37 mergedEntriesTableModel = new EntriesTableModel(ListRole.MERGED_ENTRIES) { 38 38 @Override 39 39 public boolean isCellEditable(int row, int column) { 40 switch(column) { 41 case 1: return true; 42 default: return false; 43 } 40 return column == 1; 44 41 } 45 42 }; -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r18686 r18871 175 175 final int n = allDialogs.size(); 176 176 177 /* *177 /* 178 178 * reset the panels 179 179 */ … … 183 183 } 184 184 185 /* *185 /* 186 186 * Add the elements to their respective panel. 187 187 * … … 216 216 final int numPanels = n - k; 217 217 218 /* *218 /* 219 219 * Determine the panel geometry 220 220 */ … … 245 245 } 246 246 247 /* *247 /* 248 248 * If we add additional dialogs on startup (e.g. geoimage), they may 249 249 * not have an actual height yet. … … 255 255 } 256 256 257 /* *total Height */257 /* total Height */ 258 258 final int h = mSpltPane.getMultiSplitLayout().getModel().getBounds().getSize().height; 259 259 260 /* *space, that is available for dialogs in default view (after the reconfiguration) */260 /* space, that is available for dialogs in default view (after the reconfiguration) */ 261 261 final int s2 = h - (numPanels - 1) * DIVIDER_SIZE - sumC; 262 262 … … 264 264 if (hpTrig <= 0) throw new IllegalStateException(); // Must be positive 265 265 266 /* *The new dialog gets a fair share */266 /* The new dialog gets a fair share */ 267 267 final int hnTrig = hpTrig * s2 / (hpTrig + sumP); 268 268 triggeredBy.setPreferredSize(new Dimension(Integer.MAX_VALUE, hnTrig)); 269 269 270 /* *This is remaining for the other default view dialogs */270 /* This is remaining for the other default view dialogs */ 271 271 final int r = s2 - hnTrig; 272 272 273 /* *273 /* 274 274 * Take space only from dialogs that are relatively large 275 275 */ … … 289 289 } 290 290 } 291 /* *adjust, without changing the sum */291 /* adjust, without changing the sum */ 292 292 for (final ToggleDialog dlg : allDialogs) { 293 293 if (dlg != triggeredBy && dlg.isDialogInDefaultView()) { … … 306 306 } 307 307 308 /* *308 /* 309 309 * create Layout 310 310 */ … … 334 334 mSpltPane.revalidate(); 335 335 336 /* *336 /* 337 337 * Hide the Panel, if there is nothing to show 338 338 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r18686 r18871 256 256 this.preferenceClass = prefClass; 257 257 258 /* *Use the full width of the parent element */258 /* Use the full width of the parent element */ 259 259 setPreferredSize(new Dimension(0, preferredHeight)); 260 /* *Override any minimum sizes of child elements so the user can resize freely */260 /* Override any minimum sizes of child elements so the user can resize freely */ 261 261 setMinimumSize(new Dimension(0, 0)); 262 262 this.preferredHeight = Config.getPref().getInt(preferencePrefix+".preferredHeight", preferredHeight); … … 268 268 buttonHiding = propButtonHiding.get(); 269 269 270 /* *show the minimize button */270 /* show the minimize button */ 271 271 titleBar = new TitleBar(name, iconName); 272 272 add(titleBar, BorderLayout.NORTH); … … 293 293 /** 294 294 * The action to toggle the visibility state of this toggle dialog. 295 * 295 * <p> 296 296 * Emits {@link PropertyChangeEvent}s for the property <code>selected</code>: 297 297 * <ul> … … 382 382 @Override 383 383 public void buttonHidden() { 384 if ( (Boolean) toggleAction.getValue("selected")) {384 if (Boolean.TRUE.equals(toggleAction.getValue("selected"))) { 385 385 toggleAction.actionPerformed(null); 386 386 } … … 597 597 // show the help button 598 598 addButton(new JButton(ImageProvider.get("help", ImageProvider.ImageSizes.SMALLICON)), 599 tr("Open help for this panel"), e -> { 600 HelpBrowser.setUrlForHelpTopic(helpTopic()); 601 }); 599 tr("Open help for this panel"), e -> HelpBrowser.setUrlForHelpTopic(helpTopic())); 602 600 603 601 // show the sticky button … … 967 965 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1, buttonRow.size())); 968 966 buttonsPanel.add(buttonRowPanel); 969 for (SideButton button : buttonRow) {970 buttonRowPanel.add( button);971 javax.swing.Action action = button.getAction();967 for (SideButton sideButton : buttonRow) { 968 buttonRowPanel.add(sideButton); 969 javax.swing.Action action = sideButton.getAction(); 972 970 if (action != null) { 973 971 buttonActions.add(action); 974 972 } else { 975 Logging.warn("Button " + button + " doesn't have action defined");973 Logging.warn("Button " + sideButton + " doesn't have action defined"); 976 974 Logging.error(new Exception()); 977 975 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java
r17867 r18871 47 47 INode n3 = w.getNode(2); 48 48 if (n1 != null && n2 != null && n3 != null && w.isClosed()) { 49 /* *do some simple determinant / cross product test on the first 3 nodes50 49 /* do some simple determinant / cross product test on the first 3 nodes 50 to see, if the roundabout goes clock wise or ccw */ 51 51 EastNorth en1 = n1.getEastNorth(); 52 52 EastNorth en2 = n2.getEastNorth(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java
r16886 r18871 7 7 8 8 import java.util.ArrayList; 9 import java.util.Collections; 9 10 import java.util.List; 10 import java.util.stream.Collectors;11 11 12 12 import org.openstreetmap.josm.data.osm.Node; … … 45 45 public List<WayConnectionType> updateLinks(Relation r, List<RelationMember> members) { 46 46 this.members = members; 47 final List<WayConnectionType> con = members.stream() 48 .map(ignore -> (WayConnectionType) null) 49 .collect(Collectors.toList()); 47 final List<WayConnectionType> con = new ArrayList<>(Collections.nCopies(members.size(), null)); 50 48 51 49 firstGroupIdx = 0; … … 165 163 } 166 164 167 private boolean isSuperRoute(Relation r) {165 private static boolean isSuperRoute(Relation r) { 168 166 return r != null && r.hasTag("type", "superroute"); 169 167 } … … 226 224 if (RelationSortUtils.isBackward(m) != reversed) return BACKWARD; 227 225 else return FORWARD; 228 } else { /* *guess the direction and see if it fits with the next member */226 } else { /* guess the direction and see if it fits with the next member */ 229 227 if (determineDirection(i, FORWARD, i+1) != NONE) return FORWARD; 230 228 if (determineDirection(i, BACKWARD, i+1) != NONE) return BACKWARD; … … 332 330 * Determines the direction of way {@code k} with respect to the way {@code ref_i}. 333 331 * The way {@code ref_i} is assumed to have the direction {@code ref_direction} and to be the predecessor of {@code k}. 334 * 332 * <p> 335 333 * If both ways are not linked in any way, NONE is returned. 336 * 334 * <p> 337 335 * Else the direction is given as follows: 338 336 * Let the relation be a route of oneway streets, and someone travels them in the given order. … … 363 361 return NONE; 364 362 365 /* *the list of nodes the way k can dock to */363 /* the list of nodes the way k can dock to */ 366 364 List<Node> refNodes = new ArrayList<>(); 367 365 … … 419 417 } 420 418 421 private boolean isConnected(Way way1, Way way2) {419 private static boolean isConnected(Way way1, Way way2) { 422 420 return way1 != null && way2 != null && way1.isUsable() && way2.isUsable() 423 421 && (way1.isFirstLastNode(way2.firstNode()) || way1.isFirstLastNode(way2.lastNode())); -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryWizardDialog.java
r18218 r18871 16 16 import org.openstreetmap.josm.gui.download.overpass.OverpassWizardRegistration.OverpassWizardCallbacks; 17 17 import org.openstreetmap.josm.gui.tagging.ac.AutoCompComboBoxModel; 18 import org.openstreetmap.josm.gui.widgets.JosmComboBoxModel; 18 19 import org.openstreetmap.josm.tools.Logging; 19 20 import org.openstreetmap.josm.tools.SearchCompilerQueryWizard; … … 29 30 30 31 private static final ListProperty OVERPASS_WIZARD_HISTORY = 31 new ListProperty("download.overpass.wizard", new ArrayList< String>());32 new ListProperty("download.overpass.wizard", new ArrayList<>()); 32 33 private final OverpassWizardCallbacks callbacks; 33 34 … … 37 38 private static final int CANCEL = 2; 38 39 39 private AutoCompComboBoxModel<SearchSetting> model;40 private final AutoCompComboBoxModel<SearchSetting> model; 40 41 41 42 /** preferences reader/writer with automatic transmogrification to and from String */ 42 private AutoCompComboBoxModel<SearchSetting>.Preferences prefs;43 private final JosmComboBoxModel<SearchSetting>.Preferences prefs; 43 44 44 45 /** -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r18801 r18871 200 200 if (e.getButton() == MouseEvent.BUTTON3) { 201 201 Component component = e.getComponent(); 202 if ( POPUP_MENU_ENABLED.get() && component.isShowing()) {202 if (Boolean.TRUE.equals(POPUP_MENU_ENABLED.get()) && component.isShowing()) { 203 203 new TileSourceLayerPopup(e.getX(), e.getY()).show(component, e.getX(), e.getY()); 204 204 } … … 422 422 423 423 private static String getSizeString(int size) { 424 return new StringBuilder().append(size).append('x').append(size).toString();424 return Integer.toString(size) + 'x' + size; 425 425 } 426 426 … … 452 452 getSizeString(tile.getTileSource().getTileSize()))); 453 453 content.add(Arrays.asList(tr("Tile display size"), 454 new StringBuilder().append(displaySize.getWidth())455 .append('x')456 .append(displaySize.getHeight()).toString()));454 Double.toString(displaySize.getWidth()) + 455 'x' + 456 displaySize.getHeight())); 457 457 if (layer.coordinateConverter.requiresReprojection()) { 458 458 content.add(Arrays.asList(tr("Reprojection"), … … 561 561 MapView.addZoomChangeListener(this); 562 562 563 if (this instanceof NativeScaleLayer && NavigatableComponent.PROP_ZOOM_SCALE_FOLLOW_NATIVE_RES_AT_LOAD.get()) {563 if (this instanceof NativeScaleLayer && Boolean.TRUE.equals(NavigatableComponent.PROP_ZOOM_SCALE_FOLLOW_NATIVE_RES_AT_LOAD.get())) { 564 564 event.getMapView().setNativeScaleLayer((NativeScaleLayer) this); 565 565 } … … 640 640 tileSize = tileSource.getTileSize(); 641 641 } 642 /* *642 /* 643 643 * As we can see part of the tile at the top and at the bottom, use Math.ceil(...) + 1 to accommodate for that 644 644 */ … … 646 646 int maxXtiles = (int) Math.ceil((double) width / tileSize + 1); 647 647 int visibleTiles = maxXtiles * maxYtiles; 648 /** 649 * Take into account ZOOM_OFFSET to calculate real number of tiles and multiply by 7, to cover all tiles, that might be 650 * accessed when looking for tiles outside current zoom level. 651 * 652 * Currently we use otherZooms = {1, 2, -1, -2, -3, -4, -5} 653 * 654 * The value should be sum(2^x for x in (-5 to 2)) - 1 655 * -1 to exclude current zoom level 656 * 657 * Check call to tryLoadFromDifferentZoom 658 * @see #tryLoadFromDifferentZoom(Graphics2D, int, List<Tile>,int) 659 * @see #drawInViewArea((Graphics2D, MapView, ProjectionBounds) 660 * 661 * Add +2 to maxYtiles / maxXtiles to add space in cache for extra tiles in current zoom level that are 662 * download by overloadTiles(). This is not added in computation of visibleTiles as this unnecessarily grow the cache size 663 * @see #overloadTiles() 664 */ 665 int ret = (int) Math.ceil( 666 Math.pow(2d, ZOOM_OFFSET.get()) * // use offset to decide, how many tiles are visible 667 visibleTiles * 7 + // 7 to cover tiles from other zooms as described above 668 ((maxYtiles + 2) * (maxXtiles +2))); // to add as many tiles as they will be accessed on current zoom level 648 649 int ret = calculateRealTiles(visibleTiles, maxXtiles, maxYtiles); 669 650 Logging.info("AbstractTileSourceLayer: estimated visible tiles: {0}, estimated cache size: {1}", visibleTiles, ret); 670 651 return ret; 652 } 653 654 /** 655 * Take into account ZOOM_OFFSET to calculate real number of tiles and multiply by 7, to cover all tiles, that might be 656 * accessed when looking for tiles outside current zoom level. 657 * <p> 658 * Currently we use otherZooms = {1, 2, -1, -2, -3, -4, -5} 659 * <p> 660 * The value should be sum(2^x for x in (-5 to 2)) - 1 661 * -1 to exclude current zoom level 662 * <p> 663 * Check call to tryLoadFromDifferentZoom 664 * @see #tryLoadFromDifferentZoom(Graphics2D, int, List, int) 665 * @see #drawInViewArea(Graphics2D, MapView, ProjectionBounds) 666 * 667 * Add +2 to maxYtiles / maxXtiles to add space in cache for extra tiles in current zoom level that are 668 * download by overloadTiles(). This is not added in computation of visibleTiles as this unnecessarily grow the cache size 669 * @see TileSet#overloadTiles() 670 */ 671 private static int calculateRealTiles(int visibleTiles, int maxXtiles, int maxYtiles) { 672 return (int) Math.ceil( 673 Math.pow(2d, ZOOM_OFFSET.get()) * // use offset to decide, how many tiles are visible 674 visibleTiles * 7 + // 7 to cover tiles from other zooms as described above 675 ((maxYtiles + 2) * (maxXtiles +2))); // to add as many tiles as they will be accessed on current zoom level 671 676 } 672 677 … … 1325 1330 */ 1326 1331 private void overloadTiles() { 1327 /* *1332 /* 1328 1333 * consult calculation in estimateTileCacheSize() before changing values here. 1329 1334 * … … 1596 1601 } 1597 1602 if (getDisplaySettings().isAutoZoom()) { 1598 /* *1603 /* 1599 1604 * consult calculation in estimateTileCacheSize() before changing values here. 1600 1605 * … … 1947 1952 * Calculates tiles, that needs to be downloaded to cache, gets a current tile loader and creates a task to download 1948 1953 * all of the tiles. Buffer contains at least one tile. 1949 * 1954 * <p> 1950 1955 * To prevent accidental clear of the queue, new download executor is created with separate queue 1951 1956 * -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r16967 r18871 42 42 public class WMSLayer extends AbstractCachedTileSourceLayer<AbstractWMSTileSource> { 43 43 private static final String PREFERENCE_PREFIX = "imagery.wms"; 44 /* *44 /* 45 45 * Registers all setting properties 46 46 */ … … 148 148 149 149 private Projection chooseProjection(Projection requested) { 150 if (serverProjections.contains(requested.toCode())) { 151 return requested; 152 } else { 150 if (!serverProjections.contains(requested.toCode())) { 153 151 LatLon center = MainApplication.isDisplayingMapView() ? 154 152 requested.eastNorth2latlon(MainApplication.getMap().mapView.getCenter()) : null; … … 173 171 } 174 172 Logging.warn(tr("Unable to find supported projection for layer {0}. Using {1}.", getName(), requested.toCode())); 175 return requested;176 }173 } 174 return requested; 177 175 } 178 176 -
trunk/src/org/openstreetmap/josm/gui/layer/WMTSLayer.java
r16553 r18871 23 23 * WMTS layer based on AbstractTileSourceLayer. Overrides few methods to align WMTS to Tile based computations 24 24 * but most magic is done within WMTSTileSource class. 25 * 25 * <p> 26 26 * Full specification of the protocol available at: 27 * http://www.opengeospatial.org/standards/wmts27 * <a href="https://www.ogc.org/standard/wmts/">OpenGIS Web Map Tile Service Implementation Standard</a> 28 28 * 29 29 * @author Wiktor NiesiobÄ™dzki … … 33 33 private static final String PREFERENCE_PREFIX = "imagery.wmts"; 34 34 35 /* *35 /* 36 36 * Registers all setting properties 37 37 */ -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r18797 r18871 22 22 import java.io.File; 23 23 import java.util.ArrayList; 24 import java.util.Arrays;25 24 import java.util.Collection; 26 25 import java.util.Collections; … … 193 192 this.data.addImageDataUpdateListener(this); 194 193 this.data.setLayer(this); 195 synchronized (ImageViewerDialog.class) { 196 if (!ImageViewerDialog.hasInstance()) { 197 GuiHelper.runInEDTAndWait(ImageViewerDialog::createInstance); 198 } 194 if (!ImageViewerDialog.hasInstance()) { 195 GuiHelper.runInEDTAndWait(() -> { 196 if (!ImageViewerDialog.hasInstance()) { 197 ImageViewerDialog.createInstance(); 198 } 199 }); 199 200 } 200 201 if (getInvalidGeoImages().size() == data.size()) { … … 202 203 // We do have to wrap the EDT call in a worker call, since layers may be created in the EDT. 203 204 // And the layer must be added to the layer list in order for the dialog to work properly. 204 MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> { 205 ImageViewerDialog.getInstance().displayImages(this.getSelection()); 206 })); 205 MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> ImageViewerDialog.getInstance().displayImages(this.getSelection()))); 207 206 } 208 207 } … … 813 812 /** 814 813 * Stop to load thumbnails. 815 * 814 * <p> 816 815 * Can be called at any time to make sure that the 817 816 * thumbnail loader is stopped. … … 826 825 /** 827 826 * Called to signal that the loading of thumbnails has finished. 828 * 827 * <p> 829 828 * Usually called from {@link ThumbsLoader} in another thread. 830 829 */ … … 874 873 return gpxData != null ? MainApplication.getLayerManager().getLayersOfType(GpxLayer.class) 875 874 .stream().filter(l -> gpxData.equals(l.getGpxData())) 876 .findFirst().orElseThrow( () -> new IllegalStateException()) : null;875 .findFirst().orElseThrow(IllegalStateException::new) : null; 877 876 } 878 877 … … 912 911 if (gpxFauxData == null) { 913 912 gpxFauxData = new GpxData(); 914 gpxFauxData.addTrack(new GpxTrack( Arrays.asList(913 gpxFauxData.addTrack(new GpxTrack(Collections.singletonList( 915 914 data.getImages().stream().map(ImageEntry::asWayPoint).filter(Objects::nonNull).collect(toList())), 916 915 Collections.emptyMap())); … … 974 973 @Override 975 974 public Data getData() { 976 return data;975 return getImageData(); 977 976 } 978 977 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r18684 r18871 120 120 private boolean restart; 121 121 122 @SuppressWarnings("DoNotCall") // we are calling `run` from the thread we want it to be running on (aka recursive) 122 123 @Override 123 124 public void run() { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r18753 r18871 240 240 hdopAlpha = Config.getPref().getInt("hdop.color.alpha", -1); 241 241 velocityScale = ColorScale.createHSBScale(256); 242 /* * Colors (without custom alpha channel, if given) for HDOP painting. **/242 /* Colors (without custom alpha channel, if given) for HDOP painting. */ 243 243 hdopScale = ColorScale.createHSBScale(256).makeReversed().addTitle(tr("HDOP")); 244 244 qualityScale = ColorScale.createFixedScale(rtkLibQualityColors).addTitle(tr("Quality")).addColorBarTitles(rtkLibQualityNames); … … 769 769 */ 770 770 private void drawArrows(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 771 /**************************************************************** 772 ********** STEP 3b - DRAW NICE ARROWS ************************** 773 ****************************************************************/ 771 drawArrows3b(g, mv, visibleSegments); 772 drawArrows3c(g, mv, visibleSegments); 773 } 774 775 /**************************************************************** 776 ********** STEP 3b - DRAW NICE ARROWS ************************** 777 ****************************************************************/ 778 private void drawArrows3b(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 774 779 if (lines && arrows && !arrowsFast) { 775 780 Point old = null; … … 798 803 } // end for trkpnt 799 804 } 800 801 /**************************************************************** 802 ********** STEP 3c - DRAW FAST ARROWS ************************** 803 ****************************************************************/ 805 } 806 807 /**************************************************************** 808 ********** STEP 3c - DRAW FAST ARROWS ************************** 809 ****************************************************************/ 810 private void drawArrows3c(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 804 811 if (lines && arrows && arrowsFast) { 805 812 Point old = null; … … 836 843 */ 837 844 private void drawPoints(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 838 /**************************************************************** 839 ********** STEP 3d - DRAW LARGE POINTS AND HDOP CIRCLE ********* 840 ****************************************************************/ 845 drawPointsStep3d(g, mv, visibleSegments); 846 drawPointsStep3e(g, mv, visibleSegments); 847 drawPointsStep3f(g, mv, visibleSegments); 848 } 849 850 /**************************************************************** 851 ********** STEP 3d - DRAW LARGE POINTS AND HDOP CIRCLE ********* 852 ****************************************************************/ 853 private void drawPointsStep3d(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 841 854 if (large || hdopCircle) { 842 final int halfSize = largesize /2;855 final int halfSize = largesize / 2; 843 856 for (WayPoint trkPnt : visibleSegments) { 844 857 LatLon c = trkPnt.getCoor(); … … 855 868 } 856 869 Color customColoringTransparent = hdopAlpha < 0 ? trkPnt.customColoring : 857 new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (hdopAlpha << 24), true);870 new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (hdopAlpha << 24), true); 858 871 g.setColor(customColoringTransparent); 859 872 // hdop circles 860 873 int hdopp = mv.getPoint(new LatLon( 861 874 trkPnt.getCoor().lat(), 862 trkPnt.getCoor().lon() + 2d *6*hdop*360/40000000d)).x - screen.x;863 g.drawArc(screen.x -hdopp/2, screen.y-hdopp/2, hdopp, hdopp, 0, 360);875 trkPnt.getCoor().lon() + 2d * 6 * hdop * 360 / 40000000d)).x - screen.x; 876 g.drawArc(screen.x - hdopp / 2, screen.y - hdopp / 2, hdopp, hdopp, 0, 360); 864 877 } 865 878 if (large) { … … 870 883 } else { 871 884 Color customColoringTransparent = largePointAlpha < 0 ? trkPnt.customColoring : 872 new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (largePointAlpha << 24), true);885 new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (largePointAlpha << 24), true); 873 886 874 887 g.setColor(customColoringTransparent); … … 877 890 } 878 891 } 879 g.fillRect(screen.x -halfSize, screen.y-halfSize, largesize, largesize);892 g.fillRect(screen.x - halfSize, screen.y - halfSize, largesize, largesize); 880 893 } 881 894 } // end for trkpnt 882 895 } // end if large || hdopcircle 883 884 /**************************************************************** 885 ********** STEP 3e - DRAW SMALL POINTS FOR LINES *************** 886 ****************************************************************/ 896 } 897 898 /**************************************************************** 899 ********** STEP 3e - DRAW SMALL POINTS FOR LINES *************** 900 ****************************************************************/ 901 private void drawPointsStep3e(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 887 902 if (!large && lines) { 888 903 g.setColor(neutralColor); … … 899 914 } // end for trkpnt 900 915 } // end if large 901 902 /**************************************************************** 903 ********** STEP 3f - DRAW SMALL POINTS INSTEAD OF LINES ******** 904 ****************************************************************/ 916 } 917 918 /**************************************************************** 919 ********** STEP 3f - DRAW SMALL POINTS INSTEAD OF LINES ******** 920 ****************************************************************/ 921 private void drawPointsStep3f(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) { 905 922 if (!large && !lines) { 906 923 g.setColor(neutralColor); … … 1308 1325 } 1309 1326 1310 boolean bDrawIt = false;1311 1312 1327 // when one of segment is mapped to black 1313 b DrawIt = bDrawIt ||(lastPixelColor == 0) || (thePixelColor == 0);1328 boolean bDrawIt = (lastPixelColor == 0) || (thePixelColor == 0); 1314 1329 1315 1330 // different color -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/LoadAllTilesAction.java
r11950 r18871 2 2 package org.openstreetmap.josm.gui.layer.imagery; 3 3 4 /**5 * Load all tiles.6 * @since 11950 (extracted from {@link AbstractTileSourceLayer})7 */8 4 import static org.openstreetmap.josm.tools.I18n.tr; 9 5 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r18494 r18871 46 46 /** 47 47 * MapCSS selector. 48 * 48 * <p> 49 49 * A rule has two parts, a selector and a declaration block 50 50 * e.g. … … 55 55 * 56 56 * The selector decides, if the declaration block gets applied or not. 57 * 57 * <p> 58 58 * All implementing classes of Selector are immutable. 59 59 */ … … 355 355 private Map<List<Way>, List<WaySegment>> findCrossings(IPrimitive area, 356 356 Map<Point2D, List<WaySegment>> cellSegments) { 357 /* *The detected crossing ways */357 /* The detected crossing ways */ 358 358 Map<List<Way>, List<WaySegment>> crossingWays = new HashMap<>(50); 359 359 if (area instanceof Way) { -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r18603 r18871 765 765 private static void prepareFileChooser(String url, AbstractFileChooser fc) { 766 766 if (Utils.isBlank(url)) return; 767 URL sourceUrl = null;767 URL sourceUrl; 768 768 try { 769 769 sourceUrl = new URL(url); … … 816 816 p.add(new JLabel(tr("URL / File:")), GBC.std().insets(15, 0, 5, 0)); 817 817 p.add(tfURL, GBC.std().insets(0, 0, 5, 5)); 818 JButton fileChooser = new JButton(new LaunchFileChooser Action());818 JButton fileChooser = new JButton(new LaunchFileChooserSourceTypeAction()); 819 819 fileChooser.setMargin(new Insets(0, 0, 0, 0)); 820 820 p.add(fileChooser, GBC.eol().insets(0, 0, 5, 5)); … … 848 848 } 849 849 850 class LaunchFileChooser Action extends AbstractAction {851 LaunchFileChooser Action() {850 class LaunchFileChooserSourceTypeAction extends AbstractAction { 851 LaunchFileChooserSourceTypeAction() { 852 852 new ImageProvider("open").getResource().attachImageIcon(this); 853 853 putValue(SHORT_DESCRIPTION, tr("Launch a file chooser to select a file")); … … 1535 1535 gc.weightx = 0.0; 1536 1536 gc.weighty = 1.0; 1537 add(new JButton(new LaunchFileChooser Action()));1537 add(new JButton(new LaunchFileChooserEditCellAction())); 1538 1538 1539 1539 tfFileName.addFocusListener( … … 1622 1622 } 1623 1623 1624 class LaunchFileChooser Action extends AbstractAction {1625 LaunchFileChooser Action() {1624 class LaunchFileChooserEditCellAction extends AbstractAction { 1625 LaunchFileChooserEditCellAction() { 1626 1626 putValue(NAME, "..."); 1627 1627 putValue(SHORT_DESCRIPTION, tr("Launch a file chooser to select a file")); -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r18801 r18871 24 24 import java.util.Collection; 25 25 import java.util.Collections; 26 import java.util.HashMap; 26 27 import java.util.LinkedList; 27 28 import java.util.List; … … 299 300 return null; 300 301 301 ActionDefinition result= new ActionDefinition(action);302 ActionDefinition actionDefinition = new ActionDefinition(action); 302 303 303 304 if (action instanceof ParameterizedAction) { … … 305 306 306 307 ParameterizedAction parametrizedAction = (ParameterizedAction) action; 307 Map<String, ActionParameter<?>> actionParams = new ConcurrentHashMap<>();308 Map<String, ActionParameter<?>> actionParams = new HashMap<>(); 308 309 for (ActionParameter<?> param: parametrizedAction.getActionParameters()) { 309 310 actionParams.put(param.getName(), param); … … 317 318 ActionParameter<?> actionParam = actionParams.get(paramName); 318 319 if (actionParam != null) { 319 result.getParameters().put(paramName, actionParam.readFromString(paramValue));320 actionDefinition.getParameters().put(paramName, actionParam.readFromString(paramValue)); 320 321 } 321 322 } … … 332 333 String paramValue = readTillChar(',', '}'); 333 334 if ("icon".equals(paramName) && !paramValue.isEmpty()) { 334 result.setIcon(paramValue);335 actionDefinition.setIcon(paramValue); 335 336 } else if ("name".equals(paramName) && !paramValue.isEmpty()) { 336 result.setName(paramValue);337 actionDefinition.setName(paramValue); 337 338 } 338 339 skip(','); … … 341 342 } 342 343 343 return result;344 return actionDefinition; 344 345 } 345 346 … … 798 799 private JButton createButton(String name) { 799 800 JButton b = new JButton(); 800 if ("up".equals(name)) { 801 b.setIcon(ImageProvider.get("dialogs", "up", ImageSizes.LARGEICON)); 802 b.setToolTipText(tr("Move the currently selected members up")); 803 } else if ("down".equals(name)) { 804 b.setIcon(ImageProvider.get("dialogs", "down", ImageSizes.LARGEICON)); 805 b.setToolTipText(tr("Move the currently selected members down")); 806 } else if ("<".equals(name)) { 807 b.setIcon(ImageProvider.get("dialogs/conflict", "copybeforecurrentright", ImageSizes.LARGEICON)); 808 b.setToolTipText(tr("Add all objects selected in the current dataset before the first selected member")); 809 } else if (">".equals(name)) { 810 b.setIcon(ImageProvider.get("dialogs", "delete", ImageSizes.LARGEICON)); 811 b.setToolTipText(tr("Remove")); 801 switch (name) { 802 case "up": 803 b.setIcon(ImageProvider.get("dialogs", "up", ImageSizes.LARGEICON)); 804 b.setToolTipText(tr("Move the currently selected members up")); 805 break; 806 case "down": 807 b.setIcon(ImageProvider.get("dialogs", "down", ImageSizes.LARGEICON)); 808 b.setToolTipText(tr("Move the currently selected members down")); 809 break; 810 case "<": 811 b.setIcon(ImageProvider.get("dialogs/conflict", "copybeforecurrentright", ImageSizes.LARGEICON)); 812 b.setToolTipText(tr("Add all objects selected in the current dataset before the first selected member")); 813 break; 814 case ">": 815 b.setIcon(ImageProvider.get("dialogs", "delete", ImageSizes.LARGEICON)); 816 b.setToolTipText(tr("Remove")); 817 break; 818 default: 819 // do nothing 812 820 } 813 821 b.addActionListener(moveAction); … … 1044 1052 continue; 1045 1053 } else if (!(tb instanceof String)) { 1046 if (!(tb instanceof Boolean) || (Boolean) tb) {1054 if (!(tb instanceof Boolean) || Boolean.TRUE.equals(tb)) { 1047 1055 Logging.info(tr("Strange toolbar value: {0}", 1048 1056 action.getClass().getName())); … … 1162 1170 /** 1163 1171 * Parse the toolbar preference setting and construct the toolbar GUI control. 1164 * 1172 * <p> 1165 1173 * Call this, if anything has changed in the toolbar settings and you want to refresh 1166 1174 * the toolbar content (e.g. after registering actions in a plugin) -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r18781 r18871 216 216 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 217 217 if (columnIndex == 1 && aValue instanceof Color) { 218 data.get(rowIndex).info.setValue((Color) aValue);218 getEntry(rowIndex).info.setValue((Color) aValue); 219 219 fireTableCellUpdated(rowIndex, columnIndex); 220 220 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheSettingsPanel.java
r18186 r18871 9 9 import java.util.ArrayList; 10 10 import java.util.Comparator; 11 import java.util.HashMap; 11 12 import java.util.List; 12 13 import java.util.Locale; … … 14 15 import java.util.Map.Entry; 15 16 import java.util.Set; 16 import java.util.concurrent.ConcurrentHashMap;17 17 18 18 import javax.swing.AbstractAction; … … 120 120 public static String[][] getCacheStats(CacheAccess<String, BufferedImageCacheEntry> cache) { 121 121 Set<String> keySet = cache.getCacheControl().getKeySet(); 122 Map<String, int[]> temp = new ConcurrentHashMap<>(); // use int[] as a Object reference to int, gives better performance122 Map<String, int[]> temp = new HashMap<>(); // use int[] as a Object reference to int, gives better performance 123 123 for (String key: keySet) { 124 124 String[] keyParts = key.split(":", 2); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r18694 r18871 306 306 boolean requiresRestart = PluginHandler.removePlugins(deactivatedPlugins); 307 307 if (requiresRestart) 308 return requiresRestart;308 return true; 309 309 } 310 310 return model.getNewlyActivatedPlugins().stream().anyMatch(pi -> !pi.canloadatruntime); … … 521 521 // It removes a list item mark at the beginning of the line: +, -, * 522 522 // It removes the version number after the plugin, like: 123, (123), (v5.7alpha3), (1b3), (v1-SNAPSHOT-1)... 523 Pattern regex = Pattern.compile("^[-+ \\*\\s]*|\\s[\\d\\s]*(\\([^\\(\\)\\[\\]]*\\))?[\\d\\s]*$");523 Pattern regex = Pattern.compile("^[-+*\\s]*|\\s[\\d\\s]*(\\([^()\\[\\]]*\\))?[\\d\\s]*$"); 524 524 for (String line : lines) { 525 525 String name = regex.matcher(line).replaceAll(""); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r18417 r18871 51 51 /** 52 52 * Projection preferences. 53 * 53 * <p> 54 54 * How to add new Projections: 55 55 * - Find EPSG code for the projection. 56 * - Look up the parameter string for Proj4, e.g. on http://spatialreference.org/56 * - Look up the parameter string for Proj4, e.g. on <a href="https://spatialreference.org">https://spatialreference.org</a>/ 57 57 * and add it to the file 'data/projection/epsg' in JOSM trunk 58 58 * - Search for official references and verify the parameter values. These 59 59 * documents are often available in the local language only. 60 60 * - Use {@link #registerProjectionChoice}, to make the entry known to JOSM. 61 * 61 * <p> 62 62 * In case there is no EPSG code: 63 63 * - override {@link AbstractProjectionChoice#getProjection()} and provide … … 87 87 /** 88 88 * Mercator Projection. 89 * 89 * <p> 90 90 * The center of the mercator projection is always the 0 grad coordinate. 91 * 92 * See also USGS Bulletin 1532 (http://pubs.usgs.gov/bul/1532/report.pdf)93 * initially EPSG used 3785 but that has been superseded by 3857, see https://www.epsg-registry.org/91 * <p> 92 * See also <a href="https://pubs.usgs.gov/bul/1532/report.pdf">USGS Bulletin 1532</a> 93 * initially EPSG used 3785 but that has been superseded by 3857, see <a href="https://www.epsg-registry.org/">epsg-registry.org</a> 94 94 */ 95 95 public static final ProjectionChoice mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 3857); … … 97 97 /** 98 98 * Lambert conic conform 4 zones using the French geodetic system NTF. 99 * 99 * <p> 100 100 * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy. 101 101 * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal) 102 * 103 * Source: http://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf102 * <p> 103 * Source: <a href="https://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf">Changement_systeme_geodesique.pdf</a> 104 104 */ 105 105 public static final ProjectionChoice lambert = new LambertProjectionChoice(); … … 107 107 /** 108 108 * French regions in the Caribbean Sea and Indian Ocean. 109 * 109 * <p> 110 110 * Using the UTM transvers Mercator projection and specific geodesic settings. 111 111 */ … … 114 114 /** 115 115 * Lambert Conic Conform 9 Zones projection. 116 * 116 * <p> 117 117 * As specified by the IGN in this document 118 * http://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf118 * <a href="https://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf">cc9zones.pdf</a> 119 119 */ 120 120 public static final ProjectionChoice lambert_cc9 = new LambertCC9ZonesProjectionChoice(); … … 122 122 static { 123 123 124 /* ***********************124 /* *********************** 125 125 * Global projections. 126 126 */ 127 127 128 /* *128 /* * 129 129 * UTM. 130 130 */ 131 131 registerProjectionChoice(new UTMProjectionChoice()); 132 132 133 /* ***********************133 /* *********************** 134 134 * Regional - alphabetical order by country code. 135 135 */ 136 136 137 /* *137 /* 138 138 * Belgian Lambert 72 projection. 139 * 139 * <p> 140 140 * As specified by the Belgian IGN in this document: 141 141 * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf … … 145 145 registerProjectionChoice(tr("Belgian Lambert 1972"), "core:belgianLambert1972", 31370); // BE 146 146 147 /* *147 /* 148 148 * Belgian Lambert 2008 projection. 149 * 149 * <p> 150 150 * As specified by the Belgian IGN in this document: 151 151 * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf … … 155 155 registerProjectionChoice(tr("Belgian Lambert 2008"), "core:belgianLambert2008", 3812); // BE 156 156 157 /* *157 /* 158 158 * SwissGrid CH1903 / L03, see https://en.wikipedia.org/wiki/Swiss_coordinate_system. 159 * 159 * <p> 160 160 * Actually, what we have here, is CH1903+ (EPSG:2056), but without 161 161 * the additional false easting of 2000km and false northing 1000 km. 162 * 162 * <p> 163 163 * To get to CH1903, a shift file is required. So currently, there are errors 164 164 * up to 1.6m (depending on the location). … … 168 168 registerProjectionChoice(new GaussKruegerProjectionChoice()); // DE 169 169 170 /* *170 /* 171 171 * Estonian Coordinate System of 1997. 172 * 172 * <p> 173 173 * Thanks to Johan Montagnat and its geoconv java converter application 174 174 * (https://www.i3s.unice.fr/~johan/gps/ , published under GPL license) … … 177 177 registerProjectionChoice(tr("Lambert Zone (Estonia)"), "core:lambertest", 3301); // EE 178 178 179 /* *179 /* 180 180 * Lambert conic conform 4 zones using the French geodetic system NTF. 181 * 181 * <p> 182 182 * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy. 183 183 * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal) 184 * 185 * Source: http ://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf184 * <p> 185 * Source: https://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf 186 186 * @author Pieren 187 187 */ 188 188 registerProjectionChoice(lambert); // FR 189 189 190 /* *190 /* 191 191 * Lambert 93 projection. 192 * 192 * <p> 193 193 * As specified by the IGN in this document 194 * http ://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/Lambert-93.pdf194 * https://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/Lambert-93.pdf 195 195 * @author Don-vip 196 196 */ 197 197 registerProjectionChoice(tr("Lambert 93 (France)"), "core:lambert93", 2154); // FR 198 198 199 /* *199 /* 200 200 * Lambert Conic Conform 9 Zones projection. 201 * 201 * <p> 202 202 * As specified by the IGN in this document 203 * http ://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf203 * https://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf 204 204 * @author Pieren 205 205 */ 206 206 registerProjectionChoice(lambert_cc9); // FR 207 207 208 /* *208 /* 209 209 * French departements in the Caribbean Sea and Indian Ocean. 210 * 210 * <p> 211 211 * Using the UTM transvers Mercator projection and specific geodesic settings. 212 212 */ 213 213 registerProjectionChoice(utm_france_dom); // FR 214 214 215 /* *215 /* 216 216 * LKS-92/ Latvia TM projection. 217 * 217 * <p> 218 218 * Based on data from spatialreference.org. 219 * http ://spatialreference.org/ref/epsg/3059/219 * https://spatialreference.org/ref/epsg/3059/ 220 220 * 221 221 * @author Viesturs Zarins … … 223 223 registerProjectionChoice(tr("LKS-92 (Latvia TM)"), "core:tmerclv", 3059); // LV 224 224 225 /* *225 /* 226 226 * Netherlands RD projection 227 227 * … … 230 230 registerProjectionChoice(tr("Rijksdriehoekscoördinaten (Netherlands)"), "core:dutchrd", 28992); // NL 231 231 232 /* *232 /* 233 233 * PUWG 1992 and 2000 are the official cordinate systems in Poland. 234 * 234 * <p> 235 235 * They use the same math as UTM only with different constants. 236 236 * … … 239 239 registerProjectionChoice(new PuwgProjectionChoice()); // PL 240 240 241 /* *241 /* 242 242 * SWEREF99 projections. Official coordinate system in Sweden. 243 243 */ … … 245 245 registerProjectionChoice(tr("SWEREF99 13 30 / EPSG:3008 (Sweden)"), "core:sweref99", 3008); // SE 246 246 247 /* ***********************247 /* *********************** 248 248 * Projection by Code. 249 249 */ 250 250 registerProjectionChoice(new CodeProjectionChoice()); 251 251 252 /* ***********************252 /* *********************** 253 253 * Custom projection. 254 254 */ -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java
r18683 r18871 35 35 */ 36 36 public class TaggingPresetMenu extends TaggingPreset { 37 /** The menu to show users */ 37 38 public JMenu menu; // set by TaggingPresets 38 39 … … 73 74 public void setDisplayName() { 74 75 putValue(Action.NAME, getName()); 75 /* *Tooltips should be shown for the toolbar buttons, but not in the menu. */76 /* Tooltips should be shown for the toolbar buttons, but not in the menu. */ 76 77 putValue(OPTIONAL_TOOLTIP_TEXT, group != null ? 77 78 tr("Preset group {1} / {0}", getLocaleName(), group.getName()) : -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r18342 r18871 167 167 */ 168 168 public static Collection<TaggingPreset> readAll(Reader in, boolean validate) throws SAXException { 169 return readAll(in, validate, new HashSetWithLast< TaggingPreset>());169 return readAll(in, validate, new HashSetWithLast<>()); 170 170 } 171 171 … … 181 181 XmlObjectParser parser = buildParser(); 182 182 183 /* *to detect end of {@code <checkgroup>} */183 /* to detect end of {@code <checkgroup>} */ 184 184 CheckGroup lastcheckgroup = null; 185 /* *to detect end of {@code <group>} */185 /* to detect end of {@code <group>} */ 186 186 TaggingPresetMenu lastmenu = null; 187 /* *to detect end of reused {@code <group>} */187 /* to detect end of reused {@code <group>} */ 188 188 TaggingPresetMenu lastmenuOriginal = null; 189 189 Roles lastrole = null; … … 192 192 final Map<String, List<Object>> byId = new HashMap<>(); 193 193 final Deque<String> lastIds = new ArrayDeque<>(); 194 /* *lastIdIterators contains non empty iterators of items to be handled before obtaining the next item from the XML parser */194 /* lastIdIterators contains non empty iterators of items to be handled before obtaining the next item from the XML parser */ 195 195 final Deque<Iterator<Object>> lastIdIterators = new ArrayDeque<>(); 196 196 … … 351 351 */ 352 352 public static Collection<TaggingPreset> readAll(String source, boolean validate) throws SAXException, IOException { 353 return readAll(source, validate, new HashSetWithLast< TaggingPreset>());353 return readAll(source, validate, new HashSetWithLast<>()); 354 354 } 355 355 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java
r18692 r18871 242 242 return tags.containsKey(key); 243 243 case KEY_VALUE: 244 return tags.containsKey(key) && getValues().contains(tags.get(key)) ? Boolean.TRUE : null;244 return (tags.containsKey(key) && getValues().contains(tags.get(key))) ? Boolean.TRUE : null; 245 245 case KEY_VALUE_REQUIRED: 246 246 return tags.containsKey(key) && getValues().contains(tags.get(key)); -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r18801 r18871 1120 1120 @Override 1121 1121 public String toString() { 1122 return new StringBuilder("MultiSplitLayout.Leaf \"") 1123 .append(getName()) 1124 .append("\" weight=") 1125 .append(getWeight()) 1126 .append(' ') 1127 .append(getBounds()) 1128 .toString(); 1122 return "MultiSplitLayout.Leaf \"" + 1123 getName() + 1124 "\" weight=" + 1125 getWeight() + 1126 ' ' + 1127 getBounds(); 1129 1128 } 1130 1129 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r18801 r18871 307 307 */ 308 308 protected final String toXml(IPrimitive o, boolean addBody) { 309 StringWriter s writer = new StringWriter();310 try (OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(s writer), true, version)) {311 s writer.getBuffer().setLength(0);309 StringWriter stringWriter = new StringWriter(); 310 try (OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(stringWriter), true, version)) { 311 stringWriter.getBuffer().setLength(0); 312 312 osmWriter.setWithBody(addBody); 313 313 osmWriter.setChangeset(changeset); … … 319 319 Logging.warn(e); 320 320 } 321 return s writer.toString();321 return stringWriter.toString(); 322 322 } 323 323 … … 328 328 */ 329 329 protected final String toXml(Changeset s) { 330 StringWriter s writer = new StringWriter();331 try (OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(s writer), true, version)) {332 s writer.getBuffer().setLength(0);330 StringWriter stringWriter = new StringWriter(); 331 try (OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(stringWriter), true, version)) { 332 stringWriter.getBuffer().setLength(0); 333 333 osmWriter.header(); 334 334 osmWriter.visit(s); … … 338 338 Logging.warn(e); 339 339 } 340 return s writer.toString();340 return stringWriter.toString(); 341 341 } 342 342 … … 348 348 rv.append('/'); 349 349 // this works around a ruby (or lighttpd) bug where two consecutive slashes in 350 // a nURL will cause a "404 not found" response.350 // a URL will cause a "404 not found" response. 351 351 int p; 352 352 while ((p = rv.indexOf("//", rv.indexOf("://")+2)) > -1) { … … 456 456 * Creates a new changeset based on the keys in <code>changeset</code>. If this 457 457 * method succeeds, changeset.getId() replies the id the server assigned to the new changeset 458 * 458 * <p> 459 459 * The changeset must not be null, but its key/value-pairs may be empty. 460 460 * … … 741 741 /** 742 742 * Generic method for sending requests to the OSM API. 743 * 743 * <p> 744 744 * This method will automatically re-try any requests that are answered with a 5xx 745 745 * error code, or that resulted in a timeout exception from the TCP layer. … … 851 851 } catch (IOException e) { 852 852 throw new OsmTransferException(e); 853 } catch (OsmTransferException e) {854 throw e;855 853 } 856 854 } … … 922 920 public Note createNote(LatLon latlon, String text, ProgressMonitor monitor) throws OsmTransferException { 923 921 initialize(monitor); 924 String noteUrl = new StringBuilder() 925 .append("notes?lat=") 926 .append(latlon.lat()) 927 .append("&lon=") 928 .append(latlon.lon()) 929 .append("&text=") 930 .append(Utils.encodeUrl(text)).toString(); 922 String noteUrl = "notes?lat=" + 923 latlon.lat() + 924 "&lon=" + 925 latlon.lon() + 926 "&text=" + 927 Utils.encodeUrl(text); 931 928 932 929 return parseSingleNote(sendPostRequest(noteUrl, null, monitor)); -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r13901 r18871 40 40 if (locator == null) 41 41 return ""; 42 return new StringBuilder().append('(').append(locator.getLineNumber())43 .append(',').append(locator.getColumnNumber()).append(')').toString();42 return "(" + locator.getLineNumber() + 43 ',' + locator.getColumnNumber() + ')'; 44 44 } 45 45 -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r17417 r18871 314 314 default: // Do nothing 315 315 } 316 /* *316 /* 317 317 * Did not recognize the element, so the new state is UNKNOWN. 318 318 * This includes the case where we are already inside an unknown -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r18801 r18871 313 313 /** 314 314 * Returns URL for accessing GetMap service. String will contain following parameters: 315 * * {proj} - that needs to be replaced with projection (one of {@link #getServerProjections(List)}) 316 * * {width} - that needs to be replaced with width of the tile 317 * * {height} - that needs to be replaces with height of the tile 318 * * {bbox} - that needs to be replaced with area that should be fetched (in {proj} coordinates) 319 * 315 * <ul> 316 * <li>{proj} - that needs to be replaced with projection (one of {@link #getServerProjections(List)})</li> 317 * <li>{width} - that needs to be replaced with width of the tile</li> 318 * <li>{height} - that needs to be replaces with height of the tile</li> 319 * <li>{bbox} - that needs to be replaced with area that should be fetched (in {proj} coordinates)</li> 320 * </ul> 320 321 * Format of the response will be calculated using {@link #getPreferredFormat()} 321 322 * … … 333 334 /** 334 335 * Returns URL for accessing GetMap service. String will contain following parameters: 335 * * {proj} - that needs to be replaced with projection (one of {@link #getServerProjections(List)}) 336 * * {width} - that needs to be replaced with width of the tile 337 * * {height} - that needs to be replaces with height of the tile 338 * * {bbox} - that needs to be replaced with area that should be fetched (in {proj} coordinates) 339 * 336 * <ul> 337 * <li>{proj} - that needs to be replaced with projection (one of {@link #getServerProjections(List)})</li> 338 * <li>{width} - that needs to be replaced with width of the tile</li> 339 * <li>{height} - that needs to be replaces with height of the tile</li> 340 * <li>{bbox} - that needs to be replaced with area that should be fetched (in {proj} coordinates)</li> 341 * </ul> 340 342 * Format of the response will be calculated using {@link #getPreferredFormat()} 341 343 * … … 411 413 boolean ret = a.equals(b); 412 414 if (ret) { 413 return ret;415 return true; 414 416 } 415 417 … … 488 490 489 491 private void parseRequest(XMLStreamReader reader) throws XMLStreamException { 490 String mode = "";491 String getMapUrl = "";492 String mode; 493 String newGetMapUrl = ""; 492 494 if (GetCapabilitiesParseHelper.moveReaderToTag(reader, this::tagEquals, QN_GETMAP)) { 493 495 for (int event = reader.getEventType(); … … 506 508 mode = reader.getName().getLocalPart(); 507 509 if (GetCapabilitiesParseHelper.moveReaderToTag(reader, this::tagEquals, QN_ONLINE_RESOURCE)) { 508 getMapUrl = reader.getAttributeValue(GetCapabilitiesParseHelper.XLINK_NS_URL, "href");510 newGetMapUrl = reader.getAttributeValue(GetCapabilitiesParseHelper.XLINK_NS_URL, "href"); 509 511 } 510 512 // TODO should we handle also POST? 511 if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !getMapUrl.isEmpty()) {513 if ("GET".equalsIgnoreCase(mode) && newGetMapUrl != null && !newGetMapUrl.isEmpty()) { 512 514 try { 513 String query = new URL( getMapUrl).getQuery();515 String query = new URL(newGetMapUrl).getQuery(); 514 516 if (query == null) { 515 this.getMapUrl = getMapUrl + "?";517 this.getMapUrl = newGetMapUrl + "?"; 516 518 } else { 517 this.getMapUrl = getMapUrl;519 this.getMapUrl = newGetMapUrl; 518 520 } 519 521 } catch (MalformedURLException e) { … … 581 583 private void parseAndAddStyle(XMLStreamReader reader, LayerDetails ld) throws XMLStreamException { 582 584 String name = null; 583 String title = null;585 String styleTitle = null; 584 586 for (int event = reader.getEventType(); 585 587 reader.hasNext() && !(event == XMLStreamReader.END_ELEMENT && tagEquals(QN_STYLE, reader.getName())); … … 590 592 } 591 593 if (tagEquals(QN_TITLE, reader.getName())) { 592 title = reader.getElementText();594 styleTitle = reader.getElementText(); 593 595 } 594 596 } … … 597 599 name = ""; 598 600 } 599 ld.addStyle(name, title);601 ld.addStyle(name, styleTitle); 600 602 } 601 603 … … 665 667 666 668 private static String normalizeUrl(String serviceUrlStr) throws MalformedURLException { 667 URL getCapabilitiesUrl = null;668 String ret = null;669 URL getCapabilitiesUrl; 670 String ret; 669 671 670 672 if (!Pattern.compile(".*GetCapabilities.*", Pattern.CASE_INSENSITIVE).matcher(serviceUrlStr).matches()) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r18581 r18871 196 196 } 197 197 198 /* *198 /* 199 199 * deselect objects if parameter addtags given 200 200 */ -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadDataHandler.java
r18304 r18871 82 82 validateDownloadParams(); 83 83 this.data = args.get("data"); 84 /* *84 /* 85 85 * Holds the mime type. Currently only OSM_MIME_TYPE is supported 86 86 * But it could be extended to text/csv, application/gpx+xml, ... or even binary encoded data -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r18801 r18871 89 89 * Handles self-intersections too. 90 90 * And makes commands to add the intersection points to ways. 91 * 91 * <p> 92 92 * Prerequisite: no two nodes have the same coordinates. 93 93 * … … 244 244 /** 245 245 * Tests if given point is to the right side of path consisting of 3 points. 246 * 246 * <p> 247 247 * (Imagine the path is continued beyond the endpoints, so you get two rays 248 248 * starting from lineP2 and going through lineP1 and lineP3 respectively … … 532 532 /** 533 533 * This method tests if secondNode is clockwise to first node. 534 * 534 * <p> 535 535 * The line through the two points commonNode and firstNode divides the 536 536 * plane into two parts. The test returns true, if secondNode lies in … … 564 564 */ 565 565 public static Area getArea(List<? extends INode> polygon) { 566 Path2D path = new Path2D.Double( );566 Path2D path = new Path2D.Double(Path2D.WIND_NON_ZERO, polygon.size()); 567 567 568 568 boolean begin = true; … … 842 842 /** 843 843 * Determines whether a way is oriented clockwise. 844 * 844 * <p> 845 845 * Internals: Assuming a closed non-looping way, compute twice the area 846 846 * of the polygon using the formula {@code 2 * area = sum (X[n] * Y[n+1] - X[n+1] * Y[n])}. 847 847 * If the area is negative the way is ordered in a clockwise direction. 848 * 849 * See http://paulbourke.net/geometry/polyarea/ 848 * <p> 849 * See <a href="https://web.archive.org/web/20120722100030/http://paulbourke.net/geometry/polyarea/"> 850 * https://paulbourke.net/geometry/polyarea/ 851 * </a> 850 852 * 851 853 * @param w the way to be checked. … … 994 996 /** 995 997 * Compute the center of the circle closest to different nodes. 996 * 998 * <p> 997 999 * Ensure exact center computation in case nodes are already aligned in circle. 998 1000 * This is done by least square method. … … 1013 1015 int nc = nodes.size(); 1014 1016 if (nc < 3) return null; 1015 /* *1017 /* 1016 1018 * Equation of each bisector ax + by + c = 0 1017 1019 */ … … 1160 1162 if (!polygon.isClosed() || polygon.getNodesCount() <= 3) 1161 1163 return res; 1162 /* *polygon area in east north space, calculated only when really needed */1164 /* polygon area in east north space, calculated only when really needed */ 1163 1165 Area polygonArea = null; 1164 1166 for (IPrimitive p : primitives) { … … 1283 1285 /** 1284 1286 * Calculate area and perimeter length of a polygon. 1285 * 1287 * <p> 1286 1288 * Uses current projection; units are that of the projected coordinates. 1287 1289 * … … 1327 1329 * Get the closest primitive to {@code osm} from the collection of 1328 1330 * OsmPrimitive {@code primitives} 1329 * 1331 * <p> 1330 1332 * The {@code primitives} should be fully downloaded to ensure accuracy. 1331 * 1333 * <p> 1332 1334 * Note: The complexity of this method is O(n*m), where n is the number of 1333 1335 * children {@code osm} has plus 1, m is the number of children the … … 1351 1353 * Get the closest primitives to {@code osm} from the collection of 1352 1354 * OsmPrimitive {@code primitives} 1353 * 1355 * <p> 1354 1356 * The {@code primitives} should be fully downloaded to ensure accuracy. 1355 * 1357 * <p> 1356 1358 * Note: The complexity of this method is O(n*m), where n is the number of 1357 1359 * children {@code osm} has plus 1, m is the number of children the … … 1386 1388 * Get the furthest primitive to {@code osm} from the collection of 1387 1389 * OsmPrimitive {@code primitives} 1388 * 1390 * <p> 1389 1391 * The {@code primitives} should be fully downloaded to ensure accuracy. 1390 * 1392 * <p> 1391 1393 * It does NOT give the furthest primitive based off of the furthest 1392 1394 * part of that primitive 1393 * 1395 * <p> 1394 1396 * Note: The complexity of this method is O(n*m), where n is the number of 1395 1397 * children {@code osm} has plus 1, m is the number of children the … … 1412 1414 * Get the furthest primitives to {@code osm} from the collection of 1413 1415 * OsmPrimitive {@code primitives} 1414 * 1416 * <p> 1415 1417 * The {@code primitives} should be fully downloaded to ensure accuracy. 1416 * 1418 * <p> 1417 1419 * It does NOT give the furthest primitive based off of the furthest 1418 1420 * part of that primitive 1419 * 1421 * <p> 1420 1422 * Note: The complexity of this method is O(n*m), where n is the number of 1421 1423 * children {@code osm} has plus 1, m is the number of children the … … 1454 1456 * (or the unit of the current projection, see {@link Projection}). 1455 1457 * May return {@link Double#NaN} if one of the primitives is incomplete. 1456 * 1458 * <p> 1457 1459 * Note: The complexity is O(n*m), where (n,m) are the number of child 1458 1460 * objects the {@link OsmPrimitive}s have. -
trunk/src/org/openstreetmap/josm/tools/ReflectionUtils.java
r16462 r18871 61 61 } 62 62 63 private static <T extends Object> T findCaller(Function<StackTraceElement, T> getter, Collection<T> exclusions) {63 private static <T> T findCaller(Function<StackTraceElement, T> getter, Collection<T> exclusions) { 64 64 StackTraceElement[] stack = Thread.currentThread().getStackTrace(); 65 65 for (int i = 3; i < stack.length; i++) { -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r18801 r18871 28 28 /** 29 29 * Global shortcut class. 30 * 30 * <p> 31 31 * Note: This class represents a single shortcut, contains the factory to obtain 32 32 * shortcut objects from, manages shortcuts and shortcut collisions, and 33 33 * finally manages loading and saving shortcuts to/from the preferences. 34 * 34 * <p> 35 35 * Action authors: You only need the {@link #registerShortcut} factory. Ignore everything else. 36 * 36 * <p> 37 37 * All: Use only public methods that are also marked to be used. The others are 38 38 * public so the shortcut preferences can use them. … … 433 433 434 434 // shutdown handling 435 436 /** 437 * Save shortcuts to preferences 438 * @return {@code true} if preferences were changed 439 */ 435 440 public static boolean savePrefs() { 436 441 return shortcuts.stream() … … 485 490 Integer code = (int) c; 486 491 result.add(registerShortcut( 487 new StringBuilder(shortText).append(" (").append(i).append(')').toString(), longText,492 shortText + " (" + i + ')', longText, 488 493 // Add extended keyCode if not a regular one 489 494 regularKeyCodes.containsKey(code) ? regularKeyCodes.get(code) : … … 501 506 /** 502 507 * Register a shortcut. 503 * 508 * <p> 504 509 * Here you get your shortcuts from. The parameters are: 505 510 * … … 623 628 /** 624 629 * Returns the tooltip text plus the {@linkplain #getKeyText(KeyStroke) key stroke text}. 625 * 630 * <p> 626 631 * Tooltips are usually not system dependent, unless the 627 632 * JVM is too dumb to provide correct names for all the keys. 628 * 633 * <p> 629 634 * Some LAFs don't understand HTML, such as the OSX LAFs. 630 635 * -
trunk/tools/ivy.xml
r18857 r18871 31 31 <dependency org="com.github.spotbugs" name="spotbugs-ant" rev="4.7.3" conf="spotbugs->default"/> 32 32 <!-- errorprone->default --> 33 <dependency org="com.google.errorprone" name="error_prone_core" rev=" 2.10.0" conf="errorprone->default"/>33 <dependency org="com.google.errorprone" name="error_prone_core" rev="${versions.error_prone}" conf="errorprone->default"/> 34 34 <!-- errorprone->default --> 35 35 <dependency org="com.google.errorprone" name="javac" rev="9+181-r4173-1" conf="errorprone_javac->default"/>
Note:
See TracChangeset
for help on using the changeset viewer.