Packagecom.afcomponents.umap.types
Classpublic class Bounds

Bounds is a rectangular area of the map in pixel coordinates.

Notice that a rectangle in geographical coordinates is represented by a LatLngBounds object. New Bounds rectangle can be created using any number of points represented by Point objects.


Example
Here is a quick usage example:
 import com.afcomponents.umap.types.Bounds;
 import flash.geom.Point;
  
 var point1:Point = new Point(0,0);
 var point2:Point = new Point(10,20);
 var point3:Point = new Point(-5,10);
  
 var bounds:Bounds = new Bounds(point1, point2, point3);
 trace(bounds); // traces (min=(x=-5, y=0), max=(x=10, y=20))

See also

LatLngBounds
flash.geom.Point


Public Properties
 PropertyDefined by
  center : Point
[read-only] The coordiantes of the center of the rectangle as a Point object.
Bounds
  height : Number
[read-only] The height of the rectangle.
Bounds
  max : Point
Gets or sets the maximum (bottom-right) coordinate of the rectangle.
Bounds
  maxX : Number
Gets or sets the x coordinate of the right edge of the rectangle.
Bounds
  maxY : Number
Gets or sets the x coordinate of the bottom edge of the rectangle.
Bounds
  min : Point
Gets or sets the minimum (top-left) coordinate of the rectangle.
Bounds
  minX : Number
Gets or sets the x coordinate of the left edge of the rectangle.
Bounds
  minY : Number
Gets or sets the y coordinate of the top edge of the rectangle.
Bounds
  width : Number
[read-only] The width of the rectangle.
Bounds
Public Methods
 MethodDefined by
  
Bounds(... points)
Bounds constructor.
Bounds
  
Creates a copy of this Bounds object.
Bounds
  
containsPoint(point:Point):Boolean
Checks whether given point lies within this rectangle.
Bounds
  
containsRect(rect:Bounds):Boolean
Bounds
  
equals(other:Bounds):Boolean
Determines whether two rectangles are equal.
Bounds
  
extend(point:Point):Boolean
Enlarges the rectangular area so that the point is also contained in the rectangular area.
Bounds
  
getCenter():Point
Return coordinates of the center point
Bounds
  
[static] Returns new object, which will be constructed from the source XML data.
Bounds
  
getXMLFromType(bounds:Bounds, name:String):XML
[static] Returns XML data that describes the Object.
Bounds
  
inflate(x:Number, y:Number):void
Bounds
  
Bounds
  
intersects(rect:Bounds):Boolean
Bounds
  
isValid():Boolean
Validates the rectangle.
Bounds
  
Bounds
  
toString():String
Returns a String that represents the coordinates of the rectangle's corners.
Bounds
Public Constants
 ConstantDefined by
  DEFAULT_NODE_NAME : String = "bounds"
[static] Defines default root node name for XML conversion.
Bounds
Property detail
centerproperty
center:Point  [read-only]

The coordiantes of the center of the rectangle as a Point object. If target rectangle is invalid, center point equals null.

Implementation
    public function get center():Point

See also

isValid()
flash.geom.Point
heightproperty 
height:Number  [read-only]

The height of the rectangle. If target rectangle is invalid, width equals Number.NaN.

Implementation
    public function get height():Number

See also

maxproperty 
max:Point  [read-write]

Gets or sets the maximum (bottom-right) coordinate of the rectangle.

Implementation
    public function get max():Point
    public function set max(value:Point):void

See also

min
maxXproperty 
maxX:Number  [read-write]

Gets or sets the x coordinate of the right edge of the rectangle.

Please note that if the maximum point have been set to null, it will created as a new Point(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) object.

The default value is Number.NEGATIVE_INFINITY.

Implementation
    public function get maxX():Number
    public function set maxX(value:Number):void

See also

max
maxYproperty 
maxY:Number  [read-write]

Gets or sets the x coordinate of the bottom edge of the rectangle.

Please note that if the maximum point have been set to null, it will created as a new Point(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) object.

The default value is Number.NEGATIVE_INFINITY.

Implementation
    public function get maxY():Number
    public function set maxY(value:Number):void

See also

max
minproperty 
min:Point  [read-write]

Gets or sets the minimum (top-left) coordinate of the rectangle.

Implementation
    public function get min():Point
    public function set min(value:Point):void

See also

max
minXproperty 
minX:Number  [read-write]

Gets or sets the x coordinate of the left edge of the rectangle.

Please note that if the minimum point have been set to null, it will created as a new Point(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) object.

The default value is Number.POSITIVE_INFINITY.

Implementation
    public function get minX():Number
    public function set minX(value:Number):void

See also

min
minYproperty 
minY:Number  [read-write]

Gets or sets the y coordinate of the top edge of the rectangle.

Please note that if the minimum point have been set to null, it will created as a new Point(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) object.

The default value is Number.POSITIVE_INFINITY.

Implementation
    public function get minY():Number
    public function set minY(value:Number):void

See also

min
widthproperty 
width:Number  [read-only]

The width of the rectangle. If target rectangle is invalid, width equals Number.NaN.

Implementation
    public function get width():Number

See also

Constructor detail
Bounds()constructor
public function Bounds(... points)

Bounds constructor.

Constructs a rectangle from any number of Point objects. You can specify them either as a comma-separated list or as an Array instance.

var bounds:Bounds = new Bounds(point1, point2, point3);
is the same as
var points:Array = new Array(point1, point2, point3);
  var bounds:Bounds = new Bounds(points);

Bounds object is saved as two Point objects that indicate minimum (top-left) and maximum (bottom-right) corners of the rectangular area.

Parameters
... points — Any number of Point objects or an Array of Point objects.

See also

flash.geom.Point
Method detail
clone()method
public function clone():Bounds

Creates a copy of this Bounds object.

Returns
Bounds — A copy of this object.
containsPoint()method 
public function containsPoint(point:Point):Boolean

Checks whether given point lies within this rectangle.

Returns true if given point lies within the rectangular area.
Returns false if given point lies outside of the rectangular area, or if specified point or target rectangle are invalid.

Parameters
point:Point — Target point for checking.

Returns
Boolean — A value of true if given point lies within the rectangular area; false if it is not.

See also

containsRect()method 
public function containsRect(rect:Bounds):BooleanParameters
rect:Bounds

Returns
Boolean
equals()method 
public function equals(other:Bounds):Boolean

Determines whether two rectangles are equal.

Two rectangles are equal if all parameters in this rectangle are equal to the parameters of the other.

Parameters
other:Bounds — The object to be compared.

Returns
Boolean — A value of true if object is equal to this Bounds object; false if it is not.
extend()method 
public function extend(point:Point):Boolean

Enlarges the rectangular area so that the point is also contained in the rectangular area.

Returns true if the original area have been extended.
Returns false if no changes have been made to the original rectangle.

Please note that you cannot extend invalid Bounds object.

Parameters
point:Point — Target point for extending.

Returns
Boolean — A value of true if the original area have been extended; false if it is not.

See also

getCenter()method 
public function getCenter():Point

Return coordinates of the center point

Returns
Point — A point which indicates the rectangle's center, or null if the rectangle is not valid.
getTypeFromXML()method 
public static function getTypeFromXML(xml:XML):Bounds

Returns new object, which will be constructed from the source XML data.

Parameters
xml:XML — Source XML data.

Returns
Bounds — Object that was constructed from the source XML data.
getXMLFromType()method 
public static function getXMLFromType(bounds:Bounds, name:String):XML

Returns XML data that describes the Object. You can also specify root node name in the second parameter.

Parameters
bounds:Bounds — Object that should be converted to XML.
 
name:String — Root node name.

Returns
XML — XML data that describes the properties of the source object.
inflate()method 
public function inflate(x:Number, y:Number):voidParameters
x:Number
 
y:Number
intersection()method 
public function intersection(rect:Bounds):BoundsParameters
rect:Bounds

Returns
Bounds
intersects()method 
public function intersects(rect:Bounds):BooleanParameters
rect:Bounds

Returns
Boolean
isValid()method 
public function isValid():Boolean

Validates the rectangle.

Returns true if both minimum (top-left) and maximum (bottom-right) points are defined.
Returns false if minimum (top-left) or maximum (bottom-right) are invalid or have a value of null.

Returns
Boolean — A value of true if both minimum and maximum points are defined; false if they are not.

See also

Number.NaN
placeInsideBounds()method 
public function placeInsideBounds(rect:Bounds):voidParameters
rect:Bounds
toString()method 
public function toString():String

Returns a String that represents the coordinates of the rectangle's corners.

The output will look like "(min=top-left corner, max=bottom-right corner)"

Returns
String — A textual representation of the rectangle.
Constant detail
DEFAULT_NODE_NAMEconstant
public static const DEFAULT_NODE_NAME:String = "bounds"

Defines default root node name for XML conversion.