/// <summary> /// Marks the triangles picked in the visualization. /// </summary> /// <param name="selected">List of the selected triangles</param> /// <param name="additive">If true, the <paramref name="selected"/> triangles will be selected /// in addition to the previously selected ones. Selecting a triangle twice deselects it.</param> public void PickTriangle(List <int> selected, bool additive) { if (additive) { if (selected.Count > 0) { for (int i = 0; i < normalListView.Items.Count; i++) { if ((int)normalListView.Items[i].Tag == selected[0]) { if (normalListView.SelectedIndices.Contains(normalListView.Items.IndexOf(normalListView.Items[i]))) { normalListView.SelectedIndices.Remove(normalListView.Items.IndexOf(normalListView.Items[i])); } else { normalListView.SelectedIndices.Add(normalListView.Items.IndexOf(normalListView.Items[i])); } } } } } else { if (selected.Count > 0) { normalListView.SelectedItems.Clear(); for (int i = 0; i < normalListView.Items.Count; i++) { if ((int)normalListView.Items[i].Tag == selected[0]) { normalListView.SelectedIndices.Add(normalListView.Items.IndexOf(normalListView.Items[i])); } } } else { normalListView.SelectedItems.Clear(); currentSelection.Clear(); visualization.SetColorArray(); visualization.Refresh(); } } if (normalListView.SelectedItems.Count > 0) { normalListView.TopItem = normalListView.SelectedItems[0]; } else { normalListView.TopItem = normalListView.Items[0]; } }
/// <summary> /// Updates the rotationOriginTextBox and the origin, /// when the value of the originTrackBar is changed and refreshes the NormalSwitcherControl. /// </summary> /// <param name="sender">originTrackBar</param> /// <param name="e">Standard EventArgs</param> private void OriginTrackBar_ValueChanged(object sender, EventArgs e) { origin = originTrackBar.Value; rotationOriginTextBox.Text = origin.ToString(); visualization.Refresh(); }
/// <summary> /// Updates the rotationOriginTextBox and the origin, /// when the value of the originTrackBar is changed and refreshes the NormalSwitcherControl. /// </summary> /// <param name="sender">originTrackBar</param> /// <param name="e">Standard EventArgs</param> private void OriginTrackBar_ValueChanged(object sender, EventArgs e) { origin = triangleList.Scale * originTrackBar.Value / 100; rotationOriginTextBox.Text = originTrackBar.Value.ToString(); visualization.Refresh(); }