public void Draw(object domainObj, MapRendererContext context) { var xyzObject = domainObj as XYZObject; // if (xyzObject == null) { return; } // using (var brush = new SolidBrush(Color.Aqua)) { var x = xyzObject.X - xyzObject.Radius; var y = xyzObject.Y - xyzObject.Radius; var width = 2 * xyzObject.Radius; var height = 2 * xyzObject.Radius; // // draw the circle context.World.FillEllipse(brush, x, y, width, height); // // anonotate the drawn circle with the name of the object. // place the annotation at the end of the segment var bottomRightCorner = new Point2( xyzObject.X + xyzObject.Radius, xyzObject.Y - xyzObject.Radius); Point2 annotationPoint = bottomRightCorner; // draw the annotation using the paper graphics context.Paper.DrawString( xyzObject.Name, SystemFonts.DefaultFont, brush, context.WorldToPaper(annotationPoint)); } }
public Box2 GetBounds(object o, MapRendererContext ctx) { CustomVectorField VF = (CustomVectorField)o; Point2 begin = new Point2(VF.originX, VF.originY); Point2 end = new Point2(VF.originX + VF.gridStep * VF.sizeX, VF.originY + VF.gridStep * VF.sizeY); // Return a box that describes the area the object occupies return(new Box2(begin, end)); }
public void Dispose(object domainObj, MapRendererContext context) { var xyzObject = domainObj as XYZObject; if (xyzObject != null) { var propertyChangedEventHandler = context.UserContext as PropertyChangedEventHandler; // // unsubscribe the change handler xyzObject.PropertyChanged -= propertyChangedEventHandler; } }
public Box2 GetBounds(object domainObj, MapRendererContext context) { var xyzObject = domainObj as XYZObject; // if (xyzObject == null) { return(Box2.Null); } // var topLeftCorner = new Point2(xyzObject.X - xyzObject.Radius, xyzObject.Y - xyzObject.Radius); var bottomRightCorner = new Point2(xyzObject.X + xyzObject.Radius, xyzObject.Y + xyzObject.Radius); // return(new Box2(topLeftCorner, bottomRightCorner)); }
public void Initialize(object domainObj, MapRendererContext context) { // configure rendering layer context.RenderingLayers = RenderingLayers.Solid; // var xyzObject = domainObj as XYZObject; if (xyzObject != null) { // create the property changed handler PropertyChangedEventHandler xyzObjectChangedHandler = (sender, args) => { context.Window.Invalidate(xyzObject); }; // // register the change handler xyzObject.PropertyChanged += xyzObjectChangedHandler; // // set the change handler as the context context.UserContext = xyzObjectChangedHandler; } }
public void GetPickInfo(object domainObj, MapPickedPoint point, MapRendererContext context) { var xyzObject = domainObj as XYZObject; // if (xyzObject == null) { return; } // var circleCenter = new Point2(xyzObject.X, xyzObject.Y); var pickedPoint = new Point2(point.Ray.Origin.X, point.Ray.Origin.Y); // Segment2 fromPickedPointToCircleCenter = new Segment2(circleCenter, pickedPoint); // // if the segment length is smaller than the radius then we assume that the object is selected if (fromPickedPointToCircleCenter.Length <= xyzObject.Radius) { point.PickString = new[] { "Picked XYZ" }; point.IsHit = true; } }
public bool CanDraw(object o, MapRendererContext ctx) { CustomVectorField cvf = o as CustomVectorField; return(!(cvf.VectorField == null)); }
public void Initialize(object o, MapRendererContext ctx) { ctx.RenderingLayers = RenderingLayers.Solid; }
public void Dispose(object o, MapRendererContext ctx) { return; }
public void Draw(object o, MapRendererContext ctx) { // Get the World coordinates Graphics gworld = ctx.World; using (Pen pn = new Pen(Color.Black)) { CustomVectorField VF = (CustomVectorField)o; double[, ,] field = VF.VectorField; float originX = (float)VF.originX; float originY = (float)VF.originY; float increment = (float)VF.gridStep; int sizeX = VF.sizeX; int sizeY = VF.sizeY; Pen pn1 = new Pen(VF.arrowColor); AdjustableArrowCap bigArrow = new AdjustableArrowCap(5, 7); Pen pn2 = new Pen(VF.arrowColor); pn2.CustomEndCap = bigArrow; Font drawFont = new Font("Arial", 16); SolidBrush drawBrush = new SolidBrush(VF.arrowColor); for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { if (field[i, j, 0] > 0.005) { if (VF.haveGrid) { gworld.DrawRectangle(pn, originX + (float)i * increment, originY + (float)j * increment, increment, increment); } gworld.DrawLine(pn1, (float)field[i, j, 2], (float)field[i, j, 3], (float)field[i, j, 4], (float)field[i, j, 5]); PointF point1 = new PointF((float)field[i, j, 4], (float)field[i, j, 5]); PointF point2 = new PointF((float)field[i, j, 6], (float)field[i, j, 7]); PointF point3 = new PointF((float)field[i, j, 12], (float)field[i, j, 13]); PointF point4 = new PointF((float)field[i, j, 16], (float)field[i, j, 17]); PointF point5 = new PointF((float)field[i, j, 14], (float)field[i, j, 15]); PointF point6 = new PointF((float)field[i, j, 10], (float)field[i, j, 11]); PointF point7 = new PointF((float)field[i, j, 8], (float)field[i, j, 9]); PointF[] curvePoints = { point1, point2, point3, point4, point5, point6, point7 }; gworld.FillPolygon(drawBrush, curvePoints); //gworld.DrawLine(pn1, (float)field[i, j, 4], (float)field[i, j, 5], (float)field[i, j, 6], (float)field[i, j, 7]); //gworld.DrawLine(pn1, (float)field[i, j, 4], (float)field[i, j, 5], (float)field[i, j, 8], (float)field[i, j, 9]); //PointF[] f = new PointF [4]; //for (int rrr = 0; rrr < 4 ; i++){ /* f[0].X = (int)field[i, j, 6]; * f[0].Y = (int)field[i, j, 7]; * f[1].X = (int)field[i, j, 4]; * f[1].Y = (int)field[i, j, 5]; * f[2].X = (int)field[i, j, 8]; * f[2].Y = (int)field[i, j, 9]; * f[3].X = (int)field[i, j, 10]; * f[3].Y = (int)field[i, j, 11]; * gworld.DrawPolygon(pn1, f);*/ //} //gworld.FillPolygon(drawBrush, f); } } } } }
public bool CanDraw(object domainObj, MapRendererContext context) { return(domainObj is XYZObject); }
public Box2 GetBounds( object o, MapRendererContext ctx ) { CustomVectorField VF = (CustomVectorField)o; Point2 begin = new Point2(VF.originX, VF.originY); Point2 end = new Point2(VF.originX + VF.gridStep * VF.sizeX, VF.originY + VF.gridStep * VF.sizeY); // Return a box that describes the area the object occupies return new Box2( begin, end ); }
public void Draw( object o, MapRendererContext ctx ) { // Get the World coordinates Graphics gworld = ctx.World; using (Pen pn = new Pen(Color.Black)) { CustomVectorField VF = (CustomVectorField)o; double[, ,] field = VF.VectorField; float originX = (float)VF.originX; float originY = (float)VF.originY; float increment = (float)VF.gridStep; int sizeX = VF.sizeX; int sizeY = VF.sizeY; Pen pn1 = new Pen(VF.arrowColor); AdjustableArrowCap bigArrow = new AdjustableArrowCap(5, 7); Pen pn2 = new Pen(VF.arrowColor); pn2.CustomEndCap = bigArrow; Font drawFont = new Font("Arial", 16); SolidBrush drawBrush = new SolidBrush(VF.arrowColor); for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { if (field[i, j, 0] > 0.005) { if (VF.haveGrid) { gworld.DrawRectangle(pn, originX + (float)i * increment, originY + (float)j * increment, increment, increment); } gworld.DrawLine(pn1, (float)field[i, j, 2], (float)field[i, j, 3], (float)field[i, j, 4], (float)field[i, j, 5]); PointF point1 = new PointF((float)field[i, j, 4], (float)field[i, j, 5]); PointF point2 = new PointF((float)field[i, j, 6], (float)field[i, j, 7]); PointF point3 = new PointF((float)field[i, j, 12], (float)field[i, j, 13]); PointF point4 = new PointF((float)field[i, j, 16], (float)field[i, j, 17]); PointF point5 = new PointF((float)field[i, j, 14], (float)field[i, j, 15]); PointF point6 = new PointF((float)field[i, j, 10], (float)field[i, j, 11]); PointF point7 = new PointF((float)field[i, j, 8], (float)field[i, j, 9]); PointF[] curvePoints = { point1, point2, point3, point4, point5, point6, point7 }; gworld.FillPolygon(drawBrush, curvePoints); //gworld.DrawLine(pn1, (float)field[i, j, 4], (float)field[i, j, 5], (float)field[i, j, 6], (float)field[i, j, 7]); //gworld.DrawLine(pn1, (float)field[i, j, 4], (float)field[i, j, 5], (float)field[i, j, 8], (float)field[i, j, 9]); //PointF[] f = new PointF [4]; //for (int rrr = 0; rrr < 4 ; i++){ /* f[0].X = (int)field[i, j, 6]; f[0].Y = (int)field[i, j, 7]; f[1].X = (int)field[i, j, 4]; f[1].Y = (int)field[i, j, 5]; f[2].X = (int)field[i, j, 8]; f[2].Y = (int)field[i, j, 9]; f[3].X = (int)field[i, j, 10]; f[3].Y = (int)field[i, j, 11]; gworld.DrawPolygon(pn1, f);*/ //} //gworld.FillPolygon(drawBrush, f); } } } } }
public bool CanDraw(object o, MapRendererContext ctx) { CustomVectorField cvf = o as CustomVectorField; return !(cvf.VectorField == null); }