tvaLib
create-hli.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # tvaLib Copyright (c) 2012-2016 Paul G. St-Aubin
3 # Ecole Polytechnique de Montreal, McGill University
4 # Python 2.7; (dt) Spyder Windows 10 64-bit; ipython Ubuntu 15.04 64-bit
5 version = 'R2.3.0 u. 2017-03-22'
6 
7 
8 
11 def main():
12 
16  import os
17  from site import addsitedir
18  #Add root directory from parent if available
19  if(os.path.isfile(os.path.join(os.getcwd(), os.pardir, 'main.py'))):
20  addsitedir(os.path.join(os.getcwd(), os.pardir))
21  os.chdir(os.path.join(os.getcwd(), os.pardir))
22 
23  import include.config as tvaConfig
24 
25  import lib.metadata as tvaMetaData
26 
27 
30  commands = tvaConfig.commands()
31  config = tvaConfig.Config(readonly=True)
32  if(commands.dir): config.dir = commands.dir
33  if(commands.file): config.dbn = commands.dbn
34 
35 
38  session = tvaMetaData.createDatabase(os.path.join(config.dir, config.dbn)) # if the tables were not created, need to do it
39  site_analyses = session.query(tvaMetaData.SiteAnalysis).all()
40 
41 
44  roundaboutQuadrants = session.query(tvaMetaData.HLIRoundaboutQuadrant).all()
45  roundaboutQuadrants.append(tvaMetaData.HLIRoundaboutQuadrant([x for x in site_analyses if x.idx==1][0], start_lanes='0', end_lanes='0', approach_lanes='1', exit_lanes='1', ped_lanes='', start_merge_zone='[19.58]', end_merge_zone='[36.11]', approach_merge_zone='[24.98]', exit_merge_zone='[43.15]'))
46 
47 
110 
111 
112 
115  session.add_all(roundaboutQuadrants)
116  session.commit()
117 
118 
121 if __name__ == "__main__":
122  main()
def main()
main()
Definition: create-hli.py:11
Definition: main.py:1