# Path: Qt.py

# 
# Path: ts2/scenery/helper.py
# class TrackGraphicsItem(QtWidgets.QGraphicsItem):
# class TrackPropertiesModel(QtCore.QAbstractTableModel):
# class TIProperty:
#     def __init__(self, trackItem, itemId=0):
#     def boundingRect(self):
#     def shape(self):
#     def paint(self, painter, option, widget=None):
#     def mousePressEvent(self, event):
#     def mouseMoveEvent(self, event):
#     def dragEnterEvent(self, event):
#     def dragLeaveEvent(self, event):
#     def dropEvent(self, event):
#     def __init__(self, trackItems):
#     def rowCount(self, parent=None, *args):
#     def columnCount(self, parent=None, *args):
#     def data(self, index, role=Qt.DisplayRole):
#     def setData(self, index, value, role=Qt.EditRole):
#     def headerData(self, section, orientation, role=Qt.DisplayRole):
#     def flags(self, index):
#     def __init__(self, name, display, readOnly=False, propType="str",
#                  enumNames=None, enumValues=None):
# 
# Path: ts2/scenery/abstract.py
# def qPointFStrizer(attr):
#     def getter(self):
# def qPointFDestrizer(attr):
#     def setter(self, value):
# def qPointFTupler(attr):
#     def getter(self):
# def qPointFDetupler(attr):
#     def setter(self, value):
#     def __init__(self, parameters):
#     def updateFromParameters(self, parameters):
#     def initialize(self, simulation):
#     def updateData(self, msg):
#     def getProperties():
#     def getMultiProperties():
#     def for_json(self):
#     def _getOrigin(self):
#     def _setOrigin(self, pos):
#     def _getEnd(self):
#     def _getName(self):
#     def _setName(self, value):
#     def maxSpeed(self):
#     def maxSpeed(self, value):
#     def toolTipText(self):
#     def tiTypeStr(self):
#     def highlighted(self):
#     def _getRealLength(self):
#     def place(self):
#     def nextItem(self):
#     def nextItem(self, ni):
#     def previousItem(self):
#     def previousItem(self, pi):
#     def _getGraphicsItem(self):
#     def _getSelected(self):
#     def _setSelected(self, value):
#     def conflictTI(self):
#     def conflictTiId(self):
#     def conflictTiId(self, value):
#     def getFollowingItem(self, precedingItem, direction=-1):
#     def trainPresent(self):
#     def distanceToTrainEnd(self, pos):
#     def isOnPosition(self, p):
#     def setupTriggers(self):
#     def __eq__(self, ti):
#     def __ne__(self, ti):
#     def __updateGraphics(self):
#     def removeAllGraphicsItems(self):
#     def updateGraphics(self):
#     def updateTrain(self):
#     def getPen(self):
#     def drawConnectionRect(self, painter, point):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsShape(self, shape, itemId):
#     def graphicsPaint(self, painter, options, itemId, widget=None):
#     def graphicsMousePressEvent(self, event, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
#     def graphicsDragEnterEvent(self, event, itemId):
#     def graphicsDragLeaveEvent(self, event, itemId):
#     def graphicsDropEvent(self, event, itemId):
#     def updateFromParameters(self, parameters):
#     def getProperties():
#     def for_json(self):
#     def _setOrigin(self, pos):
#     def _setEnd(self, pos):
#     def _getStart(self):
#     def _setStart(self, pos):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
# class TrackItem(QtCore.QObject):
# class ResizableItem(TrackItem):


import ts2.routing.position
import ts2.utils as utils
from Qt import QtCore, QtGui, QtWidgets, Qt
from ts2.scenery import helper, abstract
        if self.simulation.context == utils.Context.GAME:
            for i in range(len(self._trainHeads)):
                tlines.append(QtCore.QLineF(
                    self.sceneLine.pointAt(self._trainHeads[i] /
                                           self._realLength),
                    self.sceneLine.pointAt(self._trainTails[i] /
                                           self._realLength)
                ))
                if tlines[i].length() < 5.0 and self._trainTails[i] != 0:
                    # Make sure that the train representation is always
                    # at least 5 pixel long.
                    tlines[i].setLength(
                        min(5.0,
                            (1 - self._trainTails[i] / self._realLength) *
                            self.sceneLine.length()))
        self.showTrainLineItem(tlines)

    def showTrainLineItem(self, lines):
        """Shows the given lines (representing trains) on the scenery."""
        if lines:
            # Set the pen
            p = QtGui.QPen()
            p.setWidth(3)
            p.setJoinStyle(Qt.RoundJoin)
            p.setCapStyle(Qt.RoundCap)
            p.setColor(Qt.red)
            for i in range(len(lines)):
                try:
                    self._tli[i].setLine(lines[i])
                except IndexError:

# Path: Qt.py

# 
# Path: ts2/scenery/helper.py
# class TrackGraphicsItem(QtWidgets.QGraphicsItem):
# class TrackPropertiesModel(QtCore.QAbstractTableModel):
# class TIProperty:
#     def __init__(self, trackItem, itemId=0):
#     def boundingRect(self):
#     def shape(self):
#     def paint(self, painter, option, widget=None):
#     def mousePressEvent(self, event):
#     def mouseMoveEvent(self, event):
#     def dragEnterEvent(self, event):
#     def dragLeaveEvent(self, event):
#     def dropEvent(self, event):
#     def __init__(self, trackItems):
#     def rowCount(self, parent=None, *args):
#     def columnCount(self, parent=None, *args):
#     def data(self, index, role=Qt.DisplayRole):
#     def setData(self, index, value, role=Qt.EditRole):
#     def headerData(self, section, orientation, role=Qt.DisplayRole):
#     def flags(self, index):
#     def __init__(self, name, display, readOnly=False, propType="str",
#                  enumNames=None, enumValues=None):
# 
# Path: ts2/scenery/abstract.py
# def qPointFStrizer(attr):
#     def getter(self):
# def qPointFDestrizer(attr):
#     def setter(self, value):
# def qPointFTupler(attr):
#     def getter(self):
# def qPointFDetupler(attr):
#     def setter(self, value):
#     def __init__(self, parameters):
#     def updateFromParameters(self, parameters):
#     def initialize(self, simulation):
#     def updateData(self, msg):
#     def getProperties():
#     def getMultiProperties():
#     def for_json(self):
#     def _getOrigin(self):
#     def _setOrigin(self, pos):
#     def _getEnd(self):
#     def _getName(self):
#     def _setName(self, value):
#     def maxSpeed(self):
#     def maxSpeed(self, value):
#     def toolTipText(self):
#     def tiTypeStr(self):
#     def highlighted(self):
#     def _getRealLength(self):
#     def place(self):
#     def nextItem(self):
#     def nextItem(self, ni):
#     def previousItem(self):
#     def previousItem(self, pi):
#     def _getGraphicsItem(self):
#     def _getSelected(self):
#     def _setSelected(self, value):
#     def conflictTI(self):
#     def conflictTiId(self):
#     def conflictTiId(self, value):
#     def getFollowingItem(self, precedingItem, direction=-1):
#     def trainPresent(self):
#     def distanceToTrainEnd(self, pos):
#     def isOnPosition(self, p):
#     def setupTriggers(self):
#     def __eq__(self, ti):
#     def __ne__(self, ti):
#     def __updateGraphics(self):
#     def removeAllGraphicsItems(self):
#     def updateGraphics(self):
#     def updateTrain(self):
#     def getPen(self):
#     def drawConnectionRect(self, painter, point):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsShape(self, shape, itemId):
#     def graphicsPaint(self, painter, options, itemId, widget=None):
#     def graphicsMousePressEvent(self, event, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
#     def graphicsDragEnterEvent(self, event, itemId):
#     def graphicsDragLeaveEvent(self, event, itemId):
#     def graphicsDropEvent(self, event, itemId):
#     def updateFromParameters(self, parameters):
#     def getProperties():
#     def for_json(self):
#     def _setOrigin(self, pos):
#     def _setEnd(self, pos):
#     def _getStart(self):
#     def _setStart(self, pos):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
# class TrackItem(QtCore.QObject):
# class ResizableItem(TrackItem):


# Path: ts2/scenery/lineitem.py
import ts2.routing.position
import ts2.utils as utils
from Qt import QtCore, QtGui, QtWidgets, Qt
from ts2.scenery import helper, abstract

        if self.simulation.context == utils.Context.GAME:
            for i in range(len(self._trainHeads)):
                tlines.append(QtCore.QLineF(
                    self.sceneLine.pointAt(self._trainHeads[i] /
                                           self._realLength),
                    self.sceneLine.pointAt(self._trainTails[i] /
                                           self._realLength)
                ))
                if tlines[i].length() < 5.0 and self._trainTails[i] != 0:
                    # Make sure that the train representation is always
                    # at least 5 pixel long.
                    tlines[i].setLength(
                        min(5.0,
                            (1 - self._trainTails[i] / self._realLength) *
                            self.sceneLine.length()))
        self.showTrainLineItem(tlines)

    def showTrainLineItem(self, lines):
        """Shows the given lines (representing trains) on the scenery."""
        if lines:
            # Set the pen
            p = QtGui.QPen()
            p.setWidth(3)
            p.setJoinStyle(Qt.RoundJoin)
            p.setCapStyle(Qt.RoundCap)
            p.setColor(Qt.red)
            for i in range(len(lines)):
                try:
                    self._tli[i].setLine(lines[i])
                except IndexError:

                    newTli = QtWidgets.QGraphicsLineItem()