com.allen_sauer.gwt.dnd.client.util
Interface Area

All Known Implementing Classes:
AbstractArea, CoordinateArea, WidgetArea

public interface Area

Class representing a rectangular region, with convenience methods for calculations.


Method Summary
 Area copyOf()
          Clone our area.
 int distanceToEdge(Location location)
          Determine the shortest distance from the location to the edge of the area.
 int getBottom()
          Get the area's bottom coordinate in pixels.
 Location getCenter()
          Get the area's center Location.
 int getHeight()
          Get the area's height.
 int getLeft()
          Get the area's left coordinate in pixels.
 int getRight()
          Get the area's right coordinate in pixels.
 int getSize()
          Determine area (width * height).
 int getTop()
          Get the area's top coordinate in pixels.
 int getWidth()
          Get the area's width.
 boolean inBottomRight(Location location)
          Determine if location is to the bottom-right of the following 45 degree line.
 boolean intersects(Area targetArea)
          Determine if the target area intersects our area.
 boolean intersects(Location location)
          Determine if the provided location intersects with our area.
 void moveTo(Location location)
          Translate our top left position to the new location.
 

Method Detail

copyOf

Area copyOf()
Clone our area.

Returns:
the new area

distanceToEdge

int distanceToEdge(Location location)
Determine the shortest distance from the location to the edge of the area. Zero indicates a location on the edge. Negative distances indicate a location inside the area.

Parameters:
location - the reference location
Returns:
shortest distance to edge of area

getBottom

int getBottom()
Get the area's bottom coordinate in pixels.

Returns:
the bottom coordinate in pixels

getCenter

Location getCenter()
Get the area's center Location.

Returns:
the area's center Location

getHeight

int getHeight()
Get the area's height.

Returns:
the area's height in pixels

getLeft

int getLeft()
Get the area's left coordinate in pixels.

Returns:
the left coordinate in pixels

getRight

int getRight()
Get the area's right coordinate in pixels.

Returns:
the right coordinate in pixels

getSize

int getSize()
Determine area (width * height).

Returns:
size of area

getTop

int getTop()
Get the area's top coordinate in pixels.

Returns:
the top coordinate in pixels

getWidth

int getWidth()
Get the area's width.

Returns:
the area's width in pixels

inBottomRight

boolean inBottomRight(Location location)
Determine if location is to the bottom-right of the following 45 degree line.
             y  45
             | /
             |/   
        -----+----- x
            /|
           / |
 
 

Parameters:
location - the location to consider
Returns:
true if the location is to below the 45 degree line

intersects

boolean intersects(Area targetArea)
Determine if the target area intersects our area.

Parameters:
targetArea - the area to compare to
Returns:
true if target area intersects our area

intersects

boolean intersects(Location location)
Determine if the provided location intersects with our area.

Parameters:
location - the location to examine
Returns:
true if the location falls within our area

moveTo

void moveTo(Location location)
Translate our top left position to the new location.

Parameters:
location - the position to translate to


Copyright © 2011 Sage Software, Inc. All rights reserved.