public abstract class Area extends Object implements Message, Serializable
| Modifier and Type | Field and Description |
|---|---|
static MessageSerializer<Area> |
SERIALIZER
A parser of areas.
|
| Constructor and Description |
|---|
Area() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Area area)
Returns true if the specified element is fully contained in the shape, otherwise false.
|
abstract boolean |
contains(Position position) |
static Area |
fromJSON(CharSequence string)
Creates a message of this type from a JSON throwing a runtime exception if the format of the message does not
match a valid area.
|
abstract Rectangle |
getBoundingBox()
Returns a bounding box of the area.
|
Position |
getRandomPosition()
Returns a random position within the area.
|
abstract Position |
getRandomPosition(Random random)
Returns a random position within the area using a specified random source.
|
abstract boolean |
intersects(Area other) |
String |
toJSON()
Returns a JSON representation of this message
|
static Area |
unionOf(Area... areas) |
Area |
unionWith(Area other)
Returns a union of this area with the specified area.
|
public static final MessageSerializer<Area> SERIALIZER
public boolean contains(Area area)
area - the area to testpublic abstract boolean contains(Position position)
public abstract Rectangle getBoundingBox()
public final Position getRandomPosition()
public abstract Position getRandomPosition(Random random)
random - the random sourcepublic abstract boolean intersects(Area other)
public String toJSON()
public final Area unionWith(Area other)
other - the area to join with this area.public static Area fromJSON(CharSequence string)
string - the JSON string to parseCopyright © 2012–2015 Danish Maritime Authority. All rights reserved.