Ejemplo n.º 1
0
    private void LoadSiteMobilityModes()
    {
        ClearMobilityModes();

        string activeSiteName = siteBrowser.ActiveSite.Name;
        string filename       = Paths.Data + "Reachability" + Path.DirectorySeparatorChar + activeSiteName + ".csv";

        StartCoroutine(ReachabilityIO.Load(filename, (modes) =>
        {
            if (modes == null || modes.Count == 0)
            {
                CreateDefaultMobilityModes(filename);
            }
            else
            {
                mobilityModes.AddRange(modes);
            }
            OnMobilityModesLoaded();
        }, () =>
        {
            Debug.LogWarning("Couldn't find mobility data for " + activeSiteName);
            CreateDefaultMobilityModes(filename);
            OnMobilityModesLoaded();
        }));
    }
Ejemplo n.º 2
0
    private void OnSaveClick()
    {
        string activeSiteName = siteBrowser.ActiveSite.Name;
        string filename       = Paths.Data + "Reachability" + Path.DirectorySeparatorChar + activeSiteName + ".csv";

        var mobilityModes = new List <MobilityMode>(reachabilityTool.mobilityModes);

        foreach (var mode in mobilityModes)
        {
            for (int i = 0; i < mode.speeds.Length; ++i)
            {
                mode.speeds[i] /= ReachabilityTool.kmPerHourToMetersPerMin;
            }
        }
        ReachabilityIO.Save(mobilityModes, filename);
    }
Ejemplo n.º 3
0
    private void CreateDefaultMobilityModes(string filename)
    {
        var mode = new MobilityMode()
        {
            name = "Car"                                    /*translatable*/
        };

        mode.speeds[(int)ClassificationIndex.Highway]     = 80;
        mode.speeds[(int)ClassificationIndex.HighwayLink] = 50;
        mode.speeds[(int)ClassificationIndex.Primary]     = 50;
        mode.speeds[(int)ClassificationIndex.Secondary]   = 35;
        mode.speeds[(int)ClassificationIndex.Other]       = 15;
        mode.speeds[(int)ClassificationIndex.None]        = defaultWalkSpeed;
        mobilityModes.Add(mode);

        mode = new MobilityMode()
        {
            name = "Motorbike"                                /*translatable*/
        };
        mode.speeds[(int)ClassificationIndex.Highway]     = 60;
        mode.speeds[(int)ClassificationIndex.HighwayLink] = 40;
        mode.speeds[(int)ClassificationIndex.Primary]     = 30;
        mode.speeds[(int)ClassificationIndex.Secondary]   = 30;
        mode.speeds[(int)ClassificationIndex.Other]       = 15;
        mode.speeds[(int)ClassificationIndex.None]        = defaultWalkSpeed;
        mobilityModes.Add(mode);

        mode = new MobilityMode()
        {
            name = "Walk"                                      /*translatable*/
        };
        mode.speeds[(int)ClassificationIndex.Highway]     = 0; // Can't walk on highway
        mode.speeds[(int)ClassificationIndex.HighwayLink] = 0; // Can't walk on highway link
        mode.speeds[(int)ClassificationIndex.Primary]     = defaultWalkSpeed;
        mode.speeds[(int)ClassificationIndex.Secondary]   = defaultWalkSpeed;
        mode.speeds[(int)ClassificationIndex.Other]       = defaultWalkSpeed;
        mode.speeds[(int)ClassificationIndex.None]        = defaultWalkSpeed;
        mobilityModes.Add(mode);

        ReachabilityIO.Save(mobilityModes, filename);
    }