Exemplo n.º 1
0
        //public void ReadCatalogue(System.IO.Stream stream)
        //{
        //    using (var reader = new Iso8211Reader(stream))
        //    {
        //        catalogueFile = new CatalogueFile(reader);
        //        BuildCatalogue();
        //    }
        //}

        public void ReadCatalogue(ZipArchive archive)
        {
            Stream          S57map         = null;
            ZipArchiveEntry catalogueentry = null;

            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                if (entry.Name.Equals("CATALOG.031"))
                {
                    catalogueentry = entry;
                }
            }
            S57map = catalogueentry.Open();
            var count = catalogueentry.Length;

            byte[]       fileByteArray = new byte[count]; //consider re-using same byte array for next file to minimize new allocations
            MemoryStream memoryStream  = new MemoryStream(fileByteArray);

            S57map.CopyTo(memoryStream);
            memoryStream.Dispose();
            using (var reader = new Iso8211Reader(fileByteArray))
            {
                catalogueFile = new CatalogueFile(reader);
                BuildCatalogue();
                foreach (var bla in reader.tagcollector)
                {
                    Console.WriteLine(bla);
                }
            }
            S57map.Dispose();
        }
Exemplo n.º 2
0
 public void ReadCatalogue(System.IO.Stream stream)
 {
     using (var reader = new Iso8211Reader(stream))
     {
         catalogueFile = new CatalogueFile(reader);
         BuildCatalogue();
     }
 }
Exemplo n.º 3
0
        public void BuildFromDataRecord(S57Reader reader, DataRecord cr, CatalogueFile catalogueFile)
        {
            // Record Identifier Field
            var rcid = cr.Fields.GetFieldByTag("CATD");

            if (rcid != null)
            {
                RecordIdentificationNumber = (uint)rcid.GetInt32("RCID");
                fileName             = rcid.GetString("FILE");
                fileLongName         = rcid.GetString("LFIL");
                southernMostLatitude = rcid.GetDouble("SLAT");
                westernMostLongitude = rcid.GetDouble("WLON");
                northernMostLatitude = rcid.GetDouble("NLAT");
                easternMostLongitude = rcid.GetDouble("ELON");
            }
        }
Exemplo n.º 4
0
        public void BuildFromDataRecord(S57Reader reader, DataRecord cr, CatalogueFile catalogueFile)
        {
            // Record Identifier Field
            var catd = cr.Fields.GetFieldByTag("CATD");

            if (catd != null)
            {
                subFieldRow = catd.subFields.Values[0];
                tagLookup   = catd.subFields.TagIndex;
                RecordIdentificationNumber = (uint)subFieldRow.GetInt32(tagLookup.IndexOf("RCID")); //this one ist stored as integer, so implementing GetUint32 to do merely a cast will fail
                fileName             = subFieldRow.GetString(tagLookup.IndexOf("FILE"));
                fileLongName         = subFieldRow.GetString(tagLookup.IndexOf("LFIL"));
                southernMostLatitude = subFieldRow.GetDouble(tagLookup.IndexOf("SLAT"));
                westernMostLongitude = subFieldRow.GetDouble(tagLookup.IndexOf("WLON"));
                northernMostLatitude = subFieldRow.GetDouble(tagLookup.IndexOf("NLAT"));
                easternMostLongitude = subFieldRow.GetDouble(tagLookup.IndexOf("ELON"));
            }
        }
Exemplo n.º 5
0
        public void ReadArchiveCatalogue(ZipArchive archive, string MapName)
        {
            string          basename       = MapName.Remove(MapName.Length - 4);
            Stream          S57map         = null;
            ZipArchiveEntry catalogueentry = null;

            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                if (entry.Name.Contains(basename))
                {
                    if (entry.Name.Equals(MapName))
                    {
                        catalogueentry = entry;
                    }
                }
            }
            S57map = catalogueentry.Open();
            using (var reader = new Iso8211Reader(S57map))
            {
                catalogueFile = new CatalogueFile(reader);
                BuildCatalogue();
            }
            S57map.Dispose();
        }
Exemplo n.º 6
0
 public Catalogue(S57Reader reader, DataRecord cr, CatalogueFile catalogueFile)
 {
     _cr = cr;
     BuildFromDataRecord(reader, cr, catalogueFile);
 }