//static void Main(string[] args) static void Main() { var reader = new S57Reader(); string ZipName = "FR571370.zip"; string rootPath = "/home/gabin/Projet_gabin/Shom.S57/Shom.S57.Tests/"; string zipPath = Path.Combine(rootPath, ZipName); ZipArchive archive = ZipFile.OpenRead(zipPath); string MapName = "FR571370.000"; reader.ReadFromArchive(archive, MapName, true); archive.Dispose(); ListRelationships(reader, S57Obj.BOYSAW); ListFeatures(reader); QalityOfPosition(reader); FlatPolygon TempSet; var features = reader.GetFeaturesOfClass(S57Obj.BOYCAR); for (int i = 0; i < features.Count; i++) { if (features[i].Primitive == GeometricPrimitive.Area) { TempSet = features[i].GetGeometry(true) as FlatPolygon; } } var features1 = reader.GetFeaturesOfClass(S57Obj.BOYCAR); string description1 = null; Console.WriteLine(" BUOY Car extraction"); for (int i = 0; i < features1.Count; i++) { Console.WriteLine(features1[i].Attributes.TryGetValue(S57Att.COLOUR, out description1)); //http://www.s-57.com/ Console.WriteLine(description1); var test3 = features1[0].GetGeometry(false) as Point; Console.WriteLine(test3.Y); Console.WriteLine(test3.X); } // information liées aux boués latérale. var features2 = reader.GetFeaturesOfClass(S57Obj.BOYLAT); Console.WriteLine(" BUOY Lat extraction"); for (int i = 0; i < features2.Count; i++) { Console.WriteLine(features2[i].Attributes.TryGetValue(S57Att.COLOUR, out description1)); //http://www.s-57.com/ Console.WriteLine(description1); } var test2 = features1[0].GetGeometry(false) as Line; }
//static void Main(string[] args) static void Main() { var reader = new S57Reader(); string ZipName = "NC_ENCs.zip"; string rootPath = "D:/Familie/Documents/Programming/test"; string zipPath = Path.Combine(rootPath, ZipName); ZipArchive archive = ZipFile.OpenRead(zipPath); //reader.ReadCatalogue(S57map); //string MapName = "CATALOG.031"; //reader.ReadArchiveCatalogue(archive, MapName); //string MapName = "US5NC12M.000"; string MapName = "US5NC18M.000"; //string MapName = "US5NC51M.000"; reader.ReadFromArchive(archive, MapName, true); archive.Dispose(); //ListRelationships(reader, S57Obj.BOYSAW); //ListFeatures(reader); //QalityOfPosition(reader); //reader.Read(new FileStream(path, FileMode.Open)); FlatPolygon TempSet; var features = reader.GetFeaturesOfClass(S57Obj.DEPARE); for (int i = 0; i < features.Count; i++) { //if (features[i].namekey.RecordIdentificationNumber == 6163) //{ if (features[i].Primitive == GeometricPrimitive.Area) { TempSet = features[i].GetGeometry(true) as FlatPolygon; } //} } //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; //var features = reader.GetFeaturesOfClass(S57Objects.SOUNDG); //for (int i = 0; i < features.Count; i++) //{ // if (features[i].Primitive == GeometricPrimitive.Point) // { // var TempSet = features[i].ExtractSoundings(); // var TempSet2 = features[i].VectorPtrs[0].Vector.SoundingList; // } // 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(); }