New() публичный Метод

public New ( ) : IFeature
Результат IFeature
Пример #1
0
        public IEnumerable<IFeature> FetchTiles(BoundingBox boundingBox, double resolution)
        {
            var extent = new Extent(boundingBox.Min.X, boundingBox.Min.Y, boundingBox.Max.X, boundingBox.Max.Y);
            var levelId = BruTile.Utilities.GetNearestLevel(_source.Schema.Resolutions, resolution);
            var infos = _source.Schema.GetTileInfos(extent, levelId).ToList();

            ICollection<WaitHandle> waitHandles = new List<WaitHandle>();
                        
            foreach (TileInfo info in infos)    
            {
                if (_bitmaps.Find(info.Index) != null) continue;
                if (_queue.Contains(info.Index)) continue;
                var waitHandle = new AutoResetEvent(false);
                waitHandles.Add(waitHandle);
                _queue.Add(info.Index);
                ThreadPool.QueueUserWorkItem(GetTileOnThread, new object[] { _source, info, _bitmaps, waitHandle });
            }

            WaitHandle.WaitAll(waitHandles.ToArray());
            
            IFeatures features = new Features();
            foreach (TileInfo info in infos)
            {
                byte[] bitmap = _bitmaps.Find(info.Index);
                if (bitmap == null) continue;
                IRaster raster = new Raster(new MemoryStream(bitmap), new BoundingBox(info.Extent.MinX, info.Extent.MinY, info.Extent.MaxX, info.Extent.MaxY));
                IFeature feature = features.New();
                feature.Geometry = raster;
                features.Add(feature);
            }
            return features;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryProvider"/>
        /// </summary>
        /// <param name="geometry">Geometry to be in this datasource</param>
        public MemoryProvider(Geometry geometry)
        {
            SRID     = -1;
            Features = new Features();
            IFeature feature = Features.New();

            feature.Geometry = geometry;
            Features.Add(feature);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryProvider"/>
        /// </summary>
        /// <param name="geometry">Geometry to be in this datasource</param>
        public MemoryProvider(Geometry geometry)
        {
            CRS      = "";
            Features = new Features();
            IFeature feature = Features.New();

            feature.Geometry = geometry;
            Features.Add(feature);
            SymbolSize = 64;
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryProvider"/>
 /// </summary>
 /// <param name="geometries">Set of geometries that this datasource should contain</param>
 public MemoryProvider(IEnumerable <IGeometry> geometries)
 {
     CRS      = "";
     Features = new Features();
     foreach (IGeometry geometry in geometries)
     {
         IFeature feature = Features.New();
         feature.Geometry = geometry;
         Features.Add(feature);
     }
 }
        public System.Collections.Generic.IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
        {
            var features = new Features();

            IRaster raster = null;
            var view = new Viewport { Resolution = resolution, Center = box.GetCentroid(), Width = (box.Width / resolution), Height = (box.Height / resolution) };
            if (TryGetMap(view, ref raster))
            {
                IFeature feature = features.New();
                feature.Styles.Add(new VectorStyle()); // this is not my fault
                feature.Geometry = raster;
                features.Add(feature);
            }
            return features;
        }
Пример #6
0
        public IEnumerable <IFeature> FetchTiles(BoundingBox boundingBox, double resolution)
        {
            var extent = new Extent(boundingBox.Min.X, boundingBox.Min.Y, boundingBox.Max.X, boundingBox.Max.Y);
            int level  = BruTile.Utilities.GetNearestLevel(source.Schema.Resolutions, resolution);
            var infos  = source.Schema.GetTilesInView(extent, level).ToList();

            ICollection <WaitHandle> waitHandles = new List <WaitHandle>();

            foreach (TileInfo info in infos)
            {
                if (bitmaps.Find(info.Index) != null)
                {
                    continue;
                }
                if (queue.Contains(info.Index))
                {
                    continue;
                }
                var waitHandle = new AutoResetEvent(false);
                waitHandles.Add(waitHandle);
                queue.Add(info.Index);
                ThreadPool.QueueUserWorkItem(GetTileOnThread, new object[] { source.Provider, info, bitmaps, waitHandle });
            }

            foreach (WaitHandle handle in waitHandles)
            {
                handle.WaitOne();
            }

            IFeatures features = new Features();

            foreach (TileInfo info in infos)
            {
                byte[] bitmap = bitmaps.Find(info.Index);
                if (bitmap == null)
                {
                    continue;
                }
                IRaster  raster  = new Raster(new MemoryStream(bitmap), new BoundingBox(info.Extent.MinX, info.Extent.MinY, info.Extent.MaxX, info.Extent.MaxY));
                IFeature feature = features.New();
                feature.Geometry = raster;
                features.Add(feature);
            }
            return(features);
        }
Пример #7
0
        public static IEnumerable<IFeature> DataSetToFeatures(FeatureDataSet dataSet)
        {
            var features = new Features();

            foreach (FeatureDataTable table in dataSet.Tables)
            {
                foreach (FeatureDataRow row in table)
                {
                    IFeature feature = features.New();
                    feature.Geometry = row.Geometry;
                    foreach (DataColumn column in table.Columns)
                        feature[column.ColumnName] = row[column.ColumnName];

                    features.Add(feature);
                }
            }
            return features;
        }
Пример #8
0
        public IEnumerable <IFeature> FetchTiles(BoundingBox boundingBox, double resolution)
        {
            var extent  = new Extent(boundingBox.Min.X, boundingBox.Min.Y, boundingBox.Max.X, boundingBox.Max.Y);
            var levelId = BruTile.Utilities.GetNearestLevel(_source.Schema.Resolutions, resolution);
            var infos   = _source.Schema.GetTileInfos(extent, levelId).ToList();

            ICollection <WaitHandle> waitHandles = new List <WaitHandle>();

            foreach (TileInfo info in infos)
            {
                if (_bitmaps.Find(info.Index) != null)
                {
                    continue;
                }
                if (_queue.Contains(info.Index))
                {
                    continue;
                }
                var waitHandle = new AutoResetEvent(false);
                waitHandles.Add(waitHandle);
                _queue.Add(info.Index);
                Task.Run(() => GetTileOnThread(new object[] { _source, info, _bitmaps, waitHandle }));
            }

            WaitHandle.WaitAll(waitHandles.ToArray());

            IFeatures features = new Features();

            foreach (TileInfo info in infos)
            {
                byte[] bitmap = _bitmaps.Find(info.Index);
                if (bitmap == null)
                {
                    continue;
                }
                IRaster  raster  = new Raster(new MemoryStream(bitmap), new BoundingBox(info.Extent.MinX, info.Extent.MinY, info.Extent.MaxX, info.Extent.MaxY));
                IFeature feature = features.New();
                feature.Geometry = raster;
                features.Add(feature);
            }
            return(features);
        }
Пример #9
0
        public static IEnumerable <IFeature> DataSetToFeatures(FeatureDataSet dataSet)
        {
            var features = new Features();

            foreach (FeatureDataTable table in dataSet.Tables)
            {
                foreach (FeatureDataRow row in table)
                {
                    IFeature feature = features.New();
                    feature.Geometry = row.Geometry;
                    foreach (DataColumn column in table.Columns)
                    {
                        feature[column.ColumnName] = row[column.ColumnName];
                    }

                    features.Add(feature);
                }
            }
            return(features);
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryProvider"/>
 /// </summary>
 /// <param name="geometries">Set of geometries that this datasource should contain</param>
 public MemoryProvider(IEnumerable<IGeometry> geometries)
 {
     CRS = "";
     Features = new Features();
     foreach (IGeometry geometry in geometries)
     {
         IFeature feature = Features.New();
         feature.Geometry = geometry;
         Features.Add(feature);
     }
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryProvider"/>
 /// </summary>
 /// <param name="geometry">Geometry to be in this datasource</param>
 public MemoryProvider(Geometry geometry)
 {
     CRS = "";
     Features = new Features();
     IFeature feature = Features.New();
     feature.Geometry = geometry;
     Features.Add(feature);
     SymbolSize = 64;
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryProvider"/>
 /// </summary>
 /// <param name="geometry">Geometry to be in this datasource</param>
 public MemoryProvider(Geometry geometry)
 {
     SRID = -1;
     Features = new Features();
     IFeature feature = Features.New();
     feature.Geometry = geometry;
     Features.Add(feature);
 }