Changeset 15877 in josm for trunk/src/org


Ignore:
Timestamp:
2020-02-17T16:53:03+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #18730 - BBox should allow adding a latlon with some extra space (patch by taylor.smock)

File:
1 edited

Legend:

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

    r15716 r15877  
    179179
    180180    /**
     181     * Extends this bbox to include the bbox of the primitive extended by extraSpace.
     182     * @param latLon a LatLon
     183     * @param extraSpace the value to extend the primitives bbox. Unit is in LatLon degrees.
     184     * @since 15877
     185     */
     186    public void addLatLon(LatLon latLon, double extraSpace) {
     187        Objects.requireNonNull(latLon, "LatLon cannot be null");
     188        add(latLon);
     189        add(latLon.getX() - extraSpace, latLon.getY() - extraSpace);
     190        add(latLon.getX() + extraSpace, latLon.getY() + extraSpace);
     191    }
     192
     193    /**
    181194     * Gets the height of the bbox.
    182195     * @return The difference between ymax and ymin. 0 for invalid bboxes.
Note: See TracChangeset for help on using the changeset viewer.