Package net.sf.eBusx.geo
Class GeoObject
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject
-
- net.sf.eBus.messages.EField
-
- net.sf.eBusx.geo.GeoObject
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
GeoCircle
,GeoCollection
,GeoEllipse
,GeoLineString
,GeoMultiLineString
,GeoMultiPoint
,GeoMultiPolygon
,GeoPoint
,GeoPolygon
public abstract class GeoObject extends EField
Base class for all GeoJSON elements. Contains GeoJSON element type (required) and bounding box (optional).- Author:
- Charles W. Rapp
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeoObject.GeoBuilder<F extends GeoObject,B extends GeoObject.GeoBuilder<F,?>>
Base class for all GeoJSON object builders.static class
GeoObject.GeoType
Enumerates GeoJSON geo-spatial data types.-
Nested classes/interfaces inherited from class net.sf.eBus.messages.EField
EField.Builder<M extends EField>
-
-
Field Summary
Fields Modifier and Type Field Description BoundingBox
boundingBox
Optional bounding box associated with this GeoJSON type.static java.math.BigDecimal
MAX_LATITUDE
Maximum allowed latitude is +90.static java.math.BigDecimal
MAX_LONGITUDE
Maximum allowed longitude is +180.static java.math.BigDecimal
MIN_LATITUDE
Minimum allowed latitude is -90.static java.math.BigDecimal
MIN_LONGITUDE
Minimum allowed longitude is -180.GeoObject.GeoType
type
Data represents this geometry type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
GeoObject(GeoObject.GeoBuilder<?,?> builder)
Creates a new OpenStreatMap element based on the given builder settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
toString()
Returns text specifying GeoJSON type and attributesstatic java.math.BigDecimal
validateLatitude(java.math.BigDecimal latitude)
static java.math.BigDecimal
validateLongitude(java.math.BigDecimal longitude)
-
-
-
Field Detail
-
MIN_LATITUDE
public static final java.math.BigDecimal MIN_LATITUDE
Minimum allowed latitude is -90.
-
MAX_LATITUDE
public static final java.math.BigDecimal MAX_LATITUDE
Maximum allowed latitude is +90.
-
MIN_LONGITUDE
public static final java.math.BigDecimal MIN_LONGITUDE
Minimum allowed longitude is -180.
-
MAX_LONGITUDE
public static final java.math.BigDecimal MAX_LONGITUDE
Maximum allowed longitude is +180.
-
type
public final GeoObject.GeoType type
Data represents this geometry type.
-
boundingBox
@Nullable public final BoundingBox boundingBox
Optional bounding box associated with this GeoJSON type.
-
-
Constructor Detail
-
GeoObject
protected GeoObject(GeoObject.GeoBuilder<?,?> builder)
Creates a new OpenStreatMap element based on the given builder settings.- Parameters:
builder
- contains common element settings.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns text specifying GeoJSON type and attributes- Overrides:
toString
in classjava.lang.Object
- Returns:
- human-readable text containing GeoJSON type name and attributes.
-
validateLatitude
public static java.math.BigDecimal validateLatitude(java.math.BigDecimal latitude)
Certifies thatlatitude
is notnull
and is ≥MIN_LATITUDE
and ≤MAX_LATITUDE
. Throws the appropriate exception if not the case. Otherwise returns the validated latitude.- Parameters:
latitude
- validate this latitude.- Returns:
- validated
latitude
. - Throws:
java.lang.NullPointerException
- iflatitude
isnull
.java.lang.IllegalArgumentException
- iflatitude
<MIN_LATITUDE
or >MAX_LATITUDE
.
-
validateLongitude
public static java.math.BigDecimal validateLongitude(java.math.BigDecimal longitude)
Certifies thatlongitude
is notnull
and is ≥MIN_LONGITUDE
and ≤MAX_LONGITUDE
. Throws the appropriate exception if not the case. Otherwise returns the validated longitude.- Parameters:
longitude
- validate this longitude.- Returns:
- validated
longitude
. - Throws:
java.lang.NullPointerException
- iflongitude
isnull
.java.lang.IllegalArgumentException
- iflongitude
<MIN_LONGITUDE
or >MAX_LONGITUDE
.
-
-