PyANGKernel.GKNode

class GKNode

A node is a turn collection.

Details

A node is a point or an area in the network where vehicles change their direction and/or disperse. Hence, a node has one or more origin sections and one or more destination sections. Each node has a turns list, which determines the possible exits of a vehicle entering the nodes.

Inheritance diagram of PyANGKernel.GKNode

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

class GKNodeType
__init__()
addSignal(signal)
Parameters:

signalGKControlPlanSignal

Add a signal group to this node. The object is adopted.

addTurning(turning, curveTurning[, sortTurnings=true])
Parameters:
  • turningGKTurning

  • curveTurning – bool

  • sortTurnings – bool

Adds a turn to this node. The object is adopted. If curveTurning is true the turn will be curve ( curve )

By default it sorts the turns by ID. When adding several turns (in a importer for example) is faster to add them without sorting and call after all the adds to orderTurningsById

anyFromTurnings(from)
Parameters:

fromGKSection

Return type:

bool

Returns true is there are any turning that starts at section “from” .

anyToTurnings(to)
Parameters:

toGKSection

Return type:

bool

Returns true is there are any turn that ends at section “to”.

changeTurningsDestinationToAnotherSection(oldObject, newObject)
Parameters:

Look in the turns and change the connection origin from “oldObject” to “newObject”. So, all the connections from “oldObject” will be then turns from “newObject”.

This function will not change the GKSection::origin or GKSection::destination attributes.

changeTurningsOriginToAnotherSection(oldObject, newObject)
Parameters:

Look in the turns and change the connection origin from “oldObject” to “newObject”. So, all the connections from “oldObject” will be then turns from “newObject”.

This function will not change the GKSection::origin or GKSection::destination attributes.

conflictingTurnings(iTurning1, iTurning2[, considerUserDefinedConflicts=true])
Parameters:
Return type:

bool

Return if the two turns are considered conflicting

contains(obj)
Parameters:

objGKTurning

Return type:

bool

Returns true if a turn is in this node.

containsSignal(signal)
Parameters:

signalGKControlPlanSignal

Return type:

bool

discardAllPriorities()

Removes all the priorities info.

existTurning(from, to)
Parameters:
Return type:

bool

Any connection between “from” a “to” sections?

getAllPriorities()
Return type:

Dictionary with keys of type .std.pairGKTurning and values of type GKTurning.

Gets the structure containing all priorities between turns. This structure is the following: QMap< QPair< GKTurning , GKTurning >, bool >

getAllowMerge()
Return type:

bool

getConflicts()
Return type:

.list of GKNodeConflict

Returns the list of conflicts for all entities in this node.

getDetailLevel()
Return type:

DetailLevel

Get the detail level for this object.

getEntranceSections()
Return type:

.list of GKSection

Returns a vector with all the entrance sections.

getEntranceSections(scenario)
Parameters:

scenarioGKGenericScenario

Return type:

.list of GKSection

Returns a vector with the entrance sections that exist on the given scenario.

getExitSections()
Return type:

.list of GKSection

Returns a vector with the all the exit sections.

getExitSections(scenario)
Parameters:

scenarioGKGenericScenario

Return type:

.list of GKSection

Returns a vector with the exit sections that exist on the given scenario.

getFirstSignal(cross)
Parameters:

crossGKCrosswalkArea

Return type:

GKControlPlanSignal

Returns the first signal that contains this crosswalk area if any or NULL if the crosswalk area is not used in any signal group.

getFirstSignal(cross)
Parameters:

crossGKPedestrianCrossing

Return type:

GKControlPlanSignal

Returns the first signal that contains this pedestrian crossing if any or NULL if the pedestrian crossing is not used in any signal group.

getFirstSignal(turn)
Parameters:

turnGKTurning

Return type:

GKControlPlanSignal

Returns the first signal that contains this turn if any or NULL if the turn is not used in any signal group.

getFromTurnings(from)
Parameters:

fromGKSection

Return type:

.list of GKTurning

Gets turns that starts at section “from”

getFromTurnings(from, laneIndex)
Parameters:
Return type:

.list of GKTurning

Gets turns that starts at section “from” at lane “laneIndex”.

getFromTurningsOrderedFromLeftToRight(fromPolyline[, scenario=None])
Parameters:
Return type:

.list of GKTurning

Gets turns that starts at section “from” ordered from left to right in the section direction. * If scenario != nullptr, filters by scenario.

getFromTurningsOrderedFromRightToLeft(fromPolyline[, scenario=None])
Parameters:
Return type:

.list of GKTurning

Gets turns that starts at section “from” ordered from right to left in the section direction.

getLowerLayer()
Return type:

GKLayer

Returns the lower layer of all the sections in it.

getMergeCooperationDistance()
Return type:

float

getMinimalPolygons(scenario[, includeNotDrawn=true[, curvedGeometry=true]])
Parameters:
Return type:

.list of GKPoints

Calculates a group of polygons, that do not need to be convex, each of them having a group of turns that intersects with some of the others turns in the polygon. * The scenario will give us the geometry configuration context. * It will return polygons with curved geometry following the turns curves if curvedGeometry is true or polygons with straight segments joining the sections when curvedGeometry is false.

getNodeType()
Return type:

GKNodeType

Calculates the type of this node based on its turns as eSimpleNode, eComplexNode, eMerging or eDiverging.

getNotRoundaboutSections()
Return type:

.list of GKSection

getNumEntranceSections()
Return type:

int

Returns the number of entrance sections.

getNumExitSections()
Return type:

int

Returns the number of exit sections.

getNumberSignals(section)
Parameters:

sectionGKSection

Return type:

int

Returns the number of signals where the section is the origin at turn in a signal.

getNumberSignals(turn)
Parameters:

turnGKTurning

Return type:

int

Returns the number of signals where the turn “turn” is in.

getPolygon()
Return type:

GKPoints

Calculates the convex polygon that contains all the node turns.

getRoundaboutCenter()
Return type:

GKPoint

Calculates the center of the Roundabout

getRoundaboutRole()
Return type:

GKNode

getRoundaboutSections()
Return type:

.list of GKSection

getSignal(signalName)
Parameters:

signalName – str

Return type:

GKControlPlanSignal

Returns a signal group for this node by its name.

getSignal(idSignal)
Parameters:

idSignal – int

Return type:

GKControlPlanSignal

Returns a signal group for this node by its identifier.

getSignalAtPos(posSignal, scenario)
Parameters:
Return type:

GKControlPlanSignal

Returns the id of a signal in the posSignal position of the list of all the signal groups in this node. The signal group is identified by its unique id. If the signal group is not found it returns 0, else it returns the signal group id.

If scenario is different than null it will consider only the signal groups existing in that scenario.

getSignalPos(signal[, scenario=None])
Parameters:
Return type:

int

Returns the position of a signal in the list of the signal groups in this node, but only considering those existing in the active scenario. Those signal groups without turnings present in the active scenario are not considered. The signal group is identified by its unique id. If the signal group is not found it returns 0, else it returns a number between 1 and getSignals() .count both inclusive

If a scenario is provided it will consider only the signal groups existing in that scenario.

getSignalPos(idSignal[, scenario=None])
Parameters:
Return type:

int

Returns the position of a signal in the list of the signal groups in this node, but only considering those existing in the active scenario. Those signal groups without turnings present in the active scenario are not considered. The signal group is identified by its unique id. If the signal group is not found it returns 0, else it returns a number between 1 and getSignals() .count both inclusive

If a scenario is provided it will consider only the signal groups existing in that scenario.

getSignals()
Return type:

.list of GKControlPlanSignal

Returns all the signal groups for this node.

getSignals(turn)
Parameters:

turnGKTurning

Return type:

.list of GKControlPlanSignal

Returns the list of signals where the turn “turn” is in.

getSignalsUsingCrosswalk(crossing)
Parameters:

crossingGKCrosswalkArea

Return type:

.list of GKControlPlanSignal

returns the signals containing the given crosswalk

getSignalsUsingPedestrianCrossing(crossing)
Parameters:

crossingGKPedestrianCrossing

Return type:

.list of GKControlPlanSignal

returns the signals containing the specified pedestrian crossing

getSuperNode()
Return type:

GKSuperNode

getToTurnings(to[, scenario=None])
Parameters:
Return type:

.list of GKTurning

Gets turns that ends at section “to” and present in the given scenario.

getToTurnings(section, laneIndex[, scenario=None])
Parameters:
Return type:

.list of GKTurning

Gets turns that ends at section “section” at lane “laneIndex” and present in the given scenario.

getToTurningsOrderedFromLeftToRight(toPolyline)
Parameters:

toPolylineGKSection

Return type:

.list of GKTurning

Gets turns that starts at section “to” ordered from left to right in the section direction.

getToTurningsOrderedFromRightToLeft(toPolyline)
Parameters:

toPolylineGKSection

Return type:

.list of GKTurning

Gets turns that starts at section “to” ordered from right to left in the section direction.

getTurning(from, to)
Parameters:
Return type:

GKTurning

Gets turn that starts at “from” and ends at “to”.

getTurnings()
Return type:

.list of GKTurning

Gets the list of all the turns in this connector.

hasPriority(turn1, turn2)
Parameters:
Return type:

bool

Returns true if turn “turn1” has priority over “turn2”.

hasUserDefinedTurningConflict(turn1, turn2)
Parameters:
Return type:

bool

Return true if turn1 and turn2 are conflicting turns.

isAligned(secA, secB)
Parameters:
Return type:

bool

Checks if secA is aligned with secB

isEntrySection(sec)
Parameters:

secGKSection

Return type:

bool

Checks if sec is an entry section in this node.

isExitSection(sec)
Parameters:

secGKSection

Return type:

bool

Checks if sec is an exit section in this node.

isRoundabout()
Return type:

bool

isTLeg(section)
Parameters:

sectionGKSection

Return type:

bool

Verify if a section is a tLeg in the node (tLeg is considered to be a section which doesn’t have any aligned sections, but has sections to the right and to the left of it).

isToTheLeft(secA, secB)
Parameters:
Return type:

bool

Checks if secB is located to the left of secA.

isToTheRight(secA, secB)
Parameters:
Return type:

bool

Checks if secB is located to the right of secA.

isUTurning(secA, secB)
Parameters:
Return type:

bool

Checks if there is a u-turn between secA and SecB.

isYellowBox()
Return type:

bool

Is a yellow box?

laneUsed(section, lane[, asOrigin=true[, asDestination=true]])
Parameters:
  • sectionGKSection

  • lane – int

  • asOrigin – bool

  • asDestination – bool

Return type:

bool

Returns true if a lane from section is used in any turn of this node. If asOrigin is true then the method will return true if is used in a turn and from this lane the turn starts. Id asDestination is true then the method will return true if is used in a turn and to this lane the turn ends. If both are true, it will return true if any turn uses this lane.

neededSection(section)
Parameters:

sectionGKSection

Return type:

bool

Returns true if removing all the turns used by this section will remove in fact all the connector turns (that is, all the connection uses this section).

orderTurningsById()

Sort the turns by id. Required if turns are added unsorted (

See also

addTurning )

removeSignal(signal)
Parameters:

signalGKControlPlanSignal

Removes a signal group from this node. The object is not deleted. *

Warning

The specified signal group MUST be one of the node’s signal groups.

removeTurning(connection)
Parameters:

connectionGKTurning

Return type:

bool

Removes a turn from this node. Note that turn is a pointer to the turn that will be removed. The connection will NOT be deleted.

If the turn is not found in this node it will return false and true otherwise.

setAllowMerge(allow)
Parameters:

allow – bool

setConflicts(iConflicts)
Parameters:

iConflicts – .list of GKNodeConflict

Sets the list of conflicts for all entities in this node.

setDetailLevel(level)
Parameters:

levelDetailLevel

Set the detail level for this object.

setMergeCooperationDistance(distance)
Parameters:

distance – float

setPriority(turn1, turn2, priority)
Parameters:

Sets turn “turn1” priority over “turn2” or removes it, depending on the value of “priority”.

See also

hasPriority()

setRoundabout(on)
Parameters:

on – bool

setRoundaboutRole(node)
Parameters:

nodeGKNode

setSignalsName()

Give a name to any signal without.

setSuperNode(superNode)
Parameters:

superNodeGKSuperNode

setUserDefinedConflicts(value)
Parameters:

value – bool

Activate or deactivate user-defined conflicts.

setUserDefinedPriorities(value)
Parameters:

value – bool

Activate or deactivate user-defined priorities.

setUserDefinedTurningConflict(turn1, turn2, priority)
Parameters:

Set if turn1 and turn2 are conflicting turns.

setYellowBox(value)
Parameters:

value – bool

Mark (or unmark) this node as yellow box

See also

isYellowBox()

updatePosition()

Update the node position. As the position is only relevant to macro model be sure to update it before using it. At this moment no auto update is done.

userDefinedConflicts()
Return type:

bool

Are user-defined priorities used in this node?

userDefinedPriorities()
Return type:

bool

Are user-defined priorities used in this node?

usesSignal(signal)
Parameters:

signalGKControlPlanSignal

Return type:

bool

Returns true if the signal is from this node.