Beispiel #1
0
        public void TestTimer()
        {
            // arrange
            var layer      = new RasterizingLayer(CreatePointLayer());
            var schema     = new GlobalSphericalMercator();
            var box        = schema.Extent.ToBoundingBox();
            var resolution = schema.Resolutions.First().Value.UnitsPerPixel;
            var waitHandle = new AutoResetEvent(false);

            DefaultRendererFactory.Create = () => new MapRenderer(); // Using xaml renderer here to test rasterizer. Suboptimal.

            Assert.AreEqual(0, layer.GetFeaturesInView(box, resolution).Count());
            layer.DataChanged += (sender, args) =>
            {
                // assert
                waitHandle.Set();
            };

            // act
            layer.RefreshData(box, resolution, ChangeType.Discrete);

            // assert
            waitHandle.WaitOne();
            Assert.AreEqual(layer.GetFeaturesInView(box, resolution).Count(), 1);
        }
Beispiel #2
0
        public void TestTimer()
        {
            // arrange
            DefaultRendererFactory.Create = () => new MapRenderer();
            using var memoryLayer         = CreatePointLayer();
            using var layer = new RasterizingLayer(memoryLayer);
            var schema     = new GlobalSphericalMercator();
            var box        = schema.Extent.ToMRect();
            var resolution = schema.Resolutions.First().Value.UnitsPerPixel;

            using var waitHandle = new AutoResetEvent(false);

            Assert.AreEqual(0, layer.GetFeatures(box, resolution).Count());
            layer.DataChanged += (_, _) => {
                // assert
                waitHandle.Set();
            };

            var fetchInfo = new FetchInfo(box, resolution, null, ChangeType.Discrete);

            // act
            layer.RefreshData(fetchInfo);

            // assert
            waitHandle.WaitOne();
            Assert.AreEqual(layer.GetFeatures(box, resolution).Count(), 1);
        }
        private void InitLayers()
        {
            mapObjectLayer    = new MapObjectLayer();
            boundingAreaLayer = new BoundingAreaLayer();
            attractorLayer    = new WritableLayer();

            edgeLayer            = new WritableLayer();
            edgeRasterizingLayer = new RasterizingLayer(edgeLayer,
                                                        delayBeforeRasterize: 0, renderResolutionMultiplier: 1,
                                                        rasterizer: null, overscanRatio: 2);
        }