IMapRendererRender Method |
Namespace: Telogis.GeoBase
The RenderContext parameter supplies information to this method
about the state of rendering, and also provides methods for:
Related articles: Map Concept, Defining the Renderer.
public void Render(System.Drawing.Graphics graphics, RenderContext rc) { // In this case, only draw after everything else has been drawn. if (rc.Mode == RenderMode.Labelling) { // Create a pen to draw the outline of the circle. System.Drawing.Pen RenderPen = new System.Drawing.Pen(Color.Red,1); // Create a brush with which to fill in the circle. System.Drawing.Brush RenderBrush = new System.Drawing.SolidBrush(Color.FromArgb(80, Color.Blue)); // Get the BoundingBox which encloses the circle. // We assume this has already been created by the Circle class. BoundingBox bb = this.BoundingBox; // Will store the x/y co-ordinates. int x1,y1,x2,y2; // Use the specified IMap to convert the BoundingBox's // LatLon co-ordinates to x/y values. rc.Map.LatLontoXY(out x1, out y1, bb.P1 ); rc.Map.LatLontoXY(out x2, out y2, bb.P2 ); // Test whether there is space available for the circle // to be rendered (this is not mandatory). if (rc.Test(bb.Rectangle, 5, 0)) { // Reserve space for the circle by Placing it. Note that we // have specified a 5 pixel buffer around the circle. rc.Place(bb.Rectangle, 5, 0); //Draw the circle outline at the co-ordinates, with the //specified x and y radii. graphics.DrawEllipse(RenderPen,x1,y1,x2-x1,y2-y1); //Fill the circle using the same co-ordinate parameters. graphics.FillEllipse(RenderBrush,x1,y1,x2-x1,y2-y1); } } }