Package org.goplanit.zoning
Class ZoneImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.zoning.ZoneImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,Zone
- Direct Known Subclasses:
OdZoneImpl
,TransferZoneImpl
public abstract class ZoneImpl extends ExternalIdAbleImpl implements Zone
Represents a zone base class.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Centroid
centroid
Centroid of the zoneprotected org.locationtech.jts.geom.Geometry
geometry
geometry of this zoneprotected Map<String,Object>
inputProperties
generic input property storageprotected String
name
name of the zone-
Fields inherited from interface org.goplanit.utils.zoning.Zone
LOGGER, ZONE_ID_CLASS
-
-
Constructor Summary
Constructors Constructor Description ZoneImpl(IdGroupingToken tokenId)
ConstructorZoneImpl(ZoneImpl other, boolean deepCopy)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available membersabstract ZoneImpl
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.protected static long
generateZoneId(IdGroupingToken groupId)
Generate unique id for this zoneCentroid
getCentroid()
Returns the centroid of this zoneorg.locationtech.jts.geom.Geometry
getGeometry()
Collect the geometry (outer border) of this zoneObject
getInputProperty(String key)
collect a propertyString
getName()
Name of the zonelong
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idprotected void
setCentroid(Centroid centroid)
set the centroid for this zone.void
setGeometry(org.locationtech.jts.geom.Geometry geometry)
set the geometry (outer border) of this zone, can be a polygon, but also a line stringprotected void
setId(long id)
set the zone's unique internal id across all zonesvoid
setName(String name)
Name of the zoneabstract ZoneImpl
shallowClone()
Create a shallow copy of this entityString
toString()
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, getId, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.zoning.Zone
getEnvelope, getGeometry, getIdClass, hasCentroid, hasGeometry, hasInputProperty, hasName
-
-
-
-
Constructor Detail
-
ZoneImpl
public ZoneImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- contiguous id generation within this group for instances of this class
-
ZoneImpl
public ZoneImpl(ZoneImpl other, boolean deepCopy)
Constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
generateZoneId
protected static long generateZoneId(IdGroupingToken groupId)
Generate unique id for this zone- Parameters:
groupId
- contiguous id generation within this group for instances of this class- Returns:
- id for this zone
-
setCentroid
protected void setCentroid(Centroid centroid)
set the centroid for this zone. It is assumed the centroid is correctly configured to be compatible with this zoneImpl- Parameters:
centroid
- to set
-
setId
protected void setId(long id)
set the zone's unique internal id across all zones- Overrides:
setId
in classIdAbleImpl
- Parameters:
id
- to set
-
getCentroid
public Centroid getCentroid()
Returns the centroid of this zone- Specified by:
getCentroid
in interfaceZone
- Returns:
- centroid of this zone
-
setGeometry
public void setGeometry(org.locationtech.jts.geom.Geometry geometry)
set the geometry (outer border) of this zone, can be a polygon, but also a line string- Specified by:
setGeometry
in interfaceZone
- Parameters:
geometry
- of the zone
-
getGeometry
public org.locationtech.jts.geom.Geometry getGeometry()
Collect the geometry (outer border) of this zone- Specified by:
getGeometry
in interfaceZone
- Returns:
- geometry of the zone
-
getName
public String getName()
Name of the zone
-
setName
public void setName(String name)
Name of the zone
-
addInputProperty
public void addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available members- Specified by:
addInputProperty
in interfaceZone
- Parameters:
key
- key (name) of the input propertyvalue
- value of the input property
-
getInputProperty
public Object getInputProperty(String key)
collect a property- Specified by:
getInputProperty
in interfaceZone
- Parameters:
key
- for the property- Returns:
- property itself
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Parameters:
tokenId
- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
shallowClone
public abstract ZoneImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceZone
- Overrides:
shallowClone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
deepClone
public abstract ZoneImpl deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code
-
-