コード例 #1
0
    public static void ReadVissim()
    {
        var trafficDB = FindObjectOfType <TrafficIntegrationData>();

        if (trafficDB != null)
        {
            var path = EditorUtility.OpenFilePanel("Open .fzp", "", "fzp");
            if (path.Length > 0)
            {
                // Clear the trafficDB
                trafficDB.ResetTrafficDB();

                // Instantiate the simulation reader.
                var reader = SimulationReader.FindSimulationReader();
                reader.SetFileName(path);
                reader.SetUseNetworkStream(false);
                reader.SetIO(new VissimIO());
                reader.SetTrafficDB(trafficDB);

                // Start a threaded read.
                reader.ThreadUpdate();
                reader.TryShowWindow();

                //Debug.Log("ReadFZP: DoPasing thread started...");
            }
        }
    }
コード例 #2
0
    public static void ReadPws()
    {
        var trafficDB = FindObjectOfType <TrafficIntegrationData>();

        if (trafficDB != null)
        {
            var path = EditorUtility.OpenFilePanel("Open .meta", "", "meta");
            if (path.Length > 0)
            {
                // Clear the trafficDB
                trafficDB.ResetTrafficDB();

                // Instantiate the simulation reader.
                var reader = SimulationReader.FindSimulationReader();
                reader.SetFileName(path);
                reader.SetUseNetworkStream(false);
                reader.SetIO(new ProtoMetaIO());
                reader.SetTrafficDB(trafficDB);

                // Start a threaded read.
                reader.ThreadUpdate();
                reader.TryShowWindow();
            }
        }
    }
コード例 #3
0
    public void LoadScenario(int index)
    {
        Debug.Log("Loading scenario " + index);
        log.Info("Loading scenario " + index);

        if (decisionTree == null)
        {
            return;
        }
        if (trafficDB == null)
        {
            return;
        }

        var sc = decisionTree.GetScenario(index);

        if (sc == null)
        {
            return;
        }

        // Round up game time to avoid loops when going back
        timeController.gameTime += 0.1f;

        if (currentScenario != null && currentScenario.id == sc.id)
        {
            Debug.Log("Scenario already in memory, no need to load it again");
            return;
        }

        trafficDB.ResetTrafficDB();

        var reader = SimulationReader.FindSimulationReader();

        if (sc.simulation != null)
        {
            //reader.SetFileName(sc.FindSimulationPath());
            reader.SetFileName(sc.simulation.path);
            reader.SetUseNetworkStream(false);
            reader.SetIO(new ProtoMetaIO());
            reader.SetTrafficDB(trafficDB);

            // Start a threaded read.
            reader.ThreadUpdate();
        }

        // Set the current scenario with a delay to allow threading start
        StartCoroutine("SetCurrentScenario", sc);
    }
コード例 #4
0
    public static void ReadMatSim()
    {
        var trafficDB = FindObjectOfType <TrafficIntegrationData>();

        if (trafficDB != null)
        {
            var aramGis          = FindObjectOfType <MapBoundaries>();
            var connectionString = aramGis.GetOverridenConnectionString();

            // Instantiate the simulation reader.
            var reader = SimulationReader.FindSimulationReader();
            if (!reader.IsConnectionOpen(connectionString))
            {
                return;
            }

            trafficDB.ResetTrafficDB();

            reader.SetConnectionString(connectionString);
            reader.SetIO(new MatsimIO());
            reader.SetTrafficDB(trafficDB);
            reader.ThreadUpdate();

            //Debug.Log("ReadMatsim: DoPasing thread started...");

            //var path = EditorUtility.OpenFilePanel("Open .xml", "", "xml");
            //if (path.Length > 0)
            //{
            //    // Clear the trafficDB
            //    trafficDB.ResetTrafficDB();

            //    // Instantiate the simulation reader.
            //    var reader = SimulationReader.FindSimulationReader();
            //    reader.SetFileName(path);
            //    reader.SetUseNetworkStream(false);
            //    reader.SetIO(new MatsimIO());
            //    reader.SetTrafficDB(trafficDB);

            //    // Start a threaded read.
            //    reader.ThreadUpdate();
            //    reader.TryShowWindow();

            //    //Debug.Log("ReadFZP: DoPasing thread started...");

            //}
        }
    }