本文整理汇总了C#中System.Windows.Media.StreamGeometryContext类的典型用法代码示例。如果您正苦于以下问题:C# StreamGeometryContext类的具体用法?C# StreamGeometryContext怎么用?C# StreamGeometryContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamGeometryContext类属于System.Windows.Media命名空间,在下文中一共展示了StreamGeometryContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InternalDrawGeometrys
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;
}
}
}
开发者ID:chijianfeng,项目名称:PNManager,代码行数:31,代码来源:BaseAction.cs
示例2: CreateArrows
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);
}
}
开发者ID:curtmantle,项目名称:Geometry,代码行数:31,代码来源:PathElementsVisual.cs
示例3: Draw
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:25,代码来源:ManyConnectorEndPoint.cs
示例4: InternalDrawGeometry
/// <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);
}
开发者ID:wshanshan,项目名称:DDD,代码行数:39,代码来源:Wedge.cs
示例5: DrawArrow
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);
}
开发者ID:YashMaster,项目名称:GestureSign,代码行数:26,代码来源:GestureImage.cs
示例6: Draw
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);
}
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:25,代码来源:IConnectionDrawingStrategy.cs
示例7: Polygon
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);
}
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:8,代码来源:SeriesMarkerType.cs
示例8: Draw
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:8,代码来源:InheritanceCardinalityConverter.cs
示例9: Draw
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:8,代码来源:InheritanceDrawingStrategy.cs
示例10: DrawTriangle
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:9,代码来源:DrawingHelper.cs
示例11: AddRing
///<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);
}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:17,代码来源:PolygonWpfStreamGeometry.cs
示例12: AddCircleToGeometry
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);
}
}
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:9,代码来源:SqlGeometryHelper.cs
示例13: InternalDrawGeometry
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);
}
}
开发者ID:wshanshan,项目名称:DDD,代码行数:10,代码来源:Star.cs
示例14: OpenFigure
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);
}
}
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:11,代码来源:SeriesMarkerType.cs
示例15: DrawParallelLines
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:12,代码来源:DrawingHelper.cs
示例16: Draw
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:12,代码来源:ReferenceCardinalityConverter.cs
示例17: Draw
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);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:15,代码来源:IConnectorEndPointDrawingStrategy.cs
示例18: AddSegmentToGeometry
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);
}
}
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:18,代码来源:SqlGeometryHelper.cs
示例19: InternalDrawArrowGeometry
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);
}
开发者ID:christopher7694,项目名称:Hearthstone-Deck-Tracker,代码行数:19,代码来源:Arrow.cs
示例20: DrawArrowGeometry
/// <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);
}
开发者ID:subbuballa,项目名称:Loki,代码行数:25,代码来源:Arrow.cs
注:本文中的System.Windows.Media.StreamGeometryContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论