/// <summary>
        /// Initializes the NormalSwitcherForm and opens the file given by <paramref name="file"/>
        /// </summary>
        /// <param name="file">Path of the file to be displayed</param>
        public NormalSwitcherForm(string file)
        {
            InitializeComponent();

            undoButton.EnabledChanged += new EventHandler(Undo_EnabledChanged);
            allButton.EnabledChanged  += new EventHandler(FileCondition_EnabledChanged);

            StreamReader reader = new StreamReader(file);

            try {
                parser.Parse(reader);
                normalArray   = SwitchersHelpers.ExpandNormalArray(parser.NormalArray);
                vertexArray   = SwitchersHelpers.NormalizeVertexArray(parser.VertexArray, parser.Min, parser.Scale);
                backupNormals = new float[parser.NormalArray.Length];
                parser.NormalArray.CopyTo(backupNormals, 0);
                originTrackBar.Minimum     = -(int)(parser.Scale / 2);
                originTrackBar.Maximum     = (int)(parser.Scale / 2);
                originTrackBar.Value       = origin = 0;
                rotationOriginTextBox.Text = origin.ToString();
                originTrackBar.Visible     = true;
                InitVisualization();
                visualization.SetColorArray();

                currentFile       = file;
                allButton.Enabled = true;

                FillListView();
            } catch (Exception exception) {
                MessageBox.Show(exception.Message, "Error");
            } finally {
                reader.Close();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Sets the colorArray of the visualization and refreshes the visualization.
 /// </summary>
 internal void RefreshVisualization()
 {
     visualization.SetColorArray();
     visualization.Fresh = true;
 }