/// <summary> /// Method called to initialize the rendering process /// </summary> /// <param name="graphics">The graphics object to render upon</param> /// <param name="map">The map</param> protected virtual void OnRender(Graphics graphics, MapViewport map) { // Get query envelope var envelope = ToSource(map.Envelope); lock (_dataSource) { var wasOpen = _dataSource.IsOpen; if (!_dataSource.IsOpen) { _dataSource.Open(); } _geometries = DataSource.GetGeometriesInView(envelope); if (logger.IsDebugEnabled) { logger.DebugFormat("Layer {0}, NumGeometries {1}", LayerName, _geometries.Count); } if (!wasOpen) { _dataSource.Close(); } } //Setting up the Symbolizer Symbolizer.Begin(graphics, map, 0); }
/// <summary> /// Method called to initialize the rendering process /// </summary> /// <param name="graphics">The graphics object to render upon</param> /// <param name="map">The map</param> protected virtual void OnRender(Graphics graphics, Map map) { // Get query envelope var envelope = map.Envelope; // Convert bounding box to datasource's coordinate system if (CoordinateTransformation != null) { #if !DotSpatialProjections if (ReverseCoordinateTransformation != null) { envelope = GeometryTransform.TransformBox(envelope, ReverseCoordinateTransformation.MathTransform); } else { CoordinateTransformation.MathTransform.Invert(); envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.MathTransform); CoordinateTransformation.MathTransform.Invert(); } #else envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.Target, CoordinateTransformation.Source); #endif } lock (_dataSource) { var wasOpen = _dataSource.IsOpen; if (!_dataSource.IsOpen) { _dataSource.Open(); } _geometries = DataSource.GetGeometriesInView(envelope); if (logger.IsDebugEnabled) { logger.DebugFormat("Layer {0}, NumGeometries {1}", LayerName, _geometries.Count); } if (!wasOpen) { _dataSource.Close(); } } //Setting up the Symbolizer Symbolizer.Begin(graphics, map, 0); }
/// <summary> /// Method called to initialize the rendering process /// </summary> /// <param name="graphics"></param> /// <param name="map"></param> protected virtual void OnRender(Graphics graphics, Map map) { // Get query envelope BoundingBox envelope = map.Envelope; // Convert bounding box to datasource's coordinate system if (CoordinateTransformation != null) { #if !DotSpatialProjections if (ReverseCoordinateTransformation != null) { envelope = GeometryTransform.TransformBox(envelope, ReverseCoordinateTransformation.MathTransform); } else { CoordinateTransformation.MathTransform.Invert(); envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.MathTransform); CoordinateTransformation.MathTransform.Invert(); } #else envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.Target, CoordinateTransformation.Source); #endif } lock (_dataSource) { bool wasOpen = _dataSource.IsOpen; if (!_dataSource.IsOpen) { _dataSource.Open(); } _geometries = DataSource.GetGeometriesInView(envelope); Console.Out.WriteLine(string.Format("Layer {0}, NumGeometries {1}", LayerName, _geometries.Count)); if (!wasOpen) { _dataSource.Close(); } } _oldSmoothingMode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode; //Setting up the Symbolizer Symbolizer.Begin(graphics, map, 0); }