• Main Page
  • Packages
  • Classes
  • Files
  • File List

trunk/visLU/Gui/SlicingForm.cs

Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.ComponentModel;
00004 using System.Data;
00005 using System.Drawing;
00006 using System.Linq;
00007 using System.Text;
00008 using System.Windows.Forms;
00009 
00010 namespace visLU2.Gui
00011 {
00015     public partial class SlicingForm : Form
00016     {
00017         InputManager inputManager;
00018 
00019         private MainWindow mainForm;
00020 
00024         public SlicingForm()
00025         {
00026             InitializeComponent();
00027             inputManager = new InputManager();
00028             //XSliceGroup.Enabled = inputManager.enableSliceGroup(1);
00029             //YSliceGroup.Enabled = inputManager.enableSliceGroup(2);
00030             //ZSliceGroup.Enabled = inputManager.enableSliceGroup(3);
00031         }
00032 
00036         public MainWindow MainForm
00037         {
00038             set { mainForm = value; }
00039         }
00040 
00048         public void setSlicingGroups(int slice, Decimal increment, int decimalPlaces, Decimal value)
00049         {
00050             switch (slice)
00051             {
00052                 case 1:
00053                     XSliceNumericUpDown.Increment = increment;
00054                     XSliceNumericUpDown.DecimalPlaces = decimalPlaces;
00055                     XSliceNumericUpDown.Value = value;
00056                     break;
00057                 case 2:
00058                     YSliceNumericUpDown.Increment = increment;
00059                     YSliceNumericUpDown.DecimalPlaces = decimalPlaces;
00060                     YSliceNumericUpDown.Value = value;
00061                     break;
00062                 case 3:
00063                     ZSliceNumericUpDown.Increment = increment;
00064                     ZSliceNumericUpDown.DecimalPlaces = decimalPlaces;
00065                     ZSliceNumericUpDown.Value = value;
00066                     break;
00067                 default:
00068                     break;
00069 
00070             }
00071 
00072         }
00073 
00080         public void setSlicingGroups(int slice, int maximum, int value)
00081         {
00082             switch (slice)
00083             {
00084                 case 1:
00085                     XSlider.Maximum = maximum;
00086                     XSlider.Value = value;
00087                     break;
00088                 case 2:
00089                     YSlider.Maximum = maximum;
00090                     YSlider.Value = value;
00091                     break;
00092                 case 3:
00093                     ZSlider.Maximum = maximum;
00094                     ZSlider.Value = value;
00095                     break;
00096                 default:
00097                     break;
00098 
00099             }
00100 
00101         }
00102 
00103         #region event handler
00104 
00105 
00106 
00107 
00108 
00109         private void handleSliceNumericUpDown(object sender, EventArgs e)
00110         {
00111             if (sender == XSliceNumericUpDown)
00112             {
00113                 XSlider.Value = Decimal.ToInt32(Decimal.Multiply(XSliceNumericUpDown.Value, new Decimal(XSlider.Maximum)));
00114                 inputManager.setSliceValue(1, XSliceNumericUpDown.Value);
00115 
00116             }
00117             else if (sender == YSliceNumericUpDown)
00118             {
00119                 YSlider.Value = Decimal.ToInt32(Decimal.Multiply(YSliceNumericUpDown.Value, new Decimal(YSlider.Maximum)));
00120                 inputManager.setSliceValue(2, YSliceNumericUpDown.Value);
00121 
00122             }
00123             else if (sender == ZSliceNumericUpDown)
00124             {
00125                 ZSlider.Value = Decimal.ToInt32(Decimal.Multiply(ZSliceNumericUpDown.Value, new Decimal(ZSlider.Maximum)));
00126                 inputManager.setSliceValue(3, ZSliceNumericUpDown.Value);
00127 
00128             }
00129         }
00130 
00136         private void handleScrollSlider(object sender, EventArgs e)
00137         {
00138             if (sender == XSlider)
00139             {
00140                 Decimal newValue = Decimal.Divide(new Decimal(XSlider.Value), new Decimal(XSlider.Maximum));
00141                 XSliceNumericUpDown.Value = newValue;
00142                 inputManager.setSliceValue(1, newValue);
00143 
00144             }
00145             else if (sender == YSlider)
00146             {
00147                 Decimal newValue = Decimal.Divide(new Decimal(YSlider.Value), new Decimal(YSlider.Maximum));
00148                 YSliceNumericUpDown.Value = newValue;
00149                 inputManager.setSliceValue(2, newValue);
00150 
00151             }
00152             else if (sender == ZSlider)
00153             {
00154                 Decimal newValue = Decimal.Divide(new Decimal(ZSlider.Value), new Decimal(ZSlider.Maximum));
00155                 ZSliceNumericUpDown.Value = newValue;
00156                 inputManager.setSliceValue(3, newValue);
00157 
00158             }
00159         }
00160 
00161         private void SlicingForm_Enter(object sender, EventArgs e)
00162         {
00163             XSliceGroup.Enabled = inputManager.enableSliceGroup(1);
00164             YSliceGroup.Enabled = inputManager.enableSliceGroup(2);
00165             ZSliceGroup.Enabled = inputManager.enableSliceGroup(3);
00166         }
00167 
00168         #endregion
00169 
00170       
00171         
00172     }
00173 }

Generated on Wed Jan 19 2011 21:59:17 for flowvis-2 by  doxygen 1.7.2