Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ShapefileDataWriter"/> class.
        /// </summary>
        /// <param name="fileName">File path without any extension</param>
        /// <param name="geometryFactory"></param>
        public ShapefileWriter(string fileName, GeometryFactory geometryFactory)
        {
            this.geometryFactory = geometryFactory;

            // Files            
            shpFile = fileName;
            dbfFile = fileName + ".dbf";

            // Writers
            shapeWriter = new ShapeWriter(geometryFactory);
            dbaseWriter = new dBaseWriter(dbfFile);
        }
        /// <summary>
        /// Attempts to save the file to the path specified by the Filename property.
        /// This should be the .shp extension.
        /// </summary>
        private void DoSave()
        {
            string dbfFile = Path.ChangeExtension(Filename, ".dbf");
            ShapeWriter myShapeWriter = new ShapeWriter();
            myShapeWriter.Write(Filename, this);

            _writer = new BinaryWriter(File.Open(dbfFile, FileMode.Create));
            WriteHeader(_writer);
            WriteTable();
            _writer.Close();
        }