Changeset 9230 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-12-31T16:37:24+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r8840 r9230 82 82 /** 83 83 * Open a list of files. The complete list will be passed to batch importers. 84 * Filenames will not be saved in history. 84 85 * @param fileList A list of files 85 86 */ … … 88 89 } 89 90 91 /** 92 * Open a list of files. The complete list will be passed to batch importers. 93 * @param fileList A list of files 94 * @param recordHistory {@code true} to save filename in history (default: false) 95 */ 90 96 public static void openFiles(List<File> fileList, boolean recordHistory) { 91 97 OpenFileTask task = new OpenFileTask(fileList, null); … … 94 100 } 95 101 102 /** 103 * Task to open files. 104 */ 96 105 public static class OpenFileTask extends PleaseWaitRunnable { 97 106 private final List<File> files; … … 103 112 private boolean recordHistory; 104 113 114 /** 115 * Constructs a new {@code OpenFileTask}. 116 * @param files files to open 117 * @param fileFilter file filter 118 * @param title message for the user 119 */ 105 120 public OpenFileTask(final List<File> files, final FileFilter fileFilter, final String title) { 106 121 super(title, false /* don't ignore exception */); … … 130 145 } 131 146 147 /** 148 * Constructs a new {@code OpenFileTask}. 149 * @param files files to open 150 * @param fileFilter file filter 151 */ 132 152 public OpenFileTask(List<File> files, FileFilter fileFilter) { 133 153 this(files, fileFilter, tr("Opening files")); … … 135 155 136 156 /** 137 * save filename in history (for list of recently opened files)138 * default: false157 * Sets whether to save filename in history (for list of recently opened files). 158 * @param recordHistory {@code true} to save filename in history (default: false) 139 159 */ 140 160 public void setRecordHistory(boolean recordHistory) { … … 142 162 } 143 163 164 /** 165 * Determines if filename must be saved in history (for list of recently opened files). 166 * @return {@code true} if filename must be saved in history 167 */ 144 168 public boolean isRecordHistory() { 145 169 return recordHistory; … … 319 343 } 320 344 345 /** 346 * Import data files with the given importer. 347 * @param importer file importer 348 * @param files data files to import 349 */ 321 350 public void importData(FileImporter importer, List<File> files) { 322 351 if (importer.isBatchImporter()) { -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r8931 r9230 199 199 /** 200 200 * Collect groups of ways with common nodes in order to orthogonalize each group separately. 201 * @param wayDataList list of ways 201 202 * @return groups of ways with common nodes 202 203 */ … … 246 247 * - The same for vertical segments. 247 248 * 5. Rotate back. 249 * @param wayDataList list of ways 250 * @param headingNodes list of heading nodes 248 251 * @return list of commands to perform 249 252 * @throws InvalidUserInputException if selected ways have an angle different from 90 or 180 degrees … … 398 401 399 402 /** 400 * Class contains everything we need to know about a sing e way.403 * Class contains everything we need to know about a single way. 401 404 */ 402 405 private static class WayData { … … 477 480 /** 478 481 * Make sure angle (up to 2*Pi) is in interval [ 0, 2*Pi ). 482 * @param a angle 479 483 * @return correct angle 480 484 */ … … 491 495 /** 492 496 * Make sure angle (up to 2*Pi) is in interval ( -Pi, Pi ]. 497 * @param a angle 493 498 * @return correct angle 494 499 */ … … 513 518 /** 514 519 * Rotate counter-clock-wise. 520 * @param pivot pivot 521 * @param en original east/north 522 * @param angle angle, in radians 515 523 * @return new east/north 516 524 */ … … 541 549 * Recognize angle to be approximately 0, 90, 180 or 270 degrees. 542 550 * returns an integral value, corresponding to a counter clockwise turn. 551 * @param a angle, in radians 552 * @param deltaMax maximum tolerance, in radians 543 553 * @return an integral value, corresponding to a counter clockwise turn 544 554 * @throws RejectedAngleException in case of invalid angle -
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r8975 r9230 59 59 private final List<Tag> tags = new ArrayList<>(); 60 60 61 /** 62 * Constructs a new {@code TagPaster}. 63 * @param source source primitives 64 * @param target target primitives 65 */ 61 66 public TagPaster(Collection<PrimitiveData> source, Collection<OsmPrimitive> target) { 62 67 this.source = source; … … 69 74 * @return true if the source for tag pasting is heterogeneous 70 75 */ 71 protected boolean isHete ogeneousSource() {76 protected boolean isHeterogeneousSource() { 72 77 int count = 0; 73 78 count = !getSourcePrimitivesByType(OsmPrimitiveType.NODE).isEmpty() ? count + 1 : count; … … 230 235 } 231 236 237 /** 238 * Performs the paste operation. 239 * @return list of tags 240 */ 232 241 public List<Tag> execute() { 233 242 tags.clear(); 234 if (isHete ogeneousSource()) {243 if (isHeterogeneousSource()) { 235 244 pasteFromHeterogeneousSource(); 236 245 } else { … … 258 267 } 259 268 260 /** Paste tags from arbitrary text, not using JOSM buffer 269 /** 270 * Paste tags from arbitrary text, not using JOSM buffer 271 * @param selection selected primitives 272 * @param text text containing tags 261 273 * @return true if action was successful 274 * @see TextTagParser#readTagsFromText 262 275 */ 263 276 public static boolean pasteTagsFromText(Collection<OsmPrimitive> selection, String text) { … … 278 291 } 279 292 280 /** Paste tags from JOSM buffer 293 /** 294 * Paste tags from JOSM buffer 281 295 * @param selection objects that will have the tags 282 296 * @return false if JOSM buffer was empty … … 297 311 /** 298 312 * Create and execute SequenceCommand with descriptive title 313 * @param selection selected primitives 299 314 * @param commands the commands to perform in a sequential command 300 315 */ -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r9067 r9230 32 32 33 33 /** 34 * Constructs a new {@code RenameLayerAction}. 34 35 * @param file The file of the original location of this layer. 35 36 * If null, no possibility to "rename the file as well" is provided. 37 * @param layer layer to rename 36 38 */ 37 39 public RenameLayerAction(File file, Layer layer) { -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r8540 r9230 27 27 import org.openstreetmap.josm.data.osm.OsmPrimitive; 28 28 import org.openstreetmap.josm.data.osm.Way; 29 import org.openstreetmap.josm.data.projection.Ellipsoid; 29 30 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 30 31 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; … … 217 218 * @param to the upper index 218 219 * @param threshold the max error threshold 220 * @param simplifiedNodes list that will contain resulting nodes 219 221 */ 220 222 protected void buildSimplifiedNodeList(List<Node> wnew, int from, int to, double threshold, List<Node> simplifiedNodes) { … … 228 230 for (int i = from + 1; i < to; i++) { 229 231 Node n = wnew.get(i); 230 double xte = Math.abs(E ARTH_RAD232 double xte = Math.abs(Ellipsoid.WGS84.a 231 233 * xtd(fromN.getCoor().lat() * Math.PI / 180, fromN.getCoor().lon() * Math.PI / 180, toN.getCoor().lat() * Math.PI 232 234 / 180, toN.getCoor().lon() * Math.PI / 180, n.getCoor().lat() * Math.PI / 180, n.getCoor().lon() * Math.PI … … 253 255 } 254 256 255 public static final double EARTH_RAD = 6378137.0;256 257 257 /* From Aviaton Formulary v1.3 258 258 * http://williams.best.vwh.net/avform.htm -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r9062 r9230 55 55 * original order. Selected nodes at the end of a way are ignored. 56 56 */ 57 58 57 public class SplitWayAction extends JosmAction { 59 58 … … 320 319 /** 321 320 * Returns a strategy which selects the way chunk with the highest node count to keep. 321 * @return strategy which selects the way chunk with the highest node count to keep 322 322 */ 323 323 public static Strategy keepLongestChunk() { … … 338 338 /** 339 339 * Returns a strategy which selects the first way chunk. 340 * @return strategy which selects the first way chunk 340 341 */ 341 342 public static Strategy keepFirstChunk() { … … 348 349 } 349 350 } 350 351 351 352 352 /** -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r9087 r9230 165 165 * Assumes there is one tagged Node stored in selectedNode that it will try to unglue. 166 166 * (i.e. copy node and remove all tags from the old one. Relations will not be removed) 167 * @param e event that trigerred the action 167 168 */ 168 169 private void unglueNode(ActionEvent e) { … … 217 218 * Checks only if the number and type of items selected looks good. 218 219 * 219 * If this method returns "true", selectedNode and selectedWay will 220 * be set. 220 * If this method returns "true", selectedNode and selectedWay will be set. 221 221 * 222 222 * Returns true if either one node is selected or one node and one 223 223 * way are selected and the node is part of the way. 224 224 * 225 * The way will be put into the object variable "selectedWay", the 226 * node into "selectedNode".225 * The way will be put into the object variable "selectedWay", the node into "selectedNode". 226 * @param selection selected primitives 227 227 * @return true if either one node is selected or one node and one way are selected and the node is part of the way 228 228 */ … … 255 255 * Checks only if the number and type of items selected looks good. 256 256 * 257 * Returns true if one way and any number of nodes that are part of 258 * that way are selected. Note: "any" can be none, then all nodes of 259 * the way are used. 260 * 261 * The way will be put into the object variable "selectedWay", the 262 * nodes into "selectedNodes". 257 * Returns true if one way and any number of nodes that are part of that way are selected. 258 * Note: "any" can be none, then all nodes of the way are used. 259 * 260 * The way will be put into the object variable "selectedWay", the nodes into "selectedNodes". 261 * @param selection selected primitives 263 262 * @return true if one way and any number of nodes that are part of that way are selected 264 263 */ … … 298 297 * dupe the given node of the given way 299 298 * 300 * assume that OrginalNode is in the way299 * assume that originalNode is in the way 301 300 * <ul> 302 301 * <li>the new node will be put into the parameter newNodes.</li> … … 304 303 * <li>the changed way will be returned and must be put into cmds by the caller!</li> 305 304 * </ul> 306 * @return new way 305 * @param originalNode original node to duplicate 306 * @param w parent way 307 * @param cmds List of commands that will contain the new "add node" command 308 * @param newNodes List of nodes that will contain the new node 309 * @return new way The modified way. Change command mus be handled by the caller 307 310 */ 308 311 private static Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) { … … 327 330 /** 328 331 * put all newNodes into the same relation(s) that originalNode is in 332 * @param originalNode original node to duplicate 333 * @param cmds List of commands that will contain the new "change relation" commands 334 * @param newNodes List of nodes that contain the new node 329 335 */ 330 336 private void fixRelations(Node originalNode, List<Command> cmds, List<Node> newNodes) { … … 343 349 rolesToReAdd = new HashMap<>(); 344 350 } 345 rolesToReAdd.put(rm.getRole(), i); 351 if (rolesToReAdd != null) { 352 rolesToReAdd.put(rm.getRole(), i); 353 } 346 354 } 347 355 i++; 348 356 } 349 357 if (newRel != null) { 350 for (Node n : newNodes) { 351 for (Map.Entry<String, Integer> role : rolesToReAdd.entrySet()) { 352 newRel.addMember(role.getValue() + 1, new RelationMember(role.getKey(), n)); 358 if (rolesToReAdd != null) { 359 for (Node n : newNodes) { 360 for (Map.Entry<String, Integer> role : rolesToReAdd.entrySet()) { 361 newRel.addMember(role.getValue() + 1, new RelationMember(role.getKey(), n)); 362 } 353 363 } 354 364 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java
r8512 r9230 125 125 * @param url The URL to be confirmed 126 126 * @return The HTML-formatted confirmation message to be shown to user 127 * @since 127 * @since 5691 128 128 */ 129 129 String getConfirmationMessage(URL url); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r9067 r9230 120 120 121 121 /** 122 * Replies the set of ids of all complete, non-new primitives (i.e. those with ! 123 * primitive.incomplete)122 * Replies the set of ids of all complete, non-new primitives (i.e. those with !primitive.incomplete) 123 * @param ds data set 124 124 * 125 125 * @return the set of ids of all complete, non-new primitives … … 285 285 for (DownloadTask task : tasks) { 286 286 if (task instanceof AbstractDownloadTask) { 287 AbstractDownloadTask absTask = (AbstractDownloadTask) task;287 AbstractDownloadTask<?> absTask = (AbstractDownloadTask<?>) task; 288 288 if (absTask.isCanceled() || absTask.isFailed()) 289 289 return; -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r8870 r9230 256 256 * occurs. We can use AWTEvent to catch those but still lack a proper 257 257 * mouseevent. Instead we copy the previous event and only update the modifiers. 258 * @param e mouse event 259 * @param modifiers mouse modifiers 258 260 */ 259 261 private void giveUserFeedback(MouseEvent e, int modifiers) { … … 266 268 * calls the cursor and target highlighting routines. Extracts modifiers 267 269 * from mouse event. 270 * @param e mouse event 268 271 */ 269 272 private void giveUserFeedback(MouseEvent e) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r9074 r9230 894 894 895 895 /** 896 * if one of the ends of @param way is given @param node,896 * if one of the ends of {@code way} is given {@code node}, 897 897 * then set currentBaseNode = node and previousNode = adjacent node of way 898 * @param way way to continue 899 * @param node starting node 898 900 */ 899 901 private void continueWayFromNode(Way way, Node node) { … … 926 928 927 929 /** 930 * @param n node 928 931 * @return If the node is the end of exactly one way, return this. 929 932 * <code>null</code> otherwise. -
trunk/src/org/openstreetmap/josm/data/conflict/Conflict.java
r8846 r9230 17 17 * {@link OsmPrimitive} from the dataset in another layer or the one retrieved from the server.</li> 18 18 * </ul> 19 * 20 * 19 * @since 1750 21 20 */ 22 public class 21 public class Conflict<T extends OsmPrimitive> { 23 22 private final T my; 24 23 private final T their; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShift.java
r8415 r9230 23 23 24 24 import org.openstreetmap.josm.data.coor.LatLon; 25 import org.openstreetmap.josm.data.projection.Ellipsoid; 25 26 26 27 /** … … 39 40 private static final long serialVersionUID = 1L; 40 41 41 private static final double METRE_PER_SECOND = 2.0 * Math.PI * 6378137.0/ 3600.0 / 360.0;42 private static final double METRE_PER_SECOND = 2.0 * Math.PI * Ellipsoid.WGS84.a / 3600.0 / 360.0; 42 43 private static final double RADIANS_PER_SECOND = 2.0 * Math.PI / 3600.0 / 360.0; 43 44 private double lon; -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r9059 r9230 281 281 * Distributes a "bounding box changed" from one DownloadSelection 282 282 * object to the others, so they may update or clear their input fields. 283 * @param b new current bounds 283 284 * 284 285 * @param eventSource - the DownloadSelection object that fired this notification. … … 429 430 } 430 431 432 /** 433 * Automatically opens the download dialog, if autorun is enabled. 434 * @see #isAutorunEnabled 435 */ 431 436 public static void autostartIfNeeded() { 432 437 if (isAutorunEnabled()) { -
trunk/src/org/openstreetmap/josm/gui/layer/MapViewPaintable.java
r6380 r9230 11 11 /** 12 12 * Paint the dataset using the engine set. 13 * @param g Graphics 13 14 * @param mv The object that can translate GeoPoints to screen coordinates. 15 * @param bbox Bounding box 14 16 */ 15 17 void paint(Graphics2D g, MapView mv, Bounds bbox); 16 17 18 } -
trunk/src/org/openstreetmap/josm/gui/util/KeyPressReleaseListener.java
r8512 r9230 5 5 6 6 /** 7 * Interface that is used to detect key pressing and releasing 7 * Interface that is used to detect key pressing and releasing. 8 * @since 7219 8 9 */ 9 10 public interface KeyPressReleaseListener { … … 11 12 * This is called when key press event is actually pressed 12 13 * (no fake events while holding key) 14 * @param e key event 13 15 */ 14 16 void doKeyPressed(KeyEvent e); … … 17 19 * This is called when key press event is actually released 18 20 * (no fake events while holding key) 21 * @param e key event 19 22 */ 20 23 void doKeyReleased(KeyEvent e); -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r9227 r9230 437 437 /** 438 438 * Sets whether not to set header {@code Connection=close} 439 * <p />439 * <p> 440 440 * This might fix #7640, see 441 441 * <a href='https://web.archive.org/web/20140118201501/http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive'>here</a>. -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r9062 r9230 12 12 import org.openstreetmap.josm.data.Bounds; 13 13 import org.openstreetmap.josm.data.coor.LatLon; 14 import org.openstreetmap.josm.data.projection.Ellipsoid; 14 15 15 16 public final class OsmUrlToBounds { … … 188 189 } 189 190 190 /** radius of the earth */191 public static final double R = 6378137.0;192 193 191 public static Bounds positionToBounds(final double lat, final double lon, final int zoom) { 194 192 int tileSizeInPixels = 256; … … 207 205 width = 640; 208 206 } 209 double scale = (1 << zoom) * tileSizeInPixels / (2 * Math.PI * R);207 double scale = (1 << zoom) * tileSizeInPixels / (2 * Math.PI * Ellipsoid.WGS84.a); 210 208 double deltaX = width / 2.0 / scale; 211 209 double deltaY = height / 2.0 / scale; 212 double x = Math.toRadians(lon) * R;210 double x = Math.toRadians(lon) * Ellipsoid.WGS84.a; 213 211 double y = mercatorY(lat); 214 return new Bounds(invMercatorY(y - deltaY), Math.toDegrees(x - deltaX) / R, invMercatorY(y + deltaY), Math.toDegrees(x + deltaX) / R); 212 return new Bounds( 213 invMercatorY(y - deltaY), Math.toDegrees(x - deltaX) / Ellipsoid.WGS84.a, 214 invMercatorY(y + deltaY), Math.toDegrees(x + deltaX) / Ellipsoid.WGS84.a); 215 215 } 216 216 217 217 public static double mercatorY(double lat) { 218 return Math.log(Math.tan(Math.PI/4 + Math.toRadians(lat)/2)) * R;218 return Math.log(Math.tan(Math.PI/4 + Math.toRadians(lat)/2)) * Ellipsoid.WGS84.a; 219 219 } 220 220 221 221 public static double invMercatorY(double north) { 222 return Math.toDegrees(Math.atan(Math.sinh(north / R)));222 return Math.toDegrees(Math.atan(Math.sinh(north / Ellipsoid.WGS84.a))); 223 223 } 224 224
Note:
See TracChangeset
for help on using the changeset viewer.