Esempio n. 1
0
        private List <PolyLine> getAllInsideLines()
        {
            List <System.Windows.Shapes.Line> insideLines = PolyLine.getAllLines(getInsideLines());
            List <System.Windows.Shapes.Line> allLines    = new List <System.Windows.Shapes.Line>();
            bool top  = false;
            bool left = qtyY_ % 2 == 1;

            for (int i = left ? 0 : qtyX_ - 1; left?i < qtyX_ : i >= 0; i += left ? 1 : -1)
            {
                for (int j = top ? 0 : qtyY_ - 1; top?j < qtyY_ : j >= 0; j += top ? 1 : -1)
                {
                    foreach (System.Windows.Shapes.Line line in insideLines)
                    {
                        System.Windows.Shapes.Line newLine = new System.Windows.Shapes.Line();
                        newLine.X1 = line.X1 + i * outside_.Width;
                        newLine.X2 = line.X2 + i * outside_.Width;
                        newLine.Y1 = line.Y1 + j * outside_.Height;
                        newLine.Y2 = line.Y2 + j * outside_.Height;
                        //insideLines.Add(newLine);
                        allLines.Add(newLine);
                    }
                }
                top = !top;
            }
            return(PolyLine.convertLinesToPolyLines(allLines));
            //return allLines;
        }
Esempio n. 2
0
 private void updatePicture(PaintEventArgs e)
 {
     try
     {
         updateCut();
         pictureBox1.Height = (int)(pictureBox1.Width * Machine.TOTAL_HEIGHT / Machine.TOTAL_WIDTH);
         e.Graphics.Clear(Color.White);
         Pen p = new Pen(Color.Black);
         foreach (System.Windows.Shapes.Line line in PolyLine.getAllLines(cut.getAllLines()))
         {
             System.Drawing.Point p1 = Utility.CONVERT_XY_REAL_TO_POINT(line.X1, line.Y1, pictureBox1.Size);
             System.Drawing.Point p2 = Utility.CONVERT_XY_REAL_TO_POINT(line.X2, line.Y2, pictureBox1.Size);
             e.Graphics.DrawLine(p, p1, p2);
         }
     }
     catch (Exception ex)
     {
         clearCanvas();
         assignCutter();
         System.Windows.MessageBox.Show("Failed to update painting \n" + ex.Message);
     }
 }