public void update(double lat, double lon, double elev) { if (elevation) { if (elev > maxEle) { maxEle = elev; } if (elev < minEle) { minEle = elev; } } else { throw new IllegalStateException("No BBox with elevation to update"); } update(lat, lon); }
bbox.update(point.lat, point.lon); landmarkNodeIds.add(result.getClosestNode());
/** * Calculates the 2D bounding box of this route */ public BBox calcBBox2D() { check("calcRouteBBox"); BBox bounds = BBox.createInverse(false); for (int i = 0; i < pointList.getSize(); i++) { bounds.update(pointList.getLatitude(i), pointList.getLongitude(i)); } return bounds; }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }
public void update(double lat, double lon, double elev) { if (elevation) { if (elev > maxEle) { maxEle = elev; } if (elev < minEle) { minEle = elev; } } else { throw new IllegalStateException("No BBox with elevation to update"); } update(lat, lon); }
public void update(double lat, double lon, double elev) { if (elevation) { if (elev > maxEle) { maxEle = elev; } if (elev < minEle) { minEle = elev; } } else { throw new IllegalStateException("No BBox with elevation to update"); } update(lat, lon); }
public void update( double lat, double lon, double elev ) { if (elevation) { if (elev > maxEle) { maxEle = elev; } if (elev < minEle) { minEle = elev; } } else { throw new IllegalStateException("No BBox with elevation to update"); } update(lat, lon); }
bbox.update(point.lat, point.lon); landmarkNodeIds.add(result.getClosestNode());
bbox.update(point.lat, point.lon); landmarkNodeIds.add(result.getClosestNode());
/** * Calculates the bounding box of this route response */ public BBox calcRouteBBox(BBox _fallback) { check("calcRouteBBox"); BBox bounds = BBox.createInverse(_fallback.hasElevation()); int len = pointList.getSize(); if (len == 0) return _fallback; for (int i = 0; i < len; i++) { double lat = pointList.getLatitude(i); double lon = pointList.getLongitude(i); if (bounds.hasElevation()) { double ele = pointList.getEle(i); bounds.update(lat, lon, ele); } else { bounds.update(lat, lon); } } return bounds; }
/** * Calculates the 2D bounding box of this route */ public BBox calcBBox2D() { check("calcRouteBBox"); BBox bounds = BBox.createInverse(false); for (int i = 0; i < pointList.getSize(); i++) { bounds.update(pointList.getLatitude(i), pointList.getLongitude(i)); } return bounds; }
@Override public void run(Bootstrap bootstrap, Namespace args) { XmlMapper xmlMapper = new XmlMapper(); BBox bbox = BBox.createInverse(false); for (File gpxFile : args.<File>getList("gpx")) { try { Gpx gpx = xmlMapper.readValue(gpxFile, Gpx.class); for (Trk trk : gpx.trk) { List<GPXEntry> inputGPXEntries = trk.getEntries(); for (GPXEntry entry : inputGPXEntries) { bbox.update(entry.getLat(), entry.getLon()); } } } catch (IOException e) { throw new RuntimeException(e); } } System.out.println("bounds: " + bbox); // show download only for small areas if (bbox.maxLat - bbox.minLat < 0.1 && bbox.maxLon - bbox.minLon < 0.1) { double delta = 0.01; System.out.println("Get small areas via\n" + "wget -O extract.osm 'http://overpass-api.de/api/map?bbox=" + (bbox.minLon - delta) + "," + (bbox.minLat - delta) + "," + (bbox.maxLon + delta) + "," + (bbox.maxLat + delta) + "'"); } } }
/** * Calculates the bounding box of this route response */ public BBox calcRouteBBox( BBox _fallback ) { check("calcRouteBBox"); BBox bounds = BBox.createInverse(_fallback.hasElevation()); int len = pointList.getSize(); if (len == 0) return _fallback; for (int i = 0; i < len; i++) { double lat = pointList.getLatitude(i); double lon = pointList.getLongitude(i); if (bounds.hasElevation()) { double ele = pointList.getEle(i); bounds.update(lat, lon, ele); } else { bounds.update(lat, lon); } } return bounds; }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }
@Override public final void setNode( int nodeId, double lat, double lon, double ele ) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }