Esempio n. 1
0
 def __init__(self):
     self.linestable=None
     self.linedisttable=None
     self.linebustable=None
     self.businfotable=None
     
     self.linestable=linesTable()
     self.linestable.read_from_file('lines.txt')
     
     self.linedisttable=lineDistTable()
     self.linedisttable.read_from_file('linedist.txt')
     
     self.linebustable=lineBusTable()
     self.linebustable.read_from_file('linebus.txt')
     
     self.businfotable=busInfoTable()
     return
Esempio n. 2
0
#       rPos : real position of one bus
def virtual_2_real(vPos, line):
    for st in line[vPos:]:
        if st.isRealStation():
            rPos = st.realPos
            break
    return rPos

# Using for transform one line vitrual postions
def oneLineBusesVirtual2Real(vPosList, line):
    realBusesPostion = []
    for vPos in vPosList:
        rPos = virtual_2_real(vPos, line)
        realBusesPostion.append(rPos)
    return realBusesPostion


if __name__=='__main__':
    print(__file__, 'test')
    import lineDistance
    ldt = lineDistance.lineDistTable()
    ldt.read_from_file('..\linedist.txt')
    
    # test virtual2real
    vPos = 10
    line = ldt.index(0)
    print(virtual_2_real(10, line))
    
    print(oneLineBusesVirtual2Real([10,16], line))
    
Esempio n. 3
0
if __name__=='__main__':
    from testBusFile import bus
    print('test')
    bus1=bus()
    bus1.readFromFile('busone.txt')
    bus1.writeTofile('tmp3.txt')
    
    print("test distOfBusToSegmentEnd")
    ret=distOfBusToSegmentEnd((118.216117,33.963728), (118.214824,33.960854), (118.214824,33.960854))
    print(ret)
    
    
    print('test func calculateBusNextStation()')
    bus2=bus()
    bus2.readFromFile('bus2.txt')
    ldt=lineDistTable()
    ldt.read_from_file('linedist.txt')
    line=ldt.index(0)
    for i in bus1.path:
        pos=calculateBusNextStation(line, i)
        print(pos)
    
    
    print('test busPositionCalculate')
    bi1=busInfo(7132, ['302', '下行'], 118.216046, 33.95997)
    ret=busPositionCalculate(ldt.index(0), bi1)
    print(ret)
    
    
    print('test lineBusTable')
    #lineBusTable 的构造成与lineDistTable相同
Esempio n. 4
0
CODE_CLEAR          =0xCC
CODE_PERH1	       =0xCD

CODE_FRAME_HEAD =0xF1
CODE_FRAME_END   =0xAA

LEN_OF_CODE_LINE=0x1
LEN_OF_CODE_CLEAR_TEXT=0x1
LEN_OF_CODE_SPEED=0x3
LEN_OF_CODE_CLEAR=0x0

from lineDistance import lineDistTable
from lineDistance import linesTable
from ds.busPositionDT import busPositionDT

linedist = lineDistTable()
lines = linesTable()
bus_pos_dt = busPositionDT()

def initalGlobalValues():
    
    global bus_pos_dt
    global linedist
    global lines
    
    # init line data struct
    lines.read_from_file('lines.txt')
    linedist.read_from_file('linedist.txt')
    
    # init Intermediate data struct
    return