Beispiel #1
0
        public override void Render(Feature scrapFeature)
        {
            if(!(Visible && _layer.IsVisibleAt(Renderer.Zoom)))
                return;

            var tStart = Environment.TickCount;

            Renderer.Graphics.SmoothingMode = SmoothingMode;

            try
            {
                var cnt = 0;

                foreach (var feature in _layer.GetFeatures(_featureType, _layer, Renderer.Window))
                {
                    Renderer.Context.Variables[Renderer.FEATURE_VAR] = feature;
                    if (cnt >= _layer.MaxRender)
                        return;

                    Renderer.FeatureVarResolver.Feature = feature;
                    Renderer.Render(Renderers, feature);
                    
                    cnt++;
                }

                FeatureCount = cnt;
                Renderer.PerformLayerRendered(new LayerEventArgs(_layer));
            }
            catch (Exception ex)
            {
                var args = new LayerFailedEventArgs(_layer, ex);
                Renderer.PerformLayerFailed(args);
            }
            finally
            {
                Renderer.FeatureVarResolver.Feature = null; //restore old feature
            }
            
            RenderCount++;
            RenderTime = new TimeSpan((Environment.TickCount - tStart) * 10000);
        }
		void Renderer_LayerFailed(object sender, LayerFailedEventArgs e)
		{
            var ret = MessageBox.Show(string.Format("Rendering of layer '{0}' failed: {1}\r\nContinue?", e.Layer.NodePath, e.Exception.Message), Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
            if (ret == DialogResult.No)
                e.Cancel = true;
		}