/// <summary> /// Initializes a new instance of the <see cref="RigidArgs"/> struct. /// </summary> /// <param name="sourceModel"> The source model used in a rigid registration.</param> /// <param name="targetModel">The target model used in a rigid registration.</param> /// <param name="mappingAlgorithm">The point mapping algorithm used in a rigid registration.</param> /// <param name="numberOfIterations">The number of iterations.</param> public RigidArgs(Model3DFile sourceModel, Model3DFile targetModel, IPointMapping mappingAlgorithm, int numberOfIterations) { this.SourceModel = sourceModel; this.TargetModel = targetModel; this.MappingAlgorithm = mappingAlgorithm; this.NumberOfIterations = numberOfIterations; }
/// <summary> /// Called when an item is saved. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">Event arguments.</param> public void OnSaveClicked(object sender, EventArgs e) { Model3DFile file = this.listModel3DPanel.GetSelectedItem <Model3DFile>(); if (file != null) { this.saveFileDialog.InitialDirectory = Path.GetDirectoryName(file.OriginalPath); this.saveFileDialog.FileName = file.Name; DialogResult dialogResult = this.saveFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { this.statusLabel.Text = "Writing " + file.Name + " to " + this.saveFileDialog.FileName + "."; FileReader fileReader = new FileReader(); Model3DData model3D = fileReader.ReadModel(file.EditPath); try { ObjFileWriter fileWriter = new ObjFileWriter(this.saveFileDialog.FileName); fileWriter.WriteModel(model3D.Model); fileWriter.Close(); this.statusLabel.Text = "Writing was finished."; file.Exported = true; this.listModel3DPanel.Refresh(); } catch { MessageBox.Show(this, "An error occurred when writing to a file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show(this, "Please select a model that should be saved.", "Model not selected", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Called when an item is checked. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">Event arguments.</param> public void OnItemCheckChanged(object sender, ItemCheckEventArgs e) { Model3DFile file = this.listModel3DPanel.GetSelectedItem <Model3DFile>(); if (e.CurrentValue == CheckState.Unchecked) { this.helixViewer.AddModel(file.EditPath); } else { this.helixViewer.Remove(file.EditPath); } }
/// <summary> /// Imports new models into the application. /// </summary> /// <param name="sender">The sender of an event.</param> /// <param name="e">Event arguments.</param> private void fileImportMenuItem_Click(object sender, EventArgs e) { DialogResult dialogResult = this.openFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { foreach (string fileName in this.openFileDialog.FileNames) { Model3DFile model = new Model3DFile(fileName); Model3DFile foundModel = this.model3DBean.ModelListBean.FindLast(item => item.Name == model.Name); if (foundModel != null) { model.Index = foundModel.Index + 1; } this.model3DBean.ModelListBean.Add(model); this.listModel3DPanel.Add(model); } } }
/// <summary> /// Initializes a new instance of the <see cref="NonrigidArgs"/> struct. /// </summary> /// <param name="sourceModel">The source model used in a nonrigid registration.</param> /// <param name="targetModel">The target model used in a nonrigid registration.</param> /// <param name="numberOfIterations">The number of iterations of rigid registration which is used during nonrigid registration.</param> public NonrigidArgs(Model3DFile sourceModel, Model3DFile targetModel, int numberOfIterations) { this.SourceModel = sourceModel; this.TargetModel = targetModel; this.NumberOfIterations = numberOfIterations; }