Class OsmNetworkReaderLayerData
- java.lang.Object
-
- org.goplanit.osm.converter.network.OsmNetworkReaderLayerData
-
public class OsmNetworkReaderLayerData extends Object
Class containing data that maps Osm entities to PLANit entities required during parsing for a specific network layer- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<org.locationtech.jts.geom.Point,Pair<List<Link>,de.topobyte.osm4j.core.model.iface.OsmNode>>
originalLinkInternalAvailableLocations
Mapping from locations (representing known OSM nodes or auto-generated PLANit nodes without OSM node, in the latter case, no OSM node is stored in the pair) to the links they are internal to.protected Map<Long,Set<Link>>
osmWaysWithMultiplePlanitLinks
track osmways with multiple planit links if they are created due to circular ways or breaking of links.protected Map<org.locationtech.jts.geom.Point,Pair<Node,de.topobyte.osm4j.core.model.iface.OsmNode>>
planitNodesByLocation
track the PLANit nodes created on this layer by their location (which reflects eith an osm node, or an auto-generated stop_location, not related to an osm node in the latter case, no osm node is available) so they can be collected when needed, for example when breaking planit links
-
Constructor Summary
Constructors Constructor Description OsmNetworkReaderLayerData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Link>
findPlanitLinksWithInternalLocation(org.locationtech.jts.geom.Point location)
We identify which current planit links have the given location registered as internal to themMap<org.locationtech.jts.geom.Point,Pair<Node,de.topobyte.osm4j.core.model.iface.OsmNode>>
getCreatedPlanitNodesByLocation()
provide read access to the registered PLANit nodes (and original OSM node if any was used) by locationlong
getNumberOfOsmWaysWithMultiplePlanitLinks()
the number of OSM ways with multiple PLANit links created for themde.topobyte.osm4j.core.model.iface.OsmNode
getOsmNodeByLocation(org.locationtech.jts.geom.Point location)
Collect the OSM node available for the given location (if any), either internal to existing PLANit node or already available as converted PLANit node at that locationde.topobyte.osm4j.core.model.iface.OsmNode
getOsmNodeInternalToLinkByLocation(org.locationtech.jts.geom.Point location)
collect osm node registered as internal to an already created planit link based on its locationNode
getPlanitNodeByLocation(org.locationtech.jts.geom.Point location)
Collect the PLANit node available for the given locationNode
getPlanitNodeByOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
Collect the planit node available for this osm node (if any)OsmNetworkHandlerProfiler
getProfiler()
Collect the profilerSet<org.locationtech.jts.geom.Point>
getRegisteredLocationsInternalToAnyPlanitLink()
Collect all registered locations internal to a planit link (unmodifiable)Set<org.locationtech.jts.geom.Point>
getRegisteredLocationsInternalToAnyPlanitLink(int numberOfLinksNodeMustAtLeastBeInternalTo)
collect all registered locations that are internal to at least the given number of planit linksSet<de.topobyte.osm4j.core.model.iface.OsmNode>
getRegisteredOsmNodesInternalToAnyPlanitLink(int numberOfLinksNodeMustAtLeastBeInternalTo)
collect all registered osm nodes that are internal to at least the given number of planit linksboolean
isLocationInternalToAnyLink(org.locationtech.jts.geom.Point location)
Verify if location is registered as internal to a PLANit linkboolean
isLocationPresentInLayer(org.locationtech.jts.geom.Point location)
verify if location is registered on this layer either as an internal location on a planit link or as an extreme node of a planit linkboolean
isOsmNodePresentInLayer(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
verify if OSM node is part of this layer either as a PLANit node, or internal to any PLANit linkvoid
registerLocationAsInternalToPlanitLink(org.locationtech.jts.geom.Point location, Link planitLink)
add a mapping from location to the (initial) PLANit link it is internal tovoid
registerOsmNodeAsInternalToPlanitLink(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Link planitLink)
Add a mapping from OSM node id to the (initial) planit link it is internal tovoid
registerPlanitNodeByLocation(org.locationtech.jts.geom.Point location, Node planitNode)
register a PLANit node based on a location only, instead of based on an osm nodevoid
registerPlanitNodeByOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Node planitNode)
Register a PLANit node based on an OSM node for this layervoid
reset()
reset contents of membersvoid
updateOsmWaysWithMultiplePlanitLinks(Long osmWayId, Set<Link> newOsmWayToPlanitLinkMapping)
update all known OSM ways with multiple PLANit links.void
updateOsmWaysWithMultiplePlanitLinks(Map<Long,Set<Link>> newOsmWayToPlanitLinkMapping)
update all known OSM ways with multiple PLANit links.
-
-
-
Field Detail
-
osmWaysWithMultiplePlanitLinks
protected Map<Long,Set<Link>> osmWaysWithMultiplePlanitLinks
track osmways with multiple planit links if they are created due to circular ways or breaking of links. Only track globally when part of intermodal reader where follow up components require this information, otherwise it is locally discarded after use
-
planitNodesByLocation
protected final Map<org.locationtech.jts.geom.Point,Pair<Node,de.topobyte.osm4j.core.model.iface.OsmNode>> planitNodesByLocation
track the PLANit nodes created on this layer by their location (which reflects eith an osm node, or an auto-generated stop_location, not related to an osm node in the latter case, no osm node is available) so they can be collected when needed, for example when breaking planit links
-
originalLinkInternalAvailableLocations
protected Map<org.locationtech.jts.geom.Point,Pair<List<Link>,de.topobyte.osm4j.core.model.iface.OsmNode>> originalLinkInternalAvailableLocations
Mapping from locations (representing known OSM nodes or auto-generated PLANit nodes without OSM node, in the latter case, no OSM node is stored in the pair) to the links they are internal to. When initial parsing is done, we verify if any entry in the map contains more than one link in which case the two link intersect at a point other than the extremes and we must break the link. Also, in case any existing link's extreme node is internal to any other link, the link where this location is internal to must be split into two because a PLANit network requires all intersections of links to occur at the end or start of a link. Since during breaking of links, the mapping between known locations (osm nodes/auto-generated planit nodes) and planit links is no longer correct we use a separate mapping viaosmWaysWithMultiplePlanitLinks
to track how original osm ways (links) are now split allowing us to map any previously registered location to the correct planit link even after breaking of links
-
-
Method Detail
-
getPlanitNodeByOsmNode
public Node getPlanitNodeByOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode) throws PlanItException
Collect the planit node available for this osm node (if any)- Parameters:
osmNode
- to find node for- Returns:
- PLANit node found, null if not found
- Throws:
PlanItException
- thrown if error
-
getPlanitNodeByLocation
public Node getPlanitNodeByLocation(org.locationtech.jts.geom.Point location) throws PlanItException
Collect the PLANit node available for the given location- Parameters:
location
- to find for- Returns:
- PLANit node found, null if not found
- Throws:
PlanItException
- thrown if error
-
getOsmNodeByLocation
public de.topobyte.osm4j.core.model.iface.OsmNode getOsmNodeByLocation(org.locationtech.jts.geom.Point location)
Collect the OSM node available for the given location (if any), either internal to existing PLANit node or already available as converted PLANit node at that location- Parameters:
location
- to find for- Returns:
- osmNode found null otherwise
-
getCreatedPlanitNodesByLocation
public Map<org.locationtech.jts.geom.Point,Pair<Node,de.topobyte.osm4j.core.model.iface.OsmNode>> getCreatedPlanitNodesByLocation()
provide read access to the registered PLANit nodes (and original OSM node if any was used) by location- Returns:
- mapping of locations for which planit nodes are created, potentially based on osm node
-
registerPlanitNodeByOsmNode
public void registerPlanitNodeByOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Node planitNode) throws PlanItException
Register a PLANit node based on an OSM node for this layer- Parameters:
osmNode
- to index byplanitNode
- to register- Throws:
PlanItException
- thrown if error
-
registerPlanitNodeByLocation
public void registerPlanitNodeByLocation(org.locationtech.jts.geom.Point location, Node planitNode) throws PlanItException
register a PLANit node based on a location only, instead of based on an osm node- Parameters:
location
- to index byplanitNode
- to register- Throws:
PlanItException
- thrown if error
-
registerOsmNodeAsInternalToPlanitLink
public void registerOsmNodeAsInternalToPlanitLink(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Link planitLink) throws PlanItException
Add a mapping from OSM node id to the (initial) planit link it is internal to- Parameters:
osmNode
- to useplanitLink
- to register as osm node being internal to- Throws:
PlanItException
- thrown if error
-
registerLocationAsInternalToPlanitLink
public void registerLocationAsInternalToPlanitLink(org.locationtech.jts.geom.Point location, Link planitLink)
add a mapping from location to the (initial) PLANit link it is internal to- Parameters:
location
- to useplanitLink
- to register as location being internal to (location either being a known osm node, or, for example, an auto-generated stop_position, not absed on a planit node)
-
updateOsmWaysWithMultiplePlanitLinks
public void updateOsmWaysWithMultiplePlanitLinks(Map<Long,Set<Link>> newOsmWayToPlanitLinkMapping)
update all known OSM ways with multiple PLANit links. To use whenever a PLANit link is broken and split into multiple PLANit links that cover the same original OSM way. This registration is used to find the correct PLANit links that are internal to OSM nodes when needed.- Parameters:
newOsmWayToPlanitLinkMapping
- contains new mapping from osm way id to known planit links that cover this osm way
-
updateOsmWaysWithMultiplePlanitLinks
public void updateOsmWaysWithMultiplePlanitLinks(Long osmWayId, Set<Link> newOsmWayToPlanitLinkMapping)
update all known OSM ways with multiple PLANit links. To use whenever a PLANit link is broken and split into multiple PLANit links that cover the same original OSM way. This registration is used to find the correct PLANit links that are internal to OSM nodes when needed.- Parameters:
osmWayId
- to add links fornewOsmWayToPlanitLinkMapping
- contains additional PLANit links created for this OSM way
-
getNumberOfOsmWaysWithMultiplePlanitLinks
public long getNumberOfOsmWaysWithMultiplePlanitLinks()
the number of OSM ways with multiple PLANit links created for them- Returns:
- total
-
isLocationInternalToAnyLink
public boolean isLocationInternalToAnyLink(org.locationtech.jts.geom.Point location)
Verify if location is registered as internal to a PLANit link- Parameters:
location
- to verify- Returns:
- true when registered as internal, false otherwise
-
isOsmNodePresentInLayer
public boolean isOsmNodePresentInLayer(de.topobyte.osm4j.core.model.iface.OsmNode osmNode) throws PlanItException
verify if OSM node is part of this layer either as a PLANit node, or internal to any PLANit link- Parameters:
osmNode
- to check- Returns:
- true when part of a geometry in the layer, false otherwise
- Throws:
PlanItException
- thrown if error
-
isLocationPresentInLayer
public boolean isLocationPresentInLayer(org.locationtech.jts.geom.Point location)
verify if location is registered on this layer either as an internal location on a planit link or as an extreme node of a planit link- Parameters:
location
- to check- Returns:
- true when part of a geometry in the layer, false otherwise
-
getRegisteredLocationsInternalToAnyPlanitLink
public Set<org.locationtech.jts.geom.Point> getRegisteredLocationsInternalToAnyPlanitLink()
Collect all registered locations internal to a planit link (unmodifiable)- Returns:
- found locations
-
getRegisteredLocationsInternalToAnyPlanitLink
public Set<org.locationtech.jts.geom.Point> getRegisteredLocationsInternalToAnyPlanitLink(int numberOfLinksNodeMustAtLeastBeInternalTo)
collect all registered locations that are internal to at least the given number of planit links- Parameters:
numberOfLinksNodeMustAtLeastBeInternalTo
- restriction- Returns:
- found locations
-
getRegisteredOsmNodesInternalToAnyPlanitLink
public Set<de.topobyte.osm4j.core.model.iface.OsmNode> getRegisteredOsmNodesInternalToAnyPlanitLink(int numberOfLinksNodeMustAtLeastBeInternalTo)
collect all registered osm nodes that are internal to at least the given number of planit links- Parameters:
numberOfLinksNodeMustAtLeastBeInternalTo
- restriction- Returns:
- found osm nodes
-
getOsmNodeInternalToLinkByLocation
public de.topobyte.osm4j.core.model.iface.OsmNode getOsmNodeInternalToLinkByLocation(org.locationtech.jts.geom.Point location)
collect osm node registered as internal to an already created planit link based on its location- Parameters:
location
- to use- Returns:
- osmNode, null if no match was found
-
findPlanitLinksWithInternalLocation
public List<Link> findPlanitLinksWithInternalLocation(org.locationtech.jts.geom.Point location)
We identify which current planit links have the given location registered as internal to them- Parameters:
location
- to use- Returns:
- found planit links, null if input is null
-
reset
public void reset()
reset contents of members
-
getProfiler
public OsmNetworkHandlerProfiler getProfiler()
Collect the profiler- Returns:
- profiler for this layer
-
-