本文整理汇总了C#中IVertexSource.Vertices方法的典型用法代码示例。如果您正苦于以下问题:C# IVertexSource.Vertices方法的具体用法?C# IVertexSource.Vertices怎么用?C# IVertexSource.Vertices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertexSource
的用法示例。
在下文中一共展示了IVertexSource.Vertices方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public static void Save(IVertexSource vertexSource, string pathAndFileName, bool oldStyle = true)
{
if (oldStyle)
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
vertexSource.rewind(0);
double x;
double y;
ShapePath.FlagsAndCommand flagsAndCommand = vertexSource.vertex(out x, out y);
do
{
outFile.WriteLine("{0}, {1}, {2}", x, y, flagsAndCommand.ToString());
flagsAndCommand = vertexSource.vertex(out x, out y);
}
while (flagsAndCommand != ShapePath.FlagsAndCommand.CommandStop);
}
}
else
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
foreach (VertexData vertexData in vertexSource.Vertices())
{
outFile.WriteLine("{0}, {1}, {2}", vertexData.position.x, vertexData.position.y, vertexData.command.ToString());
}
}
}
}
示例2: CreatePolygons
public static List<List<IntPoint>> CreatePolygons(IVertexSource sourcePath, double scaling = 1000)
{
List<List<IntPoint>> allPolys = new List<List<IntPoint>>();
List<IntPoint> currentPoly = null;
VertexData last = new VertexData();
VertexData first = new VertexData();
bool addedFirst = false;
foreach (VertexData vertexData in sourcePath.Vertices())
{
if (vertexData.IsLineTo)
{
if (!addedFirst)
{
currentPoly.Add(new IntPoint((long)(last.position.x * scaling), (long)(last.position.y * scaling)));
addedFirst = true;
first = last;
}
currentPoly.Add(new IntPoint((long)(vertexData.position.x * scaling), (long)(vertexData.position.y * scaling)));
last = vertexData;
}
else
{
addedFirst = false;
currentPoly = new List<IntPoint>();
allPolys.Add(currentPoly);
if (vertexData.IsMoveTo)
{
last = vertexData;
}
else
{
last = first;
}
}
}
return allPolys;
}
示例3: conv_poly_counter
private conv_poly_counter(IVertexSource src)
{
m_contours = 0;
m_points = 0;
foreach (VertexData vertexData in src.Vertices())
{
if (ShapePath.is_vertex(vertexData.command))
{
++m_points;
}
if (ShapePath.is_move_to(vertexData.command))
{
++m_contours;
}
}
}
示例4: OldEqualsNewStyle
static public bool OldEqualsNewStyle(IVertexSource control, IVertexSource test, double maxError = .0001)
{
control.rewind(0);
double controlX;
double controlY;
ShapePath.FlagsAndCommand controlFlagsAndCommand = control.vertex(out controlX, out controlY);
int index = 0;
foreach (VertexData vertexData in test.Vertices())
{
if (controlFlagsAndCommand != vertexData.command
|| controlX < vertexData.position.x - maxError || controlX > vertexData.position.x + maxError
|| controlY < vertexData.position.y - maxError || controlY > vertexData.position.y + maxError)
{
return false;
}
controlFlagsAndCommand = control.vertex(out controlX, out controlY);
index++;
}
if (controlFlagsAndCommand == ShapePath.FlagsAndCommand.CommandStop)
{
return true;
}
return false;
}
示例5: add_path
public void add_path(IVertexSource vs, int pathID)
{
#if false
if (m_outline.sorted())
{
reset();
}
foreach (VertexData vertexData in vs.Vertices())
{
if(!ShapePath.is_stop(vertexData.command))
{
AddVertex(new VertexData(vertexData.command, new Vector2(vertexData.position.x, vertexData.position.y)));
}
}
#else
double x = 0;
double y = 0;
ShapePath.FlagsAndCommand PathAndFlags;
vs.rewind(pathID);
if (m_outline.sorted())
{
reset();
}
while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
{
AddVertex(new VertexData(PathAndFlags, new Vector2(x, y)));
}
#endif
}