void AddObject (object obj, EventArgs args) { double x1 = random.Next (width); double y1 = random.Next (height); double x2 = random.Next (width); double y2 = random.Next (height); if (x1 > x2) Swap (ref x1, ref x2); if (y1 > y2) Swap (ref y1, ref y2); if ((x2 - x1) < 10) x2 += 10; if ((y2 - y1) < 10) y2 += 10; CanvasRE item = null; if (random.Next (2) > 0) item = new CanvasRect (canvas.Root ()); else item = new CanvasEllipse (canvas.Root ()); item.X1 = x1; item.Y1 = y1; item.X2 = x2; item.Y2 = y2; item.FillColor = "white"; item.OutlineColor = "black"; item.WidthUnits = 1.0; item.CanvasEvent += new Gnome.CanvasEventHandler (Item_Event); }
void AddObject(object obj, EventArgs args) { double x1 = random.Next(width); double y1 = random.Next(height); double x2 = random.Next(width); double y2 = random.Next(height); if (x1 > x2) { Swap(ref x1, ref x2); } if (y1 > y2) { Swap(ref y1, ref y2); } if ((x2 - x1) < 10) { x2 += 10; } if ((y2 - y1) < 10) { y2 += 10; } CanvasRE item = null; if (random.Next(2) > 0) { item = new CanvasRect(canvas.Root()); } else { item = new CanvasEllipse(canvas.Root()); } item.X1 = x1; item.Y1 = y1; item.X2 = x2; item.Y2 = y2; item.FillColor = "white"; item.OutlineColor = "black"; item.WidthUnits = 1.0; item.CanvasEvent += new Gnome.CanvasEventHandler(Item_Event); }
public UMLActor(UMLDiagram ownerDiagram, DI.GraphNode actorGraphNode) : base(ownerDiagram, actorGraphNode) { // old ctor _head = new CanvasEllipse (ChildrensRoot); _head.OutlineColor = DEFAULT_OUTLINE_COLOR; _head.FillColor = DEFAULT_FILL_COLOR; // _arms = new CanvasLine (ChildrensRoot); _arms.WidthUnits = 1.0; _arms.FillColor = DEFAULT_OUTLINE_COLOR; // _body = new CanvasLine (ChildrensRoot); _body.WidthUnits = 1.0; _body.FillColor = DEFAULT_OUTLINE_COLOR; // _legs = new CanvasLine (ChildrensRoot); _legs.WidthUnits= 1.0; _legs.FillColor = DEFAULT_OUTLINE_COLOR; // /old ctor _modelElement = (UML.Actor) MonoUML.Widgets.Helper.GetSemanticElement (actorGraphNode); DI.GraphElement nestedDiagElem; DI.SimpleSemanticModelElement nestedBridge; // DI.DiagramElement elem = (DI.DiagramElement) actorGraphNode.Contained[0]; nestedDiagElem = elem as DI.GraphElement; if (nestedDiagElem != null) { nestedBridge = nestedDiagElem.SemanticModel as DI.SimpleSemanticModelElement; if (nestedBridge.TypeInfo == "Name") { string fontModifier = (_modelElement.IsAbstract ? "italic" : ""); _nameUMLEntry = new UMLEntry (this, (DI.GraphNode)nestedDiagElem, ownerDiagram.CanvasRoot, true, _modelElement.Name, fontModifier); base.AddFreeEntry (_nameUMLEntry); _nameUMLEntry.Show (); _nameDIGraphNode = nestedDiagElem; } } else { //TODO: Create both, entry and DI nested element } _nameUMLEntry.TextChanged += CallHub; Redraw (); }
public UMLUseCase(UMLDiagram ownerDiagram, DI.GraphNode graphNode) : base(ownerDiagram, graphNode) { _circle = new CanvasEllipse (ChildrensRoot); _circle.X1 = _circle.Y1 = 0; _circle.X2 = Width; _circle.Y2 = Height; _circle.FillColor = DEFAULT_FILL_COLOR; _circle.OutlineColor = DEFAULT_OUTLINE_COLOR; // Width = GraphNode.Size.Width; Height = GraphNode.Size.Height; // Uml2SemanticModelBridge bridge = (Uml2SemanticModelBridge) GraphNode.SemanticModel; _modelElement = (UML.UseCase) bridge.Element; DI.GraphElement nestedDiagElem; DI.SimpleSemanticModelElement nestedBridge; // foreach (DI.DiagramElement elem in GraphNode.Contained) { nestedDiagElem = elem as DI.GraphElement; if (nestedDiagElem != null) { nestedBridge = nestedDiagElem.SemanticModel as DI.SimpleSemanticModelElement; System.Console.WriteLine ("UMLUseCase nestedBridge.TypeInfo "+nestedBridge.TypeInfo); if (nestedBridge.TypeInfo == "NameCompartment") { // widget for the property Name string fontModifier = (_modelElement.IsAbstract ? "italic" : ""); _name = new UMLEntry (this, (DI.GraphNode)nestedDiagElem, ChildrensRoot, false, _modelElement.Name, fontModifier); _name.Show(); break; } } } _circle.X1 = _circle.Y1 = 0; _circle.X2 = Width; _circle.Y2 = Height; Redraw (); }
public UMLAssociationEnd(UMLDiagram ownerDiagram, DI.GraphNode graphNode) : base(ownerDiagram, graphNode) { _circle = new CanvasEllipse (ownerDiagram.CanvasRoot); _circle.OutlineColorGdk = UMLEdge.HIGHLIGHTED_OUTLINE_COLOR; _graphNode = graphNode; _modelElement = (UML.Property) MonoUML.Widgets.Helper.GetSemanticElement (graphNode); DI.SimpleSemanticModelElement bridge; foreach (DI.GraphNode gn in graphNode.Contained) { bridge = gn.SemanticModel as DI.SimpleSemanticModelElement; switch (bridge.TypeInfo) { case "Name": _name = new UMLEntry (this, gn, ownerDiagram.CanvasRoot, true, _modelElement.Name); _name.TextChanged += new UMLElementNameChangedHandler (BroadcastNameChange); base.AddFreeEntry (_name); _name.Show (); break; case "Visibility": break; case "Multiplicity": _multiplicity = new UMLEntry (this, gn, ownerDiagram.CanvasRoot, true, GetMultiplicity ()); _multiplicity.TextChanged += new UMLElementNameChangedHandler (ApplyMultiplicityChange); base.AddFreeEntry (_multiplicity); _multiplicity.Show (); break; } } }