protected override void OnPaint(PaintEventArgs e) { e.Graphics.SmoothingMode = m_smoothingMode; if (mScreenDisplay.IsCacheDirty) { mScreenDisplay.StartRecording(); mScreenDisplay.StartDrawing(e.Graphics, 0); mMap.Draw(mScreenDisplay); object newObj = mScreenDisplay.NewObject; if (newObj != null) { IScreenDisplayDraw drawNew = mScreenDisplay as IScreenDisplayDraw; if (newObj is LineString) { Pen mpen = new Pen(Color.Blue); drawNew.DrawLineString(newObj as LineString, mpen); } else if (newObj is MultiLineString) { Pen mpen = new Pen(Color.Blue); drawNew.DrawMultiLineString(newObj as MultiLineString, mpen); } else if (newObj is Polygon) { Brush brush = new SolidBrush(Color.Blue); drawNew.DrawPolygon(newObj as Polygon, brush, Pens.AliceBlue, false); } } mScreenDisplay.FinishDrawing(); mScreenDisplay.StopRecording(); } }
public override void Draw(IScreenDisplay display) { IScreenDisplayDraw displayDraw = display as IScreenDisplayDraw; if (ShapeType == RgEnumShapeType.RgPoint) { for (int i = 0; i < mGeometries.Count; i++) { RGeos.Geometries.Point pt = mGeometries[i] as RGeos.Geometries.Point; if (pt != null) { displayDraw.DrawPoint(pt, new Pen(Color.Red)); } } } if (ShapeType == RgEnumShapeType.RgLineString) { for (int i = 0; i < mGeometries.Count; i++) { LineString pt = mGeometries[i] as LineString; if (pt != null) { displayDraw.DrawLineString(pt, new Pen(Color.Red)); // display as r } } } if (ShapeType == RgEnumShapeType.RgMultiLineString) { for (int i = 0; i < mGeometries.Count; i++) { MultiLineString pt = mGeometries[i] as MultiLineString; if (pt != null) { displayDraw.DrawMultiLineString(pt, new Pen(Color.Red)); } } } if (ShapeType == RgEnumShapeType.RgPolygon) { for (int i = 0; i < mGeometries.Count; i++) { Polygon pt = mGeometries[i] as Polygon; if (pt != null) { Pen mPen = new Pen(Color.Red); Brush brush = new SolidBrush(Color.Blue); displayDraw.DrawPolygon(pt, brush, mPen, false); } } } }
public override void Draw(IScreenDisplay display) { IScreenDisplayDraw displayDraw = display as IScreenDisplayDraw; if (ShapeType == RgEnumShapeType.RgPoint) { for (int i = 0; i < mGeometries.Count; i++) { Feature feat = mGeometries[i]; RGeos.Geometries.RgPoint pt = feat.Shape as RGeos.Geometries.RgPoint; if (pt != null) { if (feat.IsSelected == false) { displayDraw.DrawPoint(pt, new Pen(Color.Red), new SolidBrush(Color.Red)); } else { displayDraw.DrawPoint(pt, new Pen(Color.LightBlue), new SolidBrush(Color.LightBlue)); } } } } if (ShapeType == RgEnumShapeType.RgLineString) { for (int i = 0; i < mGeometries.Count; i++) { Feature feat = mGeometries[i]; LineString pt = feat.Shape as LineString; if (pt != null) { if (feat.IsSelected == false) { displayDraw.DrawLineString(pt, new Pen(Color.Red)); } else { displayDraw.DrawLineString(pt, new Pen(Color.LightBlue)); } // display as r } } } if (ShapeType == RgEnumShapeType.RgMultiLineString) { for (int i = 0; i < mGeometries.Count; i++) { Feature feat = mGeometries[i]; MultiLineString pt = feat.Shape as MultiLineString; if (pt != null) { if (feat.IsSelected == false) { displayDraw.DrawMultiLineString(pt, new Pen(Color.Red)); } else { displayDraw.DrawMultiLineString(pt, new Pen(Color.LightBlue)); } } } } if (ShapeType == RgEnumShapeType.RgPolygon) { for (int i = 0; i < mGeometries.Count; i++) { Feature feat = mGeometries[i]; Polygon polygon = feat.Shape as Polygon; if (polygon != null) { Pen mPen = new Pen(Color.Red); Brush brush = new SolidBrush(Color.Blue); if (feat.IsSelected == false) { displayDraw.DrawPolygon(polygon, brush, mPen, false); } else { displayDraw.DrawPolygon(polygon, brush, new Pen(Color.LightBlue), false); } } } } }