Changeset 845 in josm
- Timestamp:
- 2008-08-22T21:25:28+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r804 r845 124 124 */ 125 125 public void eventDispatched(AWTEvent event) { 126 if(!Main.map.mapView.isDrawableLayer()) 127 return; 126 128 InputEvent e = (InputEvent) event; 127 129 ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; … … 134 136 */ 135 137 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 138 if(!Main.map.mapView.isDrawableLayer()) 139 return; 136 140 computeHelperLine(); 137 141 } … … 146 150 147 151 if (e.getButton() != MouseEvent.BUTTON1) 152 return; 153 if(!Main.map.mapView.isDrawableLayer()) 148 154 return; 149 155 … … 331 337 332 338 @Override public void mouseMoved(MouseEvent e) { 339 if(!Main.map.mapView.isDrawableLayer()) 340 return; 333 341 334 342 // we copy ctrl/alt/shift from the event just in case our global … … 441 449 */ 442 450 @Override public void mouseExited(MouseEvent e) { 451 if(!Main.map.mapView.isDrawableLayer()) 452 return; 443 453 mousePos = e.getPoint(); 444 454 Main.map.mapView.repaint(); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r811 r845 172 172 for (Layer.LayerChangeListener l : Layer.listeners) 173 173 l.layerAdded(layer); 174 // autoselect the new layer 175 Layer old = activeLayer; 176 setActiveLayer(layer); 177 for (Layer.LayerChangeListener l : Layer.listeners) 178 l.activeLayerChange(old, layer); 174 if (layer instanceof OsmDataLayer) { 175 // autoselect the new layer 176 Layer old = activeLayer; 177 setActiveLayer(layer); 178 for (Layer.LayerChangeListener l : Layer.listeners) 179 l.activeLayerChange(old, layer); 180 } 179 181 repaint(); 182 } 183 184 @Override 185 protected DataSet getData() 186 { 187 if(activeLayer != null && activeLayer instanceof OsmDataLayer) 188 return ((OsmDataLayer)activeLayer).data; 189 return new DataSet(); 190 } 191 192 public Boolean isDrawableLayer() 193 { 194 return activeLayer != null && activeLayer instanceof OsmDataLayer; 180 195 } 181 196 … … 251 266 for (int i = layers.size()-1; i >= 0; --i) { 252 267 Layer l = layers.get(i); 253 if (l.visible && l != getActiveLayer())268 if (l.visible/* && l != getActiveLayer()*/) 254 269 l.paint(tempG, this); 255 270 } 256 257 if (getActiveLayer() != null && getActiveLayer().visible)258 getActiveLayer().paint(tempG, this); 271 272 /*if (getActiveLayer() != null && getActiveLayer().visible) 273 getActiveLayer().paint(tempG, this);*/ 259 274 260 275 for (MapViewPaintable mvp : temporaryLayers) { … … 353 368 editLayer = (OsmDataLayer)layer; 354 369 Main.ds = editLayer.data; 355 DataSet.fireSelectionChanged(Main.ds.getSelected()); 356 } 370 } 371 else 372 Main.ds.setSelected(); 373 DataSet.fireSelectionChanged(Main.ds.getSelected()); 357 374 Layer old = activeLayer; 358 375 activeLayer = layer; -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r805 r845 18 18 import org.openstreetmap.josm.data.coor.EastNorth; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.data.osm.DataSet; 20 21 import org.openstreetmap.josm.data.osm.Node; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 49 50 public NavigatableComponent() { 50 51 setLayout(null); 51 } 52 } 53 54 protected DataSet getData() 55 { 56 return Main.ds; 57 } 52 58 53 59 /** … … 137 143 double minDistanceSq = Double.MAX_VALUE; 138 144 Node minPrimitive = null; 139 for (Node n : Main.ds.nodes) {145 for (Node n : getData().nodes) { 140 146 if (n.deleted || n.incomplete) 141 147 continue; … … 163 169 public final List<WaySegment> getNearestWaySegments(Point p) { 164 170 TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>(); 165 for (Way w : Main.ds.ways) {171 for (Way w : getData().ways) { 166 172 if (w.deleted || w.incomplete) continue; 167 173 Node lastN = null; … … 273 279 public Collection<OsmPrimitive> getAllNearest(Point p) { 274 280 Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>(); 275 for (Way w : Main.ds.ways) {281 for (Way w : getData().ways) { 276 282 if (w.deleted || w.incomplete) continue; 277 283 Node lastN = null; … … 295 301 } 296 302 } 297 for (Node n : Main.ds.nodes) {303 for (Node n : getData().nodes) { 298 304 if (!n.deleted && !n.incomplete 299 305 && getPoint(n.eastNorth).distanceSq(p) < snapDistance) { … … 314 320 public Collection<Node> getNearestNodes(Point p) { 315 321 Collection<Node> nearest = new HashSet<Node>(); 316 for (Node n : Main.ds.nodes) {322 for (Node n : getData().nodes) { 317 323 if (!n.deleted && !n.incomplete 318 324 && getPoint(n.eastNorth).distanceSq(p) < snapDistance) { -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r655 r845 285 285 } else { 286 286 // nodes 287 for (Node n : Main.ds.nodes) {287 for (Node n : nc.getData().nodes) { 288 288 if (!n.deleted && !n.incomplete && r.contains(nc.getPoint(n.eastNorth))) 289 289 selection.add(n); … … 291 291 292 292 // ways 293 for (Way w : Main.ds.ways) {293 for (Way w : nc.getData().ways) { 294 294 if (w.deleted || w.nodes.isEmpty() || w.incomplete) 295 295 continue; -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r745 r845 288 288 */ 289 289 public void layerAdded(Layer newLayer) { 290 model.add( 0, newLayer);290 model.add(model.size(), newLayer); 291 291 updateButtonEnabled(); 292 292 }
Note:
See TracChangeset
for help on using the changeset viewer.