本文整理汇总了C#中IRenderContext.DrawClippedPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderContext.DrawClippedPolygon方法的具体用法?C# IRenderContext.DrawClippedPolygon怎么用?C# IRenderContext.DrawClippedPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderContext
的用法示例。
在下文中一共展示了IRenderContext.DrawClippedPolygon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
/// <summary>
/// Renders the polygon annotation.
/// </summary>
/// <param name="rc">The render context.</param>
/// <param name="model">The plot model.</param>
public override void Render(IRenderContext rc, PlotModel model)
{
base.Render(rc, model);
if (this.Points == null)
{
return;
}
// transform to screen coordinates
this.screenPoints = this.Points.Select(this.Transform).ToList();
if (this.screenPoints.Count == 0)
{
return;
}
// clip to the area defined by the axes
var clippingRectangle = this.GetClippingRect();
const double MinimumSegmentLength = 4;
rc.DrawClippedPolygon(
clippingRectangle,
this.screenPoints,
MinimumSegmentLength * MinimumSegmentLength,
this.GetSelectableFillColor(this.Fill),
this.GetSelectableColor(this.Stroke),
this.StrokeThickness,
this.LineStyle,
this.LineJoin);
if (!string.IsNullOrEmpty(this.Text))
{
var textPosition = this.GetActualTextPosition(() => ScreenPointHelper.GetCentroid(this.screenPoints));
rc.DrawClippedText(
clippingRectangle,
textPosition,
this.Text,
this.ActualTextColor,
this.ActualFont,
this.ActualFontSize,
this.ActualFontWeight,
this.TextRotation,
this.TextHorizontalAlignment,
this.TextVerticalAlignment);
}
}
示例2: Render
/// <summary>
/// Renders the text annotation.
/// </summary>
/// <param name="rc">
/// The render context.
/// </param>
/// <param name="model">
/// The plot model.
/// </param>
public override void Render(IRenderContext rc, PlotModel model)
{
base.Render(rc, model);
var position = this.Transform(this.Position);
position.X += this.Offset.X;
position.Y += this.Offset.Y;
var clippingRect = this.GetClippingRect();
var textSize = rc.MeasureText(this.Text, this.ActualFont, this.ActualFontSize, this.ActualFontWeight);
const double MinDistSquared = 4;
this.actualBounds = GetTextBounds(
position, textSize, this.Padding, this.Rotation, this.HorizontalAlignment, this.VerticalAlignment);
rc.DrawClippedPolygon(
this.actualBounds, clippingRect, MinDistSquared, this.Background, this.Stroke, this.StrokeThickness);
rc.DrawClippedText(
clippingRect,
position,
this.Text,
this.GetSelectableFillColor(this.ActualTextColor),
this.ActualFont,
this.ActualFontSize,
this.ActualFontWeight,
this.Rotation,
this.HorizontalAlignment,
this.VerticalAlignment);
}
示例3: Render
/// <summary>
/// Renders the series on the specified rendering context.
/// </summary>
/// <param name="rc">The rendering context.</param>
public override void Render(IRenderContext rc)
{
var actualPoints = this.ActualPoints;
var actualPoints2 = this.ActualPoints2;
int n0 = actualPoints.Count;
if (n0 == 0)
{
return;
}
this.VerifyAxes();
double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;
var clippingRect = this.GetClippingRect();
rc.SetClip(clippingRect);
// Transform all points to screen coordinates
IList<ScreenPoint> pts0 = new ScreenPoint[n0];
for (int i = 0; i < n0; i++)
{
pts0[i] = this.XAxis.Transform(actualPoints[i].X, actualPoints[i].Y, this.YAxis);
}
int n1 = actualPoints2.Count;
IList<ScreenPoint> pts1 = new ScreenPoint[n1];
for (int i = 0; i < n1; i++)
{
int j = this.Reverse2 ? n1 - 1 - i : i;
pts1[j] = this.XAxis.Transform(actualPoints2[i].X, actualPoints2[i].Y, this.YAxis);
}
if (this.Smooth)
{
var rpts0 = ScreenPointHelper.ResamplePoints(pts0, this.MinimumSegmentLength);
var rpts1 = ScreenPointHelper.ResamplePoints(pts1, this.MinimumSegmentLength);
pts0 = CanonicalSplineHelper.CreateSpline(rpts0, 0.5, null, false, 0.25);
pts1 = CanonicalSplineHelper.CreateSpline(rpts1, 0.5, null, false, 0.25);
}
var dashArray = this.ActualDashArray;
// draw the clipped lines
rc.DrawClippedLine(
clippingRect,
pts0,
minDistSquared,
this.GetSelectableColor(this.ActualColor),
this.StrokeThickness,
dashArray,
this.LineJoin,
false);
rc.DrawClippedLine(
clippingRect,
pts1,
minDistSquared,
this.GetSelectableColor(this.ActualColor2),
this.StrokeThickness,
dashArray,
this.LineJoin,
false);
// combine the two lines and draw the clipped area
var pts = new List<ScreenPoint>();
pts.AddRange(pts1);
pts.AddRange(pts0);
// pts = SutherlandHodgmanClipping.ClipPolygon(clippingRect, pts);
rc.DrawClippedPolygon(clippingRect, pts, minDistSquared, this.GetSelectableFillColor(this.ActualFill), OxyColors.Undefined);
var markerSizes = new[] { this.MarkerSize };
// draw the markers on top
rc.DrawMarkers(
clippingRect,
pts0,
this.MarkerType,
null,
markerSizes,
this.MarkerFill,
this.MarkerStroke,
this.MarkerStrokeThickness,
1);
rc.DrawMarkers(
clippingRect,
pts1,
this.MarkerType,
null,
markerSizes,
this.MarkerFill,
this.MarkerStroke,
this.MarkerStrokeThickness,
1);
rc.ResetClip();
//.........这里部分代码省略.........
示例4: Render
/// <summary>
/// Renders the series on the specified rendering context.
/// </summary>
/// <param name="rc">The rendering context.</param>
/// <param name="model">The owner plot model.</param>
public override void Render(IRenderContext rc, PlotModel model)
{
if (this.Points.Count == 0)
{
return;
}
base.VerifyAxes();
double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;
var clippingRect = this.GetClippingRect();
// Transform all points to screen coordinates
var points = this.Points;
int n0 = points.Count;
IList<ScreenPoint> pts0 = new ScreenPoint[n0];
for (int i = 0; i < n0; i++)
{
pts0[i] = this.XAxis.Transform(points[i].X, points[i].Y, this.YAxis);
}
int n1 = this.points2.Count;
IList<ScreenPoint> pts1 = new ScreenPoint[n1];
for (int i = 0; i < n1; i++)
{
int j = this.Reverse2 ? n1 - 1 - i : i;
pts1[j] = this.XAxis.Transform(this.points2[i].X, this.points2[i].Y, this.YAxis);
}
if (this.Smooth)
{
var rpts0 = ScreenPointHelper.ResamplePoints(pts0, this.MinimumSegmentLength);
var rpts1 = ScreenPointHelper.ResamplePoints(pts1, this.MinimumSegmentLength);
pts0 = CanonicalSplineHelper.CreateSpline(rpts0, 0.5, null, false, 0.25);
pts1 = CanonicalSplineHelper.CreateSpline(rpts1, 0.5, null, false, 0.25);
}
// draw the clipped lines
rc.DrawClippedLine(
pts0,
clippingRect,
minDistSquared,
this.GetSelectableColor(this.ActualColor),
this.StrokeThickness,
this.ActualLineStyle,
this.LineJoin,
false);
rc.DrawClippedLine(
pts1,
clippingRect,
minDistSquared,
this.GetSelectableColor(this.ActualColor),
this.StrokeThickness,
this.ActualLineStyle,
this.LineJoin,
false);
// combine the two lines and draw the clipped area
var pts = new List<ScreenPoint>();
pts.AddRange(pts1);
pts.AddRange(pts0);
// pts = SutherlandHodgmanClipping.ClipPolygon(clippingRect, pts);
rc.DrawClippedPolygon(pts, clippingRect, minDistSquared, this.GetSelectableFillColor(this.Fill), null);
// draw the markers on top
rc.DrawMarkers(
pts0,
clippingRect,
this.MarkerType,
null,
new[] { this.MarkerSize },
this.MarkerFill,
this.MarkerStroke,
this.MarkerStrokeThickness,
1);
rc.DrawMarkers(
pts1,
clippingRect,
this.MarkerType,
null,
new[] { this.MarkerSize },
this.MarkerFill,
this.MarkerStroke,
this.MarkerStrokeThickness,
1);
}
示例5: Render
/// <summary>
/// Renders the arrow annotation.
/// </summary>
/// <param name="rc">
/// The render context.
/// </param>
/// <param name="model">
/// The plot model.
/// </param>
public override void Render(IRenderContext rc, PlotModel model)
{
base.Render(rc, model);
this.screenEndPoint = this.Transform(this.EndPoint);
if (!this.ArrowDirection.x.IsZero() || !this.ArrowDirection.y.IsZero())
{
this.screenStartPoint = this.screenEndPoint - this.ArrowDirection;
}
else
{
this.screenStartPoint = this.Transform(this.StartPoint);
}
var d = this.screenEndPoint - this.screenStartPoint;
d.Normalize();
var n = new ScreenVector(d.Y, -d.X);
var p1 = this.screenEndPoint - (d * this.HeadLength * this.StrokeThickness);
var p2 = p1 + (n * this.HeadWidth * this.StrokeThickness);
var p3 = p1 - (n * this.HeadWidth * this.StrokeThickness);
var p4 = p1 + (d * this.Veeness * this.StrokeThickness);
OxyRect clippingRect = this.GetClippingRect();
const double MinimumSegmentLength = 4;
rc.DrawClippedLine(
new[] { this.screenStartPoint, p4 },
clippingRect,
MinimumSegmentLength * MinimumSegmentLength,
this.GetSelectableColor(this.Color),
this.StrokeThickness,
this.LineStyle,
this.LineJoin,
false);
rc.DrawClippedPolygon(
new[] { p3, this.screenEndPoint, p2, p4 },
clippingRect,
MinimumSegmentLength * MinimumSegmentLength,
this.GetSelectableColor(this.Color),
null);
if (!string.IsNullOrEmpty(this.Text))
{
var ha = d.X < 0 ? HorizontalAlignment.Left : HorizontalAlignment.Right;
var va = d.Y < 0 ? VerticalAlignment.Top : VerticalAlignment.Bottom;
var textPoint = this.screenStartPoint;
rc.DrawClippedText(
clippingRect,
textPoint,
this.Text,
this.ActualTextColor,
this.ActualFont,
this.ActualFontSize,
this.ActualFontWeight,
0,
ha,
va);
}
}
示例6: Render
/// <summary>
/// Renders the series on the specified rendering context.
/// </summary>
/// <param name="rc">The rendering context.</param>
public override void Render(IRenderContext rc)
{
var actualPoints = this.ActualPoints;
var actualPoints2 = this.points2;
int n0 = actualPoints.Count;
if (n0 == 0)
{
return;
}
this.VerifyAxes();
double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;
var clippingRect = this.GetClippingRect();
rc.SetClip(clippingRect);
// Transform all points to screen coordinates
IList<ScreenPoint> pts0 = new List<ScreenPoint>();
for (int i = 0; i < n0; i++)
{
pts0.Add(this.XAxis.Transform(actualPoints[i].X, actualPoints[i].Y, this.YAxis));
}
int n1 = actualPoints2.Count;
IList<ScreenPoint> pts1 = new ScreenPoint[n1];
for (int i = 0; i < n1; i++)
{
int j = n1 - 1 - i;
pts1[j] = this.XAxis.Transform(actualPoints2[i].X, actualPoints2[i].Y, this.YAxis);
}
if (this.Smooth)
{
var rpts0 = ScreenPointHelper.ResamplePoints(pts0, this.MinimumSegmentLength);
// var rpts1 = ScreenPointHelper.ResamplePoints(pts1, this.MinimumSegmentLength);
pts0 = CanonicalSplineHelper.CreateSpline(rpts0, 0.5, null, false, 0.25);
// pts1 = CanonicalSplineHelper.CreateSpline(rpts1, 0.5, null, false, 0.25);
}
var dashArray = this.ActualDashArray;
var dashArray2 = this.ActualDashArray2;
var limit = this.YAxis.Transform(this.Limit);
if (limit < clippingRect.Top)
{
limit = clippingRect.Top;
}
if (limit > clippingRect.Bottom)
{
limit = clippingRect.Bottom;
}
var markerSizes = new[] { this.MarkerSize };
var bottom = clippingRect.Bottom;
var top = clippingRect.Top;
clippingRect.Top = limit;
clippingRect.Height = bottom - limit;
// draw the clipped lines belove the limit line
rc.DrawClippedLine(
clippingRect,
pts0,
minDistSquared,
this.GetSelectableColor(this.ActualColor2),
this.StrokeThickness,
dashArray2,
this.LineJoin,
false);
// combine the two lines and draw the clipped area
var pts = new List<ScreenPoint>();
pts.AddRange(pts1);
pts.AddRange(pts0);
// fill the area belove the limit line
rc.DrawClippedPolygon(clippingRect, pts, minDistSquared, this.GetSelectableFillColor(this.ActuallFill2), OxyColors.Undefined);
// draw the markers on line belove the limit line
rc.DrawMarkers(
clippingRect,
pts0,
this.MarkerType,
null,
markerSizes,
this.MarkerFill2,
//.........这里部分代码省略.........
示例7: Render
/// <summary>
/// Renders the arrow annotation.
/// </summary>
/// <param name="rc">The render context.</param>
/// <param name="model">The plot model.</param>
public override void Render(IRenderContext rc, PlotModel model)
{
base.Render(rc, model);
this.screenEndPoint = this.Transform(this.EndPoint);
if (this.ArrowDirection.LengthSquared > 0)
{
this.screenStartPoint = this.screenEndPoint - this.ArrowDirection;
}
else
{
this.screenStartPoint = this.Transform(this.StartPoint);
}
var d = this.screenEndPoint - this.screenStartPoint;
d.Normalize();
var n = new ScreenVector(d.Y, -d.X);
var p1 = this.screenEndPoint - (d * this.HeadLength * this.StrokeThickness);
var p2 = p1 + (n * this.HeadWidth * this.StrokeThickness);
var p3 = p1 - (n * this.HeadWidth * this.StrokeThickness);
var p4 = p1 + (d * this.Veeness * this.StrokeThickness);
var clippingRectangle = this.GetClippingRect();
const double MinimumSegmentLength = 4;
var dashArray = this.LineStyle.GetDashArray();
rc.DrawClippedLine(
clippingRectangle,
new[] { this.screenStartPoint, p4 },
MinimumSegmentLength * MinimumSegmentLength,
this.GetSelectableColor(this.Color),
this.StrokeThickness,
dashArray,
this.LineJoin,
false);
rc.DrawClippedPolygon(
clippingRectangle,
new[] { p3, this.screenEndPoint, p2, p4 },
MinimumSegmentLength * MinimumSegmentLength,
this.GetSelectableColor(this.Color),
OxyColors.Undefined);
if (!string.IsNullOrEmpty(this.Text))
{
var ha = this.TextHorizontalAlignment;
var va = this.TextVerticalAlignment;
if (!this.TextPosition.IsDefined())
{
// automatic position => use automatic alignment
ha = d.X < 0 ? HorizontalAlignment.Left : HorizontalAlignment.Right;
va = d.Y < 0 ? VerticalAlignment.Top : VerticalAlignment.Bottom;
}
var textPoint = this.GetActualTextPosition(() => this.screenStartPoint);
rc.DrawClippedText(
clippingRectangle,
textPoint,
this.Text,
this.ActualTextColor,
this.ActualFont,
this.ActualFontSize,
this.ActualFontWeight,
this.TextRotation,
ha,
va);
}
}
示例8: Render
/// <summary>
/// Renders the series on the specified rendering context.
/// </summary>
/// <param name="rc">The rendering context.</param>
public override void Render(IRenderContext rc)
{
this.VerifyAxes();
var actualPoints = this.ActualPoints;
if (actualPoints == null || actualPoints.Count == 0)
{
return;
}
var actualPoints2 = this.ActualPoints2;
if (actualPoints2 == null || actualPoints2.Count == 0)
{
return;
}
int startIdx = 0;
int startIdx2 = 0;
double xmax = double.MaxValue;
if (this.IsXMonotonic)
{
// determine render range
var xmin = this.XAxis.ActualMinimum;
xmax = this.XAxis.ActualMaximum;
this.WindowStartIndex = this.UpdateWindowStartIndex(actualPoints, point => point.X, xmin, this.WindowStartIndex);
this.WindowStartIndex2 = this.UpdateWindowStartIndex(actualPoints2, point => point.X, xmin, this.WindowStartIndex2);
startIdx = this.WindowStartIndex;
startIdx2 = this.WindowStartIndex2;
}
double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;
var clippingRect = this.GetClippingRect();
rc.SetClip(clippingRect);
var areaContext = new AreaRenderContext
{
Points = actualPoints,
WindowStartIndex = startIdx,
XMax = xmax,
RenderContext = rc,
ClippingRect = clippingRect,
MinDistSquared = minDistSquared,
Reverse = false,
Color = this.ActualColor,
DashArray = this.ActualDashArray
};
var chunksOfPoints = this.RenderChunkedPoints(areaContext);
areaContext.Points = actualPoints2;
areaContext.WindowStartIndex = startIdx2;
areaContext.Reverse = this.Reverse2;
areaContext.Color = this.ActualColor2;
var chunksOfPoints2 = this.RenderChunkedPoints(areaContext);
if (chunksOfPoints.Count != chunksOfPoints2.Count)
{
rc.ResetClip();
return;
}
// Draw the fill
for (int chunkIndex = 0; chunkIndex < chunksOfPoints.Count; chunkIndex++)
{
var pts = chunksOfPoints[chunkIndex];
var pts2 = chunksOfPoints2[chunkIndex];
// pts = SutherlandHodgmanClipping.ClipPolygon(clippingRect, pts);
// combine the two lines and draw the clipped area
var allPts = new List<ScreenPoint>();
allPts.AddRange(pts2);
allPts.AddRange(pts);
rc.DrawClippedPolygon(
clippingRect,
allPts,
minDistSquared,
this.GetSelectableFillColor(this.ActualFill),
OxyColors.Undefined);
var markerSizes = new[] { this.MarkerSize };
// draw the markers on top
rc.DrawMarkers(
clippingRect,
pts,
this.MarkerType,
null,
markerSizes,
this.MarkerFill,
this.MarkerStroke,
this.MarkerStrokeThickness,
//.........这里部分代码省略.........