Changeset 628 in josm for trunk/src/org


Ignore:
Timestamp:
2008-05-11T00:51:33+02:00 (17 years ago)
Author:
framm
Message:
  • make ChangePropertyCommand() constructor take single object (patch by Dave Hansen <dave@…>)
  • Give OsmDataLayer a containsPoint() function (patch by DH, modified)
Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r627 r628  
    66
    77import java.util.Collection;
     8import java.util.Collections;
    89import java.util.LinkedList;
    910import java.util.List;
     
    4142        public ChangePropertyCommand(Collection<OsmPrimitive> objects, String key, String value) {
    4243                this.objects = new LinkedList<OsmPrimitive>(objects);
     44                this.key = key;
     45                this.value = value;
     46        }
     47
     48        public ChangePropertyCommand(OsmPrimitive object, String key, String value) {
     49                this.objects = new LinkedList<OsmPrimitive>(Collections.singleton(object));
    4350                this.key = key;
    4451                this.value = value;
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r627 r628  
    3636import org.openstreetmap.josm.data.Preferences;
    3737import org.openstreetmap.josm.data.coor.EastNorth;
     38import org.openstreetmap.josm.data.coor.LatLon;
    3839import org.openstreetmap.josm.data.osm.DataSet;
    3940import org.openstreetmap.josm.data.osm.DataSource;
     
    391392                }
    392393        }
     394
     395    public boolean containsPoint(LatLon coor)
     396    {
     397        // we'll assume that if this has no data sources
     398        // that it also has no borders
     399        if (this.data.dataSources.isEmpty())
     400            return true;
     401
     402        boolean layer_bounds_point = false;
     403        for (DataSource src : this.data.dataSources) {
     404            if (src.bounds.contains(coor)) {
     405                layer_bounds_point = true;
     406                break;
     407            }
     408        }
     409        return layer_bounds_point;
     410    }
    393411}
Note: See TracChangeset for help on using the changeset viewer.