コード例 #1
0
ファイル: MainForm.cs プロジェクト: PeteFohl/SDTS-Browser
        private void File_OpenPackage_Click( object sender, EventArgs e )
        {
            var dlg = new OpenFileDialog { CheckFileExists = true, DefaultExt = "DDF" };
            if( dlg.ShowDialog() == DialogResult.OK )
            {
                try
                {
                    var catd = DataDefinitionFile.FromFile( dlg.FileName );

                    var tag = catd.DescriptiveRecord.Directories.ElementAt( 2 ).Tag;
                    if( tag != DirectoryDataType.CATD )
                    {
                        MessageBox.Show( "This does not appear to be an SDTS Catalog/Directory file." );
                        return;
                    }
                    var package = new CatalogDirectory(catd);

                    EnsureTabControl();
                    TabPage tab = new TabPage( catd.DescriptiveRecord.Filename );
                    LineSetPanel panel = new LineSetPanel { Dock = DockStyle.Fill };
                    panel.LoadPackage( package );
                    panel.UseProjection = uTMToolStripMenuItem.Checked;
                    tab.Controls.Add( panel );
                    mainTabControl.TabPages.Add( tab );
                }
                catch( Exception exc )
                {
                    MessageBox.Show( exc.Message );
                }
            }
        }
コード例 #2
0
 public void Projection_is_determined_if_utm()
 {
     var ddf = DataDefinitionFile.FromFile( "BD01CATD.DDF" );
     var dir = new CatalogDirectory( ddf );
     Assert.That(dir.Projection, Is.Not.Null);
     Assert.That( dir.Projection, Is.TypeOf( typeof( UTM ) ) );
     Assert.That( (dir.Projection as UTM).Zone, Is.EqualTo( 11 ) );
 }
コード例 #3
0
 public void LoadDDF( DataDefinitionFile ddf )
 {
     _catalog = new CatalogDirectory( ddf );
     foreach( var entry in _catalog.Entries.OrderBy(e => e.Contents))
     {
         ListViewItem item = new ListViewItem();
         item.Text = entry.FileName;
         item.SubItems.Add( new ListViewItem.ListViewSubItem( item, entry.Contents ) );
         listView1.Items.Add( item );
     }
 }
コード例 #4
0
        public void Can_create_catalog_directory_file()
        {
            var ddf = DataDefinitionFile.FromFile( "BD01CATD.DDF" );
            var dir = new CatalogDirectory( ddf );

            Assert.That( dir.Entries, Is.Not.Null );
            Assert.That( dir.Entries.Count, Is.EqualTo( 23 ) );
            CatalogDirectoryEntry entry = dir.Entries.FirstOrDefault( e => e.FileName == "BD01CATD.DDF" );
            Assert.That(entry, Is.Not.Null);
            Assert.That( entry.Contents, Is.EqualTo( "Catalog/Directory" ) );
            Assert.That( entry.Type, Is.EqualTo( "CATD" ) );
        }
コード例 #5
0
        public AttributeDisplayer(Line line, CatalogDirectory package)
        {
            InitializeComponent();

            foreach( var attribute in line.AttributeIDs)
            {
                var attributeFile = package.Entries.FirstOrDefault( entry => entry.Type == attribute.Key );
                if (attributeFile != null)
                {
                    var rows = attributeFile.File.DataRecords
                        .SelectMany( dr => dr.Rows )
                        .Where( row => row.Fields.ElementAt( 0 ).AsString == attribute.Key && row.Fields.ElementAt( 1 ).AsInt == attribute.Value );
                    foreach( var attrRow in rows)
                    {
                        listView1.Items.Add( new ListViewItem( new string[] { attribute.Key, attrRow.Fields.ElementAt(2).AsString } ) );
                    }
                }
            }
        }
コード例 #6
0
 public void Can_load_entry_files()
 {
     var ddf = DataDefinitionFile.FromFile( "BD01CATD.DDF" );
     var dir = new CatalogDirectory( ddf );
     Assert.That(dir.Entries[0].File, Is.Not.Null);
 }
コード例 #7
0
ファイル: LineSetPanel.cs プロジェクト: PeteFohl/SDTS-Browser
 public void LoadPackage( CatalogDirectory package )
 {
     LoadLineSet( package.Entries.First( entry => entry.Contents.ToUpper() == "LINE" ).File );
     _package = package;
     _projection = package.Projection;
 }