예제 #1
0
        public static void CreateODC(string fileName, string xmlTemplate, string dataDirectory)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo));

            TextReader textReader = new StreamReader(xmlTemplate);

            CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader);

            textReader.Close();

            ODCCreator odcCreator = new ODCCreator(info.HighestZone, info.Types, info.Times, info.Gap);

            foreach (var dimensionInfo in info.CacheInfo)
            {
                string fname = Path.Combine(dataDirectory, dimensionInfo.FileName);

                if (dimensionInfo.Is311)
                {
                    odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                }
                else
                {
                    if (dimensionInfo.SaveInTimes)
                    {
                        odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                    }
                    else
                    {
                        odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                    }
                }
            }
            odcCreator.Save(fileName, false);
        }
예제 #2
0
파일: ODCache.cs 프로젝트: taha-islam/XTMF
 internal void DumpToCreator(ODCCreator oDCCreator)
 {
     foreach (var originBlock in this.Indexes)
     {
         for (int o = originBlock.Start; o < originBlock.End; o++)
         {
             foreach (var destinationBlock in originBlock.SubIndex)
             {
                 for (int d = destinationBlock.Start; d < destinationBlock.End; d++)
                 {
                     oDCCreator.Set(o, d, this);
                 }
             }
         }
     }
 }
예제 #3
0
파일: ODCache.cs 프로젝트: taha-islam/XTMF
        public void ReGenerate(string dataDirectory, string outputDirectory)
        {
            string fileName = Path.GetFileNameWithoutExtension(this.FileName);

            string path    = Path.GetDirectoryName(this.FileName);
            string xmlFile = Path.Combine(path, fileName + ".xml");

            XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo));

            TextReader textReader = new StreamReader(xmlFile);

            CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader);

            textReader.Close();

            ODCCreator odcCreator = new ODCCreator(this.HighestZone, this.Types, this.Times, this.Indexes.Length);

            foreach (var dimensionInfo in info.CacheInfo)
            {
                string fname = Path.Combine(dataDirectory, dimensionInfo.FileName);

                if (dimensionInfo.Is311)
                {
                    odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                }
                else
                {
                    if (dimensionInfo.SaveInTimes)
                    {
                        odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                    }
                    else
                    {
                        odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex);
                    }
                }
            }
            odcCreator.Save(Path.Combine(outputDirectory, Path.GetFileName(this.FileName)), true);
        }
예제 #4
0
파일: TransitData.cs 프로젝트: Cocotus/XTMF
 public void Generate()
 {
     /*
         *  TRANSIT
         *  Structure for now will be:
         *  0: train in vehicle time
         *  1: train wait time
         *  2: train walk time
         *  3: train fare
         */
     ODCCreator creator = new ODCCreator( this.Root.ZoneSystem.ZoneArray.Top + 1, 4, 3, 1 );
     creator.LoadEMME2( FailIfNotExist( this.trnivttAM ), 0, 0 );
     creator.LoadEMME2( FailIfNotExist( this.fin_trnwaitAM ), 0, 1 );
     creator.LoadEMME2( FailIfNotExist( this.trnwalkAM ), 0, 2 );
     creator.LoadEMME2( FailIfNotExist( this.trnivttPM ), 1, 0 );
     creator.LoadEMME2( FailIfNotExist( this.fin_trnwaitPM ), 1, 1 );
     creator.LoadEMME2( FailIfNotExist( this.trnwalkPM ), 1, 2 );
     creator.LoadEMME2( FailIfNotExist( this.trnivttOP ), 2, 0 );
     creator.LoadEMME2( FailIfNotExist( this.fin_trnwaitOP ), 2, 1 );
     creator.LoadEMME2( FailIfNotExist( this.trnwalkOP ), 2, 2 );
     if ( !String.IsNullOrWhiteSpace( this.transitfares ) )
     {
         creator.LoadEMME2( FailIfNotExist( this.transitfares ), 0, 3 );
         creator.LoadEMME2( FailIfNotExist( this.transitfares ), 1, 3 );
         creator.LoadEMME2( FailIfNotExist( this.transitfares ), 2, 3 );
     }
     creator.Save( GetFullPath( this.ODC ), false );
     creator = null;
     GC.Collect();
 }
예제 #5
0
파일: ODCache.cs 프로젝트: Cocotus/XTMF
 internal void DumpToCreator(ODCCreator oDCCreator)
 {
     foreach ( var originBlock in this.Indexes )
     {
         for ( int o = originBlock.Start; o < originBlock.End; o++ )
         {
             foreach ( var destinationBlock in originBlock.SubIndex )
             {
                 for ( int d = destinationBlock.Start; d < destinationBlock.End; d++ )
                 {
                     oDCCreator.Set( o, d, this );
                 }
             }
         }
     }
 }
예제 #6
0
파일: ODCache.cs 프로젝트: Cocotus/XTMF
        public void ReGenerate(string dataDirectory, string outputDirectory)
        {
            string fileName = Path.GetFileNameWithoutExtension( this.FileName );

            string path = Path.GetDirectoryName( this.FileName );
            string xmlFile = Path.Combine( path, fileName + ".xml" );

            XmlSerializer deserializer = new XmlSerializer( typeof( CacheGenerationInfo ) );

            TextReader textReader = new StreamReader( xmlFile );

            CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize( textReader );
            textReader.Close();

            ODCCreator odcCreator = new ODCCreator( this.HighestZone, this.Types, this.Times, this.Indexes.Length );

            foreach ( var dimensionInfo in info.CacheInfo )
            {
                string fname = Path.Combine( dataDirectory, dimensionInfo.FileName );

                if ( dimensionInfo.Is311 )
                {
                    odcCreator.LoadEMME2( fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                }
                else
                {
                    if ( dimensionInfo.SaveInTimes )
                    {
                        odcCreator.LoadCSVTimes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                    }
                    else
                    {
                        odcCreator.LoadCSVTypes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                    }
                }
            }
            odcCreator.Save( Path.Combine( outputDirectory, Path.GetFileName( this.FileName ) ), true );
        }
예제 #7
0
파일: ODCCreator.cs 프로젝트: Cocotus/XTMF
        public static void CreateODC(string fileName, string xmlTemplate, string dataDirectory)
        {
            XmlSerializer deserializer = new XmlSerializer( typeof( CacheGenerationInfo ) );

            TextReader textReader = new StreamReader( xmlTemplate );

            CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize( textReader );
            textReader.Close();

            ODCCreator odcCreator = new ODCCreator( info.HighestZone, info.Types, info.Times, info.Gap );

            foreach ( var dimensionInfo in info.CacheInfo )
            {
                string fname = Path.Combine( dataDirectory, dimensionInfo.FileName );

                if ( dimensionInfo.Is311 )
                {
                    odcCreator.LoadEMME2( fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                }
                else
                {
                    if ( dimensionInfo.SaveInTimes )
                    {
                        odcCreator.LoadCSVTimes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                    }
                    else
                    {
                        odcCreator.LoadCSVTypes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex );
                    }
                }
            }
            odcCreator.Save( fileName, false );
        }