本文整理汇总了C#中System.Drawing.PointF.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# PointF.ToList方法的具体用法?C# PointF.ToList怎么用?C# PointF.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.PointF
的用法示例。
在下文中一共展示了PointF.ToList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEdge
public Graph AddEdge(int vInIndex, int vOutIndex, double weight, PointF[] points)
{
AddEdge(
new Edge(this[vInIndex], this[vOutIndex], weight) { Points = points.ToList() }
);
return this;
}
示例2: CalcCircumference
private static float CalcCircumference(PointF[] points)
{
List<PointF> pointsList = new List<PointF>();
pointsList = points.ToList();
pointsList.Add(pointsList[0]);
double result = 0;
for (int i = 0; i < pointsList.Count - 1; i++)
{
result += Distance(pointsList[i + 1], pointsList[i]);
}
pointsList.RemoveAt(pointsList.Count - 1);
return (float)result;
}
示例3: getConvexHullTest
public void getConvexHullTest()
{
PointF[] polygons = new PointF[] { new Point(0,0), new Point(0, 2), new Point(2, 2),
new Point(2,0), new Point(1,1) };
List<PointF> convexHull = Utils.getConvexHull(polygons.ToList());
List<PointF> trueConvexHull = new PointF[] {new Point(0,0), new Point(0, 2), new Point(2, 2),
new Point(2,0)}.ToList();
Assert.AreEqual(trueConvexHull.Except(convexHull).Count(), 0);
Assert.AreEqual(convexHull.Except(trueConvexHull).Count(), 0);
polygons = new PointF[] { new Point(0,0), new Point(0, 4), new Point(1, 3), new Point(2, 2), new Point(4, 5),
new Point(4,1), new Point(5,0) };
convexHull = Utils.getConvexHull(polygons.ToList());
trueConvexHull = new PointF[] {new Point(0,0), new Point(0, 4), new Point(4, 5),
new Point(5,0) }.ToList();
Assert.AreEqual(trueConvexHull.Except(convexHull).Count(), 0);
Assert.AreEqual(convexHull.Except(trueConvexHull).Count(), 0);
}
示例4: DistancePointToPolygonBound
public static double DistancePointToPolygonBound(PointF[] points, PointF p, double min)
{
double mindis = min + 1;
PointF linePoint = points[points.Length - 1];
points.ToList().ForEach(linePoint2 =>
{
mindis = Math.Min(mindis,
DistancePointToLine(linePoint, linePoint2, p));
linePoint = linePoint2;
});
return mindis;
}
示例5: LoadPoints
//Allow the user to import an array of points to be used to draw a signature in the view, with new
//lines indicated by a PointF.Empty in the array.
public void LoadPoints(PointF[] loadedPoints)
{
if (loadedPoints == null || loadedPoints.Count () == 0)
return;
var startIndex = 0;
var emptyIndex = loadedPoints.ToList ().IndexOf (PointF.Empty);
if (emptyIndex == -1)
emptyIndex = loadedPoints.Count ();
//Clear any existing paths or points.
paths = new List<UIBezierPath> ();
points = new List<PointF[]> ();
do {
//Create a new path and set the line options
currentPath = UIBezierPath.Create ();
currentPath.LineWidth = StrokeWidth;
currentPath.LineJoinStyle = CGLineJoin.Round;
currentPoints = new List<PointF> ();
//Move to the first point and add that point to the current_points array.
currentPath.MoveTo (loadedPoints [startIndex]);
currentPoints.Add (loadedPoints [startIndex]);
//Iterate through the array until an empty point (or the end of the array) is reached,
//adding each point to the current_path and to the current_points array.
for (var i = startIndex + 1; i < emptyIndex; i++) {
currentPath.AddLineTo (loadedPoints [i]);
currentPoints.Add (loadedPoints [i]);
}
//Add the current_path and current_points list to their respective Lists before
//starting on the next line to be drawn.
paths.Add (currentPath);
points.Add (currentPoints.ToArray ());
//Obtain the indices for the next line to be drawn.
startIndex = emptyIndex + 1;
if (startIndex < loadedPoints.Count () - 1) {
emptyIndex = loadedPoints.ToList ().IndexOf (PointF.Empty, startIndex);
if (emptyIndex == -1)
emptyIndex = loadedPoints.Count ();
} else
emptyIndex = startIndex;
} while (startIndex < emptyIndex);
//Obtain the image for the imported signature and display it in the image view.
imageView.Image = GetImage (false);
//Display the clear button.
btnClear.Hidden = false;
SetNeedsDisplay ();
}
示例6: DrawSegments
public void DrawSegments(PointF[] Stroke)
{
if (RenderMethod == RenderMode.Standard)
{
// Ensure that surface is visible
if (!this.Visible)
{
this.TopMost = true;
this.Show();
}
// Create list of points that are new this draw
List<PointF> NewPoints = new List<PointF>();
// Get number of points added since last draw including last point of last stroke and add new points to new points list
int iDelta = Stroke.Count() - LastStroke.Count() + 1;
NewPoints.AddRange(Stroke.Skip(Stroke.Count() - iDelta).Take(iDelta));
// Draw new line segments to main drawing surface
SurfaceGraphics.DrawLines(DrawingPen, NewPoints.Select(p => TranslatePoint(p)).ToArray());
// Set last stroke to copy of current stroke
// ToList method creates value copy of stroke list and assigns it to last stroke
LastStroke = Stroke.ToList();
}
else
{
foreach (CompatibilitySurface surface in CompatibilitySurfaces)
surface.SurfaceGraphics.DrawLines(DrawingPen, surface.OffsetPoints(Stroke));
}
}