public void SetModeller(Modeller modeller) { Modeller = modeller; //Clipping Modeller.ClippingEnabled = CBClippingEnabled.Checked; Modeller.ClippingRadiusMin = NBClippingRadiusMin.Value; Modeller.ClippingRadiusMax = NBClippingRadiusMax.Value; Modeller.ClippingDepthMax = NBClippingDepthMax.Value; Modeller.ClippingYMin = NBClippingYMin.Value; //Transformations Modeller.RotationX = NBRotationX.Value.ToRadians(); Modeller.SplitPlaneAngle = NBSplitPlaneAngle.Value.ToRadians(); Modeller.RotationZ = NBRotationZ.Value.ToRadians(); Modeller.TranslationX = NBTranslationX.Value; Modeller.TranslationY = NBTranslationY.Value; Modeller.TranslationZ = NBTranslationZ.Value; //Depth averaging Modeller.DepthAveragingCacheSize = NBDepthAveragingCacheSize.Int32Value; Modeller.DepthAveragingLimit = NBDepthAveragingLimit.Value; Modeller.DepthAveragingMinCount = NBDepthAveragingMinCount.Int32Value; Modeller.FusionSpacing = NBFusionSpacing.Int32Value; Modeller.GaussIterations = NBGaussIterations.Int32Value; //Projection Modeller.ProjectionYMax = NBProjectionYMax.Value; Modeller.ProjectionYMin = NBProjectionYMin.Value; if (Modeller is ExCoreModeller) { ExCoreModeller ExCoreModeller = Modeller as ExCoreModeller; ExCoreModeller.CoreX = NBCoreX.Value; ExCoreModeller.CoreY = NBCoreY.Value; NBCoreX.Visible = NBCoreY.Visible = true; } else { NBCoreX.Visible = NBCoreY.Visible = false; } if (Modeller is FusionModeller) { FusionModeller FusionModeller = Modeller as FusionModeller; FusionModeller.ProjectionWidth = NBProjectionWidth.Value; NBProjectionWidth.Visible = true; } else { NBProjectionWidth.Visible = false; } }
private void RotationScannerForm_FormClosing(object sender, FormClosingEventArgs e) { SetState(ScanningStates.None); Turntable.DeviceConnected -= Turntable_DeviceConnected; Turntable.DeviceDisconnected -= Turntable_DeviceDisconnected; if (Modeller != null) { Modeller.Dispose(); Modeller = null; } if (Turntable != null) { Turntable.Dispose(); Turntable = null; } SF.SaveSettings(); SF.Dispose(); SF = null; }
public RotationScannerForm(KinectScanContext context) { InitializeComponent(); Context = context; //Modeller Modeller = new ExCoreModeller(Context); Modeller.CreateDevice(XPanel); Modeller.DebugLoad(); //GUI Array ViewModes = Enum.GetValues(typeof(Modeller.Views)); string[] specialViewModes = Modeller.SpecialViewModes; MenuItem MI; foreach (Modeller.Views mode in ViewModes) { if (mode == KinectScan.Modeller.Views.Special && specialViewModes.Length > 0) { continue; } MI = new MenuItem(mode.ToString()); MI.RadioCheck = true; if (Modeller.ViewMode == mode) { MI.Checked = true; MISelectedView = MI; } MI.Click += (object sender, EventArgs e) => { if (MISelectedView != null) { MISelectedView.Checked = false; } MISelectedView = (MenuItem)sender; MISelectedView.Checked = true; Modeller.ViewMode = (Modeller.Views)MISelectedView.Tag; }; MI.Tag = mode; MIView.MenuItems.Add(MI); } if (specialViewModes.Length > 0) { int i = 0; MIView.MenuItems.Add(new MenuItem("-")); foreach (string mode in specialViewModes) { MI = new MenuItem(mode.ToString()); MI.RadioCheck = true; MI.Checked = (Modeller.ViewMode == Modeller.Views.Special && Modeller.SpecialViewMode == i); MI.Click += (object sender, EventArgs e) => { if (MISelectedView != null) { MISelectedView.Checked = false; } MISelectedView = (MenuItem)sender; MISelectedView.Checked = true; Modeller.ViewMode = KinectScan.Modeller.Views.Special; Modeller.SpecialViewMode = (int)MISelectedView.Tag; }; MI.Tag = i++; MIView.MenuItems.Add(MI); } } MIViewLegs.MenuItems[Modeller.VisualizedLeg].Checked = true; XPanel.KeyDown += (object o, KeyEventArgs e) => { switch (e.KeyCode) { case Keys.Space: MIScan_Click(this, null); break; case Keys.Tab: TScan.Start(); break; } }; //Settings SF = new TurntableSettingsForm(); SF.LoadSettings(); SF.SetModeller(Modeller); //Scanning ScanUITimer = new Timer(); ScanUITimer.Interval = 100; ScanUITimer.Tick += (object sender, EventArgs e) => { if (ScanningState == ScanningStates.Scanning) { int degrees = (int)Turntable.PositionInDegrees; TSPB.Value = degrees; TSSL.Text = string.Format(LocalizedResources.ScannerScanning, degrees); } }; SetState(ScanningStates.None); Context.ScannerCreated += Context_ScannerCreated; if (Context.Scanner != null) { Context_ScannerCreated(this, null); } Turntable.DeviceConnected += Turntable_DeviceConnected; Turntable.DeviceDisconnected += Turntable_DeviceDisconnected; TScan = new Timer(); TScan.Interval = 20000; TScan.Tick += (object sender, EventArgs e) => { MIScan_Click(this, null); TScan.Stop(); }; }