public ShapefileReader(string pathToShapefile) { //Ternary operation to get just the full path to the shapefile WITHOUT an extension. this.Path = System.IO.Path.HasExtension(pathToShapefile) ? pathToShapefile.Substring(0, pathToShapefile.Length - (System.IO.Path.GetExtension(pathToShapefile).Length)) : pathToShapefile; this.HasMainFiles = ShapefileReaderManager.ValidShapefileParts(this.Path); this.Shpfile = new ShapefileMain(); this.CurrentRecord = 0; this.isDisposed = false; }
public bool ParseIndexFile() { this.OpenFileStream(this.Path + ".shx"); if (IsStreamReadable()) { this.Index = (ShapefileReaderManager.GetAllIndexRecords(this.readStream)); this.CloseFileStream(); return(true); } else { return(false); } }
public bool ParseMainFile() { this.OpenFileStream(this.Path + ".shp"); if (IsStreamReadable()) { this.Shpfile.SetHeader(ShapefileReaderManager.GetHeader(this.readStream)); this.Shpfile.SetRecords(ShapefileReaderManager.GetAllMainRecords(this.readStream)); this.CloseFileStream(); return(true); } else { return(false); } }
public bool ReadMainHeader(bool keepOpen) { this.OpenFileStream(this.Path + ".shp"); if (IsStreamReadable()) { this.Shpfile.SetHeader(ShapefileReaderManager.GetHeader(this.readStream)); if (!keepOpen) { this.CloseFileStream(); } return(true); } else { return(false); } }