Exemple #1
0
        public static ScnTrackCollection Parse(string text, string path = null, ScnTrackIncludes includes = ScnTrackIncludes.Before)
        {
            var tracks = new ScnTrackCollection();

            tracks.Source         = text;
            tracks.SourcePath     = path;
            tracks.SourceIncludes = includes;
            tracks.Parse();
            tracks.GetSourceFragments();
            return(tracks);
        }
Exemple #2
0
            /// <summary>
            /// Creates track spline list instance for the track list specified
            /// </summary>
            /// <param name="tracks"></param>
            public SplineCollection(ScnTrackCollection tracks)
            {
                var tc = tracks.Count;

                Capacity = (int)Math.Round(1.1 * tc, 0);
                tracks.ForEach(t => { Add(Spline.FromTrack(t)); if (t.IsSwitch)
                                      {
                                          Add(Spline.FromTrack(t, true));
                                      }
                               });
                Tracks = tracks;
            }
Exemple #3
0
 /// <summary>
 /// Loads track data in the background
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private new void Load(object sender, DoWorkEventArgs e)
 {
     try {
         if (!DesignMode)
         {
             Tracks  = ScnTrackCollection.Load();
             MapArea = Splines.Bounds;
         }
         Message = null;
     } catch (Exception x) {
         Message = x.Message;
     }
 }
Exemple #4
0
        public static ScnTrackCollection Load()
        {
            var tracks = new ScnTrackCollection();

            ProjectFile.All.ForEach(f => {
                if (f.Type == ProjectFile.Types.SceneryPart || f.Type == ProjectFile.Types.SceneryMain)
                {
                    var set = ScnTrackCollection.Parse(f.Text, f.Path, ScnTrackIncludes.Ignore);
                    if (set.Count > 0)
                    {
                        tracks.AddRange(set);
                    }
                }
            });
            return(tracks);
        }
Exemple #5
0
        private void NameTracksMenuItem_Click(object sender, EventArgs e)
        {
            var ed = CurrentEditor;

            if (ed != null && !String.IsNullOrWhiteSpace(ed.Text))
            {
                Status.Text = Messages.ProcessingTracks;
                Application.DoEvents();
                var tracks = ScnTrackCollection.Parse(ed.Text, ed.File.Path);
                if (tracks.Count > 0)
                {
                    tracks.SortAddNames();
                    ed.BeginAutoUndo();
                    ed.Text = tracks.ReplaceText();
                    ed.EndAutoUndo();
                }
                Status.Text = Messages.Ready;
            }
        }
Exemple #6
0
        public ScnTrackCollection GetVisible(float scale, RectangleF viewport)
        {
            var visible = new ScnTrackCollection();

            return(visible);
        }