コード例 #1
0
        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        /// <param name="path">The path to the shapefile</param>
        /// <param name="validateShapePath">A value indicating that the <paramref name="path"/> must be validated</param>
        /// <param name="validateDataPath">A value indicating that the data file modified <paramref name="path"/> must be validated</param>
        /// <param name="validateIndexPath">A value indicating that the shape index modified <paramref name="path"/> must be validated</param>
        public ShapefileStreamProviderRegistry(string path, bool validateShapePath = false, bool validateDataPath = false, bool validateIndexPath = false)
        {
#if NET40
            if (string.IsNullOrWhiteSpace(path))
#else
            if (string.IsNullOrEmpty(path))
#endif
            {
                throw new ArgumentNullException("path", "Path to shapefile can't be null, empty or whitespace");
            }

            ShapeStream = new FileStreamProvider(StreamTypes.Shape, Path.ChangeExtension(path, ".shp"), validateShapePath);
            DataStream  = new FileStreamProvider(StreamTypes.Data, Path.ChangeExtension(path, ".dbf"), validateDataPath);
            IndexStream = new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath);
        }
コード例 #2
0
        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        /// <param name="path">The path to the shapefile</param>
        /// <param name="validateShapePath">A value indicating that the <paramref name="path"/> must be validated</param>
        /// <param name="validateDataPath">A value indicating that the data file modified <paramref name="path"/> must be validated</param>
        /// <param name="validateIndexPath">A value indicating that the shape index modified <paramref name="path"/> must be validated</param>
        public ShapefileStreamProviderRegistry(string path, bool validateShapePath = false, bool validateDataPath = false, bool validateIndexPath = false)
        {
#if NET40
            if (string.IsNullOrWhiteSpace(path))
#else
            if (string.IsNullOrEmpty(path))
#endif
            {
                throw new ArgumentNullException("path", "Path to shapefile can't be null, empty or whitespace");
            }

            ShapeStream = new FileStreamProvider(StreamTypes.Shape, Path.ChangeExtension(path, ".shp"), validateShapePath);
            DataStream = new FileStreamProvider(StreamTypes.Data, Path.ChangeExtension(path, ".dbf"), validateDataPath);
            IndexStream = new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath);
        }
コード例 #3
0
        public ShapefileStreamProviderRegistry(string path, bool validateShapePath = false, bool validateDataPath = false, bool validateIndexPath = false)
        {
            //if (path == null)
            //{
            //    throw new ArgumentNullException("path");
            //}

            if (StringEx.IsNullOrWhitespaceNTS(path))
            {
                throw new ArgumentNullException("path", "Path to shapefile can't be null, empty or whitespace");
            }

            ShapeStream = new FileStreamProvider(StreamTypes.Shape, Path.ChangeExtension(path, ".shp"), validateShapePath);
            DataStream  = new FileStreamProvider(StreamTypes.Data, Path.ChangeExtension(path, ".dbf"), validateDataPath);
            IndexStream = new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath);
        }
コード例 #4
0
        public ShapefileStreamProviderRegistry(string path, bool validateShapePath = false, bool validateDataPath = false, bool validateIndexPath = false)
        {
            //if (path == null)
            //{
            //    throw new ArgumentNullException("path");
            //}

            if (path.IsNullOrWhitespaceNTS())
            {
                throw new ArgumentNullException("path", "Path to shapefile can't be null, empty or whitespace");
            }

            ShapeStream = new FileStreamProvider(StreamTypes.Shape, Path.ChangeExtension(path, ".shp"), validateShapePath);
            DataStream = new FileStreamProvider(StreamTypes.Data, Path.ChangeExtension(path, ".dbf"), validateDataPath);
            IndexStream = new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath);
        }
        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        /// <param name="path">The path to the shapefile</param>
        /// <param name="validateShapePath">A value indicating that the <paramref name="path"/> must be validated</param>
        /// <param name="validateDataPath">A value indicating that the data file modified <paramref name="path"/> must be validated</param>
        /// <param name="validateIndexPath">A value indicating that the shape index modified <paramref name="path"/> must be validated</param>
        public ShapefileStreamProviderRegistry(string path, bool validateShapePath = false, bool validateDataPath = false, bool validateIndexPath = false)
        {
#if NET40
            if (string.IsNullOrWhiteSpace(path))
#else
            if (string.IsNullOrEmpty(path))
#endif
            {
                throw new ArgumentNullException("path", "Path to shapefile can't be null, empty or whitespace");
            }

            ShapeStream = new FileStreamProvider(StreamTypes.Shape, Path.ChangeExtension(path, ".shp"), validateShapePath);

            /*
             * IndexStream = File.Exists(Path.ChangeExtension(path, "shx"))
             *  ? (IStreamProvider)new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath)
             *  : new NullStreamProvider(StreamTypes.Index);
             */
            IndexStream = new FileStreamProvider(StreamTypes.Index, Path.ChangeExtension(path, ".shx"), validateIndexPath);
            DataStream  = new FileStreamProvider(StreamTypes.Data, Path.ChangeExtension(path, ".dbf"), validateDataPath);

            var tmpPath = Path.ChangeExtension(path, "prj");
            if (File.Exists(tmpPath))
            {
                ProjectionStream = new FileStreamProvider(StreamTypes.Projection, tmpPath);
            }
            tmpPath = Path.ChangeExtension(path, "cpg");
            if (File.Exists(tmpPath))
            {
                DataEncodingStream = new FileStreamProvider(StreamTypes.DataEncoding, tmpPath);
            }
            tmpPath = Path.ChangeExtension(path, "sbn");
            if (File.Exists(tmpPath))
            {
                SpatialIndexStream = new FileStreamProvider(StreamTypes.SpatialIndex, tmpPath);
            }
            tmpPath = Path.ChangeExtension(path, "sbx");
            if (File.Exists(tmpPath))
            {
                SpatialIndexIndexStream = new FileStreamProvider(StreamTypes.SpatialIndexIndex, tmpPath);
            }
        }