public void NewRelation(UmlRelation rel) { GuiClass c1 = FindClass(rel.src), c2 = FindClass(rel.dest); if (c1 != null && c2 != null) { int ux1 = 1, ux2 = 3; float uy1 = .5f, uy2 = .5f; if (rel.type == UmlRelationType.Association) { ux1 = 0; uy1 = c1.get_empty_point_on_edge(ux1); ux2 = 2; uy2 = c2.get_empty_point_on_edge(ux2); } else if (rel.type == UmlRelationType.Realization || rel.type == UmlRelationType.Inheritance) { uy2 = c2.get_empty_point_on_edge(ux2); } GuiConnection c = new GuiConnection(new GuiConnectionPoint(c1, ux1, uy1, 0), new GuiConnectionPoint(c2, ux2, uy2, 1), rel.type, this, rel.type == UmlRelationType.Attachment ? GuiConnectionStyle.Line : MouseAgent.conn_style); if (rel.type == UmlRelationType.Association) { c.nav = GuiConnectionNavigation.Left; } c.relation_id = rel.ID; c.first.UpdatePosition(true); c.second.UpdatePosition(true); c.DoCreationFixup(); c.ConnectionCreated(this, rel.src_role, rel.dest_role, rel.name, rel.stereo); Undo.Push(new CreateOperation(c), false); } }
public void AddObject(GuiItem item, string name_base) { item.parent = this; if (item is INeedRefresh) { RefreshObject((INeedRefresh)item); } item.id = RegisterItemID(name_base, item); item.Invalidate(); Undo.Push(new CreateOperation((IRemoveable)item), false); // add relations if (item is GuiClass) { GuiClass cl = (GuiClass)item; for (int i = 0; i < active_objects.Count; i++) { GuiObject obj = (GuiObject)active_objects[i]; if (obj is GuiClass) { foreach (UmlRelation rel in RelationsHelper.GetRelations(((GuiClass)obj).st, proj.model)) { if (rel.dest == cl.st || rel.src == cl.st) { NewRelation(rel); } } } } } }
public override void Drop( ) { if (dropitem == null) { throw new ArgumentException("have nothing to drop"); } parent.AddObject(dropitem, UmlModel.GetUniversal(dropobj)); action = MouseAction.None; // insert Inheritance ArrayList l = new ArrayList(parent.active_objects); foreach (GuiObject a in l) { if (a is GuiClass) { GuiClass c = a as GuiClass; // TODO ????????? /*if( c.st.bases != null && c.st.bases.Contains( dropitem.st.fullname ) ) { * NewRelation( dropitem, c, UmlRelationType.Inheritance ); * } else if( dropitem.st.bases != null && dropitem.st.bases.Contains( c.st.fullname ) ) { * NewRelation( c, dropitem, UmlRelationType.Inheritance ); * }*/ } } dropitem = null; }
public void ImportClass(UmlClass cl) { if (parent.FindClass(cl) == null) { GuiClass gc = GuiElementFactory.CreateClass(parent, x_coord_counter, ancest ? Y - 100 : Y + Height + 100, cl); x_coord_counter += 20 + gc.Width; } }
public static GuiClass CreateClass(StaticView parent, int x, int y, UmlClass cl) { GuiClass c = GuiClass.fromUML(cl); c.X = x; c.Y = y; parent.AddObject(c, UmlModel.GetUniversal(cl)); return(c); }
public static GuiClass fromUML(UmlClass st) { GuiClass s = new GuiClass(); s.name = st.UniqueName; s.st = st; s.Created(); return(s); }
public GuiClass FindClass(UmlClass cl) { foreach (GuiObject obj in active_objects) { GuiClass gcl = obj as GuiClass; if (gcl != null && gcl.st == cl) { return(gcl); } } return(null); }
public static GuiItem CreateElement(UmlObject obj) { if (obj is UmlClass) { return(GuiClass.fromUML(obj as UmlClass)); } else if (obj is UmlEnum) { return(GuiEnum.fromUML(obj as UmlEnum)); } else if (obj is UmlNamespace) { return(GuiPackage.fromUML(obj as UmlNamespace)); } else { return(null); } }
public static GuiClass fromUML( UmlClass st ) { GuiClass s = new GuiClass(); s.name = st.UniqueName; s.st = st; s.Created(); return s; }
public WrappedMember( GuiClass cl, UmlMember memb ) { this.cl = cl; this.memb = memb; }
public WrappedMember(GuiClass cl, UmlMember memb) { this.cl = cl; this.memb = memb; }