Пример #1
0
        } // end of RestoreInitialImage

        private bool GetNewData()
        {
            string         strinputfile, text;
            ArrayList      coorddata = new ArrayList();
            ArrayList      linesdata = new ArrayList();
            OpenFileDialog opendlg   = new OpenFileDialog();

            opendlg.Title = "Choose File with Coordinates of Points";
            if (opendlg.ShowDialog() == DialogResult.OK)
            {
                strinputfile = opendlg.FileName;
                FileInfo     coordfile = new FileInfo(strinputfile);
                StreamReader reader    = coordfile.OpenText();
                do
                {
                    text = reader.ReadLine();
                    if (text != null)
                    {
                        coorddata.Add(text);
                    }
                } while (text != null);
                reader.Close();
                coorddata.RemoveAt(coorddata.Count - 1);
                DecodeCoords(coorddata);
            }
            else
            {
                MessageBox.Show("***Failed to Open Coordinates File***");
                return(false);
            }

            opendlg.Title = "Choose File with Data Specifying Lines";
            if (opendlg.ShowDialog() == DialogResult.OK)
            {
                strinputfile = opendlg.FileName;
                FileInfo     linesfile = new FileInfo(strinputfile);
                StreamReader reader    = linesfile.OpenText();
                do
                {
                    text = reader.ReadLine();
                    if (text != null)
                    {
                        linesdata.Add(text);
                    }
                } while (text != null);
                reader.Close();
                DecodeLines(linesdata);
            }
            else
            {
                MessageBox.Show("***Failed to Open Line Data File***");
                return(false);
            }
            _scrnpts = new double[_numpts, 4];
            Transformations.SetIdentity(_tnet, 4, 4);  //initialize transformation matrix to identity
            return(true);
        } // end of GetNewData
Пример #2
0
        private void RestoreInitialImage()
        {
            //create the screen coordinates:
            // scrnpts = vertices*ctrans
            if (_gooddata)
            {
                Transformations.SetIdentity(_tnet, 4, 4);
                _tnet = Transformations.TranslateToOrigin(_vertices, _tnet);
                _tnet = Transformations.ReflectOnYAxis(_tnet);
                _tnet = Transformations.ScaleToIntial(_vertices, _tnet, this.ClientRectangle.Height);

                _tnet = Transformations.TranslateToCenter(_tnet, this.ClientRectangle.Width, this.ClientRectangle.Height);

                Transformations.PrintMatrix(_tnet);
                Invalidate();
            }
        } // end of RestoreInitialImage