- Timestamp:
- 2016-06-24T00:30:42+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r10382 r10467 66 66 Main.main.undoRedo.add(new AddCommand(nnew)); 67 67 getLayerManager().getEditDataSet().setSelected(nnew); 68 if (Main.map.mapView.getRealBounds().contains(nnew.getCoor())) { 69 Main.map.mapView.repaint(); 70 } else { 71 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 68 if (Main.map.mapView != null) { 69 if (Main.map.mapView.getRealBounds().contains(nnew.getCoor())) { 70 Main.map.mapView.repaint(); 71 } else { 72 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 73 } 72 74 } 73 75 } -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r10383 r10467 284 284 285 285 Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds)); 286 Main.map.repaint();287 286 } 288 287 -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r10463 r10467 205 205 // Do it! 206 206 Main.main.undoRedo.add(cmd); 207 Main.map.repaint();208 207 209 208 } catch (InvalidSelection except) { -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r10409 r10467 241 241 242 242 Main.main.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds)); 243 Main.map.repaint();244 243 } 245 244 -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r10409 r10467 98 98 // Do it! 99 99 Main.main.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds)); 100 Main.map.repaint();101 100 } 102 101 -
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r10292 r10467 137 137 } 138 138 kev.consume(); 139 Main.map.repaint();140 139 } 141 140 } … … 164 163 offsetDialog.updateOffset(); 165 164 } 166 Main.map.repaint();167 165 prevEastNorth = eastNorth; 168 166 } -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r10409 r10467 160 160 if (cmds.isEmpty()) return; 161 161 Main.main.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds)); 162 Main.map.repaint();163 162 } 164 163 -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r10409 r10467 81 81 82 82 Main.main.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds)); 83 Main.map.repaint();84 83 } 85 84 -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r10463 r10467 113 113 if (!commands.isEmpty()) { 114 114 Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands)); 115 Main.map.repaint();116 115 } else { 117 116 throw new InvalidUserInputException("Commands are empty"); … … 153 152 final SequenceCommand command = orthogonalize(sel); 154 153 Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command)); 155 Main.map.repaint();156 154 } catch (InvalidUserInputException ex) { 157 155 Main.debug(ex); -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r10463 r10467 103 103 } 104 104 Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); 105 // FIXME: This should be handled by undoRedo. 105 106 if (propertiesUpdated) { 106 107 ds.fireSelectionChanged(); 107 108 } 108 Main.map.repaint();109 109 } 110 110 -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r10409 r10467 124 124 ds.endUpdate(); 125 125 } 126 Main.map.repaint();127 126 } 128 127 -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r10409 r10467 91 91 // I'm sure there's a better way to handle this 92 92 Main.main.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes)); 93 Main.map.repaint();94 93 } 95 94 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r10306 r10467 122 122 public void run() { 123 123 targetLayer.onPostDownloadFromServer(); 124 if (Main.map != null)125 Main.map.mapView.repaint();126 124 } 127 125 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r10448 r10467 134 134 */ 135 135 public static void doActionPerformed(ActionEvent e) { 136 if (!Main.map.mapView.isActiveLayerDrawable()) 137 return; 136 MainLayerManager lm = Main.getLayerManager(); 137 OsmDataLayer editLayer = lm.getEditLayer(); 138 if (editLayer == null) { 139 return; 140 } 141 138 142 boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 139 143 boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK)) != 0; 140 144 141 MainLayerManager lm = Main.getLayerManager();142 145 Command c; 143 146 if (ctrl) { 144 c = DeleteCommand.deleteWithReferences( lm.getEditLayer(), lm.getEditDataSet().getSelected());147 c = DeleteCommand.deleteWithReferences(editLayer, lm.getEditDataSet().getSelected()); 145 148 } else { 146 c = DeleteCommand.delete( lm.getEditLayer(), lm.getEditDataSet().getSelected(), !alt /* also delete nodes in way */);149 c = DeleteCommand.delete(editLayer, lm.getEditDataSet().getSelected(), !alt /* also delete nodes in way */); 147 150 } 148 151 // if c is null, an error occurred or the user aborted. Don't do anything in that case. 149 152 if (c != null) { 150 153 Main.main.undoRedo.add(c); 154 //FIXME: This should not be required, DeleteCommand should update the selection, otherwise undo/redo won't work. 151 155 lm.getEditDataSet().setSelected(); 152 Main.map.repaint();153 156 } 154 157 } … … 213 216 private void repaintIfRequired(Set<OsmPrimitive> newHighlights, WaySegment newHighlightedWaySegment) { 214 217 boolean needsRepaint = false; 215 DataSet ds = getLayerManager().getEditDataSet();218 OsmDataLayer editLayer = getLayerManager().getEditLayer(); 216 219 217 220 if (newHighlightedWaySegment == null && oldHighlightedWaySegment != null) { 218 if ( ds!= null) {219 ds.clearHighlightedWaySegments();221 if (editLayer != null) { 222 editLayer.data.clearHighlightedWaySegments(); 220 223 needsRepaint = true; 221 224 } 222 225 oldHighlightedWaySegment = null; 223 226 } else if (newHighlightedWaySegment != null && !newHighlightedWaySegment.equals(oldHighlightedWaySegment)) { 224 if ( ds!= null) {225 ds.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment));227 if (editLayer != null) { 228 editLayer.data.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment)); 226 229 needsRepaint = true; 227 230 } … … 229 232 } 230 233 needsRepaint |= highlightHelper.highlightOnly(newHighlights); 231 if (needsRepaint ) {232 Main.map.mapView.repaint();234 if (needsRepaint && editLayer != null) { 235 editLayer.invalidate(); 233 236 } 234 237 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10446 r10467 185 185 186 186 // update selection to reflect which way being modified 187 DataSet currentDataSet = getLayerManager().getEditDataSet(); 188 if (getCurrentBaseNode() != null && currentDataSet != null && !currentDataSet.selectionEmpty()) { 187 OsmDataLayer editLayer = getLayerManager().getEditLayer(); 188 if (getCurrentBaseNode() != null && editLayer != null && !editLayer.data.selectionEmpty()) { 189 DataSet currentDataSet = editLayer.data; 189 190 Way continueFrom = getWayForNode(getCurrentBaseNode()); 190 191 if (alt && continueFrom != null && (!getCurrentBaseNode().isSelected() || continueFrom.isSelected())) { … … 197 198 } 198 199 199 if (needsRepaint ) {200 Main.map.mapView.repaint();200 if (needsRepaint && editLayer != null) { 201 editLayer.invalidate(); 201 202 } 202 203 return needsRepaint; … … 917 918 @Override 918 919 public void mouseExited(MouseEvent e) { 919 if (!Main.map.mapView.isActiveLayerDrawable()) 920 OsmDataLayer editLayer = Main.getLayerManager().getEditLayer(); 921 if (editLayer == null) 920 922 return; 921 923 mousePos = e.getPoint(); … … 925 927 // caused one already, don’t do it again. 926 928 if (!repaintIssued) { 927 Main.map.mapView.repaint();929 editLayer.invalidate(); 928 930 } 929 931 } -
trunk/src/org/openstreetmap/josm/command/AddCommand.java
r9371 r10467 59 59 @Override 60 60 public boolean executeCommand() { 61 get Layer().data.addPrimitive(osm);61 getAffectedDataSet().addPrimitive(osm); 62 62 osm.setModified(true); 63 63 checkNodeStyles(osm); … … 67 67 @Override 68 68 public void undoCommand() { 69 get Layer().data.removePrimitive(osm);69 getAffectedDataSet().removePrimitive(osm); 70 70 checkNodeStyles(osm); 71 71 } -
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r9371 r10467 78 78 79 79 for (PrimitiveData pd : data) { 80 OsmPrimitive primitive = get Layer().data.getPrimitiveById(pd);80 OsmPrimitive primitive = getAffectedDataSet().getPrimitiveById(pd); 81 81 boolean created = primitive == null; 82 82 if (created) { … … 87 87 } 88 88 if (created) { 89 get Layer().data.addPrimitive(primitive);89 getAffectedDataSet().addPrimitive(primitive); 90 90 } 91 91 newPrimitives.add(primitive); … … 115 115 116 116 @Override public void undoCommand() { 117 DataSet ds = get Layer().data;117 DataSet ds = getAffectedDataSet(); 118 118 119 119 if (createdPrimitives == null) { … … 167 167 Collection<OsmPrimitive> prims = new HashSet<>(); 168 168 for (PrimitiveData d : data) { 169 OsmPrimitive osm = get Layer().data.getPrimitiveById(d);169 OsmPrimitive osm = getAffectedDataSet().getPrimitiveById(d); 170 170 if (osm == null) 171 171 throw new RuntimeException(); -
trunk/src/org/openstreetmap/josm/command/Command.java
r10452 r10467 17 17 import org.openstreetmap.josm.data.coor.EastNorth; 18 18 import org.openstreetmap.josm.data.coor.LatLon; 19 import org.openstreetmap.josm.data.osm.DataSet; 19 20 import org.openstreetmap.josm.data.osm.Node; 20 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 210 211 protected OsmDataLayer getLayer() { 211 212 return layer; 213 } 214 215 /** 216 * Gets the data set this command affects. 217 * @return The data set. May be <code>null</code> if no layer was set and no edit layer was found. 218 * @since 10467 219 */ 220 public DataSet getAffectedDataSet() { 221 return layer == null ? null : layer.data; 212 222 } 213 223 -
trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java
r9371 r10467 59 59 // 60 60 for (Node n:mergedNodeList) { 61 if (!get Layer().data.getNodes().contains(n)) {61 if (!getAffectedDataSet().getNodes().contains(n)) { 62 62 Main.warn(tr("Main dataset does not include node {0}", n.toString())); 63 63 } -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r10452 r10467 74 74 */ 75 75 public synchronized void add(final Command c) { 76 DataSet ds = Main.getLayerManager().getEditDataSet(); 77 Collection<? extends OsmPrimitive> oldSelection = ds.getSelected(); 76 DataSet ds = c.getAffectedDataSet(); 77 if (ds == null) { 78 // old, legacy behaviour 79 ds = Main.getLayerManager().getEditDataSet(); 80 } 81 Collection<? extends OsmPrimitive> oldSelection = null; 82 if (ds != null) { 83 oldSelection = ds.getSelected(); 84 } 78 85 addNoRedraw(c); 79 86 afterAdd(); 80 87 81 88 // the command may have changed the selection so tell the listeners about the current situation 82 fireIfSelectionChanged(ds, oldSelection); 89 if (ds != null) { 90 fireIfSelectionChanged(ds, oldSelection); 91 } 83 92 } 84 93 -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r10001 r10467 203 203 if (pnt.compareTo(earliest) < 0) { 204 204 earliest = pnt; 205 } else {205 } else if (pnt.compareTo(latest) > 0) { 206 206 latest = pnt; 207 207 } -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r10212 r10467 19 19 20 20 /** 21 * The seconds (not milliseconds!) since 1970-01-01 .21 * The seconds (not milliseconds!) since 1970-01-01 00:00 UTC 22 22 */ 23 23 public double time; -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10444 r10467 101 101 @Override 102 102 protected void initializeMainWindow() { 103 mainPanel.reAddListeners(); 103 104 if (mainFrame != null) { 104 105 mainFrame.initialize(); … … 410 411 final MainFrame mainFrame = new MainFrame(contentPanePrivate, mainPanel, geometry); 411 412 Main.parent = mainFrame; 412 mainPanel.reAddListeners();413 413 414 414 if (args.containsKey(Option.LOAD_PREFERENCES)) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r10432 r10467 175 175 * Creates a layer list and attach it to the given mapView. 176 176 * @param layerManager The layer manager this list is for 177 */ 178 private LayerListDialog(MainLayerManager layerManager) { 177 * @since 10467 178 */ 179 public LayerListDialog(MainLayerManager layerManager) { 179 180 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), 180 181 Shortcut.registerShortcut("subwindow:layers", tr("Toggle: {0}", tr("Layers")), KeyEvent.VK_L, -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r10428 r10467 257 257 Main.pref.addPreferenceChangeListener(this); 258 258 259 registerInWindowMenu(); 260 } 261 262 /** 263 * Registers this dialog in the window menu. Called in the constructor. 264 * @since 10467 265 */ 266 protected void registerInWindowMenu() { 259 267 windowMenuItem = MainMenu.addWithCheckbox(Main.main.menu.windowMenu, 260 268 (JosmAction) getToggleAction(), -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r10420 r10467 117 117 } 118 118 119 /** 120 * Sets the displacement offset of this layer. The layer is automatically invalidated. 121 * @param dx The x offset 122 * @param dy The y offset 123 */ 119 124 public void setOffset(double dx, double dy) { 120 125 this.dx = dx; 121 126 this.dy = dy; 127 invalidate(); 122 128 } 123 129 -
trunk/src/org/openstreetmap/josm/gui/layer/LayerManager.java
r10458 r10467 7 7 import java.util.concurrent.CopyOnWriteArrayList; 8 8 9 import org.openstreetmap.josm.Main; 9 10 import org.openstreetmap.josm.gui.util.GuiHelper; 10 11 import org.openstreetmap.josm.tools.Utils; … … 175 176 insertLayerAt(layer, position); 176 177 fireLayerAdded(layer); 177 layer.hookUpMapView(); // needs to be after fireLayerAdded 178 if (Main.map != null) { 179 layer.hookUpMapView(); // needs to be after fireLayerAdded 180 } 178 181 } 179 182 -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r10436 r10467 878 878 setRequiresSaveToFile(false); 879 879 setRequiresUploadToServer(isModified()); 880 invalidate(); 880 881 } 881 882 … … 886 887 setRequiresSaveToFile(true); 887 888 setRequiresUploadToServer(isModified()); 889 invalidate(); 888 890 } 889 891
Note:
See TracChangeset
for help on using the changeset viewer.