• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IProgressHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IProgressHandler的典型用法代码示例。如果您正苦于以下问题:C# IProgressHandler类的具体用法?C# IProgressHandler怎么用?C# IProgressHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IProgressHandler类属于命名空间,在下文中一共展示了IProgressHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateNew

        /// <summary>
        /// This create new method implies that this provider has the priority for creating a new file.
        /// An instance of the dataset should be created and then returned.  By this time, the fileName
        /// will already be checked to see if it exists, and deleted if the user wants to overwrite it.
        /// </summary>
        /// <param name="fileName">The string fileName for the new instance</param>
        /// <param name="featureType">Point, Line, Polygon etc.  Sometimes this will be specified, sometimes it will be "Unspecified"</param>
        /// <param name="inRam">Boolean, true if the dataset should attempt to store data entirely in ram</param>
        /// <param name="progressHandler">An IProgressHandler for status messages.</param>
        /// <returns>An IRaster</returns>
        public virtual IFeatureSet CreateNew(string fileName, FeatureType featureType, bool inRam, IProgressHandler progressHandler)
        {
            if (featureType == FeatureType.Point)
            {
                PointShapefile ps = new PointShapefile();
                ps.Filename = fileName;
                return ps;
            }
            else if (featureType == FeatureType.Line)
            {
                LineShapefile ls = new LineShapefile();
                ls.Filename = fileName;
                return ls;
            }
            else if (featureType == FeatureType.Polygon)
            {
                PolygonShapefile ps = new PolygonShapefile();
                ps.Filename = fileName;
                return ps;
            }
            else if (featureType == FeatureType.MultiPoint)
            {
                MultiPointShapefile mps = new MultiPointShapefile();
                mps.Filename = fileName;
                return mps;
            }

            return null;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:39,代码来源:ShapefileDataProvider.cs


示例2: BufferedBinaryReader

        /// <summary>
        /// Creates a new instance of BufferedBinaryReader, and specifies where to send progress messages.
        /// </summary>
        /// <param name="fileName">The string path of a file to open using this BufferedBinaryReader.</param>
        /// <param name="progressHandler">Any implementation of IProgressHandler for receiving progress messages.</param>
        public BufferedBinaryReader(string fileName, IProgressHandler progressHandler)
        {
            //Modified 9/22/09 by L. C. Wilson to open as read-only so it is possible to open read-only files
            //Not sure if elsewhere write access is required
            _fileName = fileName;
            _fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            _binaryReader = new BinaryReader(_fileStream);

            FileInfo fi = new FileInfo(fileName);

            _fileLength = fi.Length;
            _fileOffset = 0;

            _readOffset = -1; // There is no buffer loaded.

            _bufferSize = 0;
            _bufferOffset = -1; // -1 means no buffer is loaded.

            _isFinishedBuffering = false;
            _isFinishedReading = false;
            _progressMeter = new ProgressMeter(progressHandler, "Reading from " + Path.GetFileName(fileName), _fileLength);

            if (_fileLength < 10000000) _progressMeter.StepPercent = 5;
            if (_fileLength < 5000000) _progressMeter.StepPercent = 10;
            if (_fileLength < 100000) _progressMeter.StepPercent = 50;
            if (_fileLength < 10000) _progressMeter.StepPercent = 100;
            //long testMax = _fileLength / _progressMeter.StepPercent;
            //if (testMax < (long)9600000) _maxBufferSize = Convert.ToInt32(testMax); // otherwise keep it at 96000000
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:34,代码来源:BufferedBinaryReader.cs


示例3: Open

        /// <summary>
        /// Opens a shapefile
        /// </summary>
        /// <param name="fileName">The string fileName of the line 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.PolyLineM:
                    CoordinateType = CoordinateType.M;
                    break;
                case ShapeType.PolyLineZ:
                    CoordinateType = CoordinateType.Z;
                    break;
                default:
                    CoordinateType = CoordinateType.Regular;
                    break;
            }

            Extent = Header.ToExtent();
            Name = Path.GetFileNameWithoutExtension(fileName);
            Attributes.Open(fileName);

            FillLines(fileName, progressHandler, this, FeatureType.Line);
            ReadProjection();
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:33,代码来源:LineShapefile.cs


示例4: Smoother

 /// <summary>
 /// Creates a new instance of Smoother
 /// </summary>
 public Smoother(BitmapData inBmpData, byte[] inRgbData, IProgressHandler progHandler)
 {
     _bmpData = inBmpData;
     _rgbData = inRgbData;
     _result = new byte[inRgbData.Length];
     pm = new ProgressMeter(progHandler, "Smoothing Image", inBmpData.Height);
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:10,代码来源:Smoother.cs


示例5: ProgressMeter

 /// <summary>
 /// A progress meter that simply keeps track of progress and is capable of sending progress messages.
 /// </summary>
 /// <param name="progressHandler">Any valid implementation if IProgressHandler that will handle the progress function</param>
 /// <param name="baseMessage">The message without any progress information.</param>
 /// <param name="endValue">Percent should show a range between the MinValue and MaxValue.  MinValue is assumed to be 0.</param>
 public ProgressMeter(IProgressHandler progressHandler, string baseMessage, object endValue)
 {
     _endValue = Convert.ToDouble(endValue);
     _progressHandler = progressHandler;
     Reset();
     _baseMessage = baseMessage;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:13,代码来源:ProgressMeter.cs


示例6: Open

        /// <summary>
        /// Opens a shapefile
        /// </summary>
        /// <param name="fileName">The string fileName of the point shapefile to load</param>
        /// <param name="progressHandler">Any valid implementation of the DotSpatial.Data.IProgressHandler</param>
        public void Open(string fileName, IProgressHandler progressHandler)
        {
            //JK - handle case when filename doesn't exist
            if (!File.Exists(fileName))
            {
                Attributes = new AttributeTable();
                Header = new ShapefileHeader { FileLength = 100, ShapeType = ShapeType.Point };
                FeatureType = FeatureType.Point;
                return;
            }

            IndexMode = true;
            Filename = fileName;

            Header = new ShapefileHeader(fileName);
            CoordinateType = CoordinateType.Regular;
            if (Header.ShapeType == ShapeType.PointM)
            {
                CoordinateType = CoordinateType.M;
            }
            if (Header.ShapeType == ShapeType.PointZ)
            {
                CoordinateType = CoordinateType.Z;
            }
            MyExtent = Header.ToExtent();
            Name = Path.GetFileNameWithoutExtension(fileName);
            Attributes.Open(fileName);
            FillPoints(fileName, progressHandler);
            ReadProjection();
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:35,代码来源:PointShapefile.cs


示例7: ReSample

        /// <summary>
        /// This will resample the cells.
        /// If the cell size is zero, this will default to the shorter of the width or height
        /// divided by 256.
        /// </summary>
        /// <param name="input1">Input Raster.</param>
        /// <param name="cellHeight">New Cell Height or Null.</param>
        /// <param name="cellWidth">New Cell Width or Null.</param>
        /// <param name="destFilename">Output Raster Name.</param>
        /// <param name="progressHandler">An interface for handling the progress messages.</param>
        /// <returns>Resampled raster.</returns>
        public static IRaster ReSample(IRaster input1,double cellHeight, double cellWidth, string destFilename, IProgressHandler progressHandler)
        {
            if (input1 == null)
                return null;

            IEnvelope envelope = input1.Bounds.Envelope;

            if (cellHeight == 0)
            {
                cellHeight = envelope.Height / 256;
            }
            if(cellWidth==0)
            {
                cellWidth = envelope.Width / 256;
            }
                
            //Calculate new number of columns and rows
            int noOfCol = Convert.ToInt32(Math.Abs(envelope.Width / cellWidth));
            int noOfRow = Convert.ToInt32(Math.Abs(envelope.Height / cellHeight));


            IRaster output = Raster.Create(destFilename, "", noOfCol, noOfRow, 1, input1.DataType, new[] { "" });
            RasterBounds bound = new RasterBounds(noOfRow, noOfCol, envelope);
            output.Bounds = bound;

            output.NoDataValue = input1.NoDataValue;

            RcIndex index1;
            int max = (output.Bounds.NumRows);
            ProgressMeter pm = new ProgressMeter(progressHandler, "ReSize Cells", max);
            //Loop throug every cell for new value

            for (int i = 0; i < max; i++)
            {
                for (int j = 0; j < output.Bounds.NumColumns; j++)
                {
                    //Projet the cell position to Map
                    Coordinate cellCenter = output.CellToProj(i, j);
                    index1 = input1.ProjToCell(cellCenter);

                    double val;
                    if (index1.Row <= input1.EndRow && index1.Column <= input1.EndColumn && index1.Row > -1 && index1.Column > -1)
                    {
                        if (input1.Value[index1.Row, index1.Column] == input1.NoDataValue)
                            val = output.NoDataValue;
                        else
                            val = input1.Value[index1.Row, index1.Column];
                    }
                    else
                        val = output.NoDataValue;

                    output.Value[i, j] = val;
                }
                pm.CurrentPercent = i;
            }

            output.Save();
            pm.Reset();
            return output;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:71,代码来源:ReSampleCells.cs


示例8: BufferedBinaryWriter

        /// <summary>
        /// Creates a new instance of BufferedBinaryWriter, and specifies where to send progress messages.
        /// </summary>
        /// <param name="fileName">The string path of a file to open using this BufferedBinaryReader.</param>
        /// <param name="progressHandler">Any implementation of IProgressHandler for receiving progress messages.</param>
        /// <param name="expectedByteCount">A long specifying the number of bytes that will be written for the purposes of tracking progress</param>
        public BufferedBinaryWriter(string fileName, IProgressHandler progressHandler, long expectedByteCount)
        {
            if (File.Exists(fileName))
            {
                // Imagine we have written a header and want to add more stuff
                _fileStream = new FileStream(fileName, FileMode.Append, FileAccess.Write);
                FileInfo fi = new FileInfo(fileName);
                _fileLength = fi.Length;
                _fileOffset = 0;
            }
            else
            {
                // In this case, we just create the new file from scratch
                _fileStream = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write);
                _fileLength = 0;
                _fileOffset = 0;
            }

            _binaryWriter = new BinaryWriter(_fileStream);
            _buffer = new byte[expectedByteCount];
            _bufferSize = Convert.ToInt32(expectedByteCount);
            _maxBufferSize = _bufferSize;
            _writeOffset = -1; // There is no buffer loaded.
            _bufferOffset = -1; // -1 means no buffer is loaded.

            //report progress
            if (progressHandler != null)
            {
                _progressHandler = progressHandler;
                _progressMeter.Key = "Writing to " + Path.GetFileName(fileName);
                _progressMeter.EndValue = expectedByteCount;
            }
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:39,代码来源:BufferedBinaryWriter.cs


示例9: OpenLayer

 /// <summary>
 /// Opens an existing raster and returns a layer containing it
 /// </summary>
 /// <param name="fileName">The string fileName to open</param>
 /// <param name="inRam">Opens in ram</param>
 /// <param name="container">A container to automatically add this layer to</param>
 /// <param name="progressHandler">Returns progress</param>
 /// <returns>An ILayer</returns>
 public ILayer OpenLayer(string fileName, bool inRam, ICollection<ILayer> container, IProgressHandler progressHandler)
 {
     IRaster raster = Raster.OpenFile(fileName, inRam, progressHandler);
     RasterLayer rl = new RasterLayer(raster, progressHandler);
     container.Add(rl);
     return rl;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:15,代码来源:BinaryLayerProvider.cs


示例10: Create

        /// <summary>
        /// Creates a new image given the specified file format
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="inRam">if set to <c>true</c> should load entire file in ram.</param>
        /// <param name="progHandler">The prog handler.</param>
        /// <param name="bandType">Type of the band.</param>
        /// <returns></returns>
        public IImageData Create(string fileName, int width, int height, bool inRam, IProgressHandler progHandler, ImageBandType bandType)
        {
            Gdal.AllRegister();
            Driver d = GetDriverByExtension(fileName);
            if (d == null) return null;
            Dataset ds;
            if (bandType == ImageBandType.ARGB)
            {
                ds = d.Create(fileName, width, height, 4, DataType.GDT_Byte, new string[] { });
            }
            else if (bandType == ImageBandType.RGB)
            {
                ds = d.Create(fileName, width, height, 3, DataType.GDT_Byte, new string[] { });
            }
            else if (bandType == ImageBandType.PalletCoded)
            {
                ds = d.Create(fileName, width, height, 1, DataType.GDT_Byte, new string[] { });
            }
            else
            {
                ds = d.Create(fileName, width, height, 1, DataType.GDT_Byte, new string[] { });
            }

            return new GdalImage(fileName, ds, bandType);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:35,代码来源:GdalImageProvider.cs


示例11: Open

        /// <summary>
        /// Opens a shapefile
        /// </summary>
        /// <param name="fileName">The string fileName of the line 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))
            {
                Attributes = new AttributeTable();
                Header = new ShapefileHeader { FileLength = 100, ShapeType = ShapeType.PolyLine };
                FeatureType = FeatureType.Line;
                return;
            }

            Filename = fileName;
            FeatureType = FeatureType.Line;
            Header = new ShapefileHeader(fileName);
            CoordinateType = CoordinateType.Regular;
            IndexMode = true;
            if (Header.ShapeType == ShapeType.PolyLineM)
            {
                CoordinateType = CoordinateType.M;
            }
            if (Header.ShapeType == ShapeType.PolyLineZ)
            {
                CoordinateType = CoordinateType.Z;
            }
            MyExtent = Header.ToExtent();
            Name = Path.GetFileNameWithoutExtension(fileName);
            Attributes.Open(fileName);
            FillLines(fileName, progressHandler);
            ReadProjection();
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:34,代码来源:LineShapefile.cs


示例12: Fill

 /// <summary>
 /// Fills depressions in an image
 /// - Files specified by parameters
 /// - Progress and status messages will be sent back via IProgressHandler
 /// - Frames will be sized to default values
 /// </summary>
 /// <param name="SourceFile">String filename of unfilled DEM</param>
 /// <param name="DestFile">String filename of output file</param>
 /// <param name="progress">The progress.</param>
 /// <remarks>
 /// Images too large to process all at once are broken down into a framework.
 /// A frame represents what will be loaded into memory at any given time.
 /// </remarks>
 public static void Fill(string SourceFile, string DestFile, IProgressHandler progress)
 {
     // 2000 width
     // 1000 height
     //MapWinUtility.Logger.Dbg("Fill(SourceFile: " + SourceFile + ",\n" +
     //                         "     DestFile: " + DestFile + ",\n" +
     //                         "     IProgressHandler");
     File_Fill(SourceFile, DestFile, true, false, 10000, 2000, progress);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:22,代码来源:Hydrology.cs


示例13: GeoPluginArgs

 /// <summary>
 /// Creates a new instance of the GeoPluginArgs
 /// </summary>
 /// <param name="map">Each Manager is associated with a single map</param>
 /// <param name="legend">The legend</param>
 /// <param name="mainMenu">The main menu</param>
 /// <param name="mainToolStrip">The main toolstrip</param>
 /// <param name="progressHandler">The progress handler</param>
 /// <param name="plugins">The list of plugins controlled by the manager</param>
 /// <param name="toolStripContainer">The container where any toolstrips should be added</param>
 public GeoPluginArgs(IMap map, ILegend legend, MenuStrip mainMenu, ToolStrip mainToolStrip, IProgressHandler progressHandler, List<IMapPlugin> plugins, ToolStripContainer toolStripContainer)
 {
     _toolStripContainer = toolStripContainer;
     _map = map;
     _legend = legend;
     _mainMenu = mainMenu;
     _mainToolStrip = mainToolStrip;
     _plugins = plugins;
     _progressHandler = progressHandler;
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:20,代码来源:MapPluginArgs.cs


示例14: ShapefileFeatureSet

 /// <summary>
 /// Constructor that also accepts a progres handler to show the progress of loading the values into memory.
 /// </summary>
 /// <param name="filename">The filename to open.</param>
 /// <param name="progressHandler">Any valid implementation of the IProgressHandler interface.</param>
 public ShapefileFeatureSet(string filename, IProgressHandler progressHandler)
 {
     //Fields = new Dictionary<string, Field>();
     _columns = new List<Field>();
     DataTable = new System.Data.DataTable();
     Features = new FeatureList(this);
     // Since they have passed a filename go ahead and open it
     Filename = filename;
     FeatureType = FeatureTypes.Unspecified; // this will get set when queried the first time
     Name = Path.GetFileNameWithoutExtension(filename);
     Open(progressHandler);
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:17,代码来源:ShapefileFeatureSet.cs


示例15: TimedProgressMeter

        /// <summary>
        /// Constructs a Time-Based progress meter that shows progress against an expected time.
        /// </summary>
        /// <param name="progressHandler"></param>
        /// <param name="baseMessage"></param>
        /// <param name="estimatedTime"></param>
        public TimedProgressMeter(IProgressHandler progressHandler, string baseMessage, TimeSpan estimatedTime)
        {
            _progressHandler = progressHandler;
            _baseMessage = baseMessage;
            _timeSpan = estimatedTime;
            _endValue = estimatedTime.TotalSeconds * 1000;

            _timer = new Timer();
            _timer.Interval = Convert.ToInt32(_timeSpan.TotalSeconds * 10); // Attempt to have a tick once during each estimated percentile
            //_timer.Interval = 100;
            _timer.Tick += TimerTick;
            _timer.Start(); // Timers should be on another thread...
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:19,代码来源:TimedProgressMeter.cs


示例16: GetSeriesCatalogForBox

        protected override IEnumerable<SeriesDataCart> GetSeriesCatalogForBox(double xMin, double xMax, double yMin, double yMax, string keyword,
            DateTime startDate, DateTime endDate, int[] networkIDs, IProgressHandler bgWorker, long currentTile, long totalTilesCount)
        {
            bgWorker.ReportMessage(string.Format("Executed query to the database. Keyword: {0}. Tile {1}/{2}.", keyword, currentTile, totalTilesCount));

            var dt = _db.GetSeriesDataTableInBox(xMin, xMax, yMin, yMax, new []{keyword}, startDate, endDate, networkIDs);
            var seriesList = new List<SeriesDataCart>(dt.Rows.Count);
            foreach (DataRow row in dt.Rows)
            {
                var series = _db.SeriesDataCartFromRow(row);
                if (series != null)
                {
                    // Update BeginDate/EndDate/ValueCount to the user-specified range
                    SearchHelper.UpdateDataCartToDateInterval(series, startDate, endDate);
                    seriesList.Add(series);
                }
            }
            return seriesList;
        }
开发者ID:CUAHSI,项目名称:HydroClient,代码行数:19,代码来源:MetadataCacheSearcher.cs


示例17: Open

 /// <summary>
 /// Opens a shapefile
 /// </summary>
 /// <param name="fileName">The string fileName of the point shapefile to load</param>
 /// <param name="progressHandler">Any valid implementation of the DotSpatial.Data.IProgressHandler</param>
 public void Open(string fileName, IProgressHandler progressHandler)
 {
     IndexMode = true;
     Filename = fileName;
     FeatureType = FeatureType.MultiPoint;
     Header = new ShapefileHeader(fileName);
     CoordinateType = CoordinateType.Regular;
     if (Header.ShapeType == ShapeType.MultiPointM)
     {
         CoordinateType = CoordinateType.M;
     }
     if (Header.ShapeType == ShapeType.MultiPointZ)
     {
         CoordinateType = CoordinateType.Z;
     }
     Name = Path.GetFileNameWithoutExtension(fileName);
     Attributes.Open(fileName);
     FillPoints(fileName, progressHandler);
     ReadProjection();
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:25,代码来源:MultiPointShapefile.cs


示例18: CreateNew

        /// <summary>
        /// Not Implemented yet
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="featureType"></param>
        /// <param name="inRam"></param>
        /// <param name="container"></param>
        /// <param name="progressHandler"></param>
        /// <returns></returns>
        public IFeatureLayer CreateNew(string fileName, FeatureType featureType, bool inRam, ICollection<ILayer> container, IProgressHandler progressHandler)
        {
            ShapefileDataProvider dp = new ShapefileDataProvider();
            IFeatureSet fs = dp.CreateNew(fileName, featureType, inRam, progressHandler);
            if (progressHandler == null) progressHandler = LayerManager.DefaultLayerManager.ProgressHandler;

            if (fs.FeatureType == FeatureType.Line)
            {
                return new MapLineLayer(fs, container);
            }
            if (fs.FeatureType == FeatureType.Polygon)
            {
                return new MapPolygonLayer(fs, container);
            }
            if (fs.FeatureType == FeatureType.Point || fs.FeatureType == FeatureType.MultiPoint)
            {
                return new MapPointLayer(fs, container);
            }
            return null;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:29,代码来源:ShapefileLayerProvider.cs


示例19: Open

 /// <summary>
 /// Opens a shapefile
 /// </summary>
 /// <param name="filename">The string filename of the line shapefile to load</param>
 /// <param name="progressHandler">Any valid implementation of the MapWindow.Main.IProgressHandler</param>
 public void Open(string filename, IProgressHandler progressHandler)
 {
     Filename = filename;
     FeatureType = FeatureTypes.Line;
     Header = new ShapefileHeader(filename);
     CoordinateType = CoordinateTypes.Regular;
     IndexMode = true;
     if (Header.ShapeType == ShapeTypes.PolyLineM)
     {
         CoordinateType = CoordinateTypes.M;
     }
     if (Header.ShapeType == ShapeTypes.PolyLineZ)
     {
         CoordinateType = CoordinateTypes.Z;
     }
     base.Envelope = Header.ToEnvelope(); 
     Name = Path.GetFileNameWithoutExtension(filename);
     Attributes.Open(filename);
     FillLines(filename, progressHandler);
     ReadProjection();
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:26,代码来源:LineShapefile.cs


示例20: OpenLayer

        /// <summary>
        /// Opens a shapefile, but returns it as a FeatureLayer
        /// </summary>
        /// <param name="fileName">The string fileName</param>
        /// <param name="inRam">Boolean, if this is true it will attempt to open the entire layer in memory.</param>
        /// <param name="container">A container to hold this layer.</param>
        /// <param name="progressHandler">The progress handler that should receive status messages</param>
        /// <returns>An IFeatureLayer</returns>
        public ILayer OpenLayer(string fileName, bool inRam, ICollection<ILayer> container, IProgressHandler progressHandler)
        {
            ShapefileDataProvider dp = new ShapefileDataProvider();
            IFeatureSet fs = dp.Open(fileName);

            if (fs != null)
            {
                if (fs.FeatureType == FeatureType.Line)
                {
                    return new MapLineLayer(fs, container);
                }
                if (fs.FeatureType == FeatureType.Polygon)
                {
                    return new MapPolygonLayer(fs, container);
                }
                if (fs.FeatureType == FeatureType.Point || fs.FeatureType == FeatureType.MultiPoint)
                {
                    return new MapPointLayer(fs, container);
                }
            }
            return null;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:30,代码来源:ShapefileLayerProvider.cs



注:本文中的IProgressHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IProgressIndicator类代码示例发布时间:2022-05-24
下一篇:
C# IProgress类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap