Changeset 24942 in osm for applications/editors/josm/plugins/FixAddresses/src/org
- Timestamp:
- 2011-01-02T12:45:06+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java
r24941 r24942 17 17 import java.util.Locale; 18 18 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.data.Bounds; 19 21 import org.openstreetmap.josm.data.coor.LatLon; 20 22 import org.openstreetmap.josm.data.osm.Node; … … 23 25 import org.openstreetmap.josm.data.osm.RelationMember; 24 26 import org.openstreetmap.josm.data.osm.Way; 27 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 25 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 26 29 import org.openstreetmap.josm.tools.Pair; 27 30 31 // TODO: Auto-generated Javadoc 28 32 /** 29 33 * The Class OsmUtils provides some utilities not provided by the OSM data framework. 30 34 */ 31 35 public class OsmUtils { 36 37 /** 38 * Instantiates a new osm utils. 39 */ 32 40 private OsmUtils() {} 33 41 42 /** The cached locale. */ 34 43 private static String cachedLocale = null; 35 44 … … 196 205 return cachedLocale; 197 206 } 207 208 /** 209 * Zooms to the given addresses. 210 * 211 * @param addressList the address list 212 */ 213 public static void zoomAddresses(List<OSMAddress> addressList) { 214 CheckParameterUtil.ensureParameterNotNull(addressList, "addressList"); 215 216 if (Main.map == null && Main.map.mapView == null) return; // nothing to do 217 218 // compute bounding box 219 BoundingXYVisitor bbox = new BoundingXYVisitor(); 220 for (OSMAddress source : addressList) { 221 OsmPrimitive osm = source.getOsmObject(); 222 Bounds b = new Bounds(osm.getBBox().getTopLeft(), osm.getBBox().getBottomRight()); 223 bbox.visit(b); 224 } 225 226 // zoom to calculated bounding box 227 Main.map.mapView.zoomTo(bbox.getBounds()); 228 } 198 229 199 230 /** … … 205 236 */ 206 237 private static void applyDerivedValue(OSMAddress address, Way w, String tag) { 238 CheckParameterUtil.ensureParameterNotNull(address, "address"); 239 CheckParameterUtil.ensureParameterNotNull(w, "way"); 240 207 241 if (!address.hasTag(tag) && TagUtils.hasTag(w, tag)) { 208 242 address.setDerivedValue(tag, w.get(tag)); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesDialog.java
r24940 r24942 41 41 import org.openstreetmap.josm.plugins.fixAddresses.IAddressEditContainerListener; 42 42 import org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity; 43 import org.openstreetmap.josm.plugins.fixAddresses.OsmUtils; 43 44 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AbstractAddressEditAction; 44 45 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction; … … 204 205 for (AbstractAddressEditAction action : actions) { 205 206 action.setEvent(event); 206 } 207 } 208 209 OsmUtils.zoomAddresses(event.getSelectedIncompleteAddresses()); 207 210 } 208 211 -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesTableModel.java
r24231 r24942 142 142 143 143 144 /* (non-Javadoc) 145 * @see org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel#sortByColumn(int, boolean) 146 */ 144 147 @Override 145 148 protected void sortByColumn(int column, boolean ascending) {
Note:
See TracChangeset
for help on using the changeset viewer.