private void InternalDrawGeometrys(StreamGeometryContext context, List<Point> listp) { bool first = true; Point pre = new Point(0, 0); foreach (Point ep in listp) { Point p1 = new Point(ep.X - Constants.CALACTION_TRACELEN, ep.Y); Point p2 = new Point(ep.X, ep.Y - Constants.CALACTION_TRACELEN); Point p3 = new Point(ep.X + Constants.CALACTION_TRACELEN, ep.Y); Point p4 = new Point(ep.X, ep.Y + Constants.CALACTION_TRACELEN); //draw cross context.BeginFigure(p1, true, false); context.LineTo(p3, true, true); context.BeginFigure(p2, true, false); context.LineTo(p4, true, true); if (first) { first = false; pre = ep; } else { context.BeginFigure(pre, true, false); context.LineTo(ep, true, true); pre = ep; } } }
private static void DrawArrow(StreamGeometryContext streamGeometryContext, Point[] points, Vector sizeOffset, double thickness) { double headWidth = thickness; double headHeight = thickness * 0.8; Point pt1 = Point.Add(points[points.Length - 2], sizeOffset); Point pt2 = Point.Add(points[points.Length - 1], sizeOffset); double theta = Math.Atan2(pt1.Y - pt2.Y, pt1.X - pt2.X); double sint = Math.Sin(theta); double cost = Math.Cos(theta); Point pt3 = new Point( pt2.X + (headWidth * cost - headHeight * sint), pt2.Y + (headWidth * sint + headHeight * cost)); Point pt4 = new Point( pt2.X + (headWidth * cost + headHeight * sint), pt2.Y - (headHeight * cost - headWidth * sint)); streamGeometryContext.BeginFigure(pt1, true, false); streamGeometryContext.LineTo(pt2, true, true); streamGeometryContext.LineTo(pt3, true, true); streamGeometryContext.LineTo(pt2, true, true); streamGeometryContext.LineTo(pt4, true, true); }
private void CreateArrows(Path path, StreamGeometryContext gc) { double start; if (path.PathType == PathType.Convex) { start = GeometryHelper.GetAngleFromPoint(path.StartPoint, path.Origin); } else { start = GeometryHelper.GetAngleFromPoint(path.EndPoint, path.Origin); } for(int i= 0; i < 10; i++) { start += 8; var org = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius, start); var pt1 = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius + 10, start); var pt2 = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius - 10, start); var pt3 = GeometryHelper.GetPointAtAngle(org, 20, start + 90); gc.BeginFigure(pt1, true, true); gc.LineTo(pt2, true, true); gc.LineTo(pt3, true, true); gc.LineTo(pt1, true, true); gc.BeginFigure(path.Origin, false, false); gc.LineTo(pt1, true, true); } }
public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint) { Vector line = endPoint - startPoint; Vector perpendicularLine = new Vector(line.Y, -line.X); perpendicularLine.Normalize(); double halfLength = line.Length/2; Point leftPoint = startPoint - (perpendicularLine*halfLength); Point rightPoint = startPoint + (perpendicularLine * halfLength); var norLine = new Vector(line.X, line.Y); norLine.Normalize(); Point shortEndPoint = endPoint - (norLine * 4); context.BeginFigure(startPoint, true, false); context.LineTo(shortEndPoint, true, false); context.LineTo(leftPoint, false, false); context.LineTo(shortEndPoint, true, false); context.LineTo(rightPoint, false, false); context.LineTo(shortEndPoint, true, false); context.LineTo(endPoint, true, false); }
/// <summary> /// Draws the primitive geometric components of the wedge. /// </summary> /// <param name="context">The context.</param> public void InternalDrawGeometry(StreamGeometryContext context) { Point startPoint = center; Point innerArcStartPoint = ComputeCartesianCoordinate(rotationAngle, innerRadius); innerArcStartPoint.Offset(center.X, center.Y); Point innerArcEndPoint = ComputeCartesianCoordinate(rotationAngle + sweep, innerRadius); innerArcEndPoint.Offset(center.X, center.Y); Point outerArcStartPoint = ComputeCartesianCoordinate(rotationAngle, /*innerRadius +*/ outerRadius); outerArcStartPoint.Offset(center.X, center.Y); Point outerArcEndPoint = ComputeCartesianCoordinate(rotationAngle + sweep, /*innerRadius +*/ outerRadius); outerArcEndPoint.Offset(center.X, center.Y); bool largeArc = sweep > 180.0; /* Point offset = ComputeCartesianCoordinate(rotationAngle + sweep / 2, PushOut); innerArcStartPoint.Offset(offset.X, offset.Y); innerArcEndPoint.Offset(offset.X, offset.Y); outerArcStartPoint.Offset(offset.X, offset.Y); outerArcEndPoint.Offset(offset.X, offset.Y); */ Size outerArcSize = new Size(/*innerRadius +*/ outerRadius, /*innerRadius +*/ outerRadius); Size innerArcSize = new Size(innerRadius, innerRadius); context.BeginFigure(innerArcStartPoint, true, true); context.LineTo(outerArcStartPoint, true, true); context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArc, SweepDirection.Clockwise, true, true); context.LineTo(innerArcEndPoint, true, true); context.ArcTo(innerArcStartPoint, innerArcSize, 0, largeArc, SweepDirection.Counterclockwise, true, true); }
public override void Draw(StreamGeometryContext context, Connection connection) { if (connection.SourceConnectionPoint == null || connection.TargetConnectionPoint == null) { context.BeginFigure(connection.StartPoint, true, false); context.LineTo(connection.EndPoint, true, true); } else if(connection.Source == connection.Target) { Point startPoint = connection.SourceEndPoint.EndPoint; Point midPoint = connection.SourceConnectionPoint.LineAwayFromThisTo(startPoint, 50); context.BeginFigure(startPoint, true, true); context.ArcTo(midPoint, new Size(50, 50), 180, false, SweepDirection.Clockwise, true, true); context.ArcTo(startPoint, new Size(50, 50), 180, false, SweepDirection.Clockwise, true, true); } else { Point startPoint = connection.SourceEndPoint.EndPoint; Point endPoint = connection.TargetEndPoint.EndPoint; context.BeginFigure(startPoint, true, false); context.LineTo(endPoint, true, true); } }
static void Polygon(StreamGeometryContext ctx, Point point, double size, double startAngle, int steps) { var halfSize = size / 2; var xOffset = halfSize * Math.Sin(startAngle); var yOffset = halfSize * Math.Cos(startAngle); ctx.BeginFigure(new Point(point.X + xOffset, point.Y - yOffset), true, true); for (var angle = startAngle + (MoreMath.TwoPi / steps); angle < MoreMath.TwoPi; angle += MoreMath.TwoPi / steps) ctx.LineTo(new Point(point.X + (halfSize * Math.Sin(angle)), point.Y - (halfSize * Math.Cos(angle))), true, true); }
public void Draw(StreamGeometryContext context, Connection connection) { Point startPoint = connection.SourceEndPoint.EndPoint; Point endPoint = connection.TargetEndPoint.EndPoint; context.BeginFigure(startPoint, true, false); context.LineTo(endPoint, true, true); }
public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint) { Vector mainLine = startPoint.To(endPoint); mainLine.Normalize(); Vector mainPerpendicularLine = DrawingHelper.GetPerpendicularLine(startPoint, endPoint); DrawingHelper.DrawTriangle(context, mainLine, mainPerpendicularLine, startPoint, 10, false); }
///<summary> /// Adds a <see cref="PathFigure"/> representing a polygon ring /// having the given coordinate sequence to the supplied <see cref="StreamGeometryContext"/> ///</summary> ///<param name="sgc">The stream geometry context.</param> ///<param name="coordinates">A coordinate sequence</param> ///<param name="filled">Starting paramter for </param> ///<returns>The path for the coordinate sequence</returns> private static void AddRing(StreamGeometryContext sgc, Coordinate[] coordinates, bool filled) { if (coordinates.Length <= 0) return; sgc.BeginFigure(ToPoint(coordinates[0]), filled, true); if (coordinates.Length > 0) sgc.PolyLineTo(ToPoint(coordinates, 1), true, true); }
public static void DrawTriangle(StreamGeometryContext context, Vector mainLine, Vector mainPerpendicularLine, Point point1, int size, bool isFilled) { int halfSize = size / 2; context.BeginFigure(point1, isFilled, true); var point2 = point1 + (mainPerpendicularLine * halfSize) + (mainLine * size); var point3 = point1 - (mainPerpendicularLine * halfSize) + (mainLine * size); context.LineTo(point2, true, true); context.LineTo(point3, true, true); }
private static void AddCircleToGeometry(StreamGeometryContext streamGeometryContext, Point[] points, double pointSize) { foreach (Point point in points) { streamGeometryContext.BeginFigure(new Point(point.X - (pointSize / 2), point.Y - (pointSize / 2)), true, true); streamGeometryContext.ArcTo(new Point(point.X - (pointSize / 2) - 0.0001, point.Y - (pointSize / 2)), new Size(pointSize, pointSize), 360, true, SweepDirection.Clockwise, true, false); } }
private void InternalDrawGeometry(StreamGeometryContext context) { generateGeometry(); context.BeginFigure(tips[0], true, true); for (int x = 1; x < points.Count(); x++) { context.LineTo(points[x], true, true); } }
static void OpenFigure(StreamGeometryContext ctx, Point point, double size, double startAngle, int steps) { var halfSize = size / 2; for (var angle = startAngle; angle <= Math.PI; angle += Math.PI / steps) { var xOffset = halfSize * Math.Sin(angle); var yOffset = halfSize * Math.Cos(angle); ctx.BeginFigure(new Point(point.X + xOffset, point.Y - yOffset), false, false); ctx.LineTo(new Point(point.X - xOffset, point.Y + yOffset), true, false); } }
public static void DrawParallelLines(StreamGeometryContext context, Point startPoint, Point endPoint, int spacing) { Vector perpendicularLine = GetPerpendicularLine(startPoint, endPoint); // Draw 1->2 line context.BeginFigure(startPoint + (perpendicularLine * spacing), true, false); context.LineTo(endPoint + (perpendicularLine * spacing), true, true); // Draw 2->1 line context.BeginFigure(startPoint - (perpendicularLine * spacing), true, false); context.LineTo(endPoint - (perpendicularLine * spacing), true, true); }
public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint) { var spacing = ReferenceDrawingStrategy.Spacing; DrawingHelper.DrawParallelLines(context, startPoint, endPoint, spacing); Vector mainLine = startPoint.To(endPoint); mainLine.Normalize(); Vector mainPerpendicularLine = DrawingHelper.GetPerpendicularLine(startPoint, endPoint); DrawingHelper.DrawTriangle(context, mainLine, mainPerpendicularLine, startPoint + mainPerpendicularLine*spacing, 4); }
public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint) { base.Draw(context, startPoint, endPoint); Vector line = endPoint - startPoint; Vector perpendicularLine = new Vector(line.Y, -line.X); perpendicularLine.Normalize(); double halfLength = line.Length / 2; Point leftPoint = endPoint - (perpendicularLine * halfLength); Point rightPoint = endPoint + (perpendicularLine * halfLength); context.BeginFigure(leftPoint, true, false); context.LineTo(rightPoint, true, false); }
private static void AddSegmentToGeometry(StreamGeometryContext streamGeometryContext, Point[] points, bool close) { for (int i = 0; i < points.Length; i++) { if (i == 0) { streamGeometryContext.BeginFigure(points[i], true, false); } else { streamGeometryContext.LineTo(points[i], true, true); } } if (close) { streamGeometryContext.LineTo(points[0], true, true); } }
private void InternalDrawArrowGeometry(StreamGeometryContext context) { var theta = Math.Atan2(Y1 - Y2, X1 - X2); var sint = Math.Sin(theta); var cost = Math.Cos(theta); var pt1 = new Point(X1, Y1); var pt2 = new Point(X2, Y2); var pt3 = new Point(X2 + (HeadWidth * cost - HeadHeight * sint), Y2 + (HeadWidth * sint + HeadHeight * cost)); var pt4 = new Point(X2 + (HeadWidth * cost + HeadHeight * sint), Y2 - (HeadHeight * cost - HeadWidth * sint)); context.BeginFigure(pt1, true, false); context.LineTo(pt2, true, true); context.LineTo(pt3, true, true); context.LineTo(pt2, true, true); context.LineTo(pt4, true, true); }
/// <summary> /// The actual method for drawing the arrow. /// </summary> /// <param name="StreamGeometryContext">Describes a geometry using drawing commands.</param> protected override void DrawArrowGeometry(StreamGeometryContext StreamGeometryContext) { var theta = Math.Atan2(Y1 - Y2, X1 - X2); var sint = Math.Sin(theta); var cost = Math.Cos(theta); var ArrowOrigin = new Point(X1, Y1); var ArrowTarget = new Point(X2, Y2); var pt3 = new Point(X2 + (HeadWidth * cost - HeadHeight * sint), Y2 + (HeadWidth * sint + HeadHeight * cost)); var pt4 = new Point(X2 + (HeadWidth * cost + HeadHeight * sint), Y2 - (HeadHeight * cost - HeadWidth * sint)); StreamGeometryContext.BeginFigure(ArrowOrigin, isFilled: true, isClosed: false); StreamGeometryContext.LineTo (ArrowTarget, isStroked: true, isSmoothJoin: true); StreamGeometryContext.LineTo (pt3, isStroked: true, isSmoothJoin: true); StreamGeometryContext.LineTo (ArrowTarget, isStroked: true, isSmoothJoin: true); StreamGeometryContext.LineTo (pt4, isStroked: true, isSmoothJoin: true); }
private void DrawGeometry(StreamGeometryContext context, Point centre, float RotationAngle, float WedgeAngle, float Radius, float InnerRadius) { var innerArcStartPoint = ComputeCartesianCoordinate(RotationAngle, InnerRadius); innerArcStartPoint.Offset(centre.X, centre.Y); var innerArcEndPoint = ComputeCartesianCoordinate(RotationAngle + WedgeAngle, InnerRadius); innerArcEndPoint.Offset(centre.X, centre.Y); var outerArcStartPoint = ComputeCartesianCoordinate(RotationAngle, Radius); outerArcStartPoint.Offset(centre.X, centre.Y); var outerArcEndPoint = ComputeCartesianCoordinate(RotationAngle + WedgeAngle, Radius); outerArcEndPoint.Offset(centre.X, centre.Y); var largeArc = WedgeAngle > 180.0; var outerArcSize = new Size(Radius, Radius); var innerArcSize = new Size(InnerRadius, InnerRadius); context.BeginFigure(innerArcStartPoint, true, true); context.LineTo(outerArcStartPoint, true, true); context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArc, SweepDirection.Clockwise, true, true); context.LineTo(innerArcEndPoint, true, true); context.ArcTo(innerArcStartPoint, innerArcSize, 0, largeArc, SweepDirection.Counterclockwise, true, true); }
/// <summary> /// Draws the pie piece /// </summary> private void DrawGeometry(StreamGeometryContext context) { if (AngleDelta <= 0) { return; } double outerStartAngle = StartAngle; double outerAngleDelta = AngleDelta; double innerStartAngle = StartAngle; double innerAngleDelta = AngleDelta; Point arcCenter = new Point(CenterX, CenterY); Size outerArcSize = new Size(OuterRadius, OuterRadius); Size innerArcSize = new Size(InnerRadius, InnerRadius); // If have to draw a full-circle, draws two semi-circles, because 'ArcTo()' can not draw a full-circle if (AngleDelta >= 360 && Padding <= 0) { Point outerArcTopPoint = ComputeCartesianCoordinate(arcCenter, outerStartAngle, OuterRadius + PushOut); Point outerArcBottomPoint = ComputeCartesianCoordinate(arcCenter, outerStartAngle + 180, OuterRadius + PushOut); Point innerArcTopPoint = ComputeCartesianCoordinate(arcCenter, innerStartAngle, InnerRadius + PushOut); Point innerArcBottomPoint = ComputeCartesianCoordinate(arcCenter, innerStartAngle + 180, InnerRadius + PushOut); context.BeginFigure(innerArcTopPoint, true, true); context.LineTo(outerArcTopPoint, true, true); context.ArcTo(outerArcBottomPoint, outerArcSize, 0, false, SweepDirection.Clockwise, true, true); context.ArcTo(outerArcTopPoint, outerArcSize, 0, false, SweepDirection.Clockwise, true, true); context.LineTo(innerArcTopPoint, true, true); context.ArcTo(innerArcBottomPoint, innerArcSize, 0, false, SweepDirection.Counterclockwise, true, true); context.ArcTo(innerArcTopPoint, innerArcSize, 0, false, SweepDirection.Counterclockwise, true, true); } // Else draws as always else { if (Padding > 0) { // Offsets the angle by the padding double outerAngleVariation = (180 * (Padding / OuterRadius)) / Math.PI; double innerAngleVariation = (180 * (Padding / InnerRadius)) / Math.PI; outerStartAngle += outerAngleVariation; outerAngleDelta -= outerAngleVariation * 2; innerStartAngle += innerAngleVariation; innerAngleDelta -= innerAngleVariation * 2; } Point outerArcStartPoint = ComputeCartesianCoordinate(arcCenter, outerStartAngle, OuterRadius + PushOut); Point outerArcEndPoint = ComputeCartesianCoordinate(arcCenter, outerStartAngle + outerAngleDelta, OuterRadius + PushOut); Point innerArcStartPoint = ComputeCartesianCoordinate(arcCenter, innerStartAngle, InnerRadius + PushOut); Point innerArcEndPoint = ComputeCartesianCoordinate(arcCenter, innerStartAngle + innerAngleDelta, InnerRadius + PushOut); bool largeArcOuter = outerAngleDelta > 180.0; bool largeArcInner = innerAngleDelta > 180.0; context.BeginFigure(innerArcStartPoint, true, true); context.LineTo(outerArcStartPoint, true, true); context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArcOuter, SweepDirection.Clockwise, true, true); context.LineTo(innerArcEndPoint, true, true); context.ArcTo(innerArcStartPoint, innerArcSize, 0, largeArcInner, SweepDirection.Counterclockwise, true, true); } }
/// <summary> /// SerializeData - Serialize the contents of this Segment to the provided context. /// </summary> internal override void SerializeData(StreamGeometryContext ctx) { ctx.LineTo(Point, IsStroked, IsSmoothJoin); }
/// <summary> /// SerializeData - Serialize the contents of this Segment to the provided context. /// </summary> internal override void SerializeData(StreamGeometryContext ctx) { ctx.PolyQuadraticBezierTo(Points, IsStroked, IsSmoothJoin); }
/// <summary> /// SerializeData - Serialize the contents of this Segment to the provided context. /// </summary> internal override void SerializeData(StreamGeometryContext ctx) { ctx.ArcTo(Point, Size, RotationAngle, IsLargeArc, SweepDirection, IsStroked, IsSmoothJoin); }
public void displayRecord() { //Find maximum and minimum for this graphlet, in case needed for scaling double max = double.NegativeInfinity; double min = double.PositiveInfinity; foreach (int channel in channels) { Multigraph.displayChannel dc = mg.displayedChannels.Where(n => n.channel == channel).First(); max = Math.Max(dc.max, max); min = Math.Min(dc.min, min); } //Check to see if new Y-axis and grid needed if(mg.individual) if (mg.useAllYMax) drawYGrid(Math.Max(mg.allChanMax, -mg.allChanMin)); else if (!mg.fixedYMax) //then must be per graphlet max drawYGrid(Math.Max(max,-min)); if (mg.individual) // make sure this is the only one { foreach (Plot pl in plots) gCanvas.Children.Remove(pl.path); plots.Clear(); graphletMax = double.MinValue; graphletMin = double.MaxValue; } foreach (int channel in channels) { Multigraph.displayChannel dc = mg.displayedChannels.Where(n => n.channel == channel).First(); points = new StreamGeometry(); ctx = points.Open(); ctx.BeginFigure(new Point(0, offset - mg.gp.halfMargin - dc.buffer[0] * graphletYScale), false, false); double maxY = 10D * MainWindow.graphletSize; for (int x = 1; x < dc.buffer.GetLength(0); x++) { double y = offset - mg.gp.halfMargin - dc.buffer[x] * graphletYScale; if (y > maxY) y = maxY; //limit size of displayed point else if (y < -maxY) y = -maxY; ctx.LineTo(new Point((double)x * graphletXScale, y), true, true); } ctx.Close(); points.Freeze(); Path p = new Path(); p.Stroke = channel == mg.highlightedChannel ? Brushes.Red : Brushes.Black; p.StrokeThickness = channel == mg.highlightedChannel ? strokeThickness * 2D : strokeThickness; p.StrokeLineJoin = PenLineJoin.Round; p.SnapsToDevicePixels = false; //use anti-aliasing p.Data = points; gCanvas.Children.Add(p); //draw the plot onto graphlet Plot pl = new Plot(); pl.path = p; pl.channel = channel; pl.recNumber = mg.RecSet; pl.max = max; graphletMax = Math.Max(graphletMax, max); //for superimposed records pl.min = min; graphletMin = Math.Min(graphletMin, min); pl.gvList = mg.gvList; plots.Add(pl); } }
/// <summary> /// Draws the pie piece /// </summary> private void DrawGeometry(StreamGeometryContext context) { Point startPoint = new Point(CentreX, CentreY); Point innerArcStartPoint = Utils.ComputeCartesianCoordinate(RotationAngle, InnerRadius); innerArcStartPoint.Offset(CentreX, CentreY); Point innerArcEndPoint = Utils.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, InnerRadius); innerArcEndPoint.Offset(CentreX, CentreY); Point outerArcStartPoint = Utils.ComputeCartesianCoordinate(RotationAngle, Radius); outerArcStartPoint.Offset(CentreX, CentreY); Point outerArcEndPoint = Utils.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, Radius); outerArcEndPoint.Offset(CentreX, CentreY); bool largeArc = WedgeAngle>180.0; if (PushOut > 0) { Point offset = Utils.ComputeCartesianCoordinate(RotationAngle + WedgeAngle / 2, PushOut); innerArcStartPoint.Offset(offset.X, offset.Y); innerArcEndPoint.Offset(offset.X, offset.Y); outerArcStartPoint.Offset(offset.X, offset.Y); outerArcEndPoint.Offset(offset.X, offset.Y); } Size outerArcSize = new Size(Radius, Radius); Size innerArcSize = new Size(InnerRadius, InnerRadius); Size endingsArcSize = new Size(5, 5); context.BeginFigure(innerArcStartPoint, true, true); // Use LineTo to draw a flat endings //context.LineTo(outerArcStartPoint, true, true); context.ArcTo(outerArcStartPoint, endingsArcSize, 0, false, SweepDirection.Counterclockwise, true, true); context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArc, SweepDirection.Clockwise, true, true); //context.LineTo(innerArcEndPoint, true, true); context.ArcTo(innerArcEndPoint, endingsArcSize, 0, false, SweepDirection.Counterclockwise, true, true); context.ArcTo(innerArcStartPoint, innerArcSize, 0, largeArc, SweepDirection.Counterclockwise, true, true); }
/// <summary> /// Parse a PathFigureCollection string /// </summary> internal void ParseToGeometryContext( StreamGeometryContext context, string pathString, int startIndex) { // [BreakingChange] Dev10 Bug #453199 // We really should throw an ArgumentNullException here for context and pathString. // From original code // This is only used in call to Double.Parse _formatProvider = System.Globalization.CultureInfo.InvariantCulture; _context = context; _pathString = pathString; _pathLength = pathString.Length; _curIndex = startIndex; _secondLastPoint = new Point(0, 0); _lastPoint = new Point(0, 0); _lastStart = new Point(0, 0); _figureStarted = false; bool first = true; char last_cmd = ' '; while (ReadToken()) // Empty path is allowed in XAML { char cmd = _token; if (first) { if ((cmd != 'M') && (cmd != 'm')) // Path starts with M|m { ThrowBadToken(); } first = false; } switch (cmd) { case 'm': case 'M': // XAML allows multiple points after M/m _lastPoint = ReadPoint(cmd, ! AllowComma); context.BeginFigure(_lastPoint, IsFilled, ! IsClosed); _figureStarted = true; _lastStart = _lastPoint; last_cmd = 'M'; while (IsNumber(AllowComma)) { _lastPoint = ReadPoint(cmd, ! AllowComma); context.LineTo(_lastPoint, IsStroked, ! IsSmoothJoin); last_cmd = 'L'; } break; case 'l': case 'L': case 'h': case 'H': case 'v': case 'V': EnsureFigure(); do { switch (cmd) { case 'l': _lastPoint = ReadPoint(cmd, ! AllowComma); break; case 'L': _lastPoint = ReadPoint(cmd, ! AllowComma); break; case 'h': _lastPoint.X += ReadNumber(! AllowComma); break; case 'H': _lastPoint.X = ReadNumber(! AllowComma); break; case 'v': _lastPoint.Y += ReadNumber(! AllowComma); break; case 'V': _lastPoint.Y = ReadNumber(! AllowComma); break; } context.LineTo(_lastPoint, IsStroked, ! IsSmoothJoin); } while (IsNumber(AllowComma)); last_cmd = 'L'; break; case 'c': case 'C': // cubic Bezier case 's': case 'S': // smooth cublic Bezier EnsureFigure(); do { Point p; if ((cmd == 's') || (cmd == 'S')) { if (last_cmd == 'C') { p = Reflect(); } else { p = _lastPoint; } _secondLastPoint = ReadPoint(cmd, ! AllowComma); } else { p = ReadPoint(cmd, ! AllowComma); _secondLastPoint = ReadPoint(cmd, AllowComma); } _lastPoint = ReadPoint(cmd, AllowComma); context.BezierTo(p, _secondLastPoint, _lastPoint, IsStroked, ! IsSmoothJoin); last_cmd = 'C'; } while (IsNumber(AllowComma)); break; case 'q': case 'Q': // quadratic Bezier case 't': case 'T': // smooth quadratic Bezier EnsureFigure(); do { if ((cmd == 't') || (cmd == 'T')) { if (last_cmd == 'Q') { _secondLastPoint = Reflect(); } else { _secondLastPoint = _lastPoint; } _lastPoint = ReadPoint(cmd, ! AllowComma); } else { _secondLastPoint = ReadPoint(cmd, ! AllowComma); _lastPoint = ReadPoint(cmd, AllowComma); } context.QuadraticBezierTo(_secondLastPoint, _lastPoint, IsStroked, ! IsSmoothJoin); last_cmd = 'Q'; } while (IsNumber(AllowComma)); break; case 'a': case 'A': EnsureFigure(); do { // A 3,4 5, 0, 0, 6,7 double w = ReadNumber(! AllowComma); double h = ReadNumber(AllowComma); double rotation = ReadNumber(AllowComma); bool large = ReadBool(); bool sweep = ReadBool(); _lastPoint = ReadPoint(cmd, AllowComma); context.ArcTo( _lastPoint, new Size(w, h), rotation, large, #if PBTCOMPILER sweep, #else sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise, #endif IsStroked, ! IsSmoothJoin ); } while (IsNumber(AllowComma)); last_cmd = 'A'; break; case 'z': case 'Z': EnsureFigure(); context.SetClosedState(IsClosed); _figureStarted = false; last_cmd = 'Z'; _lastPoint = _lastStart; // Set reference point to be first point of current figure break; default: ThrowBadToken(); break; } } }
private void method18(StreamGeometryContext streamGeometryContext) { Point point = new Point(method10(), method12()); Point point2 = Utils.ComputeCartesianCoordinate(method8(), method4()); point2.Offset(method10(), method12()); Point point3 = Utils.ComputeCartesianCoordinate(method8() + method6(), method4()); point3.Offset(method10(), method12()); Point point4 = Utils.ComputeCartesianCoordinate(method8(), method0()); point4.Offset(method10(), method12()); Point point5 = Utils.ComputeCartesianCoordinate(method8() + method6(), method0()); point5.Offset(method10(), method12()); bool isLargeArc = method6() > 180.0; if (method2() > 0.0) { Point point6 = Utils.ComputeCartesianCoordinate(method8() + method6() / 2.0, method2()); point2.Offset(point6.X, point6.Y); point3.Offset(point6.X, point6.Y); point4.Offset(point6.X, point6.Y); point5.Offset(point6.X, point6.Y); } Size size = new Size(method0(), method0()); Size size2 = new Size(method4(), method4()); streamGeometryContext.BeginFigure(point2, true, true); streamGeometryContext.LineTo(point4, true, true); streamGeometryContext.ArcTo(point5, size, 0.0, isLargeArc, SweepDirection.Clockwise, true, true); streamGeometryContext.LineTo(point3, true, true); streamGeometryContext.ArcTo(point2, size2, 0.0, isLargeArc, SweepDirection.Counterclockwise, true, true); }
/// <summary> /// SerializeData - Serialize the contents of this Segment to the provided context. /// </summary> internal abstract void SerializeData(StreamGeometryContext ctx);
/// <summary> /// SerializeData - Serialize the contents of this Segment to the provided context. /// </summary> internal override void SerializeData(StreamGeometryContext ctx) { ctx.BezierTo(Point1, Point2, Point3, IsStroked, IsSmoothJoin); }
/// <summary> /// The actual method for drawing the arrow. /// </summary> /// <param name="StreamGeometryContext">Describes a geometry using drawing commands.</param> protected abstract void DrawArrowGeometry(StreamGeometryContext StreamGeometryContext);