Changeset 13177 in josm for trunk/src/org
- Timestamp:
- 2017-12-01T23:17:19+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r13146 r13177 820 820 mouseOnExistingWays = new HashSet<>(); 821 821 822 showStatusInfo(-1, -1, -1, snapHelper.isSnapOn());823 824 822 if (!ctrl && mousePos != null) { 825 823 currentMouseNode = mv.getNearestNode(mousePos, OsmPrimitive::isSelectable); … … 853 851 return; // Don't create zero length way segments. 854 852 853 showStatusInfo(-1, -1, -1, snapHelper.isSnapOn()); 855 854 856 855 double curHdg = Utils.toDegrees(getCurrentBaseNode().getEastNorth() -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r13159 r13177 73 73 import org.openstreetmap.josm.data.osm.OsmPrimitive; 74 74 import org.openstreetmap.josm.data.osm.Way; 75 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 76 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 77 import org.openstreetmap.josm.data.osm.event.DataSetListener; 78 import org.openstreetmap.josm.data.osm.event.DatasetEventManager; 75 79 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; 80 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 81 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; 82 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 83 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 76 84 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 85 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 86 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 77 87 import org.openstreetmap.josm.data.preferences.AbstractProperty; 78 88 import org.openstreetmap.josm.data.preferences.BooleanProperty; … … 111 121 */ 112 122 public final class MapStatus extends JPanel implements 113 Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, SelectionChangedListener, ZoomChangeListener {123 Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, SelectionChangedListener, DataSetListener, ZoomChangeListener { 114 124 115 125 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Config.getPref().get("statusbar.decimal-format", "0.0")); … … 941 951 942 952 Config.getPref().addPreferenceChangeListener(this); 953 DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT); 943 954 SelectionEventManager.getInstance().addSelectionListener(this, FireMode.IN_EDT_CONSOLIDATED); 944 955 … … 1126 1137 NavigatableComponent.removeZoomChangeListener(this); 1127 1138 Config.getPref().removePreferenceChangeListener(this); 1139 DatasetEventManager.getInstance().removeDatasetListener(this); 1128 1140 SelectionEventManager.getInstance().removeSelectionListener(this); 1129 1141 mv.removeComponentListener(mvComponentAdapter); … … 1173 1185 } 1174 1186 1175 @Override 1176 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 1187 private void refreshDistText(Collection<? extends OsmPrimitive> newSelection) { 1177 1188 if (newSelection.size() == 2) { 1178 1189 Iterator<? extends OsmPrimitive> it = newSelection.iterator(); … … 1193 1204 1194 1205 @Override 1206 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 1207 refreshDistText(newSelection); 1208 } 1209 1210 @Override 1195 1211 public void zoomChanged() { 1196 1212 if (!GraphicsEnvironment.isHeadless()) { … … 1202 1218 } 1203 1219 } 1220 1221 @Override 1222 public void wayNodesChanged(WayNodesChangedEvent event) { 1223 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 1224 if (ds != null) { 1225 Collection<OsmPrimitive> sel = ds.getSelected(); 1226 if (sel.size() == 1 && sel.contains(event.getChangedWay())) { 1227 refreshDistText(sel); 1228 } 1229 } 1230 } 1231 1232 @Override 1233 public void nodeMoved(NodeMovedEvent event) { 1234 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 1235 if (ds != null) { 1236 Collection<OsmPrimitive> sel = ds.getSelected(); 1237 if (sel.size() == 2 && sel.contains(event.getNode())) { 1238 refreshDistText(sel); 1239 } 1240 } 1241 } 1242 1243 @Override 1244 public void primitivesAdded(PrimitivesAddedEvent event) { 1245 // Do nothing 1246 } 1247 1248 @Override 1249 public void primitivesRemoved(PrimitivesRemovedEvent event) { 1250 // Do nothing 1251 } 1252 1253 @Override 1254 public void tagsChanged(TagsChangedEvent event) { 1255 // Do nothing 1256 } 1257 1258 @Override 1259 public void relationMembersChanged(RelationMembersChangedEvent event) { 1260 // Do nothing 1261 } 1262 1263 @Override 1264 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 1265 // Do nothing 1266 } 1267 1268 @Override 1269 public void dataChanged(DataChangedEvent event) { 1270 // Do nothing 1271 } 1204 1272 }
Note:
See TracChangeset
for help on using the changeset viewer.