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 OnMouseDown(int x, int y, System.Windows.Forms.MouseEventArgs e) { RgPoint P1 = mScreenDisplay.DisplayTransformation.ToUnit(new System.Drawing.PointF(x, y)); Graphics g = Graphics.FromHwnd(mMapCtrl.Handle); mScreenDisplay.StartDrawing(g, 1); IScreenDisplayDraw mScreenDisplayDraw = mScreenDisplay as IScreenDisplayDraw; mScreenDisplayDraw.DrawPoint(P1, new System.Drawing.Pen(System.Drawing.Color.Yellow), new System.Drawing.SolidBrush(System.Drawing.Color.Yellow)); mScreenDisplay.FinishDrawing(); g.Dispose(); if (PickUpFinishedEventHandler != null) { PickUpFinishedEventHandler(P1); } //mMapCtrl.Refresh(); mPickedPoint = P1; }
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); } } } } }