public override bool Render(RenderProperties rp) { //if (this.Visible && Style.Enabled && this.Style.MaxVisible >= absoluteZoom && this.Style.MinVisible <= absoluteZoom) //{ // if (this.DataSource == null) // throw (new ApplicationException("DataSource property not set on layer '" + this.LayerName + "'")); //} return true; }
public override bool Render(RenderProperties rp) { List<PolyShapeBBInformation> transportPointList = new List<PolyShapeBBInformation>(); StringBuilder dispString = new StringBuilder(); Pen pen = new Pen(config.ExPGonLayerLineColor, config.exPGonLayerLineWidth); Pen hihglightPen = new Pen(Color.Red, config.exPGonLayerLineWidth); hihglightPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; Brush brush = new SolidBrush(config.ExPGonLayerLineColor); Brush fillBrush = new SolidBrush(config.ExPGonLayerFillColor); SolidBrush hlBrush = new SolidBrush(Color.Red); SolidBrush brushPoint = new SolidBrush(config.ExPGonLayerPointColor); Graphics g = rp.G; double dX = rp.DX; double dY = rp.DY; double scale = rp.Scale; int pntWidth = config.ExPGonLayerPointWidth; IShape vertex = null; layermanager.generatePolygonList(ref transportPointList); if (transportPointList.Count != 0) { IShape shape; for (int i = transportPointList.Count - 1; i >= 0; i--) { shape = transportPointList[i].Shape; if (shape.Visible) { // brush the fill if (config.ExPGonLayerFill) g.FillPolygon(fillBrush, transportPointList[i].Pointlist); // draw the outline if (shape.IsHighlighted) g.DrawLines(hihglightPen, transportPointList[i].Pointlist); else g.DrawLines(pen, transportPointList[i].Pointlist); //draw highlighted vertices for (int j = shape.PointCount - 1; j >= 0; j--) { vertex = shape.getElement(j); // draw highlighted vertices if (vertex.IsHighlighted) g.FillEllipse(hlBrush, vertex.getDisplayBoundingBox(dX, dY, pntWidth, scale, 1)); else { // draw the vertices if (pntWidth > 0) g.FillEllipse(brushPoint, vertex.getDisplayBoundingBox(dX, dY, pntWidth, scale, 0)); } } if (config.ExPGonLayerDisplayComments) { dispString.Remove(0, dispString.Length); dispString.Append(shape.Commment); if (dispString.Length > 0) { if (dispString.Length > displayCharacterCount) { dispString.Remove(displayCharacterCount, dispString.Length - this.displayCharacterCount); dispString.Append("..."); } SizeF stringSize = g.MeasureString(dispString.ToString(), commentFont); shape.StringSize = stringSize; g.DrawString(dispString.ToString(), this.commentFont, brush, new Rectangle( transportPointList[i].BoundingBox.Right + 2, transportPointList[i].BoundingBox.Bottom + 2, (int)stringSize.Width, (int)stringSize.Height)); } } } } } return true; }
protected override void OnPaint(PaintEventArgs e) { _stopwatch.Reset(); _stopwatch.Start(); SizeF textSize; String text = String.Empty; System.Drawing.Graphics gx = vectorRenderer.Graphics = e.Graphics; // Graphics.FromImage(backBuffer); //e.Graphics; gx.Clear(Color.White); this.dpiX = gx.DpiX; this.dpiY = gx.DpiY; double scale = mainControler.LayerManager.Scale; int layerCount = mainControler.LayerManager.LayerCount; LayerManager lm = mainControler.LayerManager; // TransportLayer // TODO: [9] Ist TransportShapes malen mit QuadTree schneller oder wenn man alles malt? (ab wann ist das wichtig?) lm.generateCurrentVisibleIShapes(d, drawingArea.Width, drawingArea.Height, absoluteZoom); // now draw the image previously created in the given order // ! We assume that there are no gaps (e.g. "1, 2, 4") in the mapping-list Layer layer; RenderProperties rp = new RenderProperties(gx, e.ClipRectangle, d.x, d.y, absoluteZoom, screenChanged, this.drawingArea, scale, mHighlight); for (int i = layerCount - 1; i >= 0; i--) { layer = lm.getLayerFromMapping(i); if (layer.Visible) { if (!(layer.Render(rp))) { this.Invalidate(); return; } } } //IntPtr hBackBuffert = MapPanelBindings.GetRotatedBitmapNT(backBuffer.HBitmap, 0.0f, MakeCOLORREF(255, 255, 255)); //Image newBackImage = Image.FromHbitmap(hBackBuffert); //gx = Graphics.FromImage(newBackImage); //rotateImage(backBuffer, 0); if (screenChanged) { mZoom = false; screenChanged = false; } StringFormat format = new StringFormat(StringFormatFlags.NoWrap); StylePen blackPen = new StylePen(StyleColor.Black, 1.0f); SolidStyleBrush blackBrush = new SolidStyleBrush(StyleColor.Black); #region Transportlayer lm.TransportPolygonLayer.Render(rp); lm.TransportPolylineLayer.Render(rp); lm.TransportPointLayer.Render(rp); #endregion #region GPS-Layer if (config.UseGPS) lm.GPSLayer.Render(rp); #endregion #region Längenanzeige if (config.ShowDistanceLine) { StylePen borderPen = new StylePen(StyleColor.White, 1.0f); // get the scaling factor for other dimensions int multiplikator = (int)(dpiX / 96.0); // get the amount of pixels representing one centimeter int width = Convert.ToInt32(dpiX / 2.54); ; blackPen.Width *= multiplikator; int left = drawingArea.X + 7*multiplikator; int right = left + width; int top = drawingArea.Bottom - 15 * multiplikator; int bottom = top + 7 * multiplikator; double dM = width / mainControler.LayerManager.Scale; if (dM > 1000) // display as kilometers text = String.Format("{0}km", (dM / 1000).ToString("#0.0")); else if (dM > 1) // display as meters text = String.Format("{0}m", Convert.ToInt32(dM).ToString()); else // display as centimeters text = String.Format("{0}cm", Convert.ToInt32(dM * 10).ToString()); textSize = gx.MeasureString(text, font); int x = left + (int)((right - left - textSize.Width) / 2F); int y = top - 4 * multiplikator; // a white background for the text vectorRenderer.FillRectangle(new SolidStyleBrush(StyleColor.White), new Rectangle(x - 1, y - 1, (int)textSize.Width + 2, (int)textSize.Height + 2)); vectorRenderer.DrawLine(blackPen, left, top, left, bottom); vectorRenderer.DrawLine(blackPen, left, bottom, right, bottom); vectorRenderer.DrawLine(blackPen, right, bottom, right, top); // the white outline vectorRenderer.DrawLine(borderPen, left - 1, top, left - 1, bottom); vectorRenderer.DrawLine(borderPen, left + 1, top, left + 1, bottom - 1); vectorRenderer.DrawLine(borderPen, left - 1, top - 1, left + 1, top - 1); vectorRenderer.DrawLine(borderPen, left - 1, bottom + 1, right + 1, bottom + 1); vectorRenderer.DrawLine(borderPen, left + 1, bottom - 1, right - 1, bottom - 1); vectorRenderer.DrawLine(borderPen, right - 1, top, right - 1, bottom - 1); vectorRenderer.DrawLine(borderPen, right + 1, top, right + 1, bottom); vectorRenderer.DrawLine(borderPen, right - 1, top - 1, right + 1, top - 1); // the text vectorRenderer.DrawString(text, font, blackBrush, x, y, format); } #endregion #region Nordpfeil if (config.ShowNorthArrow) { // linke Seite (weiß) vectorRenderer.FillPolygon(new SolidStyleBrush(StyleColor.White), new Point[] { new Point(drawingArea.Right - 20, drawingArea.Bottom -27), new Point(drawingArea.Right - 25, drawingArea.Bottom -5), new Point(drawingArea.Right - 20, drawingArea.Bottom -8)}); vectorRenderer.DrawLines(new StylePen(StyleColor.Black, 1.0f), new Point[] { new Point(drawingArea.Right - 20, drawingArea.Bottom -27), new Point(drawingArea.Right - 25, drawingArea.Bottom -5), new Point(drawingArea.Right - 20, drawingArea.Bottom -8)}); // rechte Seite (schwarz) vectorRenderer.FillPolygon(new SolidStyleBrush(StyleColor.Black), new Point[] { new Point(drawingArea.Right - 20, drawingArea.Bottom -27), new Point(drawingArea.Right - 20, drawingArea.Bottom -8), new Point(drawingArea.Right - 14, drawingArea.Bottom -4), new Point(drawingArea.Right - 20, drawingArea.Bottom -27)}); } #endregion #region Draw backbuffer (Backbuffer is currently disabled!) //e.Graphics.DrawImage(backBuffer, 0, 0); #endregion #region Zoom rectangle if (mZoom) e.Graphics.DrawRectangle(new Pen(Color.Red, 1.0f), zoomRec); #endregion #region SelectedItem / Tracking Info text = String.Empty; if (displayTrackingStatus) { text = _trackingStatus; } else if (selectedTransportShape != null) { text = String.Empty; if (selectedTransportShape as ShpPolyline != null) { text = String.Format("Länge: {0}m", ((ShpPolyline)selectedTransportShape).Length.ToString("#0.00")); } else if (selectedTransportShape as ShpPolygon != null) { ShpPolygon pg = (ShpPolygon)selectedTransportShape; text = String.Format("Umfang: {0}m Fläche: {1} m²", pg.Perimeter.ToString("#0.00"), pg.Area.ToString("#0.00")); } } if (!String.IsNullOrEmpty(text)) { textSize = gx.MeasureString(text, font); m_TextHeight = (int)(textSize.Height + 4); vectorRenderer.FillRectangle(new SolidStyleBrush(StyleColor.White), drawingArea.X, drawingArea.Y, drawingArea.Width, m_TextHeight); vectorRenderer.DrawLine(new StylePen(StyleColor.Blue, 1.0f), drawingArea.X, drawingArea.Y + m_TextHeight, drawingArea.Width, drawingArea.Y + m_TextHeight); vectorRenderer.DrawString(text, font, blackBrush, drawingArea.X + 1, drawingArea.Y + 2, format); } #endregion #region Meta-Define Drawings #if DRAW_INVALIDATEREC foreach (Rectangle r in this.rectangleList) { GKCoord gk = new GKCoord(); gk.r_value = r.X; gk.h_value = r.Y; PointD p = CoordCalculator.calculateDisplayCoords(gk, this.DX, this.DY, mainControler.LayerManager.Scale); gx.DrawRectangle(new Pen(Color.Pink), new Rectangle((int)(p.x),(int)(p.y),r.Width,r.Height)); } #endif #if DRAW_GRID // Grid drawing for (int i = (int)(mainControler.LayerManager.ShapeArray[0].Width * mainControler.LayerManager.Scale); i >= 0; i -= mainControler.LayerManager.ShapeArray[0].PartGrid.Cell_width) { gx.DrawLine(new Pen(Color.Red), (int)d[0] + i, (int)d[1] + margin, (int)d[0] + i, (int)(d[1] + mainControler.LayerManager.ShapeArray[0].Height * mainControler.LayerManager.Scale) - margin); } for (int i = (int)(mainControler.LayerManager.ShapeArray[0].Height * mainControler.LayerManager.Scale); i >= 0; i -= mainControler.LayerManager.ShapeArray[0].PartGrid.Cell_height) { gx.DrawLine(new Pen(Color.Red), (int)d[0] + margin, (int)d[1] + i, (int)(d[0] + mainControler.LayerManager.ShapeArray[0].Width * mainControler.LayerManager.Scale) - margin, (int)d[1] + i); } #endif #if DRAW_QUADTREE mainControler.LayerManager.draw_QuadTree(gx, d); #endif #if DRAW_BOUNDINGBOXES // Draw Boundingboxes List<Rectangle> transportRectangleList = new List<Rectangle>(); // :: Points mainControler.LayerManager.generateBBList(ref transportRectangleList, absoluteZoom); if (transportRectangleList.Count != 0) { Pen temporaryPen = new Pen(Color.Green); for (int i = transportRectangleList.Count - 1; i >= 0; i--) gx.DrawRectangle(temporaryPen, transportRectangleList[i]); } #endif #endregion //Bounding Box of selected IShape //if (selectedTransportShape != null) // vectorRenderer.DrawRectangle(new Pen(Color.Green), selectedTransportShape.getDisplayBoundingBox( // d.x, d.y, config.ExPntLayerPointWidth, scale, 1)); //Boundary rectangle Rectangle rc = this.ClientRectangle; rc.Width--; rc.Height--; //Draw boundary e.Graphics.DrawRectangle(new Pen(Color.Blue), rc); gx.Dispose(); _stopwatch.Stop(); // if the render time is higher than the gps update interval // we have to set the update interval higher if (_stopwatch.ElapsedMilliseconds >= config.GPSUpdateInterval) { // base update interval is render time * 1.2 double newInterval = _stopwatch.ElapsedMilliseconds * 1.2; // since we want full 1000th as interval we round up to the next 1000 try { config.GPSUpdateInterval = Convert.ToUInt32( newInterval + ( 1000 - newInterval % 1000 ) ); } catch { config.GPSUpdateInterval = 5000; } finally { mainControler.OnSettingsChanged(); } } }
public override bool Render(RenderProperties rp) { double xOff = rp.DX / rp.Scale; double yOff = rp.DY / rp.Scale; if (Changed) recalculateData(rp.AbsoluteZoom, rp.Scale, xOff, yOff); IntPtr hDC = rp.G.GetHdc(); MapPanelBindings.GDALDrawImage(layermanager.CGDALContainer, hDC, xOff, yOff, this.layerID); rp.G.ReleaseHdc(hDC); return true; }
public abstract bool Render(RenderProperties rp);
public override bool Render(RenderProperties rp) { if (this.shapeType != ShapeLib.ShapeType.NullShape && NumberOfShapes > 0) { if (Changed || rp.ScreenChanged) { int tempPointSize = layerManager.PointSize; Pen layerPen = this.vectorInfo.LayerPen; if (rp.AbsoluteZoom > constZoomLevelLimit || bOutOfMemory) { // if we are switching to this "mode" (e.g. calculating all the points // again on every change) we must initialize the bitmapList with drawingArea // sized bitmaps since we do not want to create them all the time from scratch if (prepareBitmap) { bitmap.Dispose(); bitmap = new Bitmap(rp.DrawingArea.Width, rp.DrawingArea.Height, System.Drawing.Imaging.PixelFormat.Format16bppRgb555); prepareBitmap = false; } // this is done because multiplication is faster than division double invAbsZoom = 1.0 / rp.AbsoluteZoom; Rectangle collideRec = new Rectangle(1, 1, (int)(Math.Ceiling(rp.DrawingArea.Width * invAbsZoom)), (int)(Math.Ceiling(rp.DrawingArea.Height * invAbsZoom))); //Rectangle collideRec = new Rectangle(1, 1, // (int)(Math.Ceiling(rp.ClipRectangle.Width * invAbsZoom)), // (int)(Math.Ceiling(rp.ClipRectangle.Height * invAbsZoom))); Graphics gx = Graphics.FromImage(bitmap); gx.Clear(Color.NavajoWhite); // clip the collide rectanlge //clipRectagle // TODO: kann man das nicht irgendwie zusammenfassen / beschleunigen? collideRec.X = (int)(rp.DX * invAbsZoom - BoundingBox.Left * rp.Scale * invAbsZoom); collideRec.Y = (int)(-(rp.DY * invAbsZoom - BoundingBox.Top * rp.Scale * invAbsZoom)); //collideRec.X = (int)( (rp.DX + rp.ClipRectangle.X) * invAbsZoom - BoundingBox.Left * rp.Scale * invAbsZoom); //collideRec.Y = (int)(-((rp.DY + rp.ClipRectangle.Y) * invAbsZoom - BoundingBox.Top * rp.Scale * invAbsZoom)); long relativeDiffX = Convert.ToInt64(rp.DX - BoundingBox.Left * rp.Scale); //int relativeDiffX = Convert.ToInt32(rp.DX); long relativeDiffY = Convert.ToInt64(BoundingBox.Top * rp.Scale - rp.DY); //int relativeDiffY = Convert.ToInt32(-rp.DY); List<PointList> pl = new List<PointList>(); partGrid.CollidingPoints(collideRec, ref pl); if (!isPoint) { Point[] temp; // treat polygons special since they can be filled if (this.shapeType == MapTools.ShapeLib.ShapeType.Polygon && vectorInfo.Fill) { Brush layerBrush = new SolidBrush(this.vectorInfo.FillColor); for (int pointList = 0; pointList < pl.Count; pointList++) { temp = new Point[pl[pointList].Length]; for (int p = 0; p < temp.Length; p++) { temp[p].X = (int)(pl[pointList].getDispPoint(p).X - relativeDiffX); temp[p].Y = (int)(pl[pointList].getDispPoint(p).Y - relativeDiffY); } gx.FillPolygon(layerBrush, temp); gx.DrawLines(layerPen, temp); } } else if (this.shapeType != MapTools.ShapeLib.ShapeType.MultiPoint) { for (int pointList = 0; pointList < pl.Count; pointList++) { temp = new Point[pl[pointList].Length]; for (int p = 0; p < temp.Length; p++) { temp[p].X = (int)(pl[pointList].getDispPoint(p).X - relativeDiffX); temp[p].Y = (int)(pl[pointList].getDispPoint(p).Y - relativeDiffY); } gx.DrawLines(layerPen, temp); } } else { Rectangle drawRect = new Rectangle(); Brush tempPointBrush = new SolidBrush(this.VectorInfo.LayerPen.Color); for (int pointList = 0; pointList < pl.Count; pointList++) { temp = new Point[pl[pointList].Length]; for (int p = 0; p < temp.Length; p++) { temp[p].X = (int)(pl[pointList].getDispPoint(p).X - relativeDiffX); temp[p].Y = (int)(pl[pointList].getDispPoint(p).Y - relativeDiffY); } drawRect = new Rectangle(); for (int p = 0; p < temp.Length; p++) { drawRect.X = (int)(temp[p].X - (tempPointSize >> 1)); // >>1 is faster thatn *2 drawRect.Y = (int)(temp[p].Y - (tempPointSize >> 1)); drawRect.Width = tempPointSize; drawRect.Height = tempPointSize; gx.FillEllipse(tempPointBrush, drawRect); } } } } else // only one point in shape { gx.DrawEllipse(VectorInfo.LayerPen, new Rectangle((int)(_boundingBox.Left - relativeDiffX), (int)(_boundingBox.Bottom - relativeDiffY), tempPointSize, tempPointSize)); } gx.Dispose(); } else { // we rendered the image if (Changed) { bitmap.Dispose(); try { //try: drawing Points bitmap = new Bitmap( Convert.ToInt32(Width * rp.Scale + tempPointSize * 0.5 + 1), Convert.ToInt32(Height * rp.Scale + tempPointSize * 0.5 + 1), System.Drawing.Imaging.PixelFormat.Format16bppRgb555); } catch (OutOfMemoryException) { // jump over to resuce plan B :P bOutOfMemory = true; prepareBitmap = true; return false; } Graphics gx = Graphics.FromImage(bitmap); gx.Clear(Color.NavajoWhite); if (shapeType == MapTools.ShapeLib.ShapeType.MultiPoint) { Rectangle drawRect = new Rectangle(); Brush tempPointBrush = new SolidBrush(VectorInfo.LayerPen.Color); Point[] intPL; for (int pointList = 0; pointList < polyLinePointList.Length; pointList++) { intPL = polyLinePointList[pointList].displayPointList; drawRect.X = (int)(intPL[0].X - (tempPointSize >> 1)); // >>1 is faster than *2 drawRect.Y = (int)(intPL[0].Y - (tempPointSize >> 1)); if (drawRect.X < 0) drawRect.X = 0; if (drawRect.Y < 0) drawRect.Y = 0; drawRect.Width = tempPointSize; drawRect.Height = tempPointSize; gx.FillEllipse(tempPointBrush, drawRect); } } else { if (vectorInfo.Fill) { Brush layerBrush = new SolidBrush(vectorInfo.FillColor); for (int pointList = 0; pointList < polyLinePointList.Length; pointList++) { gx.FillPolygon(layerBrush, polyLinePointList[pointList].displayPointList); gx.DrawLines(VectorInfo.LayerPen, polyLinePointList[pointList].displayPointList); } } else for (int pointList = 0; pointList < polyLinePointList.Length; pointList++) gx.DrawLines(VectorInfo.LayerPen, polyLinePointList[pointList].displayPointList); } if (isPoint) { double tempScale = layerManager.Scale; Brush tempBrush = new SolidBrush(VectorInfo.LayerPen.Color); gx.FillEllipse(tempBrush, new Rectangle( (int)((_boundingBox.Left) * tempScale), (int)((_boundingBox.Bottom) * tempScale), tempPointSize, tempPointSize)); } gx.Dispose(); Changed = false; } } } Rectangle destRect = new Rectangle(rp.DrawingArea.X, rp.DrawingArea.Y, bitmap.Width, bitmap.Height); if (rp.AbsoluteZoom <= constZoomLevelLimit && !bOutOfMemory) { destRect.X += Convert.ToInt32(BoundingBox.Left * rp.Scale - rp.DX); destRect.Y += Convert.ToInt32(rp.DY - BoundingBox.Top * rp.Scale); } rp.G.DrawImage(bitmap, destRect, 0, 0, destRect.Width, destRect.Height, GraphicsUnit.Pixel, imageAttributes); #region Feature highlighting // this has to be drawn directly to screen since we do not // want to change the stored image if (rp.Highlight && selectedItems != null) { int tempPointSize = layerManager.PointSize; Point[] intPL; Graphics g = rp.G; int drawingAreaX = rp.DrawingArea.X; int drawingAreaY = rp.DrawingArea.Y; Pen highlightPen = new Pen(Color.Red, this.vectorInfo.LayerPen.Width + 2); if (rp.AbsoluteZoom > constZoomLevelLimit || bOutOfMemory) { #region "direct draw" case //long relativeDiffX = Convert.ToInt64(dX - relativeLeft * absoluteZoom); //long relativeDiffY = Convert.ToInt64(-(dY + relativeTop * absoluteZoom)); long relativeDiffX = Convert.ToInt64(rp.DX - BoundingBox.Left * rp.Scale); long relativeDiffY = Convert.ToInt64(BoundingBox.Top * rp.Scale - rp.DY); PointList myPl; if (IsWellDefined) { for (int i = selectedItems.Length - 1; i >= 0; i--) { myPl = polyLinePointList[selectedItems[i]]; intPL = new Point[myPl.Length]; for (int p = 0; p < intPL.Length; p++) { intPL[p].X = (int)(myPl.getDispPoint(p).X - relativeDiffX); intPL[p].Y = (int)(myPl.getDispPoint(p).Y - relativeDiffY); } if (this.shapeType != ShapeLib.ShapeType.MultiPoint) g.DrawLines(highlightPen, intPL); else { Rectangle drawRect = new Rectangle(); Brush tempPointBrush = new SolidBrush(Color.Red); for (int p = 0; p < intPL.Length; p++) { drawRect.X = (int)(intPL[p].X - tempPointSize / 2); drawRect.Y = (int)(intPL[p].Y - tempPointSize / 2); drawRect.Width = tempPointSize; drawRect.Height = tempPointSize; g.FillEllipse(tempPointBrush, drawRect); } } } } #endregion } else { # region Bitmap drawing case if (IsWellDefined) { if (this.shapeType != ShapeLib.ShapeType.MultiPoint) { for (int i = selectedItems.Length - 1; i >= 0; i--) { intPL = (Point[])(polyLinePointList[selectedItems[i]].displayPointList.Clone()); for (int j = intPL.Length - 1; j >= 0; j--) { intPL[j].X += destRect.X; intPL[j].Y += destRect.Y; } g.DrawLines(highlightPen, intPL); } } else { Rectangle drawRect = new Rectangle(); Brush tempPointBrush = new SolidBrush(Color.Red); for (int i = selectedItems.Length - 1; i >= 0; i--) { intPL = (Point[])(polyLinePointList[selectedItems[i]].displayPointList.Clone()); drawRect.X = (int)(intPL[0].X - tempPointSize * 0.5 + destRect.X); drawRect.Y = (int)(intPL[0].Y - tempPointSize * 0.5 + destRect.Y); drawRect.Width = drawRect.Height = tempPointSize; g.FillEllipse(tempPointBrush, drawRect); } } } #endregion } } #endregion }
public override bool Render(RenderProperties rp) { // clip everything outside drawingArea // in this case this means, draw nothing if (isInDrawingArea(p, rp.DrawingArea)) { SolidBrush brush = new SolidBrush(config.GpsLayerPointColor); p = CoordCalculator.calculateDisplayCoords( gkToRender, rp.DX, rp.DY, this.mainControler.LayerManager.Scale); rp.G.FillEllipse(brush, new Rectangle( Convert.ToInt32(p.x), Convert.ToInt32(p.y), config.GpsLayerPointWidth, config.GpsLayerPointWidth)); } return true; }
public override bool Render(RenderProperties rp) { List<ShapeBBInformation> transportRectangleList = new List<ShapeBBInformation>(); StringBuilder dispString = new StringBuilder(); SolidBrush brush = new SolidBrush(config.ExPntLayerPointColor); SolidBrush highlightBrush = new SolidBrush(Color.Red); layerManager.generatePointList(ref transportRectangleList); int displayCharacterCount = config.ExPntLayerDisplayCommentMaxLength; if (transportRectangleList.Count != 0) { IShape shape; for (int i = 0; i < transportRectangleList.Count; i++) { shape = transportRectangleList[i].Shape; if (shape.Visible) { // draw the outline if (shape.IsHighlighted) rp.G.FillEllipse(highlightBrush, transportRectangleList[i].BoundingBox); else rp.G.FillEllipse(brush, transportRectangleList[i].BoundingBox); if (config.ExPntLayerDisplayComments) { dispString.Remove(0, dispString.Length); dispString.Append(shape.Commment); if (dispString.Length > 0) { if (dispString.Length > displayCharacterCount) { dispString.Remove(displayCharacterCount, dispString.Length - displayCharacterCount); dispString.Append("..."); } SizeF stringSize = rp.G.MeasureString(dispString.ToString(), CommentFont); shape.StringSize = stringSize; rp.G.DrawString(dispString.ToString(), CommentFont, brush, new Rectangle( transportRectangleList[i].BoundingBox.Right + 2, transportRectangleList[i].BoundingBox.Bottom + 2, (int)stringSize.Width, (int)stringSize.Height)); } } } } } return true; }