Package org.planit.network
Class InfrastructureNetwork
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.assignment.TrafficAssignmentComponent<Network>
-
- org.planit.network.Network
-
- org.planit.network.InfrastructureNetwork
-
- All Implemented Interfaces:
Serializable
,Comparable<Idable>
,org.djutils.event.EventProducerInterface
,Idable
- Direct Known Subclasses:
MacroscopicNetwork
public class InfrastructureNetwork extends Network
A network with physical infrastructure layers- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description InfrastructureLayers
infrastructureLayers
stores the various layers grouped by their supported modes of transportModes
modes
class instance containing all modes specific functionality across the layers-
Fields inherited from class org.planit.network.Network
MACROSCOPIC_NETWORK, networkIdGroupingToken
-
Fields inherited from class org.planit.assignment.TrafficAssignmentComponent
id, tokenId, trafficComponentType
-
-
Constructor Summary
Constructors Constructor Description InfrastructureNetwork(IdGroupingToken tokenId)
Default constructorInfrastructureNetwork(IdGroupingToken tokenId, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.opengis.referencing.crs.CoordinateReferenceSystem
getCoordinateReferenceSystem()
collect the used crsInfrastructureLayer
getInfrastructureLayerByMode(Mode mode)
collect an infrastructure layer by mode (identical to this.infrastructureLayers.get(mode))void
initialiseInfrastructureLayers(InfrastructureLayersConfigurator planitInfrastructureLayerConfiguration)
Tries to intialise and create/register infrastructure layers via a predefined configuration rather than letting the user do this manually via the infrastructure layers container.void
removeDanglingSubnetworks()
remove any dangling subnetworks from the network's layers if they exist and subsequently reorder the internal ids if neededvoid
removeDanglingSubnetworks(Integer belowSize, Integer aboveSize, boolean alwaysKeepLargest)
remove any dangling subnetworks below a given size from the network if they exist and subsequently reorder the internal ids if neededvoid
setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
set the coordinate reference system used for all layersvoid
transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCoordinateReferenceSystem)
change the coordinate system, which will result in an update of all geometries in the network layers from the original CRS to the new CRS.-
Methods inherited from class org.planit.network.Network
getNetworkGroupingTokenId
-
Methods inherited from class org.planit.assignment.TrafficAssignmentComponent
equals, getId, getIdGroupingToken, getSourceId, getTrafficComponentType, hashCode
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
modes
public final Modes modes
class instance containing all modes specific functionality across the layers
-
infrastructureLayers
public final InfrastructureLayers infrastructureLayers
stores the various layers grouped by their supported modes of transport
-
-
Constructor Detail
-
InfrastructureNetwork
public InfrastructureNetwork(IdGroupingToken tokenId)
Default constructor- Parameters:
tokenId
- to use for id generation
-
InfrastructureNetwork
public InfrastructureNetwork(IdGroupingToken tokenId, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
Default constructor- Parameters:
tokenId
- to use for id generationcoordinateReferenceSystem
- preferred coordinate reference system to use
-
-
Method Detail
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
collect the used crs- Returns:
- coordinateReferencesystem used by this infrastructure network
-
setCoordinateReferenceSystem
public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
set the coordinate reference system used for all layers- Parameters:
coordinateReferenceSystem
- to set
-
transform
public void transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCoordinateReferenceSystem) throws PlanItException
change the coordinate system, which will result in an update of all geometries in the network layers from the original CRS to the new CRS. If the network is empty and no CRS is set then this is identical to calling setCoordinateReferenceSystem, otherwise it will change the CRS while the set method will throw an exception- Parameters:
newCoordinateReferenceSystem
- to transform the network to- Throws:
PlanItException
- thrown if error
-
getInfrastructureLayerByMode
public InfrastructureLayer getInfrastructureLayerByMode(Mode mode)
collect an infrastructure layer by mode (identical to this.infrastructureLayers.get(mode))- Parameters:
mode
- to collect layer for- Returns:
- corresponding layer, null if not found)
-
initialiseInfrastructureLayers
public void initialiseInfrastructureLayers(InfrastructureLayersConfigurator planitInfrastructureLayerConfiguration)
Tries to intialise and create/register infrastructure layers via a predefined configuration rather than letting the user do this manually via the infrastructure layers container. Only possible when the network is still empty and no layers are yet active- Parameters:
planitInfrastructureLayerConfiguration
- to use for configuration
-
removeDanglingSubnetworks
public void removeDanglingSubnetworks() throws PlanItException
remove any dangling subnetworks from the network's layers if they exist and subsequently reorder the internal ids if needed- Throws:
PlanItException
- thrown if error
-
removeDanglingSubnetworks
public void removeDanglingSubnetworks(Integer belowSize, Integer aboveSize, boolean alwaysKeepLargest) throws PlanItException
remove any dangling subnetworks below a given size from the network if they exist and subsequently reorder the internal ids if needed- Parameters:
belowSize
- remove subnetworks below the given sizeaboveSize
- remove subnetworks above the given size (typically set to maximum value)alwaysKeepLargest
- when true the largest of the subnetworks is always kept, otherwise not- Throws:
PlanItException
- thrown if error
-
-