/// <summary> /// Opens a shapefile. /// </summary> /// <param name="fileName">The string fileName of the polygon shapefile to load.</param> /// <param name="progressHandler">Any valid implementation of the DotSpatial.Data.IProgressHandler</param> public void Open(string fileName, IProgressHandler progressHandler) { if (!File.Exists(fileName)) { return; } Filename = fileName; IndexMode = true; Header = new ShapefileHeader(Filename); switch (Header.ShapeType) { case ShapeType.PolygonM: CoordinateType = CoordinateType.M; break; case ShapeType.PolygonZ: CoordinateType = CoordinateType.Z; break; default: CoordinateType = CoordinateType.Regular; break; } Extent = Header.ToExtent(); Name = Path.GetFileNameWithoutExtension(fileName); Attributes.Open(Filename); LineShapefile.FillLines(Filename, progressHandler, this, FeatureType.Polygon); ReadProjection(); }
/// <summary> /// Opens a shapefile. /// </summary> /// <param name="fileName">The string fileName of the polygon shapefile to load.</param> /// <param name="progressHandler">Any valid implementation of the DotSpatial.Data.IProgressHandler.</param> public void Open(string fileName, IProgressHandler progressHandler) { if (!File.Exists(fileName)) { return; } Filename = fileName; IndexMode = true; Header = new ShapefileHeader(Filename); CoordinateType = Header.ShapeType switch { ShapeType.PolygonM => CoordinateType.M, ShapeType.PolygonZ => CoordinateType.Z, _ => CoordinateType.Regular, }; Extent = Header.ToExtent(); Name = Path.GetFileNameWithoutExtension(fileName); Attributes.Open(Filename); LineShapefile.FillLines(Filename, progressHandler, this, FeatureType.Polygon); ReadProjection(); }