Ignore:
Timestamp:
2017-05-15T15:43:30+02:00 (7 years ago)
Author:
michael2402
Message:

See #13415: Add the ILatLon interface, unify handling of Nodes and CachedLatLon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/BBox.java

    r11452 r12161  
    77
    88import org.openstreetmap.josm.data.Bounds;
     9import org.openstreetmap.josm.data.coor.ILatLon;
    910import org.openstreetmap.josm.data.coor.LatLon;
    1011import org.openstreetmap.josm.data.coor.QuadTiling;
     
    8586     */
    8687    public BBox(Way w) {
    87         w.getNodes().forEach(n -> add(n.getCoor()));
     88        w.getNodes().forEach(this::add);
    8889    }
    8990
     
    9394     */
    9495    public BBox(Node n) {
    95         if (n.isLatLonKnown()) {
    96             add(n.getCoor());
    97         }
     96        this((ILatLon) n);
     97    }
     98
     99    /**
     100     * Create BBox for a given latlon. An invalid BBox is returned if the coordinates are not known.
     101     * @param ll The lat lon position
     102     */
     103    public BBox(ILatLon ll) {
     104        add(ll);
     105    }
     106
     107    /**
     108     * Add a point to an existing BBox. Extends this bbox if necessary so that this.bounds(c) will return true
     109     * if c is a valid LatLon instance.
     110     * Kept for binary compatibility
     111     * @param c a LatLon point
     112     */
     113    public final void add(LatLon c) {
     114        add((ILatLon) c);
    98115    }
    99116
     
    103120     * @param c a LatLon point
    104121     */
    105     public final void add(LatLon c) {
    106         if (c != null && c.isValid()) {
    107             add(c.lon(), c.lat());
    108         }
     122    public final void add(ILatLon c) {
     123        add(c.lon(), c.lat());
    109124    }
    110125
Note: See TracChangeset for help on using the changeset viewer.