def createAllSegments(nodesPath):
    allSegments = []
    isFloorChange = False
    intNodesPath = []
    for i in range(len(nodesPath)):
        node = nodesPath[i]
        if (isinstance(node, Intersection) or isinstance(node, Elevator) or (i == 0) or (i == (len(nodesPath) - 1))):
            intNodesPath.append(node)
    for i in range((len(intNodesPath) - 1)):
        (node, nextNode) = (intNodesPath[i], intNodesPath[(i + 1)])
        if (isinstance(node, Elevator) and isinstance(nextNode, Elevator)):
            isFloorChange = True
        segment = Segment(node.getCoords(), nextNode.getCoords(), i, False, isFloorChange)
        isFloorChange = False
        allSegments.append(segment)
    allSegments.append(Segment(intNodesPath[(- 1)].getCoords(), intNodesPath[(- 1)].getCoords(), i, False, False))
    return allSegments
def createAllSegments(nodesPath):
    allSegments = []
    isFloorChange = False
    intNodesPath = []
    for i in range(len(nodesPath)):
        node = nodesPath[i]
        if (isinstance(node, Intersection) or isinstance(node, Elevator) or (i == 0) or (i == (len(nodesPath) - 1))):
            intNodesPath.append(node)
    for i in range((len(intNodesPath) - 1)):
        (node, nextNode) = (intNodesPath[i], intNodesPath[(i + 1)])
        if (isinstance(node, Elevator) and isinstance(nextNode, Elevator)):
            isFloorChange = True
        segment = Segment(node.getCoords(), nextNode.getCoords(), i, False, isFloorChange)
        isFloorChange = False
        allSegments.append(segment)
    allSegments.append(Segment(intNodesPath[(- 1)].getCoords(), intNodesPath[(- 1)].getCoords(), i, False, False))
    return allSegments