Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string path   = args[0];
            var    reader = new S57Reader();

            reader.Read(new FileStream(path, FileMode.Open));
            var features = reader.GetFeaturesOfClass(119);
        }
Ejemplo n.º 2
0
        //static void Main(string[] args)
        static void Main()
        {
            //string path = args[0];
            var    reader  = new S57Reader();
            string ZipName = "NC_ENCs.zip";
            //string MapName = "ENC_ROOT/CATALOG.031";
            //string MapName = "ENC_ROOT/US5NC51M/US5NC51M.000";
            string MapName  = "ENC_ROOT/US5NC18M/US5NC18M.000";
            string rootPath = "D:/Familie/Documents/Programming/test";
            string zipPath  = Path.Combine(rootPath, ZipName);
            var    bla      = ZipFile.OpenRead(zipPath);
            Stream S57map   = bla.GetEntry(MapName).Open();

            //reader.ReadCatalogue(S57map);
            reader.Read(S57map);

            //reader.Read(new FileStream(path, FileMode.Open));
            //ListFeatures(reader);
            var features = reader.GetFeaturesOfClass(S57Objects.DEPARE);

            //var test1 = features.First(x => x.RecordName == 6140u);
            //var test2 = features.First(x => x.RecordName == 6140u).GetGeometry() as PolygonSet;
            //var test1 = features.First(x => x.RecordName == 6156u);
            //var test2 = features.First(x => x.RecordName == 6156u).GetGeometry() as PolygonSet;
            //var test1 = features.First(x => x.RecordName == 6134u);
            //var test2 = features.First(x => x.RecordName == 6134u).GetGeometry() as PolygonSet;
            //var test1 = features.First(x => x.RecordName == 6155u);
            var test2 = features.First(x => x.RecordName == 6155u).GetGeometry() as Area;

            features = reader.GetFeaturesOfClass(S57Objects.SOUNDG);
            for (int i = 0; i < features.Count; i++)
            {
                if (features[i].Primitive == GeometricPrimitive.Point)
                {
                    var TempSet = features[i].ExtractSoundings();
                }
                else
                {
                    continue;
                }
            }

            //var features = reader.GetFeaturesOfClass(S57Objects.DEPCNT);
            //var test1 = features.First(x => x.RecordName == 6345u);
            //var test2 = features.First(x => x.RecordName == 6345u).GetGeometry() as Line;
            //foreach (var xyz in test2.Areas)
            //{
            //foreach (var xy in xyz.points)
            //foreach (var xy in test2.points)
            //{
            //    var a = xy.X;
            //    var b = xy.Y;
            //    Console.WriteLine($"{a:0.0######}" + " , " + $"{b:0.0######}");
            //}
            //}
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        //static void Main(string[] args)
        static void Main()
        {
            S57Reader reader;
            string    ZipName        = "NC_ENCs.zip";
            string    zipRootPath    = "D:/Familie/Documents/Programming/test";
            string    zipPath        = Path.Combine(zipRootPath, ZipName);
            string    VolumeRootPath = "D:/Familie/Documents/Programming/test/ENC_ROOT";
            string    MapName        = "US5NC51M.000"; //US5NC12M.000  US5NC51M.000
            Stopwatch timer          = new Stopwatch();

            //timer.Start();
            //var reader = new S57Reader();
            //reader.ReadCatalogue(VolumeRootPath);
            //foreach (var map in reader.BaseFiles)
            //{
            //    string name = map.Value.fileName;
            //    string _MapName = name.Substring(name.IndexOf("\\") + 1);
            //    reader.Read(VolumeRootPath, MapName, false);
            //    Console.WriteLine(_MapName);
            //    var bla = reader.GetFeaturesOfClass(S57Obj.M_COVR);
            //};
            //timer.Stop();
            //Console.WriteLine(((double)(timer.Elapsed.TotalMilliseconds)).ToString("0.00 ms"));


            ZipArchive archive = ZipFile.OpenRead(zipPath);

            timer.Reset();
            timer.Start();
            reader = new S57Reader();
            reader.ReadCatalogue(archive);
            foreach (var map in reader.BaseFiles)
            {
                string name     = map.Value.fileName;
                string _MapName = name.Substring(name.IndexOf("\\") + 1);
                reader.Read(archive, _MapName, false);
                Console.WriteLine(_MapName);
                var bla = reader.GetFeaturesOfClass(S57Obj.DEPARE);
            }
            ;
            //reader.Read(archive, MapName, true);
            archive.Dispose();
            timer.Stop();
            Console.WriteLine(((double)(timer.Elapsed.TotalMilliseconds)).ToString("0.00 ms"));

            //ListRelationships(reader, S57Obj.BOYSAW);
            //ListFeatures(reader);
            //QalityOfPosition(reader);

            //FlatPolygon TempSet;
            //var features = reader.GetFeaturesOfClass(S57Obj.DEPARE);
            //for (int i = 0; i < features.Count; i++)
            //{
            //    if (features[i].Primitive == GeometricPrimitive.Area)
            //    {
            //        TempSet = features[i].GetGeometry(true) as FlatPolygon;
            //    }
            //}
            //var features = reader.GetFeaturesOfClass(S57Obj.LNDMRK);
            //for (int i = 0; i < features.Count; i++)
            //{
            //    string tempString;
            //    features[i].Attributes.TryGetValue(S57Att.SCAMIN, out tempString);
            //}
            Console.ReadKey();
        }