当前位置: 首页>>代码示例>>C#>>正文


C# IVertexSource.Vertices方法代码示例

本文整理汇总了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());
             }
         }
     }
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:29,代码来源:VertexSourceIO.cs

示例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;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:38,代码来源:VertexSourceToClipperPolygons.cs

示例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;
				}
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:18,代码来源:PolygonClipping.cs

示例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;
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:27,代码来源:PathStorage.cs

示例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
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:32,代码来源:ScanlineRasterizer.cs


注:本文中的IVertexSource.Vertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。