public double[] toArray() { JSObject boundsOpaque = BoundsImpl.toArray(getJSObject()); JDoubleArray bounds = JDoubleArray.narrowToJDoubleArray(boundsOpaque); int boundsLength = bounds.length(); double[] boundsCoordinates = new double[4]; if (boundsLength == 4) { for (int i = 0; i < boundsLength; i++) { boundsCoordinates[i] = bounds.get(i); } } return boundsCoordinates; }
/** * APIMethod: containsLonLat * * <p>Parameters: ll - {<OpenLayers.LonLat>} inclusive - {Boolean} Whether or not to include the * border. Default is true. * * <p>Returns: {Boolean} The passed-in lonlat is within this bounds. */ public boolean containsLonLat(LonLat ll, boolean inclusive) { return BoundsImpl.containsLonLat(getJSObject(), ll.getJSObject(), inclusive); }
/** * Scales the bounds around a LonLat. * * @param ratio * @param origin default is center * @return a new bounds that is scaled by ratio from origin */ public Bounds scale(float ratio, LonLat origin) { JSObject originJsObj = (origin == null) ? null : origin.getJSObject(); return Bounds.narrowToBounds(BoundsImpl.scale(this.getJSObject(), ratio, originJsObj)); }
/** * @param x * @param y * @return A new bounds whose coordinates are the same as this, but shifted by the passed-in x and * y values. */ public Bounds add(float x, float y) { return Bounds.narrowToBounds(BoundsImpl.add(this.getJSObject(), x, y)); }
/** * @param significantDigits - Number of significant digits in the bbox coordinates, pass null to * use the default of 6. * @return String - simple string representation of a Bounds object. For example: "5,42,10,45" */ public String toBBox(Integer significantDigits) { return BoundsImpl.toBBox(getJSObject(), significantDigits); }
public float getWidth() { return BoundsImpl.getWidth(getJSObject()); }
/** @return double - lower left y-coordinate of bounds */ public double getLowerLeftY() { return BoundsImpl.getMinY(getJSObject()); }
/** Create an empty Bounds object with coordinates set to null */ public Bounds() { this(BoundsImpl.create()); }
public void extend(LonLat lonLat) { BoundsImpl.extend(this.getJSObject(), lonLat.getJSObject()); }
public boolean containsBounds(Bounds bounds, boolean partial, boolean contains) { return BoundsImpl.containsBounds(getJSObject(), bounds.getJSObject(), partial, contains); }
public Geometry toGeometry() { return Geometry.narrowToGeometry(BoundsImpl.toGeometry(this.getJSObject())); }
/** @return the center of the bounds in pixel space */ public Pixel getCenterPixel() { return Pixel.narrowToPixel(BoundsImpl.getCenterPixel(this.getJSObject())); }
/** @return the center of the bounds in map space */ public LonLat getCenterLonLat() { return LonLat.narrowToLonLat(BoundsImpl.getCenterLonLat(this.getJSObject())); }
public String toString() { return BoundsImpl.toString(getJSObject()); }
/** * Determine whether the target bounds intersects this bounds. Bounds are considered intersecting * if any of their edges intersect or if one bounds contains the other. * * @param bounds the target bounds * @return whether the passed-in bounds object intersects this bounds */ public boolean intersectsBounds(Bounds bounds) { return BoundsImpl.intersectsBounds(this.getJSObject(), bounds.getJSObject()); }
/** * Create a bounding box by specifying its lower left coordinates, and its upper right * coordinates. * * <p>The units of the bounding box will depend on the CRS and or projection used. * * <p>For example, a bounds object that represents the world-wide bounds in EPSG:4392 is specified * as: new Bounds(-180,-90,180,90); * * @param lowerLeftX = west = minx * @param lowerLeftY = south = miny * @param upperRightX = east = maxx * @param upperRightY = north = maxy */ public Bounds(double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY) { this(BoundsImpl.create(lowerLeftX, lowerLeftY, upperRightX, upperRightY)); }
public void extend(Point point) { BoundsImpl.extend(this.getJSObject(), point.getJSObject()); }
public void extend(Bounds bounds) { BoundsImpl.extend(this.getJSObject(), bounds.getJSObject()); }
public Bounds transform(Projection source, Projection dest) { return Bounds.narrowToBounds( BoundsImpl.transform(getJSObject(), source.getJSObject(), dest.getJSObject())); }
/** @return double - upper right y-coordinate of bounds */ public double getUpperRightY() { return BoundsImpl.getMaxY(getJSObject()); }
/** * Scales the bounds. * * @param ratio * @return a new bounds that is scaled by ratio */ public Bounds scale(float ratio) { return Bounds.narrowToBounds(BoundsImpl.scale(this.getJSObject(), ratio, null)); }
public float getHeight() { return BoundsImpl.getHeight(getJSObject()); }
/** @return the size of the box */ public Size getSize() { return Size.narrowToSize(BoundsImpl.getSize(getJSObject())); }