Package net.sf.eBusx.geo
Class GeoPolygon.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EField.Builder<F>
-
- net.sf.eBusx.geo.GeoObject.GeoBuilder<GeoPolygon,GeoPolygon.Builder>
-
- net.sf.eBusx.geo.GeoPolygon.Builder
-
- Enclosing class:
- GeoPolygon
public static final class GeoPolygon.Builder extends GeoObject.GeoBuilder<GeoPolygon,GeoPolygon.Builder>
Builder class used to createGeoPolygoninstances. ABuilderinstance is obtained by callingGeoPolygon.builder()method.
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.messages.EMessageObject.Builder
mTargetClass
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GeoPolygon.Builderadd(LineString ring)Appends linear ring to rings list.GeoPolygon.BuilderaddAll(java.util.Collection<LineString> rings)Appends linear rings collection to linear rings list.GeoPolygon.BuilderaddAll(LineString[] rings)Appends linear rings array to linear rings list.protected GeoPolygonbuildImpl()Returns a newGeoPolygoninstance created from this builder's validated settings.GeoPolygon.BuilderlinearRings(LineString[] rings)Sets linear rings list to the given linear ring values.protected GeoPolygon.Builderself()Returns subclass instance.protected Validatorvalidate(Validator problems)Check if: at least one linear ring was provided, each linear ring has at least four positions, and each linear ring isis closed.-
Methods inherited from class net.sf.eBusx.geo.GeoObject.GeoBuilder
boundingBox, type
-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
self
protected GeoPolygon.Builder self()
Description copied from class:GeoObject.GeoBuilderReturns subclass instance.- Specified by:
selfin classGeoObject.GeoBuilder<GeoPolygon,GeoPolygon.Builder>- Returns:
- builder instance reference.
-
validate
protected Validator validate(Validator problems)
Check if:- at least one linear ring was provided,
- each linear ring has at least four positions, and
-
each linear ring is
is closed.
- Overrides:
validatein classEField.Builder<GeoPolygon>- Parameters:
problems- append detected problems to this validator.- Returns:
problemsto allow for method chaining.- See Also:
Validator
-
buildImpl
protected GeoPolygon buildImpl()
Returns a newGeoPolygoninstance created from this builder's validated settings.- Specified by:
buildImplin classEMessageObject.Builder<GeoPolygon>- Returns:
- new GeoJSON polygon instance.
-
add
public GeoPolygon.Builder add(LineString ring)
Appends linear ring to rings list.- Parameters:
ring- add this linear ring.- Returns:
this Builderinstance.- Throws:
java.lang.NullPointerException- ifringisnull.java.lang.IllegalArgumentException- ifringhas < 4 positions or is not closed.- See Also:
addAll(LineString[]),addAll(Collection),linearRings(LineString[])
-
addAll
public GeoPolygon.Builder addAll(LineString[] rings)
Appends linear rings array to linear rings list.- Parameters:
rings- append all rings to list.- Returns:
this Builderinstance.- Throws:
java.lang.NullPointerException- ifringsisnullorringscontains anullvalue.java.lang.IllegalArgumentException- ifringscontains an invalid ring.- See Also:
add(LineString),addAll(Collection),linearRings(LineString[])
-
addAll
public GeoPolygon.Builder addAll(java.util.Collection<LineString> rings)
Appends linear rings collection to linear rings list.- Parameters:
rings- append all rings to list.- Returns:
this Builderinstance.- Throws:
java.lang.NullPointerException- ifringsisnullor contains anullring.java.lang.IllegalArgumentException- ifringscontains an invalid ring.- See Also:
add(LineString),addAll(LineString[]),linearRings(LineString[])
-
linearRings
public GeoPolygon.Builder linearRings(LineString[] rings)
Sets linear rings list to the given linear ring values. Note that all previously added rings are removed from the list prior to adding these rings but only after validating the linear rings array.- Parameters:
rings- set linear rings list to this array.- Returns:
this Builderinstance.- Throws:
java.lang.NullPointerException- ifringsisnull. If this exception is thrown then linear rings list is unchanged.- See Also:
add(LineString),addAll(LineString[]),addAll(Collection)
-
-