[josm-dev] [PATCH 02/24] Give OsmDataLayer a bounds() function
Dave Hansen
dave at sr71.net
Sat May 3 20:15:04 BST 2008
We'll use this in the validator to figure out whether a particular
node is truly the end of a series of ways, of if it may just not
have downloaded other ways touching this node.
Think of coastline validation. The coastline isn't allowed to
end, but it is ok to end if it is outside the downloaded area.
---
core-dave/./src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java | 16 ++++++++++
1 file changed, 16 insertions(+)
diff -puN ./src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java~give-layer-bounds-func ./src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
--- core/./src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java~give-layer-bounds-func 2008-05-03 12:08:38.000000000 -0700
+++ core-dave/./src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java 2008-05-03 12:08:38.000000000 -0700
@@ -35,6 +35,7 @@ import org.openstreetmap.josm.actions.Sa
import org.openstreetmap.josm.command.Command;
import org.openstreetmap.josm.data.Preferences;
import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.DataSource;
import org.openstreetmap.josm.data.osm.Relation;
@@ -390,4 +391,19 @@ public class OsmDataLayer extends Layer
Main.main.removeLayer(OsmDataLayer.this);
}
}
+ public boolean bounds(LatLon coor)
+ {
+ // we'll assume that if this has no data sources
+ // that it also has no borders
+ if (this.data.dataSources.isEmpty())
+ return true;
+
+ boolean layer_bounds_point = false;
+ for (DataSource src : this.data.dataSources) {
+ if (src.bounds.contains(coor))
+ layer_bounds_point = true;
+ //Main.debug("bounds: " + src.bounds + " " + layer_bounds_point);
+ }
+ return layer_bounds_point;
+ }
}
_
More information about the josm-dev
mailing list