public class LayoutHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DIST_HYPOT |
static int |
DIST_X |
static int |
DIST_Y |
static int |
SORT_ORDER_TOP |
static int |
UNSORTED |
Constructor and Description |
---|
LayoutHelper(android.graphics.Rect maxBounds,
java.util.List<android.graphics.Rect> otherBounds) |
Modifier and Type | Method and Description |
---|---|
void |
add(IMapWidget widget)
Add occupied boundary for a given widget
|
android.graphics.Rect |
findBestPosition(android.graphics.Rect bounds,
int position)
Find the best position for the given bounds
|
android.graphics.Rect |
findBestPosition(android.graphics.Rect bounds,
android.graphics.Point desiredPt)
Find the best position for the given bounds
|
android.graphics.Rect |
findBestPosition(android.graphics.Rect bounds,
android.graphics.Point desiredPt,
int distMethod)
Find the best position for the given bounds
|
android.graphics.Rect |
findMaxHeight(android.graphics.Rect bounds)
Find the maximum possible height for a given boundary
|
android.graphics.Rect |
findMaxWidth(android.graphics.Rect bounds)
Find the maximum possible width for a given boundary
|
static android.graphics.Rect |
getBounds(IMapWidget w)
Get the bounds of a widget
|
java.util.List<android.graphics.Rect> |
getOccupiedBounds()
Get the list of occupied boundaries
|
boolean |
intersects(android.graphics.Rect bounds)
Check if the given bounds intersects any of the occupied boundaries
|
void |
sort(int sortOrder)
Sort the other bounds by the specified sort order
This is used to make intersection testing more efficient
|
public static final int UNSORTED
public static final int SORT_ORDER_TOP
public static final int DIST_X
public static final int DIST_Y
public static final int DIST_HYPOT
public LayoutHelper(android.graphics.Rect maxBounds, java.util.List<android.graphics.Rect> otherBounds)
public void add(IMapWidget widget)
widget
- Widgetpublic java.util.List<android.graphics.Rect> getOccupiedBounds()
public void sort(int sortOrder)
sortOrder
- Sort order (either SORT_ORDER_TOP
or UNSORTED
)public android.graphics.Rect findBestPosition(android.graphics.Rect bounds, android.graphics.Point desiredPt, int distMethod)
bounds
- Widget/view boundsdesiredPt
- Desired positiondistMethod
- Distance calculation methodpublic android.graphics.Rect findBestPosition(android.graphics.Rect bounds, android.graphics.Point desiredPt)
bounds
- Widget/view boundsdesiredPt
- Desired positionpublic android.graphics.Rect findBestPosition(android.graphics.Rect bounds, int position)
bounds
- Widget/view boundsposition
- Desired RootLayoutWidget
positionpublic android.graphics.Rect findMaxWidth(android.graphics.Rect bounds)
bounds
- Boundspublic android.graphics.Rect findMaxHeight(android.graphics.Rect bounds)
bounds
- Boundspublic boolean intersects(android.graphics.Rect bounds)
bounds
- Bounds to checkpublic static android.graphics.Rect getBounds(IMapWidget w)
w
- Widget