cent_percent_dotnet

Counterclockwise Empty polygon

May 8th, 2020
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 72.30 KB | None | 0 0
  1. ///By (Contract Miner username Noobplus)
  2. ///Usage
  3. ///DataTable with Structure
  4. /// Image_Length,Image_Width are size datacolumns
  5. /// Starting_X, Starting_Y are position datacolumns
  6. /// the four are dimensions of the images to fit in the parent picturebox.
  7. /// pictureBox2.Width,pictureBox2.Height are dimensions of parent pattern in which images are to be fit
  8. ///Description
  9. /// The pictureBox2 is the pattern. In this pattern, smaller images can be placed. The images are stored in C# DataTable as dimensions and positions. When the user clicks on the pictureBox2 where there is not image, the following code checks for irregular polygons in the empty area counterclockwise.
  10. ///Hope it helps someone ;)
  11.                                                     //regions
  12.                                                     #region regions
  13.                                                     List<Point> points = new List<Point>();
  14.                                                     DataRow[] drNearestTop = dtCurrentPattern.Select("Starting_Y+Image_Length<" + controlRelatedCoords.Y + " and Starting_X<=" + controlRelatedCoords.X + " and Starting_X+Image_Width>=" + controlRelatedCoords.X + "");
  15.                                                     drNearestTop = drNearestTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  16.                                                     int islandStartX = 0;
  17.                                                     int islandStartY = 0;
  18.                                                     if (drNearestTop.Length > 0)
  19.                                                     {
  20.                                                         DataRow[] innerTop = dtCurrentPattern.Select("Starting_Y=" + (DataHelper.GetInt(drNearestTop[0]["Starting_Y"]) + DataHelper.GetInt(drNearestTop[0]["Image_Length"])) + "" +
  21.                                                             " and Starting_X+Image_Width<=" + controlRelatedCoords.X + "" +
  22.                                                             " and Starting_X+Image_Width>" + DataHelper.GetInt(drNearestTop[0]["Starting_X"]) + "" +
  23.                                                             "");
  24.                                                         innerTop = innerTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"])+ DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  25.                                                         if (innerTop.Length>0)
  26.                                                         {
  27.                                                             islandStartX = (DataHelper.GetInt(innerTop[0]["Starting_X"]) + DataHelper.GetInt(innerTop[0]["Image_Width"]));
  28.                                                             islandStartY = (DataHelper.GetInt(drNearestTop[0]["Starting_Y"]) + DataHelper.GetInt(drNearestTop[0]["Image_Length"]));
  29.                                                         }
  30.                                                         else
  31.                                                         {
  32.                                                             islandStartX = (DataHelper.GetInt(drNearestTop[0]["Starting_X"]) + DataHelper.GetInt(drNearestTop[0]["Image_Width"]));
  33.                                                             islandStartY = (DataHelper.GetInt(drNearestTop[0]["Starting_Y"]) + DataHelper.GetInt(drNearestTop[0]["Image_Length"]));
  34.                                                         }
  35.                                                     }
  36.                                                     else
  37.                                                     {
  38.                                                         //nearest left side horizontally
  39.                                                         drNearestTop = dtCurrentPattern.Select("Starting_Y+Image_Length<" + controlRelatedCoords.Y + " and Starting_X>=" + controlRelatedCoords.X + " ");
  40.                                                         drNearestTop = drNearestTop.OrderBy(row => DataHelper.GetInt(row["Starting_X"])).ToArray<DataRow>();
  41.                                                         if (drNearestTop.Length > 0)
  42.                                                         {
  43.                                                             islandStartX = DataHelper.GetInt(drNearestTop[0]["Starting_X"]);
  44.                                                             islandStartY = DataHelper.GetInt(drNearestTop[0]["Starting_Y"]);
  45.                                                         }
  46.                                                         else
  47.                                                         {
  48.                                                             //nearest left side vertically
  49.                                                             drNearestTop = dtCurrentPattern.Select("Starting_Y<" + controlRelatedCoords.Y + " and Starting_X>=" + controlRelatedCoords.X + " ");
  50.                                                             drNearestTop = drNearestTop.OrderBy(row => DataHelper.GetInt(row["Starting_X"])).ToArray<DataRow>();
  51.                                                             if (drNearestTop.Length > 0)
  52.                                                             {
  53.                                                                 islandStartX = DataHelper.GetInt(drNearestTop[0]["Starting_X"]);
  54.                                                                 islandStartY = DataHelper.GetInt(drNearestTop[0]["Starting_Y"]);
  55.                                                             }
  56.                                                             else
  57.                                                             {
  58.  
  59.                                                                 islandStartX = pictureBox2.Width;
  60.                                                                 islandStartY = 0;
  61.                                                             }
  62.                                                         }
  63.                                                     }
  64.                                                     //MessageBox.Show("nearestTop:" + islandStartX + ":" + islandStartY);
  65.                                                     points.Add(new Point(islandStartX, islandStartY));
  66.  
  67.                                                     int islandCurrentX = -1;
  68.                                                     int islandCurrentY = -1;
  69.                                                     ///directions
  70.                                                     ///0 left
  71.                                                     ///1 up
  72.                                                     ///2 right
  73.                                                     ///3 down
  74.                                                     string direction = "Left";
  75.                                                     int count = 0;
  76.                                                     string pth = "";
  77.                                                     //testing
  78.                                                     //currentTrackless.Width = 20;
  79.                                                     //currentTrackless.Height = 20;
  80.                                                     //
  81.                                                     while ((islandCurrentX != islandStartX || islandCurrentY != islandStartY) && count < 500)
  82.                                                     {
  83.                                                         int tempIslandX = (islandCurrentX == -1 ? islandStartX : islandCurrentX);
  84.                                                         int tempIslandY = (islandCurrentY == -1 ? islandStartY : islandCurrentY);
  85.                                                         string oldDirection = direction;
  86.                                                         //break;
  87.                                                         count++;
  88.                                                        
  89.                                                         if (direction == "Left" )//&& 1==2)
  90.                                                         {
  91.                                                             DataRow[] drLeftBottom = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and " +
  92.                                                                 "Starting_Y<=" + tempIslandY + " and " +
  93.                                                                 "Starting_Y+Image_Length>" + tempIslandY + "");
  94.                                                             //drLeftBottom = drLeftBottom.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  95.                                                             //DataRow[] drLeftBottomDownwards = dtCurrentPattern.Select("");//inside ifdrlb>0
  96.                                                             DataRow[] drLeftLeft = dtCurrentPattern.Select("Starting_X<" + tempIslandX + " and " +
  97.                                                                 "Starting_X+Image_Width>="+tempIslandX+" and " +
  98.                                                                 "Starting_Y+Image_Length=" + tempIslandY + "");
  99.                                                             //for leftleft two conditions: if before leftwards ending any box is below
  100.                                                             DataRow[] drLeftTop = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and " +
  101.                                                                 "Starting_Y<" + tempIslandY + " and " +
  102.                                                                 "Starting_Y+Image_Length>=" + tempIslandY + "");
  103.                                                             DataRow[] drRight= dtCurrentPattern.Select("Starting_X<=" + tempIslandX + " and " +
  104.                                                                 "Starting_X+Image_Length>" + tempIslandY + " and " +
  105.                                                                 "Starting_Y=" + tempIslandY + "");
  106.                                                             if (drLeftBottom.Length>0)
  107.                                                             {
  108.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_X"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Width"])) + " and" +
  109.                                                                     " Starting_Y>" + tempIslandY + " and " +
  110.                                                                     " Starting_Y<=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Length"])) + "");
  111.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  112.                                                                 if(drParallelDown.Length>0)
  113.                                                                 {
  114.                                                                     islandCurrentX = tempIslandX;
  115.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  116.                                                                     direction = "Right";
  117.                                                                 }
  118.                                                                 else
  119.                                                                 {
  120.                                                                     islandCurrentX = tempIslandX;
  121.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"])+ DataHelper.GetInt(drLeftBottom[0]["Image_Length"]));
  122.                                                                     direction = "Down";
  123.                                                                 }
  124.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  125.                                                             }
  126.                                                             else if(tempIslandX==0)
  127.                                                             {
  128.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and" +
  129.                                                                     " Starting_Y>" + tempIslandY + " " +
  130.                                                                     " ");
  131.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  132.                                                                 if (drParallelDown.Length > 0)
  133.                                                                 {
  134.                                                                     islandCurrentX = tempIslandX;
  135.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  136.                                                                     direction = "Right";
  137.                                                                 }
  138.                                                                 else
  139.                                                                 {
  140.                                                                     islandCurrentX = tempIslandX;
  141.                                                                     islandCurrentY = pictureBox2.Height;
  142.                                                                     direction = "Right";//"Right"Prevold
  143.                                                                 }
  144.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  145.                                                             }
  146.                                                             else if(drLeftLeft.Length>0)
  147.                                                             {
  148.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_Y"]) + DataHelper.GetInt(drLeftLeft[0]["Image_Length"])) + " and" +
  149.                                                                     " Starting_X<" + tempIslandX + " and " +
  150.                                                                     " Starting_X>=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_X"])) + "");
  151.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"])+ DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  152.                                                                 if (drParallelLeft.Length > 0)
  153.                                                                 {
  154.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"])+ DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  155.                                                                     islandCurrentY = tempIslandY;
  156.                                                                     direction = "Down";
  157.                                                                 }
  158.                                                                 else
  159.                                                                 {
  160.                                                                     islandCurrentX = (DataHelper.GetInt(drLeftLeft[0]["Starting_X"]) );
  161.                                                                     islandCurrentY = tempIslandY;
  162.                                                                 }
  163.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  164.                                                             }
  165.                                                             else if (tempIslandY == 0)
  166.                                                             {
  167.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + tempIslandY + " and" +
  168.                                                                     " Starting_X<" + tempIslandX + "");
  169.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  170.                                                                 if (drParallelLeft.Length > 0)
  171.                                                                 {
  172.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"]) + DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  173.                                                                     islandCurrentY = tempIslandY;
  174.                                                                     direction = "Down";
  175.                                                                 }
  176.                                                                 else
  177.                                                                 {
  178.                                                                     islandCurrentX = 0;
  179.                                                                     islandCurrentY = tempIslandY;
  180.                                                                     direction = "Down";
  181.                                                                 }
  182.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  183.                                                             }
  184.                                                             else if (drLeftTop.Length > 0)
  185.                                                             {
  186.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + (DataHelper.GetInt(drLeftTop[0]["Starting_X"])) + " and" +
  187.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " and " +
  188.                                                                     " Starting_Y+Image_Length>=" + (DataHelper.GetInt(drLeftTop[0]["Starting_Y"])) + "");
  189.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  190.                                                                 if (drParallellTop.Length > 0)
  191.                                                                 {
  192.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  193.                                                                     //direction = "Down";
  194.                                                                     direction = "Up";
  195.                                                                     islandCurrentX = tempIslandX;
  196.                                                                 }
  197.                                                                 else
  198.                                                                 {
  199.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftTop[0]["Starting_Y"]));
  200.                                                                     islandCurrentX = tempIslandX;
  201.                                                                     //direction = "Right";//old
  202.                                                                     direction = "Left";
  203.                                                                 }
  204.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  205.                                                             }
  206.                                                             else if (tempIslandX==pictureBox2.Width)
  207.                                                             {
  208.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and" +
  209.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " ");
  210.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  211.                                                                 if (drParallellTop.Length > 0)
  212.                                                                 {
  213.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  214.                                                                     //direction = "Down";
  215.                                                                     direction = "Up";
  216.                                                                     islandCurrentX = tempIslandX;
  217.                                                                 }
  218.                                                                 else
  219.                                                                 {
  220.                                                                     islandCurrentY = 0;
  221.                                                                     islandCurrentX = tempIslandX;
  222.                                                                     direction = "Left";
  223.                                                                 }
  224.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  225.                                                             }
  226.                                                             //else if (drRight.Length > 0)
  227.                                                             //{
  228.                                                             //    DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + (DataHelper.GetInt(drRight[0]["Starting_Y"]) + DataHelper.GetInt(drRight[0]["Image_Length"])) + " and" +
  229.                                                             //        " Starting_X>" + tempIslandX + " and " +
  230.                                                             //        " Starting_X<=" + (DataHelper.GetInt(drRight[0]["Starting_X"])+ DataHelper.GetInt(drRight[0]["Image_Width"])) + "");
  231.                                                             //    drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  232.                                                             //    if (drParallelRight.Length > 0)
  233.                                                             //    {
  234.                                                             //        islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]) );
  235.                                                             //        islandCurrentY = tempIslandY;
  236.                                                             //        direction = "Up";
  237.                                                             //    }
  238.                                                             //    else
  239.                                                             //    {
  240.                                                             //        islandCurrentX = (DataHelper.GetInt(drRight[0]["Starting_X"])+ DataHelper.GetInt(drRight[0]["Image_Length"]));
  241.                                                             //        islandCurrentY = tempIslandY;
  242.                                                             //        direction = "Right";
  243.                                                             //    }
  244.                                                             //    points.Add(new Point(islandCurrentX, islandCurrentY));
  245.                                                             //}
  246.                                                             //else if (tempIslandY == pictureBox2.Height)
  247.                                                             //{
  248.                                                             //    DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + pictureBox2.Height + " and" +
  249.                                                             //        " Starting_X>" + tempIslandX + " ");
  250.                                                             //    drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  251.                                                             //    if (drParallelRight.Length > 0)
  252.                                                             //    {
  253.                                                             //        islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  254.                                                             //        islandCurrentY = tempIslandY;
  255.                                                             //        direction = "Up";
  256.                                                             //    }
  257.                                                             //    else
  258.                                                             //    {
  259.                                                             //        islandCurrentX = pictureBox2.Width;
  260.                                                             //        islandCurrentY = tempIslandY;
  261.                                                             //        direction = "Right";
  262.                                                             //    }
  263.                                                             //    points.Add(new Point(islandCurrentX, islandCurrentY));
  264.                                                             //}
  265.                                                             else
  266.                                                             {
  267.                                                                 direction = "Down";
  268.                                                             }
  269.  
  270.                                                         }
  271.                                                         #region Down
  272.                                                         else if(direction=="Down")
  273.                                                         {
  274.                                                             DataRow[] drRight = dtCurrentPattern.Select("Starting_X<=" + tempIslandX + " and " +
  275.                                                                 "Starting_X+Image_Width>" + tempIslandX + " and " +
  276.                                                                 "Starting_Y=" + tempIslandY + "");
  277.                                                             DataRow[] drLeftBottom = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and " +
  278.                                                                 "Starting_Y<=" + tempIslandY + " and " +
  279.                                                                 "Starting_Y+Image_Length>" + tempIslandY + "");
  280.                                                             //drLeftBottom = drLeftBottom.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  281.                                                             //DataRow[] drLeftBottomDownwards = dtCurrentPattern.Select("");//inside ifdrlb>0
  282.                                                             DataRow[] drLeftLeft = dtCurrentPattern.Select("Starting_X<" + tempIslandX + " and " +
  283.                                                                 "Starting_X+Image_Width>=" + tempIslandX + " and " +
  284.                                                                 "Starting_Y+Image_Length=" + tempIslandY + "");
  285.                                                             //for leftleft two conditions: if before leftwards ending any box is below
  286.                                                             if (drRight.Length > 0)
  287.                                                             {
  288.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + (DataHelper.GetInt(drRight[0]["Starting_Y"]) ) + " and" +//dtCurrentPattern.Select("Starting_Y+Image_Length=" + (DataHelper.GetInt(drRight[0]["Starting_Y"]) + DataHelper.GetInt(drRight[0]["Image_Length"])) + " and" +" Starting_X>" + tempIslandX + " and " +" Starting_X<=" + (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"])) + "")
  289.                                                                     " Starting_X>" + tempIslandX + " and " +
  290.                                                                     " Starting_X<=" + (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"])) + "");
  291.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  292.                                                                 if (drParallelRight.Length > 0)
  293.                                                                 {
  294.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  295.                                                                     islandCurrentY = tempIslandY;
  296.                                                                     direction = "Up";
  297.                                                                 }
  298.                                                                 else
  299.                                                                 {
  300.                                                                     islandCurrentX = (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"]));
  301.                                                                     islandCurrentY = tempIslandY;
  302.                                                                     direction = "Right";
  303.                                                                 }
  304.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  305.                                                             }
  306.                                                             else if (tempIslandY == pictureBox2.Height)
  307.                                                             {
  308.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + pictureBox2.Height + " and" +
  309.                                                                     " Starting_X>" + tempIslandX + " ");
  310.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  311.                                                                 if (drParallelRight.Length > 0)
  312.                                                                 {
  313.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  314.                                                                     islandCurrentY = tempIslandY;
  315.                                                                     direction = "Up";
  316.                                                                 }
  317.                                                                 else
  318.                                                                 {
  319.                                                                     islandCurrentX = pictureBox2.Width;
  320.                                                                     islandCurrentY = tempIslandY;
  321.                                                                     direction = "Right";
  322.                                                                 }
  323.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  324.                                                             }
  325.                                                             else if (drLeftBottom.Length > 0)
  326.                                                             {
  327.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_X"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Width"])) + " and" +
  328.                                                                     " Starting_Y>" + tempIslandY + " and " +
  329.                                                                     " Starting_Y<=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Length"])) + "");
  330.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  331.                                                                 if (drParallelDown.Length > 0)
  332.                                                                 {
  333.                                                                     islandCurrentX = tempIslandX;
  334.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  335.                                                                     direction = "Right";
  336.                                                                 }
  337.                                                                 else
  338.                                                                 {
  339.                                                                     islandCurrentX = tempIslandX;
  340.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Length"]));
  341.                                                                     direction = "Down";
  342.                                                                 }
  343.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  344.                                                             }
  345.                                                             else if (tempIslandX == 0)
  346.                                                             {
  347.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and" +
  348.                                                                     " Starting_Y>" + tempIslandY + " " +
  349.                                                                     " ");
  350.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  351.                                                                 if (drParallelDown.Length > 0)
  352.                                                                 {
  353.                                                                     islandCurrentX = tempIslandX;
  354.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  355.                                                                     direction = "Right";
  356.                                                                 }
  357.                                                                 else
  358.                                                                 {
  359.                                                                     islandCurrentX = tempIslandX;
  360.                                                                     islandCurrentY = pictureBox2.Height;
  361.                                                                     direction = "Right";
  362.                                                                 }
  363.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  364.                                                             }
  365.                                                             else if (drLeftLeft.Length > 0)
  366.                                                             {
  367.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_Y"]) + DataHelper.GetInt(drLeftLeft[0]["Image_Length"])) + " and" +
  368.                                                                     " Starting_X<" + tempIslandX + " and " +
  369.                                                                     " Starting_X>=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_X"])) + "");
  370.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  371.                                                                 if (drParallelLeft.Length > 0)
  372.                                                                 {
  373.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"]) + DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  374.                                                                     islandCurrentY = tempIslandY;
  375.                                                                     direction = "Down";
  376.                                                                 }
  377.                                                                 else
  378.                                                                 {
  379.                                                                     islandCurrentX = (DataHelper.GetInt(drLeftLeft[0]["Starting_X"]));
  380.                                                                     islandCurrentY = tempIslandY;
  381.                                                                 }
  382.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  383.                                                             }
  384.                                                             else if (tempIslandY == 0)
  385.                                                             {
  386.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + tempIslandY + " and" +
  387.                                                                     " Starting_X<" + tempIslandX + "");
  388.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  389.                                                                 if (drParallelLeft.Length > 0)
  390.                                                                 {
  391.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"]) + DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  392.                                                                     islandCurrentY = tempIslandY;
  393.                                                                     direction = "Down";
  394.                                                                 }
  395.                                                                 else
  396.                                                                 {
  397.                                                                     islandCurrentX = 0;
  398.                                                                     islandCurrentY = tempIslandY;
  399.                                                                     direction = "Down";
  400.                                                                 }
  401.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  402.                                                             }
  403.                                                             else
  404.                                                             {
  405.                                                                 direction = "Right";
  406.                                                             }
  407.                                                         }
  408.                                                         #endregion
  409.                                                         #region Right
  410.                                                         else if(direction=="Right")
  411.                                                         {
  412.                                                             DataRow[] drLeftTop = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and " +
  413.                                                                "Starting_Y<" + tempIslandY + " and " +
  414.                                                                "Starting_Y+Image_Length>=" + tempIslandY + "");
  415.                                                             DataRow[] drRight = dtCurrentPattern.Select("Starting_X<=" + tempIslandX + " and " +
  416.                                                                 "Starting_X+Image_Width>" + tempIslandX + " and " +
  417.                                                                 "Starting_Y=" + tempIslandY + "");
  418.                                                             DataRow[] drLeftBottom = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and " +
  419.                                                                                                                             "Starting_Y<=" + tempIslandY + " and " +
  420.                                                                                                                             "Starting_Y+Image_Length>" + tempIslandY + "");
  421.                                                             if (drLeftTop.Length > 0)
  422.                                                             {
  423.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + (DataHelper.GetInt(drLeftTop[0]["Starting_X"])) + " and" +
  424.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " and " +
  425.                                                                     " Starting_Y+Image_Length>=" + (DataHelper.GetInt(drLeftTop[0]["Starting_Y"])) + "");
  426.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  427.                                                                 if (drParallellTop.Length > 0)
  428.                                                                 {
  429.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  430.                                                                     direction = "Up";
  431.                                                                     islandCurrentX = tempIslandX;
  432.                                                                 }
  433.                                                                 else
  434.                                                                 {
  435.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftTop[0]["Starting_Y"]));
  436.                                                                     islandCurrentX = tempIslandX;
  437.                                                                     //direction="Right";//old
  438.                                                                     direction = "Left";
  439.                                                                 }
  440.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  441.                                                             }
  442.                                                             else if (tempIslandX == pictureBox2.Width)
  443.                                                             {
  444.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and" +
  445.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " ");
  446.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  447.                                                                 if (drParallellTop.Length > 0)
  448.                                                                 {
  449.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  450.                                                                     //direction = "Down";
  451.                                                                     direction = "Up";
  452.                                                                     islandCurrentX = tempIslandX;
  453.                                                                 }
  454.                                                                 else
  455.                                                                 {
  456.                                                                     islandCurrentY = 0;
  457.                                                                     islandCurrentX = tempIslandX;
  458.                                                                     direction = "Left";
  459.                                                                 }
  460.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  461.                                                             }
  462.                                                             else if (drRight.Length > 0)
  463.                                                             {
  464.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + (DataHelper.GetInt(drRight[0]["Starting_Y"]) ) + " and" +//+ DataHelper.GetInt(drRight[0]["Image_Length"])
  465.                                                                     " Starting_X>" + tempIslandX + " and " +
  466.                                                                     " Starting_X<=" + (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"])) + "");
  467.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  468.                                                                 if (drParallelRight.Length > 0)
  469.                                                                 {
  470.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  471.                                                                     islandCurrentY = tempIslandY;
  472.                                                                     direction = "Up";
  473.                                                                 }
  474.                                                                 else
  475.                                                                 {
  476.                                                                     islandCurrentX = (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"]));
  477.                                                                     islandCurrentY = tempIslandY;
  478.                                                                     direction = "Right";
  479.                                                                 }
  480.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  481.                                                             }
  482.                                                             else if (tempIslandY == pictureBox2.Height)
  483.                                                             {
  484.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + pictureBox2.Height + " and" +
  485.                                                                     " Starting_X>" + tempIslandX + " ");
  486.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  487.                                                                 if (drParallelRight.Length > 0)
  488.                                                                 {
  489.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  490.                                                                     islandCurrentY = tempIslandY;
  491.                                                                     direction = "Up";
  492.                                                                 }
  493.                                                                 else
  494.                                                                 {
  495.                                                                     islandCurrentX = pictureBox2.Width;
  496.                                                                     islandCurrentY = tempIslandY;
  497.                                                                     direction = "Right";
  498.                                                                 }
  499.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  500.                                                             }
  501.                                                             else if (drLeftBottom.Length > 0)
  502.                                                             {
  503.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_X"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Width"])) + " and" +
  504.                                                                     " Starting_Y>" + tempIslandY + " and " +
  505.                                                                     " Starting_Y<=" + (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Length"])) + "");
  506.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  507.                                                                 if (drParallelDown.Length > 0)
  508.                                                                 {
  509.                                                                     islandCurrentX = tempIslandX;
  510.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  511.                                                                     direction = "Right";
  512.                                                                 }
  513.                                                                 else
  514.                                                                 {
  515.                                                                     islandCurrentX = tempIslandX;
  516.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftBottom[0]["Starting_Y"]) + DataHelper.GetInt(drLeftBottom[0]["Image_Length"]));
  517.                                                                     direction = "Down";
  518.                                                                 }
  519.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  520.                                                             }
  521.                                                             else if (tempIslandX == 0)
  522.                                                             {
  523.                                                                 DataRow[] drParallelDown = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and" +
  524.                                                                     " Starting_Y>" + tempIslandY + " " +
  525.                                                                     " ");
  526.                                                                 drParallelDown = drParallelDown.OrderBy(row => DataHelper.GetInt(row["Starting_Y"])).ToArray<DataRow>();
  527.                                                                 if (drParallelDown.Length > 0)
  528.                                                                 {
  529.                                                                     islandCurrentX = tempIslandX;
  530.                                                                     islandCurrentY = DataHelper.GetInt(drParallelDown[0]["Starting_Y"]);
  531.                                                                     direction = "Right";
  532.                                                                 }
  533.                                                                 else
  534.                                                                 {
  535.                                                                     islandCurrentX = tempIslandX;
  536.                                                                     islandCurrentY = pictureBox2.Height;
  537.                                                                     direction = "Right";
  538.                                                                 }
  539.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  540.                                                             }
  541.                                                             else
  542.                                                             {
  543.                                                                 direction = "Up";
  544.                                                             }
  545.                                                         }
  546.                                                         #endregion
  547.                                                         else if(direction=="Up")
  548.                                                         {
  549.                                                             DataRow[] drLeftLeft = dtCurrentPattern.Select("Starting_X<" + tempIslandX + " and " +
  550.                                                                 "Starting_X+Image_Width>=" + tempIslandX + " and " +
  551.                                                                 "Starting_Y+Image_Length=" + tempIslandY + "");
  552.                                                             DataRow[] drLeftTop = dtCurrentPattern.Select("Starting_X=" + tempIslandX + " and " +
  553.                                                                "Starting_Y<" + tempIslandY + " and " +
  554.                                                                "Starting_Y+Image_Length>=" + tempIslandY + "");
  555.                                                             DataRow[] drRight = dtCurrentPattern.Select("Starting_X<=" + tempIslandX + " and " +
  556.                                                                 "Starting_X+Image_Width>" + tempIslandX + " and " +
  557.                                                                 "Starting_Y=" + tempIslandY + "");
  558.                                                             if (drLeftLeft.Length > 0)
  559.                                                             {
  560.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_Y"]) + DataHelper.GetInt(drLeftLeft[0]["Image_Length"])) + " and" +
  561.                                                                     " Starting_X<" + tempIslandX + " and " +
  562.                                                                     " Starting_X>=" + (DataHelper.GetInt(drLeftLeft[0]["Starting_X"])) + "");
  563.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  564.                                                                 if (drParallelLeft.Length > 0)
  565.                                                                 {
  566.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"]) + DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  567.                                                                     islandCurrentY = tempIslandY;
  568.                                                                     direction = "Down";
  569.                                                                 }
  570.                                                                 else
  571.                                                                 {
  572.                                                                     islandCurrentX = (DataHelper.GetInt(drLeftLeft[0]["Starting_X"]));
  573.                                                                     islandCurrentY = tempIslandY;
  574.                                                                 }
  575.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  576.                                                             }
  577.                                                             else if (tempIslandY == 0)
  578.                                                             {
  579.                                                                 DataRow[] drParallelLeft = dtCurrentPattern.Select("Starting_Y=" + tempIslandY + " and" +
  580.                                                                     " Starting_X<" + tempIslandX + "");
  581.                                                                 drParallelLeft = drParallelLeft.OrderByDescending(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  582.                                                                 if (drParallelLeft.Length > 0)
  583.                                                                 {
  584.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelLeft[0]["Starting_X"]) + DataHelper.GetInt(drParallelLeft[0]["Image_Width"]));
  585.                                                                     islandCurrentY = tempIslandY;
  586.                                                                     direction = "Down";
  587.                                                                 }
  588.                                                                 else
  589.                                                                 {
  590.                                                                     islandCurrentX = 0;
  591.                                                                     islandCurrentY = tempIslandY;
  592.                                                                     direction = "Down";
  593.                                                                 }
  594.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  595.                                                             }
  596.                                                             else if (drLeftTop.Length > 0)
  597.                                                             {
  598.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + (DataHelper.GetInt(drLeftTop[0]["Starting_X"])) + " and" +
  599.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " and " +
  600.                                                                     " Starting_Y+Image_Length>=" + (DataHelper.GetInt(drLeftTop[0]["Starting_Y"])) + "");
  601.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  602.                                                                 if (drParallellTop.Length > 0)
  603.                                                                 {
  604.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  605.                                                                     //direction = "Down";
  606.                                                                     direction = "Up";
  607.                                                                     islandCurrentX = tempIslandX;
  608.                                                                 }
  609.                                                                 else
  610.                                                                 {
  611.                                                                     islandCurrentY = (DataHelper.GetInt(drLeftTop[0]["Starting_Y"]));
  612.                                                                     islandCurrentX = tempIslandX;
  613.                                                                     //direction = "Right";//old
  614.                                                                     direction = "Left";
  615.                                                                 }
  616.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  617.                                                             }
  618.                                                             else if (tempIslandX == pictureBox2.Width)
  619.                                                             {
  620.                                                                 DataRow[] drParallellTop = dtCurrentPattern.Select("Starting_X+Image_Width=" + tempIslandX + " and" +
  621.                                                                     " Starting_Y+Image_Length<" + tempIslandY + " ");
  622.                                                                 drParallellTop = drParallellTop.OrderByDescending(row => (DataHelper.GetInt(row["Starting_Y"]) + DataHelper.GetInt(row["Image_Length"]))).ToArray<DataRow>();
  623.                                                                 if (drParallellTop.Length > 0)
  624.                                                                 {
  625.                                                                     islandCurrentY = (DataHelper.GetInt(drParallellTop[0]["Starting_Y"]) + DataHelper.GetInt(drParallellTop[0]["Image_Length"]));
  626.                                                                     //direction = "Down";
  627.                                                                     direction = "Up";
  628.                                                                     islandCurrentX = tempIslandX;
  629.                                                                 }
  630.                                                                 else
  631.                                                                 {
  632.                                                                     islandCurrentY = 0;
  633.                                                                     islandCurrentX = tempIslandX;
  634.                                                                     direction = "Left";
  635.                                                                 }
  636.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  637.                                                             }
  638.                                                             else if (drRight.Length > 0)
  639.                                                             {
  640.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + (DataHelper.GetInt(drRight[0]["Starting_Y"]) ) + " and" +//+ DataHelper.GetInt(drRight[0]["Image_Length"])
  641.                                                                     " Starting_X>" + tempIslandX + " and " +
  642.                                                                     " Starting_X<=" + (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"])) + "");
  643.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  644.                                                                 if (drParallelRight.Length > 0)
  645.                                                                 {
  646.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  647.                                                                     islandCurrentY = tempIslandY;
  648.                                                                     direction = "Up";
  649.                                                                 }
  650.                                                                 else
  651.                                                                 {
  652.                                                                     islandCurrentX = (DataHelper.GetInt(drRight[0]["Starting_X"]) + DataHelper.GetInt(drRight[0]["Image_Width"]));
  653.                                                                     islandCurrentY = tempIslandY;
  654.                                                                     direction = "Right";
  655.                                                                 }
  656.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  657.                                                             }
  658.                                                             else if (tempIslandY > pictureBox2.Height)
  659.                                                             {
  660.                                                                 DataRow[] drParallelRight = dtCurrentPattern.Select("Starting_Y+Image_Length=" + pictureBox2.Height + " and" +
  661.                                                                     " Starting_X>" + tempIslandX + " ");
  662.                                                                 drParallelRight = drParallelRight.OrderBy(row => (DataHelper.GetInt(row["Starting_X"]) + DataHelper.GetInt(row["Image_Width"]))).ToArray<DataRow>();
  663.                                                                 if (drParallelRight.Length > 0)
  664.                                                                 {
  665.                                                                     islandCurrentX = (DataHelper.GetInt(drParallelRight[0]["Starting_X"]));
  666.                                                                     islandCurrentY = tempIslandY;
  667.                                                                     direction = "Up";
  668.                                                                 }
  669.                                                                 else
  670.                                                                 {
  671.                                                                     islandCurrentX = pictureBox2.Width;
  672.                                                                     islandCurrentY = tempIslandY;
  673.                                                                     direction = "Right";
  674.                                                                 }
  675.                                                                 points.Add(new Point(islandCurrentX, islandCurrentY));
  676.                                                             }
  677.                                                             else
  678.                                                             {
  679.                                                                 direction = "Left";
  680.                                                             }
  681.                                                         }
  682.                                                        
  683.                                                         else
  684.                                                         {
  685.                                                             break;
  686.                                                         }
  687.                                                         pth += "\n(" + islandCurrentX + "," + islandCurrentY + "):"+ oldDirection+"->" + direction;
  688.                                                     }
  689.                                                     //points.Add(new Point(islandStartX, islandStartY));
  690.                                                     //points = points.Distinct().ToList<Point>();
  691.                                                     string pts = "";
  692.                                                     foreach(Control control in pictureBox2.Controls)
  693.                                                     {
  694.                                                         if(control.Name=="xy")
  695.                                                         {
  696.                                                             pictureBox2.Controls.Remove(control);
  697.                                                         }
  698.                                                     }
  699.                                                     foreach (Point p in points)
  700.                                                     {
  701.                                                         Label lbl = new Label();
  702.                                                         lbl.Name = "xy";
  703.                                                         lbl.AutoSize = true;
  704.                                                         lbl.Text= "(" + p.X + "," + p.Y + ")";
  705.                                                         lbl.Top = p.Y;
  706.                                                         lbl.Left = p.X;
  707.                                                         //pictureBox2.Controls.Add(lbl);
  708.                                                         //lbl.BringToFront();
  709.                                                         pts += "(" + p.X + "," + p.Y + ")";
  710.                                                     }
  711.                                                     //currentIsland.Region = points;
  712.                                                     currentIsland.Width = pictureBox2.Width;
  713.                                                     currentIsland.Height = pictureBox2.Height;
  714.                                                     using (GraphicsPath gp = new GraphicsPath())
  715.                                                     {
  716.                                                         gp.AddClosedCurve(points.ToArray());//correct
  717.                                                         currentIsland.Region = new Region(gp);//correct
  718.                                                     }
  719.                                                     currentIsland.BringToFront();
  720.                                                     currentIsland.points = points;//correct
  721.                                                     currentIsland.Invalidate();//correct
  722.                                                     //MessageBox.Show("region length:" + pts);
  723.                                                     //MessageBox.Show("region :" + pth);
  724.                                                     #endregion
Add Comment
Please, Sign In to add comment