本文整理汇总了C#中System.Windows.Media.PointCollection.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# PointCollection.RemoveAt方法的具体用法?C# PointCollection.RemoveAt怎么用?C# PointCollection.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.PointCollection
的用法示例。
在下文中一共展示了PointCollection.RemoveAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateGeometry
/// <summary>
/// Generate the shapes geometry.
/// </summary>
protected Geometry GenerateGeometry()
{
PathGeometry pathGeometry = new PathGeometry();
if (Points.Count == 2 || Points.Count == 3)
{
// Make a straight line.
PathFigure fig = new PathFigure();
fig.IsClosed = false;
fig.IsFilled = false;
fig.StartPoint = Points[0];
for (int i = 1; i < Points.Count; ++i)
{
fig.Segments.Add(new LineSegment(Points[i], true));
}
pathGeometry.Figures.Add(fig);
}
else
{
PointCollection adjustedPoints = new PointCollection();
adjustedPoints.Add(Points[0]);
for (int i = 1; i < Points.Count; ++i)
{
adjustedPoints.Add(Points[i]);
}
if (adjustedPoints.Count == 4)
{
// Make a curved line.
PathFigure fig = new PathFigure();
fig.IsClosed = false;
fig.IsFilled = false;
fig.StartPoint = adjustedPoints[0];
fig.Segments.Add(new BezierSegment(adjustedPoints[1], adjustedPoints[2], adjustedPoints[3], true));
pathGeometry.Figures.Add(fig);
}
else if (adjustedPoints.Count >= 5)
{
// Make a curved line.
PathFigure fig = new PathFigure();
fig.IsClosed = false;
fig.IsFilled = false;
fig.StartPoint = adjustedPoints[0];
adjustedPoints.RemoveAt(0);
while (adjustedPoints.Count > 3)
{
Point generatedPoint = adjustedPoints[1] + ((adjustedPoints[2] - adjustedPoints[1]) / 2);
fig.Segments.Add(new BezierSegment(adjustedPoints[0], adjustedPoints[1], generatedPoint, true));
adjustedPoints.RemoveAt(0);
adjustedPoints.RemoveAt(0);
}
if (adjustedPoints.Count == 2)
{
fig.Segments.Add(new BezierSegment(adjustedPoints[0], adjustedPoints[0], adjustedPoints[1], true));
}
else
{
Trace.Assert(adjustedPoints.Count == 2);
fig.Segments.Add(new BezierSegment(adjustedPoints[0], adjustedPoints[1], adjustedPoints[2], true));
}
pathGeometry.Figures.Add(fig);
}
}
return pathGeometry;
}
示例2: ClipPolygon
//.........这里部分代码省略.........
{
if ((xTop < Left) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() > Left))
{
clippedPolygon.Add(new Point(Left, Top));
}
else if ((xTop > Right) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() < Right))
{
clippedPolygon.Add(new Point(Right, Top));
}
}
if (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() == Right) && (point2.get_X() <= Right)) && (Right < point.get_X()))
{
if ((yRight < Top) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() > Top))
{
clippedPolygon.Add(new Point(Right, Top));
}
else if ((yRight > Bottom) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() < Bottom))
{
clippedPolygon.Add(new Point(Right, Bottom));
}
}
if (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() == Bottom) && (point2.get_Y() <= Bottom)) && (Bottom < point.get_Y()))
{
if ((xBottom > Right) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() < Right))
{
clippedPolygon.Add(new Point(Right, Bottom));
}
else if ((xBottom < Left) && (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() > Left))
{
clippedPolygon.Add(new Point(Left, Bottom));
}
}
}
if (((Left <= point2.get_X()) && (point2.get_X() <= Right)) && ((Top <= point2.get_Y()) && (point2.get_Y() <= Bottom)))
{
if (((Top <= yLeft) && (yLeft <= Bottom)) && ((point.get_X() < Left) && (Left < point2.get_X())))
{
if ((((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() == Top) && (point.get_Y() == Top)) && (point2.get_Y() == Top)) || (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() == Bottom) && (point.get_Y() == Bottom)) && (point2.get_Y() == Bottom)))
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
else
{
clippedPolygon.Add(new Point(Left, yLeft));
}
}
else if (((Left <= xTop) && (xTop <= Right)) && ((point.get_Y() < Top) && (Top < point2.get_Y())))
{
if ((((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() == Left) && (point.get_X() == Left)) && (point2.get_X() == Left)) || (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() == Right) && (point.get_X() == Right)) && (point2.get_X() == Right)))
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
else
{
clippedPolygon.Add(new Point(xTop, Top));
}
}
else if (((Top <= yRight) && (yRight <= Bottom)) && ((point2.get_X() < Right) && (Right < point.get_X())))
{
if ((((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() == Top) && (point.get_Y() == Top)) && (point2.get_Y() == Top)) || (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() == Bottom) && (point.get_Y() == Bottom)) && (point2.get_Y() == Bottom)))
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
else
{
clippedPolygon.Add(new Point(Right, yRight));
}
}
else if (((Left <= xBottom) && (xBottom <= Right)) && ((point2.get_Y() < Bottom) && (Bottom < point.get_Y())))
{
if ((((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() == Left) && (point.get_X() == Left)) && (point2.get_X() == Left)) || (((clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() == Right) && (point.get_X() == Right)) && (point2.get_X() == Right)))
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
else
{
clippedPolygon.Add(new Point(xBottom, Bottom));
}
}
}
else
{
this.ClipLine(point, point2, yLeft, xTop, yRight, xBottom, Left, Top, Right, Bottom, ref clippedPolygon);
}
}
}
if (num5 > 0)
{
for (int m = 0; m < num5; m++)
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
return clippedPolygon;
}
if ((clippedPolygon.get_Item(0).get_X() == clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X()) && (clippedPolygon.get_Item(0).get_Y() == clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y()))
{
clippedPolygon.RemoveAt(clippedPolygon.get_Count() - 1);
}
return clippedPolygon;
}
示例3: TriangleSubdivide
/// <summary>
///
/// </summary>
/// <param name="vertices"></param>
/// <param name="normals"></param>
/// <param name="indices"></param>
/// <param name="textures"></param>
protected void TriangleSubdivide(Point3DCollection vertices,
Vector3DCollection normals,
Int32Collection indices,
PointCollection textures)
{
for (int i = 0; i < 3; i++)
{
verticesBase[2 - i] = vertices[vertices.Count - 1];
normalsBase[2 - i] = normals[vertices.Count - 1];
texturesBase[2 - i] = textures[vertices.Count - 1];
vertices.RemoveAt(vertices.Count - 1);
normals.RemoveAt(normals.Count - 1);
indices.RemoveAt(indices.Count - 1);
textures.RemoveAt(textures.Count - 1);
}
int indexStart = vertices.Count;
for (int slice = 0; slice <= Slices; slice++)
{
double weight = (double)slice / Slices;
Point3D vertex1 = Point3DWeight(verticesBase[0], verticesBase[1], weight);
Point3D vertex2 = Point3DWeight(verticesBase[0], verticesBase[2], weight);
Vector3D normal1 = Vector3DWeight(normalsBase[0], normalsBase[1], weight);
Vector3D normal2 = Vector3DWeight(normalsBase[0], normalsBase[2], weight);
Point texture1 = PointWeight(texturesBase[0], texturesBase[1], weight);
Point texture2 = PointWeight(texturesBase[0], texturesBase[2], weight);
for (int i = 0; i <= slice; i++)
{
weight = (double)i / slice;
if (Double.IsNaN(weight))
weight = 0;
vertices.Add(Point3DWeight(vertex1, vertex2, weight));
normals.Add(Vector3DWeight(normal1, normal2, weight));
textures.Add(PointWeight(texture1, texture2, weight));
}
}
for (int slice = 0; slice < Slices; slice++)
{
int base1 = (slice + 1) * slice / 2;
int base2 = base1 + slice + 1;
for (int i = 0; i <= 2 * slice; i++)
{
int half = i / 2;
if ((i & 1) == 0) // even
{
indices.Add(indexStart + base1 + half);
indices.Add(indexStart + base2 + half);
indices.Add(indexStart + base2 + half + 1);
}
else // odd
{
indices.Add(indexStart + base1 + half);
indices.Add(indexStart + base2 + half + 1);
indices.Add(indexStart + base1 + half + 1);
}
}
}
}
示例4: CreatePolyLineGeometry
private static Geometry CreatePolyLineGeometry(PointCollection points)
{
Point point = points[0];
points.RemoveAt(0);
PathGeometry pathGeometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
PolyLineSegment polyLineSegment = new PolyLineSegment();
pathFigure.IsClosed = true;
pathFigure.StartPoint = point;
polyLineSegment.Points = points;
pathFigure.Segments.Add((PathSegment)polyLineSegment);
pathGeometry.Figures.Add(pathFigure);
return (Geometry)pathGeometry;
}