Changeset 10250 in josm for trunk/src/org
- Timestamp:
- 2016-05-18T17:44:31+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r9983 r10250 441 441 private final Set<NodePair> edges; 442 442 private int numUndirectedEges; 443 private Map<Node, List<NodePair>> successors;444 private Map<Node, List<NodePair>> predecessors;443 private final Map<Node, List<NodePair>> successors = new LinkedHashMap<>(); 444 private final Map<Node, List<NodePair>> predecessors = new LinkedHashMap<>(); 445 445 446 446 protected void rememberSuccessor(NodePair pair) { … … 482 482 protected void prepare() { 483 483 Set<NodePair> undirectedEdges = new LinkedHashSet<>(); 484 successors = new LinkedHashMap<>();485 predecessors = new LinkedHashMap<>();484 successors.clear(); 485 predecessors.clear(); 486 486 487 487 for (NodePair pair: edges) { -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r10001 r10250 420 420 */ 421 421 private static class WayData { 422 public final List<Node> wayNodes; 423 public final int nSeg; // Number of Segments of the Way424 public final int nNode; // Number of Nodes of the Way425 public Direction[] segDirections; // Direction of the segments422 public final List<Node> wayNodes; // The assigned way 423 public final int nSeg; // Number of Segments of the Way 424 public final int nNode; // Number of Nodes of the Way 425 public final Direction[] segDirections; // Direction of the segments 426 426 // segment i goes from node i to node (i+1) 427 427 public EastNorth segSum; // (Vector-)sum of all horizontal segments plus the sum of all vertical … … 433 433 this.nNode = wayNodes.size(); 434 434 this.nSeg = nNode - 1; 435 this.segDirections = new Direction[nSeg]; 435 436 } 436 437 … … 448 449 en[i] = wayNodes.get(i).getEastNorth(); 449 450 } 450 segDirections = new Direction[nSeg];451 451 Direction direction = pInitialDirection; 452 452 segDirections[0] = direction; -
trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java
r10131 r10250 120 120 private static final class OverpassDownloadDialog extends DownloadDialog { 121 121 122 private HistoryComboBox overpassWizard;123 private JosmTextArea overpassQuery;122 private final HistoryComboBox overpassWizard = new HistoryComboBox(); 123 private final JosmTextArea overpassQuery = new JosmTextArea("", 8, 80); 124 124 private static OverpassDownloadDialog instance; 125 125 private static final CollectionProperty OVERPASS_WIZARD_HISTORY = new CollectionProperty("download.overpass.wizard", … … 151 151 152 152 final String tooltip = tr("Builds an Overpass query using the Overpass Turbo query wizard"); 153 overpassWizard = new HistoryComboBox();154 153 overpassWizard.setToolTipText(tooltip); 155 154 overpassWizard.getEditorComponent().addFocusListener(disableActionsFocusListener); … … 178 177 pnl.add(overpassWizard, GBC.eol().fill(GBC.HORIZONTAL)); 179 178 180 overpassQuery = new JosmTextArea("", 8, 80);181 179 overpassQuery.setFont(GuiHelper.getMonospacedFont(overpassQuery)); 182 180 overpassQuery.addFocusListener(disableActionsFocusListener); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java
r10129 r10250 127 127 */ 128 128 public final Future<?> download() { 129 return Main.worker.submit(downloadTaskRunnable);129 return downloadTaskRunnable != null ? Main.worker.submit(downloadTaskRunnable) : null; 130 130 } 131 131 132 132 @Override 133 133 public final Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) { 134 return Main.worker.submit(downloadTaskRunnable);134 return downloadTaskRunnable != null ? Main.worker.submit(downloadTaskRunnable) : null; 135 135 } 136 136 137 137 @Override 138 138 public final void cancel() { 139 downloadTaskRunnable.cancel(); 139 if (downloadTaskRunnable != null) { 140 downloadTaskRunnable.cancel(); 141 } 140 142 } 141 143 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTask.java
r10124 r10250 26 26 */ 27 27 public class ChangesetContentDownloadTask extends AbstractChangesetDownloadTask { 28 29 private final DownloadTask downloadTask;30 28 31 29 class DownloadTask extends RunnableDownloadTask { … … 129 127 throw new IllegalArgumentException( 130 128 MessageFormat.format("Expected integer value > 0 for parameter ''{0}'', got ''{1}''", "changesetId", changesetId)); 131 downloadTask = new DownloadTask(parent, Collections.singleton(changesetId)); 132 setDownloadTask(downloadTask); 129 setDownloadTask(new DownloadTask(parent, Collections.singleton(changesetId))); 133 130 } 134 131 … … 142 139 */ 143 140 public ChangesetContentDownloadTask(Component parent, Collection<Integer> changesetIds) { 144 downloadTask = new DownloadTask(parent, changesetIds); 145 setDownloadTask(downloadTask); 141 setDownloadTask(new DownloadTask(parent, changesetIds)); 146 142 } 147 143 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTask.java
r10164 r10250 27 27 */ 28 28 public class ChangesetHeaderDownloadTask extends AbstractChangesetDownloadTask { 29 30 private final DownloadTask downloadTask;31 29 32 30 class DownloadTask extends RunnableDownloadTask { … … 112 110 */ 113 111 public ChangesetHeaderDownloadTask(Component dialogParent, Collection<Integer> ids, boolean includeDiscussion) { 114 downloadTask = new DownloadTask(dialogParent, ids, includeDiscussion); 115 setDownloadTask(downloadTask); 112 setDownloadTask(new DownloadTask(dialogParent, ids, includeDiscussion)); 116 113 } 117 114 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java
r10129 r10250 26 26 */ 27 27 public class ChangesetQueryTask extends AbstractChangesetDownloadTask { 28 29 private final DownloadTask downloadTask;30 28 31 29 class DownloadTask extends RunnableDownloadTask { … … 134 132 public ChangesetQueryTask(Component parent, ChangesetQuery query) { 135 133 CheckParameterUtil.ensureParameterNotNull(query, "query"); 136 downloadTask = new DownloadTask(parent, query); 137 setDownloadTask(downloadTask); 134 setDownloadTask(new DownloadTask(parent, query)); 138 135 } 139 136 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10228 r10250 51 51 private ProgressMonitor progressMonitor; 52 52 53 private void addDownloadTask( DownloadTask dt, Rectangle2D td, int i, int n) {53 private void addDownloadTask(ProgressMonitor progressMonitor, DownloadTask dt, Rectangle2D td, int i, int n) { 54 54 ProgressMonitor childProgress = progressMonitor.createSubTaskMonitor(1, false); 55 55 childProgress.setCustomText(tr("Download {0} of {1} ({2} left)", i, n, n - i)); … … 82 82 i++; 83 83 if (osmData) { 84 addDownloadTask( new DownloadOsmTask(), td, i, n);84 addDownloadTask(progressMonitor, new DownloadOsmTask(), td, i, n); 85 85 } 86 86 if (gpxData) { 87 addDownloadTask( new DownloadGpsTask(), td, i, n);87 addDownloadTask(progressMonitor, new DownloadGpsTask(), td, i, n); 88 88 } 89 89 } -
trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java
r9371 r10250 63 63 public void undoCommand() { 64 64 relation.setMember(position, new RelationMember(oldRole, relation.getMember(position).getMember())); 65 relation.setModified(oldModified); 65 if (oldModified != null) { 66 relation.setModified(oldModified); 67 } 66 68 } 67 69 -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r10242 r10250 103 103 public void loadGridShiftFile(InputStream in, boolean loadAccuracy) throws IOException { 104 104 byte[] b8 = new byte[8]; 105 boolean bigEndian = true;106 105 fromEllipsoid = ""; 107 106 toEllipsoid = ""; … … 111 110 if (!"NUM_OREC".equals(overviewHeaderCountId)) 112 111 throw new IllegalArgumentException("Input file is not an NTv2 grid shift file"); 112 boolean bigEndian; 113 113 readBytes(in, b8); 114 114 overviewHeaderCount = NTV2Util.getIntBE(b8, 0); … … 204 204 */ 205 205 public boolean gridShiftForward(NTV2GridShift gs) { 206 // Try the last sub grid first, big chance the coord is still within it 207 NTV2SubGrid subGrid = lastSubGrid.getSubGridForCoord(gs.getLonPositiveWestSeconds(), gs.getLatSeconds()); 206 NTV2SubGrid subGrid = null; 207 if (lastSubGrid != null) { 208 // Try the last sub grid first, big chance the coord is still within it 209 subGrid = lastSubGrid.getSubGridForCoord(gs.getLonPositiveWestSeconds(), gs.getLatSeconds()); 210 } 208 211 if (subGrid == null) { 209 subGrid = getSubGrid( gs.getLonPositiveWestSeconds(), gs.getLatSeconds());210 } 211 if (subGrid == null) 212 subGrid = getSubGrid(topLevelSubGrid, gs.getLonPositiveWestSeconds(), gs.getLatSeconds()); 213 } 214 if (subGrid == null) { 212 215 return false; 213 else {216 } else { 214 217 subGrid.interpolateGridShift(gs); 215 218 gs.setSubGridName(subGrid.getSubGridName()); … … 251 254 252 255 /** 253 * Find the finest SubGrid containing the coordinate, specified 254 * in Positive West Seconds 255 * 256 * Find the finest SubGrid containing the coordinate, specified in Positive West Seconds 257 * @param topLevelSubGrid top level subgrid 256 258 * @param lon Longitude in Positive West Seconds 257 259 * @param lat Latitude in Seconds 258 260 * @return The SubGrid found or null 259 261 */ 260 private NTV2SubGrid getSubGrid(double lon, double lat) {262 private static NTV2SubGrid getSubGrid(NTV2SubGrid[] topLevelSubGrid, double lon, double lat) { 261 263 NTV2SubGrid sub = null; 262 264 for (int i = 0; i < topLevelSubGrid.length; i++) { -
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r10235 r10250 4 4 import org.openstreetmap.josm.data.projection.Ellipsoid; 5 5 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException; 6 import org.openstreetmap.josm.tools.CheckParameterUtil; 6 7 7 8 /** … … 84 85 @Override 85 86 public void initialize(ProjParameters params) throws ProjectionConfigurationException { 87 CheckParameterUtil.ensureParameterNotNull(params, "params"); 88 CheckParameterUtil.ensureParameterNotNull(params.ellps, "params.ellps"); 86 89 e2 = params.ellps.e2; 87 90 e = params.ellps.e; -
trunk/src/org/openstreetmap/josm/data/projection/proj/LonLat.java
r10001 r10250 6 6 import org.openstreetmap.josm.data.Bounds; 7 7 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException; 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 8 9 9 10 /** … … 26 27 @Override 27 28 public void initialize(ProjParameters params) throws ProjectionConfigurationException { 29 CheckParameterUtil.ensureParameterNotNull(params, "params"); 30 CheckParameterUtil.ensureParameterNotNull(params.ellps, "params.ellps"); 28 31 a = params.ellps.a; 29 32 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
r9970 r10250 6 6 import org.openstreetmap.josm.data.Bounds; 7 7 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException; 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 8 9 9 10 /** … … 119 120 public void initialize(ProjParameters params) throws ProjectionConfigurationException { 120 121 super.initialize(params); 122 CheckParameterUtil.ensureParameterNotNull(params, "params"); 123 CheckParameterUtil.ensureParameterNotNull(params.ellps, "params.ellps"); 121 124 eb2 = params.ellps.eb2; 122 125 latitudeOfOrigin = params.lat0 == null ? 0 : Math.toRadians(params.lat0); -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r10181 r10250 123 123 124 124 if (selected) { 125 g.setColor(getHighlightColor( ));125 g.setColor(getHighlightColor(color)); 126 126 g.fillOval(p.x - 5, p.y - 5, 10, 10); 127 127 } … … 146 146 int deg = (int) Math.toDegrees(t); 147 147 if (selected) { 148 g.setColor(getHighlightColor( ));148 g.setColor(getHighlightColor(color)); 149 149 int[] x = new int[] {(int) (p1.x + cosT), (int) (p2.x + cosT), 150 150 (int) (p2.x - cosT), (int) (p1.x - cosT)}; … … 260 260 /** 261 261 * Gets the color to draw highlight markers with. 262 * @param color severity color 262 263 * @return The color. 263 264 */ 264 private Color getHighlightColor() {265 private static Color getHighlightColor(Color color) { 265 266 return new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (color.getAlpha() * .4)); 266 267 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r8510 r10250 40 40 41 41 /** All way segments, grouped by cells */ 42 private Map<Point2D, List<WaySegment>> cellSegments;42 private final Map<Point2D, List<WaySegment>> cellSegments = new HashMap<>(1000); 43 43 /** The already detected errors */ 44 private Set<WaySegment> errorSegments;44 private final Set<WaySegment> errorSegments = new HashSet<>(); 45 45 /** The already detected ways in error */ 46 private Map<List<Way>, List<WaySegment>> seenWays;46 private final Map<List<Way>, List<WaySegment>> seenWays = new HashMap<>(50); 47 47 48 48 /** … … 188 188 public void startTest(ProgressMonitor monitor) { 189 189 super.startTest(monitor); 190 cellSegments = new HashMap<>(1000);191 errorSegments = new HashSet<>();192 seenWays = new HashMap<>(50);190 cellSegments.clear(); 191 errorSegments.clear(); 192 seenWays.clear(); 193 193 } 194 194 … … 196 196 public void endTest() { 197 197 super.endTest(); 198 cellSegments = null;199 errorSegments = null;200 seenWays = null;198 cellSegments.clear(); 199 errorSegments.clear(); 200 seenWays.clear(); 201 201 } 202 202 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r10241 r10250 620 620 })); 621 621 } 622 Rectangle bounds = button.getBounds(); 623 menu.show(button, bounds.x + bounds.width, 0); 622 if (button != null) { 623 Rectangle bounds = button.getBounds(); 624 menu.show(button, bounds.x + bounds.width, 0); 625 } 624 626 } 625 627 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r9992 r10250 397 397 } 398 398 399 protected boolean isLastFilterValid() {399 protected final boolean isLastFilterValid() { 400 400 return lastFilter != null && filterModel.getFilters().contains(lastFilter); 401 401 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r10234 r10250 738 738 * @param layer the layer which is removed 739 739 */ 740 pr otectedvoid onRemoveLayer(Layer layer) {740 private void onRemoveLayer(Layer layer) { 741 741 if (layer == null) 742 742 return; … … 762 762 * @param layer the layer 763 763 */ 764 pr otectedvoid onAddLayer(Layer layer) {764 private void onAddLayer(Layer layer) { 765 765 if (layer == null) 766 766 return; … … 768 768 fireTableDataChanged(); 769 769 int idx = getLayers().indexOf(layer); 770 layerList.setRowHeight(idx, Math.max(16, layer.getIcon().getIconHeight())); 770 if (layerList != null) { 771 layerList.setRowHeight(idx, Math.max(16, layer.getIcon().getIconHeight())); 772 } 771 773 selectionModel.setSelectionInterval(idx, idx); 772 774 ensureSelectedIsVisible(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r10217 r10250 1010 1010 public void actionPerformed(ActionEvent e) { 1011 1011 try { 1012 recentTags.ignoreTag(tag, tagsToIgnore); 1013 PROPERTY_TAGS_TO_IGNORE.put(tagsToIgnore.writeToString()); 1012 if (tagsToIgnore != null) { 1013 recentTags.ignoreTag(tag, tagsToIgnore); 1014 PROPERTY_TAGS_TO_IGNORE.put(tagsToIgnore.writeToString()); 1015 } 1014 1016 } catch (SearchCompiler.ParseError parseError) { 1015 1017 throw new IllegalStateException(parseError); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java
r10217 r10250 232 232 */ 233 233 private Direction determineDirection(int refI, final Direction refDirection, int k, boolean reversed) { 234 if (refI < 0 || k < 0 || refI >= members.size() || k >= members.size()) 235 return NONE; 236 if (refDirection == NONE) 234 if (members == null || refI < 0 || k < 0 || refI >= members.size() || k >= members.size() || refDirection == NONE) 237 235 return NONE; 238 236
Note:
See TracChangeset
for help on using the changeset viewer.