/// <summary>
        /// This will return the correct shapefile type by reading the filename.
        /// </summary>
        /// <param name="filename">A string specifying the file with the extension .shp to open.</param>
        /// <param name="progressHandler">recieves progress messages and overrides the ProgressHandler on the DataManager.DefaultDataManager</param>
        /// <returns>A correct shapefile object which is exclusively for reading the .shp data</returns>
        public new static Shapefile OpenFile(string filename, IProgressHandler progressHandler)
        {

            ShapefileHeader head = new ShapefileHeader();
            head.Open(filename);
            PointShapefile psf;
            LineShapefile lsf;
            PolygonShapefile pgsf;
            MultiPointShapefile mpsf;
            switch (head.ShapeType)
            {
                case ShapeTypes.MultiPatch:
                    throw new NotImplementedException("This shape type is not yet supported.");
                   // break;
                case ShapeTypes.MultiPoint:
                    mpsf = new MultiPointShapefile();
                    mpsf.Open(filename, progressHandler);
                    return mpsf;
                case ShapeTypes.MultiPointM:
                    mpsf = new MultiPointShapefile();
                    mpsf.Open(filename, progressHandler);
                    return mpsf;
                case ShapeTypes.MultiPointZ:
                    mpsf = new MultiPointShapefile();
                    mpsf.Open(filename, progressHandler);
                    return mpsf;
                case ShapeTypes.NullShape:
                    throw new NotImplementedException("This shape type is not yet supported.");
                  //  break;
                case ShapeTypes.Point:
                    
                    // Instantiate a new object to handle the point shapefile
                    psf = new PointShapefile();

                    // Open the geometric components of the data (but not the dbf components)
                    psf.Open(filename, progressHandler);

                    return psf;
                    
                   

                case ShapeTypes.PointM:
                    // Instantiate a new object to handle the point shapefile
                    psf = new PointShapefile();

                    // Open the geometric components of the data (but not the dbf components)
                    psf.Open(filename, progressHandler);

                    return psf;

                    

                case ShapeTypes.PointZ:

                    // Instantiate a new object to handle the point shapefile
                    psf = new PointShapefile();

                    // Open the geometric components of the data (but not the dbf components)
                    psf.Open(filename, progressHandler);

                    return psf;

                   

                case ShapeTypes.Polygon:
                    pgsf = new PolygonShapefile();
                    pgsf.Open(filename, progressHandler);
                    return pgsf;
                 
                case ShapeTypes.PolygonM:
                    pgsf = new PolygonShapefile();
                    pgsf.Open(filename, progressHandler);
                    return pgsf;

                case ShapeTypes.PolygonZ:
                    pgsf = new PolygonShapefile();
                    pgsf.Open(filename, progressHandler);
                    return pgsf;

                case ShapeTypes.PolyLine:
                    lsf = new LineShapefile();
                    lsf.Open(filename, progressHandler);
                    return lsf;

                case ShapeTypes.PolyLineM:
                    lsf = new LineShapefile();
                    lsf.Open(filename, progressHandler);
                    return lsf;

                case ShapeTypes.PolyLineZ:
                    lsf = new LineShapefile();
                    lsf.Open(filename, progressHandler);
                    return lsf;
            }
            
            
            return null;
        }