コード例 #1
0
        /// <summary>
        /// Open form for given plugin
        /// </summary>
        /// <param name="rccm">Reference to RCCM object</param>
        /// <param name="plugin">Plugin to be started from this form</param>
        public PluginInitializationForm(RCCMSystem rccm, IRCCMPlugin plugin)
        {
            this.rccm   = rccm;
            this.plugin = plugin;

            InitializeComponent();

            // Add rows for each input and give them a fixed size
            this.tableLayoutPanelParams             = new TableLayoutPanel();
            this.tableLayoutPanelParams.Dock        = DockStyle.Fill;
            this.tableLayoutPanelParams.ColumnCount = 2;
            this.tableLayoutPanelParams.RowCount    = plugin.Params.Length;
            this.tableLayoutPanelGrid.Controls.Add(this.tableLayoutPanelParams, 0, 0);
            this.parameterControls = new Dictionary <string, TextBox>();
            for (int i = 0; i < plugin.Params.Length; i++)
            {
                this.tableLayoutPanelParams.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
                // Add label
                Label paramLabel = new Label();
                paramLabel.Text = plugin.Params[i];
                this.tableLayoutPanelParams.Controls.Add(paramLabel, 0, i);
                // Add control
                TextBox paramTextBox = new TextBox();
                paramTextBox.Dock = DockStyle.Fill;
                this.tableLayoutPanelParams.Controls.Add(paramTextBox, 1, i);
                // Add textbox to dictionary of parameter controls
                parameterControls[plugin.Params[i]] = paramTextBox;
            }
            this.Text = plugin.Name;
            this.buttonStop.Enabled = false;
            this.Height             = 80 + 32 * this.plugin.Params.Length;
            this.tableLayoutPanelGrid.RowStyles[0].Height = 32 * this.plugin.Params.Length;
        }
コード例 #2
0
        /// <summary>
        /// Create plugin actor from parameter strings
        /// </summary>
        /// <param name="rccm">Reference to RCCM object</param>
        /// <param name="parameters">Map of test parameters to values</param>
        public PressureCameraTrigger(RCCMSystem rccm, Dictionary <string, string> parameters)
        {
            this.rccm    = rccm;
            this.Running = false;

            // Create instance values from provided map from parameter name to user inputted value
            this.path = parameters["Path"];
            // Camera string must be one of 4 options
            switch (parameters["Camera"].ToLower())
            {
            case "wfov 1":
                this.camera = rccm.WFOV1;
                break;

            case "wfov 2":
                this.camera = rccm.WFOV2;
                break;

            case "nfov 1":
                this.camera = rccm.NFOV1;
                break;

            case "nfov 2":
                this.camera = rccm.NFOV2;
                break;

            default:
                throw new ArgumentException("Camera must be nfov/wfov 1/2");
            }
            // Extract numeric value from user input for pressure that triggers image capture
            this.triggerPressure = Double.Parse(parameters["Pressure"]);
            // Extract true or false from user input
            this.ascending = Boolean.Parse(parameters["Ascending"]);
        }
コード例 #3
0
ファイル: NFOVViewForm.cs プロジェクト: jmal0/RCCM
 /// <summary>
 /// Initialize NFOV display
 /// </summary>
 /// <param name="rccm">RCCMSystem object, needed for getting location and zoom status</param>
 /// <param name="camera">NFOV camera to display</param>
 /// <param name="cracks">List of cracks to display</param>
 public NFOVViewForm(RCCMSystem rccm, NFOV camera, ObservableCollection <MeasurementSequence> cracks)
 {
     this.rccm       = rccm;
     this.camera     = camera;
     this.stage      = camera == rccm.NFOV1 ? RCCMStage.RCCM1 : RCCMStage.RCCM2;
     this.cameraName = camera == rccm.NFOV1 ? "nfov 1" : "nfov 2";
     this.cracks     = cracks;
     this.cracks.CollectionChanged += cracksChangedHandler;
     this.Drawing     = false;
     this.ActiveIndex = -1;
     this.ActivePoint = -1;
     this.bwRepaint   = new BackgroundWorker();
     InitializeComponent();
     this.editFocus.Value = (decimal)(camera == rccm.NFOV1 ? rccm.LensController.FocusOffset1 : rccm.LensController.FocusOffset2);
     this.updateMeasurementControls();
 }
コード例 #4
0
ファイル: RepeatabilityTest.cs プロジェクト: jmal0/RCCM
        public RepeatabilityTest(RCCMSystem rccm, Dictionary <string, string> parameters)
        {
            this.rccm    = rccm;
            this.Running = false;

            // Create instance values from provided map from parameter name to user inputted value

            // Camera string must be one of 4 options
            switch (parameters["Camera"].ToLower())
            {
            case "wfov 1":
                this.camera = rccm.WFOV1;
                break;

            case "wfov 2":
                this.camera = rccm.WFOV2;
                break;

            case "nfov 1":
                this.camera = rccm.NFOV1;
                break;

            case "nfov 2":
                this.camera = rccm.NFOV2;
                break;

            default:
                throw new ArgumentException("Camera must be nfov/wfov 1/2");
            }
            this.path = (string)Program.Settings.json[parameters["Camera"]]["image directory"] +
                        string.Format("\\Repeatability-{0:yyyy-MM-dd_hh-mm-ss-tt-fff}", DateTime.Now);
            Directory.CreateDirectory(this.path);
            // Actuator string must be one of 8 options
            try
            {
                this.motor = this.rccm.motors[parameters["Actuator"]];
            }
            catch (KeyNotFoundException e)
            {
                throw new ArgumentException("Actuator must be coarse X/Y or fine 1/2 X/Y");
            }
            // Extract numeric value from user input for repititions and move distance
            this.repetitions = Int32.Parse(parameters["Repetitions"]);
            this.distance    = Double.Parse(parameters["Distance"]);
        }
コード例 #5
0
        /// <summary>
        /// Create form and initialize given camera
        /// </summary>
        /// <param name="rccm">Reference to the RCCM object</param>
        /// <param name="camera">Camera to be displayed</param>
        /// <param name="cracks">Reference to the list of all measurement sequences</param>
        public WFOVViewForm(RCCMSystem rccm, WFOV camera, ObservableCollection <MeasurementSequence> cracks)
        {
            this.rccm       = rccm;
            this.camera     = camera;
            this.stage      = this.camera == rccm.WFOV1 ? RCCMStage.RCCM1 : RCCMStage.RCCM2;
            this.cameraName = this.camera == rccm.WFOV1 ? "wfov 1" : "wfov 2";
            this.cracks     = cracks;
            this.cracks.CollectionChanged += cracksChangedHandler;
            this.Drawing     = false;
            this.ActiveIndex = -1;
            this.ActivePoint = -1;

            InitializeComponent();
            this.updateMeasurementControls();

            this.panelWFOVOverlay = new WFOVPanel(this.wfovContainer);
            this.Controls.Add(this.panelWFOVOverlay);
            this.panelWFOVOverlay.BringToFront();
            this.wfovRepaint = new System.Windows.Forms.Timer();
        }
コード例 #6
0
        /// <summary>
        /// Create plugin actor from parameter strings
        /// </summary>
        /// <param name="rccm">Reference to RCCM object</param>
        /// <param name="parameters">Map of test parameters to values</param>
        public CameraCalibration(RCCMSystem rccm, Dictionary <string, string> parameters)
        {
            this.rccm    = rccm;
            this.Running = false;

            // Camera string must be one of 4 options
            switch (parameters["Camera"].ToLower())
            {
            case "wfov 1":
                this.camera = this.rccm.WFOV1;
                this.xMotor = this.rccm.motors["fine 1 X"];
                this.yMotor = this.rccm.motors["fine 1 Y"];
                break;

            case "wfov 2":
                this.camera = this.rccm.WFOV2;
                this.xMotor = this.rccm.motors["fine 2 X"];
                this.yMotor = this.rccm.motors["fine 2 Y"];
                break;

            case "nfov 1":
                this.camera = this.rccm.NFOV1;
                this.xMotor = this.rccm.motors["fine 1 X"];
                this.yMotor = this.rccm.motors["fine 1 Y"];
                break;

            case "nfov 2":
                this.camera = this.rccm.NFOV2;
                this.xMotor = this.rccm.motors["fine 2 X"];
                this.yMotor = this.rccm.motors["fine 2 Y"];
                break;

            default:
                throw new ArgumentException("Camera must be nfov/wfov 1/2");
            }
            // Automatically create folder for saving test data from settings
            this.path = (string)Program.Settings.json[parameters["Camera"]]["test data directory"] +
                        string.Format("\\scaling-{0:yyyy-MM-dd_hh-mm-ss-fff}", DateTime.Now);
            Directory.CreateDirectory(this.path);
        }
コード例 #7
0
ファイル: LensCalibrationForm.cs プロジェクト: jmal0/RCCM
        /// <summary>
        /// Create a calibration UI form for the specified stage. Saves changes to specified settings object
        /// </summary>
        /// <param name="controller">NFOV lens controller</param>
        /// <param name="stage">Parent stage of NFOV camera to be adjusted</param>
        public LensCalibrationForm(RCCMSystem rccm, RCCMStage stage)
        {
            InitializeComponent();

            this.rccm       = rccm;
            this.controller = this.rccm.LensController;
            this.stage      = stage;

            this.oldCalibration = stage == RCCMStage.RCCM1 ? this.controller.NFOV1Calibration : this.controller.NFOV2Calibration;
            this.calibration    = new SortedList <double, CalibrationPoint>();
            if (this.oldCalibration != null)
            {
                for (int i = 0; i < this.oldCalibration.GetLength(0); i++)
                {
                    this.calibration.Add(this.oldCalibration[i, 0],
                                         new CalibrationPoint(this.oldCalibration[i, 0], this.oldCalibration[i, 1]));
                }
            }

            // Set text box values
            Motor zMotor = this.stage == RCCMStage.RCCM1 ? this.rccm.motors["fine 1 Z"] : this.rccm.motors["fine 2 Z"];

            this.heightEdit.Value     = (decimal)zMotor.GetPos();
            this.focalPowerEdit.Value = (decimal)this.controller.GetFocalPower(this.stage);
            if (this.stage == RCCMStage.RCCM1)
            {
                this.editFocusOffset.Value = (decimal)this.controller.FocusOffset1;
            }
            else
            {
                this.editFocusOffset.Value = (decimal)this.controller.FocusOffset2;
            }
            this.updateListView();

            this.controller.PauseFocusing(this.stage);
        }
コード例 #8
0
 /// <summary>
 /// Create plugin with given test parameters
 /// </summary>
 /// <param name="rccm"></param>
 /// <param name="parameters">User entered test parameters</param>
 /// <returns></returns>
 public IRCCMPluginActor Instance(RCCMSystem rccm, Dictionary <string, string> parameters)
 {
     return(new PressureCameraTrigger(rccm, parameters));
 }
コード例 #9
0
 public IRCCMPluginActor Instance(RCCMSystem rccm, Dictionary <string, string> parameters)
 {
     return(new RepeatabilityTest(rccm, parameters));
 }
コード例 #10
0
        /// <summary>
        /// Create the main form and initialize all hardware
        /// </summary>
        /// <param name="plugins">List of plugins that were found on startup</param>
        public RCCMMainForm(ICollection <IRCCMPlugin> plugins)
        {
            // Show splash screen
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            RCCMSplashScreen             splash    = new RCCMSplashScreen();

            splash.Show();
            stopwatch.Start();

            // Need to load the ActiveX state or something, I'm not actually sure
            this.resources = new ComponentResourceManager(typeof(RCCMMainForm));
            // Create Trio controller ActiveX control and initialize
            this.triopc = new AxTrioPCLib.AxTrioPC();
            ((ISupportInitialize)(this.triopc)).BeginInit();
            this.Controls.Add(this.triopc);
            this.triopc.Name     = "AxTrioPC1";
            this.triopc.Visible  = false;
            this.triopc.OcxState = ((AxHost.State)(resources.GetObject("AxTrioPC1.OcxState")));
            ((ISupportInitialize)(this.triopc)).EndInit();

            InitializeComponent();

            this.rccm   = new RCCMSystem(this.triopc);
            this.cracks = new ObservableCollection <MeasurementSequence>();
            this.test   = new TestResults(this.rccm, this.cracks, this.chartCracks, this.chartCycles, this.textCycle, this.textPressure, this.listCrackSelection);
            this.view   = new PanelView(this.rccm);

            // Apply certain settings to controls
            this.applyUISettings();

            // Create timer for redrawing panel graphics
            this.panelRepaintTimer          = new Timer();
            this.panelRepaintTimer.Enabled  = true;
            this.panelRepaintTimer.Interval = (int)Program.Settings.json["repaint period"];
            this.panelRepaintTimer.Tick    += new EventHandler(refreshPanelView);

            // Add toolstrip item for each plugin
            if (plugins != null)
            {
                foreach (IRCCMPlugin plugin in plugins)
                {
                    ToolStripMenuItem pluginItem = new ToolStripMenuItem(plugin.Name);
                    this.pluginsToolStripMenuItem.DropDownItems.Add(pluginItem);
                    pluginItem.Click += delegate(object sender, EventArgs e)
                    {
                        this.PluginToolStripClick(plugin);
                    };
                }
            }

            this.jogging = false;

            // Set new state to prevent system sleep
            this.fPreviousExecutionState = NativeMethods.SetThreadExecutionState(
                NativeMethods.ES_CONTINUOUS | NativeMethods.ES_SYSTEM_REQUIRED);
            if (this.fPreviousExecutionState == 0)
            {
                Console.WriteLine("SetThreadExecutionState failed. Do something here...");
            }

            Logger.LoadPositions(this.rccm);

            stopwatch.Stop();
            System.Threading.Thread.Sleep((int)Math.Max(2000 - stopwatch.ElapsedMilliseconds, 0));
            splash.Close();

            Show();
        }
コード例 #11
0
 /// <summary>
 /// Create camera settings form
 /// </summary>
 /// <param name="rccm">Reference to RCCM object</param>
 public CameraSettingsForm(RCCMSystem rccm)
 {
     this.rccm = rccm;
     InitializeComponent();
 }
コード例 #12
0
 /// <summary>
 /// Open coordinate system form
 /// </summary>
 /// <param name="rccm">Reference to RCCM object</param>
 public CoordinateSystemSettingsForm(RCCMSystem rccm)
 {
     this.rccm = rccm;
     InitializeComponent();
 }
コード例 #13
0
 /// <summary>
 /// Create plugin with given test parameters
 /// </summary>
 /// <param name="rccm"></param>
 /// <param name="parameters">User entered test parameters</param>
 /// <returns></returns>
 public IRCCMPluginActor Instance(RCCMSystem rccm, Dictionary <string, string> parameters)
 {
     return(new CameraCalibration(rccm, parameters));
 }