public RotateVerticesAction(QuiverEditorModel model, IEnumerable <int> vertices, Point center, double radians)
 {
     this.model    = model ?? throw new ArgumentNullException(nameof(model));
     this.vertices = vertices.ToList();
     this.center   = center;
     this.radians  = radians;
 }
Example #2
0
 public RemoveVertexAction(QuiverEditorModel model, int vertex, IEnumerable <Arrow <int> > arrowsToRemove)
 {
     this.model          = model ?? throw new ArgumentNullException(nameof(model));
     this.vertexToRemove = vertex;
     this.vertexPosition = model.quiverInPlane.GetVertexPosition(vertex);
     this.arrowsToRemove = arrowsToRemove ?? throw new ArgumentNullException(nameof(arrowsToRemove));
 }
Example #3
0
 public RelabelVerticesAction(QuiverEditorModel model, IReadOnlyDictionary <int, int> relabelingMap)
 {
     this.model = model ?? throw new ArgumentNullException(nameof(model));
     if (relabelingMap is null)
     {
         throw new ArgumentNullException(nameof(relabelingMap));
     }
     this.relabelingMap = relabelingMap.ToDictionary(pair => pair.Key, pair => pair.Value); // Copy the relabeling map
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoadPredefinedQuiverAction"/> class.
 /// </summary>
 /// <param name="model">The quiver-editor model.</param>
 /// <param name="predefinedQuiver">The type of predefined quiver to load.</param>
 /// <param name="quiverParameter">The parameter for the predefined quiver to load.</param>
 /// <param name="quiverInPlaneBeforeAction">The quiver in plane before the action.</param>
 /// <remarks>
 /// <para>This constructor takes care of copying
 /// <paramref name="quiverInPlaneBeforeAction"/> to ensure that the quiver in plane before
 /// the action that is stored in this <see cref="LoadPredefinedQuiverAction"/> is not
 /// modified.</para>
 /// </remarks>
 public LoadPredefinedQuiverAction(QuiverEditorModel model, PredefinedQuiver predefinedQuiver, dynamic quiverParameter, QuiverInPlane <int> quiverInPlaneBeforeAction)
 {
     this.model = model ?? throw new ArgumentNullException(nameof(model));
     if (!predefinedQuiver.IsInEnum())
     {
         throw new ArgumentOutOfRangeException(nameof(predefinedQuiver));
     }
     this.predefinedQuiver          = predefinedQuiver;
     this.quiverParameter           = quiverParameter;
     this.quiverInPlaneBeforeAction = quiverInPlaneBeforeAction?.Copy() ?? throw new ArgumentNullException(nameof(quiverInPlaneBeforeAction));
 }
 public QuiverEditorMvc(
     Form parent,
     Canvas canvas,
     Label centerOfCanvasLabel,
     Label mousePointerOnCanvasLocationLabel,
     ListView vertexListView,
     Label vertexCountLabel,
     ListView arrowListView,
     Label arrowCountLabel,
     IReadOnlyDictionary <QuiverEditorTool, Button> toolButtons,
     IReadOnlyDictionary <QuiverEditorTool, IEnumerable <Control> > toolSettingsControlsDictionary,
     NumericUpDown vertexToAddNud,
     ToolStripMenuItem undoMenuItem,
     ToolStripMenuItem redoMenuItem,
     ToolStripMenuItem relabelVerticesMenuItem,
     ToolStripMenuItem rotateVerticesMenuItem,
     IReadOnlyDictionary <PredefinedQuiver, ToolStripMenuItem> predefinedQuiverMenuItems,
     ToolStripMenuItem importFromMutationAppFileToolStripMenuItem,
     OpenFileDialog importFromMutationAppFileOpenFileDialog,
     ToolStripMenuItem exportAsMutationAppFileMenuItem,
     SaveFileDialog exportAsMutationAppFileSaveFileDialog)
 {
     Model = new QuiverEditorModel(new QuiverInPlane <int>());
     View  = new QuiverEditorView(
         Model,
         parent,
         canvas,
         centerOfCanvasLabel,
         mousePointerOnCanvasLocationLabel,
         vertexListView,
         vertexCountLabel,
         arrowListView,
         arrowCountLabel,
         toolButtons,
         toolSettingsControlsDictionary,
         vertexToAddNud,
         undoMenuItem,
         redoMenuItem,
         relabelVerticesMenuItem,
         rotateVerticesMenuItem,
         predefinedQuiverMenuItems,
         importFromMutationAppFileToolStripMenuItem,
         importFromMutationAppFileOpenFileDialog,
         exportAsMutationAppFileMenuItem,
         exportAsMutationAppFileSaveFileDialog);
     Controller = new QuiverEditorController(Model, View);
 }
Example #6
0
 public QuiverAnalyzerMvc(
     QuiverEditorModel editorModel,
     Button analyzeButton,
     GroupBox analysisResultsGroupBox,
     Label analysisMainResultLabel,
     ListView maximalPathRepresentativesListView,
     ListView nakayamaPermutationListView,
     TextBox orbitTextBox,
     TextBox longestPathEncounteredTextBox,
     Label longestPathEncounteredLengthLabel)
 {
     Model = new QuiverAnalyzerModel(editorModel);
     View  = new QuiverAnalyzerView(
         Model,
         analyzeButton,
         analysisResultsGroupBox,
         analysisMainResultLabel,
         maximalPathRepresentativesListView,
         nakayamaPermutationListView,
         orbitTextBox,
         longestPathEncounteredTextBox,
         longestPathEncounteredLengthLabel);
     Controller = new QuiverAnalyzerController(Model, View);
 }
        public QuiverEditorController(QuiverEditorModel model, QuiverEditorView view)
        {
            this.model = model ?? throw new ArgumentNullException(nameof(model));
            this.view  = view ?? throw new ArgumentNullException(nameof(view));

            view.KeyDown += View_KeyDown;
            view.VertexListViewKeyDown          += View_VertexListViewKeyDown;
            view.ArrowListViewKeyDown           += View_ArrowListViewKeyDown;
            view.SelectToolKeyDown              += View_SelectToolKeyDown;
            view.VertexMouseDown                += View_VertexMouseDown;
            view.ArrowMouseDown                 += View_ArrowMouseDown;
            view.CanvasClicked                  += View_CanvasClicked;
            view.VertexSelectedInListView       += View_VertexSelectedInListView;
            view.ArrowSelectedInListView        += View_ArrowSelectedInListView;
            view.ToolButtonClicked              += View_ToolButtonClicked;
            view.VertexToAddChanged             += View_VertexToAddNudValueChanged;
            view.UndoMenuItemClicked            += View_UndoMenuItemClicked;
            view.RedoMenuItemClicked            += View_RedoMenuItemClicked;
            view.RelabelVerticesMenuItemClicked += View_RelabelVerticesMenuItemClicked;
            view.RotateVerticesMenuItemClicked  += View_RotateVerticesMenuItemClicked;
            view.PredefinedQuiverDialogAccepted += View_PredefinedQuiverDialogAccepted;
            view.ImportQuiverFromMutationAppFileDialogAccepted += View_ImportQuiverFromMutationAppFileDialogAccepted;
            view.ExportQuiverAsMutationAppFileDialogAccepted   += View_ExportQuiverAsMutationAppFileDialogAccepted;
        }
 public RemoveArrowAction(QuiverEditorModel model, Arrow <int> arrow)
 {
     this.model = model ?? throw new ArgumentNullException(nameof(model));
     this.arrow = arrow ?? throw new ArgumentNullException(nameof(arrow));
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportQuiverFromMutationAppFileAction"/>
 /// class.
 /// </summary>
 /// <param name="model">The quiver-editor model.</param>
 /// <param name="path">The path of the file from which to import the quiver.</param>
 /// <param name="quiverInPlaneBeforeAction">The quiver in plane before the action.</param>
 /// <para>This constructor takes care of copying
 /// <paramref name="quiverInPlaneBeforeAction"/> to ensure that the quiver in plane before
 /// the action that is stored in this <see cref="ImportQuiverFromMutationAppFileAction"/>
 /// is not modified.</para>
 public ImportQuiverFromMutationAppFileAction(QuiverEditorModel model, string path, QuiverInPlane <int> quiverInPlaneBeforeAction)
 {
     this.model = model ?? throw new ArgumentNullException(nameof(model));
     this.path  = path ?? throw new ArgumentNullException(nameof(path));
     this.quiverInPlaneBeforeAction = quiverInPlaneBeforeAction?.Copy() ?? throw new ArgumentNullException(nameof(quiverInPlaneBeforeAction));
 }
 public AddVertexAction(QuiverEditorModel model, int vertex, Point vertexPosition)
 {
     this.model          = model ?? throw new ArgumentNullException(nameof(model));
     this.vertex         = vertex;
     this.vertexPosition = vertexPosition;
 }