public Aggregation(string cFirst, string cSecond, string title, MaxApstractionClass fromClass, MaxApstractionClass toClass) { this.cFirst = cFirst; this.cSecond = cSecond; this.title = title; this.fromClass = fromClass; this.toClass = toClass; this.type = "Aggregation"; this.currentPen.Brush = Brushes.Blue; }
public Generalisation(string cFirst, string cSecond, string title, MaxApstractionClass fromClass, MaxApstractionClass toClass) { this.cFirst = cFirst; this.cSecond = cSecond; this.title = title; this.fromClass = fromClass; this.toClass = toClass; this.type = "Generalisation"; this.currentPen.Brush = Brushes.Red; }
public Realization(string cFirst, string cSecond, string title, MaxApstractionClass fromClass, MaxApstractionClass toClass) { this.cFirst = cFirst; this.cSecond = cSecond; this.title = title; this.fromClass = fromClass; this.toClass = toClass; this.type = "Realization"; this.currentPen.DashPattern = new float[] { 10F, 10F }; this.currentPen.Brush = Brushes.BlueViolet; }
private void MouseClicked(object sender, MouseEventArgs e) { if (this.cbSelectConnection.Checked) { foreach (Connection c in this.listOfConnections) { foreach (Line l in c.getConnectionLines()) { if (l.contains(new Point(e.X, e.Y))) { this.selectedConnection = c; this.setConnectionInfo(); return; } } } } if (this.cbShowDetails.Checked) { MessageBox.Show("You are in edit mode, can't make or select new classes! Uncheck it first!", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } if (this.rbClass.Checked) { if (this.tfClassName.Text == "") { MessageBox.Show("Please fill in class name field!", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } else if (this.tfClassName.Text.Length > 13) { MessageBox.Show("Class name can't be longer than 13 characters!", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); this.tfClassName.Text = this.tfClassName.Text.Substring(0, 13); } else { if (this.doesClassNameExist()) { MessageBox.Show("Class with name " + this.tfClassName.Text.ToString() + " already exists!", "Error!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); this.tfClassName.Focus(); return; } MaxApstractionClass mClass = new MaxApstractionClass(this.tfClassName.Text.ToString(), e.X, e.Y); foreach (MaxApstractionClass mc in this.listMaxApstractionClass) { if (mc.classRec.Contains(e.X, e.Y)) { mClass.classRec.X += mClass.classRec.Width + 5; mClass.classRec.Y = mc.classRec.Y; break; } } mClass.draw(this.g); this.listMaxApstractionClass.Add(mClass); } } else // selection mode is on { foreach (MaxApstractionClass mClass in this.listMaxApstractionClass) { if (mClass.classRec.Contains(e.X, e.Y)) { foreach (MaxApstractionClass selectedMClass in this.listSelectedMaxApstractionClass) { if (mClass == selectedMClass) { // deselect mClass.defaultBrush = Brushes.LightGray; mClass.defaultPen = Pens.Black; mClass.defaultFontBrush = Brushes.Black; mClass.draw(this.g); this.listSelectedMaxApstractionClass.Remove(selectedMClass); if (this.listSelectedMaxApstractionClass.Count < 2) { this.gbConnectionOptions.Enabled = false; } return; } } if (this.listSelectedMaxApstractionClass.Count > 1) { MessageBox.Show("You can't select more than 2 classes at the same time!", "Error!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } // select mClass.defaultBrush = Brushes.DodgerBlue; mClass.defaultPen = Pens.RoyalBlue; mClass.defaultFontBrush = Brushes.White; mClass.draw(this.g); this.listSelectedMaxApstractionClass.Add(mClass); if (listSelectedMaxApstractionClass.Count == 2) { this.gbConnectionOptions.Enabled = true; } return; } } } }