Esempio n. 1
0
        private void recalculateFieldsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string dir = FolderBrowser("Select folder with metadata txt for recalculation");

            if (dir == null)
            {
                return;
            }

            //find all .txt files in the directory
            List <string> dirs = FileDecoder.TakeFileNames(dir);

            //System.Windows.Forms.MessageBox.Show(string.Join("\n", dirs));
            data.fileNames = dirs.ToArray();

            //find all strings with "Move XY"
            string[] cornerInfo = FileDecoder.readFields(dirs);
            //System.Windows.Forms.MessageBox.Show(string.Join("\n", cornerInfo));

            //calculate points
            data.dataPoint = CornerReader.CalculatePoints(cornerInfo);

            if (data.dataPoint == null || data.afterPoint == null ||
                data.beforePoint == null)
            {
                return;
            }

            //Load data

            FieldCalculation.RecalculateFields(data);
            //save data
            dataForm.Hide();
            dataForm.Show();
        }
Esempio n. 2
0
        private void loadCornersAfterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string dir = FolderBrowser("Select folder with metadata txt - after");

            if (dir == null)
            {
                return;
            }

            //find all .txt files in the directory
            List <string> dirs = FileDecoder.TakeFileNames(dir);

            //System.Windows.Forms.MessageBox.Show(string.Join("\n", dirs));

            //find all strings with "Move XY"
            string[] cornerInfo = FileDecoder.readCorners(dirs);
            //System.Windows.Forms.MessageBox.Show(string.Join("\n", cornerInfo));

            //calculate points
            data.afterPoint = CornerReader.ReorderPoints(CornerReader.CalculatePoints(cornerInfo));

            if (data.afterPoint == null)
            {
                return;
            }
            //Load data
            nX1.Text = "X: " + data.afterPoint[0].X.ToString();
            nX2.Text = "X: " + data.afterPoint[1].X.ToString();
            nX3.Text = "X: " + data.afterPoint[2].X.ToString();
            nX4.Text = "X: " + data.afterPoint[3].X.ToString();

            nY1.Text = "Y: " + data.afterPoint[0].Y.ToString();
            nY2.Text = "Y: " + data.afterPoint[1].Y.ToString();
            nY3.Text = "Y: " + data.afterPoint[2].Y.ToString();
            nY4.Text = "Y: " + data.afterPoint[3].Y.ToString();

            FieldCalculation.FindCompensations(data);

            translationX.Text = "X: " + data.dX.ToString();
            translationY.Text = "Y: " + data.dY.ToString();
            rotAngle.Text     = (-data.angle * (180 / Math.PI)).ToString() + "°";
        }