Esempio n. 1
0
        public override IEnumerable <IFeature> GetFeatures(IEnvelope box, ILayer layer)
        {
            var vectorLayer = (VectorLayer)layer;
            var symbol      = vectorLayer.Style.Symbol;

            var boxExpandedForImageSize = MapHelper.GetEnvelopeForImage(layer.Map, box.Centre,
                                                                        symbol.Width * 1.2, symbol.Height * 1.2);

            return(layer.GetFeatures(geometryFactory.ToGeometry(boxExpandedForImageSize), false));
        }
        public override IEnumerable<IFeature> GetFeatures(IEnvelope box, ILayer layer)
        {
            var vectorLayer = (VectorLayer)layer;
            var symbol = vectorLayer.Style.Symbol;

            var boxExpandedForImageSize = MapHelper.GetEnvelopeForImage(layer.Map, box.Centre,
                                                                                    symbol.Width*1.2, symbol.Height*1.2);

            return layer.GetFeatures(geometryFactory.ToGeometry(boxExpandedForImageSize), false);
        }
        public IEnumerable <IFeature> GetFeatures(Envelope box, ILayer layer)
        {
            return(layer.GetFeatures(geometryFactory.ToGeometry(box), false));

            var intersectedFeatures = new List <IFeature>();

            foreach (IFeature feature in layer.DataSource.Features)
            {
                IGeometry geometry = GetRenderedFeatureGeometry(feature, layer);
                if (geometry.EnvelopeInternal.Intersects(box))
                {
                    intersectedFeatures.Add(feature);
                }
            }
            return(intersectedFeatures);
        }
 public IEnumerable <IFeature> GetFeatures(IEnvelope box, ILayer layer)
 {
     return(layer.GetFeatures(new GeometryFactory().ToGeometry(box), false));
 }
 public IEnumerable <IFeature> GetFeatures(IGeometry geometry, ILayer layer)
 {
     return(layer.GetFeatures(geometry, false));
 }
Esempio n. 6
0
        private static void IterateLayer(IReadOnlyViewport viewport, ILayer layer,
                                         Action <IReadOnlyViewport, ILayer, IStyle, IFeature, float> callback)
        {
            if (viewport.Extent == null)
            {
                return;
            }
            var features = layer.GetFeatures(viewport.Extent, viewport.Resolution).ToList();

            var layerStyles = ToArray(layer);

            foreach (var layerStyle in layerStyles)
            {
                var style = layerStyle; // This is the default that could be overridden by an IThemeStyle

                foreach (var feature in features)
                {
                    if (layerStyle is IThemeStyle themeStyle)
                    {
                        var styleForFeature = themeStyle.GetStyle(feature);
                        if (styleForFeature == null)
                        {
                            continue;
                        }
                        style = styleForFeature;
                    }

                    if (ShouldNotBeApplied(style, viewport))
                    {
                        continue;
                    }

                    if (style is StyleCollection styles) // The ThemeStyle can again return a StyleCollection
                    {
                        foreach (var s in styles)
                        {
                            if (ShouldNotBeApplied(s, viewport))
                            {
                                continue;
                            }
                            callback(viewport, layer, s, feature, (float)layer.Opacity);
                        }
                    }
                    else
                    {
                        callback(viewport, layer, style, feature, (float)layer.Opacity);
                    }
                }
            }

            foreach (var feature in features)
            {
                var featureStyles = feature.Styles ?? Enumerable.Empty <IStyle>(); // null check
                foreach (var featureStyle in featureStyles)
                {
                    if (ShouldNotBeApplied(featureStyle, viewport))
                    {
                        continue;
                    }

                    callback(viewport, layer, featureStyle, feature, (float)layer.Opacity);
                }
            }
        }
        public IEnumerable<IFeature> GetFeatures(IEnvelope box, ILayer layer)
        {
            return layer.GetFeatures(geometryFactory.ToGeometry(box), false);

            var intersectedFeatures = new List<IFeature>();

            foreach (IFeature feature in layer.DataSource.Features)
            {
                IGeometry geometry = GetRenderedFeatureGeometry(feature, layer);
                if (geometry.EnvelopeInternal.Intersects(box))
                {
                    intersectedFeatures.Add(feature);
                }
            }
            return intersectedFeatures;
        }