當前位置: 首頁>>代碼示例>>C#>>正文


C# PointCollection.get_Count方法代碼示例

本文整理匯總了C#中System.Windows.Media.PointCollection.get_Count方法的典型用法代碼示例。如果您正苦於以下問題:C# PointCollection.get_Count方法的具體用法?C# PointCollection.get_Count怎麽用?C# PointCollection.get_Count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.PointCollection的用法示例。


在下文中一共展示了PointCollection.get_Count方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ClipPolygon

 private PointCollection ClipPolygon(Polygon polygon, double Left, double Top, double Right, double Bottom)
 {
     Point point;
     Point point2;
     PointCollection clippedPolygon = new PointCollection();
     double xTop = 0.0;
     double yLeft = 0.0;
     double xBottom = 0.0;
     double yRight = 0.0;
     int num5 = 0;
     int num6 = -1;
     double num7 = 0.0;
     double num8 = 0.0;
     double num9 = 0.0;
     double num10 = 0.0;
     for (int i = 0; i < polygon.get_Points().get_Count(); i++)
     {
         point = polygon.get_Points().get_Item(i);
         if (point.get_X() < num7)
         {
             num7 = point.get_X();
         }
         if (point.get_X() > num8)
         {
             num8 = point.get_X();
         }
         if (point.get_Y() < num9)
         {
             num9 = point.get_Y();
         }
         if (point.get_Y() > num10)
         {
             num10 = point.get_Y();
         }
         if (((Left <= point.get_X()) && (point.get_X() <= Right)) && ((Top <= point.get_Y()) && (point.get_Y() <= Bottom)))
         {
             num6 = i;
             break;
         }
     }
     if (num6 == -1)
     {
         for (int k = 0; k < polygon.get_Points().get_Count(); k++)
         {
             point = polygon.get_Points().get_Item(k);
             point2 = (k == (polygon.get_Points().get_Count() - 1)) ? polygon.get_Points().get_Item(0) : polygon.get_Points().get_Item(k + 1);
             this.CalculateLineIntersection(point, point2, ref yLeft, ref xTop, ref yRight, ref xBottom, Left, Top, Right, Bottom);
             if (((((Top <= yLeft) && (yLeft <= Bottom)) && (((point.get_X() < Left) && (Left < point2.get_X())) || ((point2.get_X() < Left) && (Left < point.get_X())))) || (((Left <= xTop) && (xTop <= Right)) && (((point.get_Y() < Top) && (Top < point2.get_Y())) || ((point2.get_Y() < Top) && (Top < point.get_Y()))))) || ((((Top <= yRight) && (yRight <= Bottom)) && (((point.get_X() < Right) && (Right < point2.get_X())) || ((point2.get_X() < Right) && (Right < point.get_X())))) || (((Left <= xBottom) && (xBottom <= Right)) && (((point.get_Y() < Bottom) && (Bottom < point2.get_Y())) || ((point2.get_Y() < Bottom) && (Bottom < point.get_Y()))))))
             {
                 this.ClipLine(point, point2, yLeft, xTop, yRight, xBottom, Left, Top, Right, Bottom, ref clippedPolygon);
                 num5 = clippedPolygon.get_Count();
                 num6 = (k == (polygon.get_Points().get_Count() - 1)) ? 0 : (k + 1);
                 break;
             }
         }
     }
     if (num6 == -1)
     {
         if (((num7 <= Left) && (Right <= num8)) && ((num9 <= Top) && (Bottom <= num10)))
         {
             clippedPolygon.Add(new Point(Left, Top));
             clippedPolygon.Add(new Point(Right, Top));
             clippedPolygon.Add(new Point(Right, Bottom));
             clippedPolygon.Add(new Point(Left, Bottom));
         }
         return clippedPolygon;
     }
     for (int j = num6; j < (polygon.get_Points().get_Count() + num6); j++)
     {
         point = polygon.get_Points().get_Item((j < polygon.get_Points().get_Count()) ? j : (j - polygon.get_Points().get_Count()));
         point2 = ((j + 1) < polygon.get_Points().get_Count()) ? polygon.get_Points().get_Item(j + 1) : polygon.get_Points().get_Item((j + 1) - polygon.get_Points().get_Count());
         this.CalculateLineIntersection(point, point2, ref yLeft, ref xTop, ref yRight, ref xBottom, Left, Top, Right, Bottom);
         if (((Left <= point.get_X()) && (point.get_X() <= Right)) && ((Top <= point.get_Y()) && (point.get_Y() <= Bottom)))
         {
             if (((clippedPolygon.get_Count() == 0) || (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_X() != point.get_X())) || (clippedPolygon.get_Item(clippedPolygon.get_Count() - 1).get_Y() != point.get_Y()))
             {
                 clippedPolygon.Add(point);
             }
             if (((point2.get_X() < Left) || (Right < point2.get_X())) || ((point2.get_Y() < Top) || (Bottom < point2.get_Y())))
             {
                 if (((Top <= yLeft) && (yLeft <= Bottom)) && ((point2.get_X() < Left) && (Left < point.get_X())))
                 {
                     clippedPolygon.Add(new Point(Left, yLeft));
                 }
                 else if (((Left <= xTop) && (xTop <= Right)) && ((point2.get_Y() < Top) && (Top < point.get_Y())))
                 {
                     clippedPolygon.Add(new Point(xTop, Top));
                 }
                 else if (((Top <= yRight) && (yRight <= Bottom)) && ((point.get_X() < Right) && (Right < point2.get_X())))
                 {
                     clippedPolygon.Add(new Point(Right, yRight));
                 }
                 else if (((Left <= xBottom) && (xBottom <= Right)) && ((point.get_Y() < Bottom) && (Bottom < point2.get_Y())))
                 {
                     clippedPolygon.Add(new Point(xBottom, Bottom));
                 }
             }
         }
         else
         {
//.........這裏部分代碼省略.........
開發者ID:guazipi,項目名稱:bjAirPollution,代碼行數:101,代碼來源:MainPage.cs

示例2: ClipLine

 private void ClipLine(Point point, Point NextPoint, double yLeft, double xTop, double yRight, double xBottom, double Left, double Top, double Right, double Bottom, ref PointCollection ClippedPolygon)
 {
     if ((xTop == Left) && (yLeft == Top))
     {
         if (((ClippedPolygon.get_Count() == 0) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_X() != Left)) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_Y() != Top))
         {
             ClippedPolygon.Add(new Point(Left, Top));
         }
     }
     else if ((xTop == Right) && (yRight == Top))
     {
         if (((ClippedPolygon.get_Count() == 0) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_X() != Right)) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_Y() != Top))
         {
             ClippedPolygon.Add(new Point(Right, Top));
         }
     }
     else if ((xBottom == Right) && (yRight == Bottom))
     {
         if (((ClippedPolygon.get_Count() == 0) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_X() != Right)) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_Y() != Bottom))
         {
             ClippedPolygon.Add(new Point(Right, Bottom));
         }
     }
     else if ((xBottom == Left) && (yLeft == Bottom))
     {
         if (((ClippedPolygon.get_Count() == 0) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_X() != Left)) || (ClippedPolygon.get_Item(ClippedPolygon.get_Count() - 1).get_Y() != Bottom))
         {
             ClippedPolygon.Add(new Point(Left, Bottom));
         }
     }
     else if (((Top <= yLeft) && (yLeft <= Bottom)) && ((Left <= xTop) && (xTop <= Right)))
     {
         if (((point.get_X() < Left) && (point.get_Y() > Top)) && ((NextPoint.get_X() > Left) && (NextPoint.get_Y() < Top)))
         {
             ClippedPolygon.Add(new Point(Left, yLeft));
             ClippedPolygon.Add(new Point(xTop, Top));
         }
         else if (((point.get_X() > Left) && (point.get_Y() < Top)) && ((NextPoint.get_Y() > Top) && (NextPoint.get_X() < Left)))
         {
             ClippedPolygon.Add(new Point(xTop, Top));
             ClippedPolygon.Add(new Point(Left, yLeft));
         }
     }
     else if (((Left <= xTop) && (xTop <= Right)) && ((Top <= yRight) && (yRight <= Bottom)))
     {
         if (((point.get_X() > Right) && (point.get_Y() > Top)) && ((NextPoint.get_X() < Right) && (NextPoint.get_Y() < Top)))
         {
             ClippedPolygon.Add(new Point(Right, yRight));
             ClippedPolygon.Add(new Point(xTop, Top));
         }
         else if (((point.get_X() < Right) && (point.get_Y() < Top)) && ((NextPoint.get_X() > Right) && (NextPoint.get_Y() > Top)))
         {
             ClippedPolygon.Add(new Point(xTop, Top));
             ClippedPolygon.Add(new Point(Right, yRight));
         }
     }
     else if (((Left <= xBottom) && (xBottom <= Right)) && ((Top <= yRight) && (yRight <= Bottom)))
     {
         if (((point.get_X() > Right) && (point.get_Y() < Bottom)) && ((NextPoint.get_X() < Right) && (NextPoint.get_Y() > Bottom)))
         {
             ClippedPolygon.Add(new Point(Right, yRight));
             ClippedPolygon.Add(new Point(xBottom, Bottom));
         }
         else if (((point.get_X() < Right) && (point.get_Y() > Bottom)) && ((NextPoint.get_X() > Right) && (NextPoint.get_Y() < Bottom)))
         {
             ClippedPolygon.Add(new Point(xBottom, Bottom));
             ClippedPolygon.Add(new Point(Right, yRight));
         }
     }
     else if (((Left <= xBottom) && (xBottom <= Right)) && ((Top <= yLeft) && (yLeft <= Bottom)))
     {
         if (((point.get_X() < Left) && (point.get_Y() < Bottom)) && ((NextPoint.get_X() > Left) && (NextPoint.get_Y() > Bottom)))
         {
             ClippedPolygon.Add(new Point(Left, yLeft));
             ClippedPolygon.Add(new Point(xBottom, Bottom));
         }
         else if (((point.get_X() > Left) && (point.get_Y() > Bottom)) && ((NextPoint.get_X() < Left) && (NextPoint.get_Y() < Bottom)))
         {
             ClippedPolygon.Add(new Point(xBottom, Bottom));
             ClippedPolygon.Add(new Point(Left, yLeft));
         }
     }
     else if (((Left <= xTop) && (xTop <= Right)) && ((Left <= xBottom) && (xBottom <= Right)))
     {
         if ((point.get_Y() < Top) && (NextPoint.get_Y() > Bottom))
         {
             ClippedPolygon.Add(new Point(xTop, Top));
             ClippedPolygon.Add(new Point(xBottom, Bottom));
         }
         else if ((point.get_Y() > Bottom) && (NextPoint.get_Y() < Top))
         {
             ClippedPolygon.Add(new Point(xBottom, Bottom));
             ClippedPolygon.Add(new Point(xTop, Top));
         }
     }
     else if (((Top <= yLeft) && (yLeft <= Bottom)) && ((Top <= yRight) && (yRight <= Bottom)))
     {
         if ((point.get_X() < Left) && (NextPoint.get_X() > Right))
         {
             ClippedPolygon.Add(new Point(Left, yLeft));
//.........這裏部分代碼省略.........
開發者ID:guazipi,項目名稱:bjAirPollution,代碼行數:101,代碼來源:MainPage.cs


注:本文中的System.Windows.Media.PointCollection.get_Count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。