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


C# Polygons.Clear方法代码示例

本文整理汇总了C#中Polygons.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Polygons.Clear方法的具体用法?C# Polygons.Clear怎么用?C# Polygons.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polygons的用法示例。


在下文中一共展示了Polygons.Clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PolyTreeToPolygons

        //------------------------------------------------------------------------------

        public static void PolyTreeToPolygons(PolyTree polytree, Polygons polygons)
        {
            polygons.Clear();
            polygons.Capacity = polytree.Total;
            AddPolyNodeToPolygons(polytree, polygons);
        }
开发者ID:caomw,项目名称:elementdiscovery,代码行数:8,代码来源:clipper.cs

示例2: BuildResult

        //------------------------------------------------------------------------------

        private void BuildResult(Polygons polyg)
        {
            polyg.Clear();
            polyg.Capacity = m_PolyOuts.Count;
            for (int i = 0; i < m_PolyOuts.Count; i++)
            {
                OutRec outRec = m_PolyOuts[i];
                if (outRec.pts == null) continue;
                OutPt p = outRec.pts;
                int cnt = PointCount(p);
                if (cnt < 3) continue;
                Polygon pg = new Polygon(cnt);
                for (int j = 0; j < cnt; j++)
                {
                    pg.Add(p.pt);
                    p = p.prev;
                }
                polyg.Add(pg);
            }
        }
开发者ID:caomw,项目名称:elementdiscovery,代码行数:22,代码来源:clipper.cs

示例3: Execute

        //------------------------------------------------------------------------------

        public bool Execute(ClipType clipType, Polygons solution,
            PolyFillType subjFillType, PolyFillType clipFillType)
        {
            if (m_ExecuteLocked) return false;
            m_ExecuteLocked = true;
            solution.Clear();
            m_SubjFillType = subjFillType;
            m_ClipFillType = clipFillType;
            m_ClipType = clipType;
            m_UsingPolyTree = false;
            bool succeeded = ExecuteInternal();
            //build the return polygons ...
            if (succeeded) BuildResult(solution);
            m_ExecuteLocked = false;
            return succeeded;
        }
开发者ID:caomw,项目名称:elementdiscovery,代码行数:18,代码来源:clipper.cs

示例4: LoadFromFile

        //---------------------------------------------------------------------

        bool LoadFromFile(string filename, Polygons ppg, double scale = 0,
          int xOffset = 0, int yOffset = 0)
        {
            double scaling = Math.Pow(10, scale);
            ppg.Clear();
            if (!File.Exists(filename)) return false;
            StreamReader sr = new StreamReader(filename);
            if (sr == null) return false;
            string line;
            if ((line = sr.ReadLine()) == null) return false;
            int polyCnt, vertCnt;
            if (!Int32.TryParse(line, out polyCnt) || polyCnt < 0) return false;
            ppg.Capacity = polyCnt;
            for (int i = 0; i < polyCnt; i++)
            {
                if ((line = sr.ReadLine()) == null) return false;
                if (!Int32.TryParse(line, out vertCnt) || vertCnt < 0) return false;
                Polygon pg = new Polygon(vertCnt);
                ppg.Add(pg);
                for (int j = 0; j < vertCnt; j++)
                {
                    double x, y;
                    if ((line = sr.ReadLine()) == null) return false;
                    char[] delimiters = new char[] { ',', ' ' };
                    string [] vals = line.Split(delimiters);
                    if (vals.Length < 2) return false;
                    if (!double.TryParse(vals[0], out x)) return false;
                    if (!double.TryParse(vals[1], out y))
                        if (vals.Length < 2 || !double.TryParse(vals[2], out y)) return false;
                    x = x * scaling + xOffset;
                    y = y * scaling + yOffset;
                    pg.Add(new IntPoint((int)Math.Round(x), (int)Math.Round(y)));
                }
            }
            return true;
        }
开发者ID:caomw,项目名称:elementdiscovery,代码行数:38,代码来源:Form1.cs

示例5: PolyTreeToPolygons

      //------------------------------------------------------------------------------

      public static void PolyTreeToPolygons(PolyTree polytree, Polygons polys)
      {
        polys.Clear();
        polys.Capacity = polytree.Total;
        AddPolyNodeToPaths(polytree, NodeType.ntAny, polys);
      }
开发者ID:CharlesTaylor95,项目名称:clipper,代码行数:8,代码来源:clipper.cs

示例6: PushPolygonToArray

            PushPolygonToArray(List<List<IntPoint>> subjects, List<List<IntPoint>> clips)
        {
            Polygons nextClip = new Polygons();
            Polygons currentSubject = new Polygons();
            Polygons currentClip = new Polygons();
            Polygons currentArrayDraw = new Polygons();
            Polygons currentArrayInvisible = new Polygons();
            Clipper cTupleDraw = new Clipper();
            Clipper cTupleInvisible = new Clipper();

            //find polygons to be drawn
            currentSubject.Clear();
            currentClip.Clear();
            currentSubject = subjects;
            currentClip = clips;
            cTupleDraw.Clear();
            cTupleDraw.AddPaths(currentSubject, PolyType.ptSubject, true);
            cTupleDraw.AddPaths(currentClip, PolyType.ptClip, true);
            currentArrayDraw.Clear();
            bool succeededDraw = cTupleDraw.Execute(ClipType.ctDifference, currentArrayDraw,
                PolyFillType.pftNonZero, PolyFillType.pftNonZero);

            //find next clipped polygon
            nextClip.Clear();
            bool succeededNextClip = cTupleDraw.Execute(ClipType.ctUnion, nextClip,
                PolyFillType.pftNonZero, PolyFillType.pftNonZero);

            //find invisible polygons
            cTupleInvisible.Clear();
            cTupleInvisible.AddPaths(currentSubject, PolyType.ptSubject, true);
            cTupleInvisible.AddPaths(currentClip, PolyType.ptClip, true);
            currentArrayInvisible.Clear();
            bool succeededInvisible = cTupleInvisible.Execute(ClipType.ctIntersection, currentArrayInvisible,
                PolyFillType.pftNonZero, PolyFillType.pftNonZero);

            return new Tuple<List<List<IntPoint>>, List<List<IntPoint>>, List<List<IntPoint>>>
                (currentArrayDraw, currentArrayInvisible, nextClip);
        }
开发者ID:vuhoangminh,项目名称:smartd,代码行数:38,代码来源:Form1.cs


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