Example #1
0
        public TopFile(List<Station> Stations, TopFile file = null)
        {
            ch0 = 'T';
            ch1 = 'o';
            ch2 = 'p';
            ver = 3;

            this.TripCount = 1;
            this.Trips = new List<Trip>() { new Trip() };

            this.ShotsCount = (uint)Stations.Count;
            this.Shots = new List<Shot>();
            foreach (Station station in Stations)
            {
                Shots.Add(new Shot(station));
            }

            this.RefCount = 0;
            this.References = new List<Reference>();

            if (file != null)
            {
                this.OverView = file.OverView;
                this.OutLine = file.OutLine;
                this.SideView = file.SideView;
            }
            else
            {
                this.OverView = new Mapping();
                this.OutLine = new Drawing();
                this.SideView = new Drawing();
            }
            this.FileLoaded = true;
        }
Example #2
0
        public TopFile(List <Station> Stations, TopFile file = null)
        {
            ch0 = 'T';
            ch1 = 'o';
            ch2 = 'p';
            ver = 3;

            this.TripCount = 1;
            this.Trips     = new List <Trip>()
            {
                new Trip()
            };

            this.ShotsCount = (uint)Stations.Count;
            this.Shots      = new List <Shot>();
            foreach (Station station in Stations)
            {
                Shots.Add(new Shot(station));
            }

            this.RefCount   = 0;
            this.References = new List <Reference>();

            if (file != null)
            {
                this.OverView = file.OverView;
                this.OutLine  = file.OutLine;
                this.SideView = file.SideView;
            }
            else
            {
                this.OverView = new Mapping();
                this.OutLine  = new Drawing();
                this.SideView = new Drawing();
            }
            this.FileLoaded = true;
        }
 public Test(TopFile fajl)
 {
     this.Name = fajl.FileName;
     this.Test2Items = new ObservableCollection<Test2>();
     foreach (var stationPair in fajl.StationMappings)
     {
         this.Test2Items.Add(new Test2(stationPair));
     }
 }
Example #4
0
        private void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.Filter = "top files (*.top)|*.top";
            dlg.Title = "Please select an top file to open.";

            Nullable<bool> result = dlg.ShowDialog();

            if (result == true)
            {
                string filename = dlg.FileName;
                using (BinaryReader b = new BinaryReader(File.Open(filename, FileMode.Open)))
                {
                    int pos = 0;
                    int length = (int)b.BaseStream.Length;
                    this.topFile = new TopFile(b);
                    LoadGrid();
                }
            }
        }
Example #5
0
 private void NewFile_Click(object sender, RoutedEventArgs e)
 {
     TopFile top = new TopFile();
     this.topFile = top;
     LoadGrid();
 }
Example #6
0
 private void LoadAllTopFilesFromFolder(string sFolderName)
 {
     string[] files = Directory.GetFiles(sFolderName);
     topFilesFromFolder = new List<TopFile>();
     foreach(string file in files)
     {
         if (file.Substring(file.LastIndexOf(".")).Contains("top"))
         {
             TopFile TopFile = new TopFile(new BinaryReader((new StreamReader(file)).BaseStream));
             topFilesFromFolder.Add(TopFile);
         }
     }
     MessageBox.Show("Done");
 }
Example #7
0
        private void Import_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.Filter = "top files (*.svx)|*.svx";
            dlg.Title = "Please select an svx file to open.";

            Nullable<bool> result = dlg.ShowDialog();

            if (result == true)
            {
                string filename = dlg.FileName;
                using (StreamReader b = new StreamReader(filename))
                {
                    this.topFile = new TopFile(b);

                    LoadGrid();
                }
            }
        }
Example #8
0
        private IEnumerable<string> GetLinesFromPocketTopo(TopFile tfile)
        {
            foreach(var groupedElements in tfile.Shots.GroupBy(x => new { x.From, x.To }))
            {
                if (groupedElements.Key.To == null)
                {
                    /*foreach (var pt in groupedElements)
                        yield return string.Format("{0}\t{1}\t{2}\t{3}\t{4}", pt.From, pt.To == null ? "*" : pt.To, pt.Distance, pt.Azimuth, pt.Inclination);*/
                }
                else
                {

                    yield return string.Format("{0}\t{1}\t{2}\t{3}\t{4}", groupedElements.First().From, groupedElements.First().To == null ? "*" : groupedElements.First().To, groupedElements.Average(el => el.Distance), groupedElements.Average(el => el.Azimuth), groupedElements.Average(el => el.Inclination));
                }
            }
        }
Example #9
0
        internal static List<TopFile> LoadMultipleFilesFromFolder(string path4MultipleFiles)
        {
            List<TopFile> MultipleTopFiles = new List<TopFile>();
            int pos = 1;
            foreach (var filename in Directory.GetFiles(path4MultipleFiles).Where(s => s.EndsWith(".top")))
            {
                using (BinaryReader b = new BinaryReader(File.Open(filename, FileMode.Open)))
                {

                    int length = (int)b.BaseStream.Length;
                    TopFile localTopFile = new TopFile(b);
                    localTopFile.MultipleIndex = pos;
                    localTopFile.FileName = Path.GetFileName(filename);
                    MultipleTopFiles.Add(localTopFile);
                    pos += 1;
                }
            }
            ImportExportHelper.ConnectMultipleTopFiles(MultipleTopFiles);

            return MultipleTopFiles;
        }