コード例 #1
0
 //public UMLControlPointGroup (UMLNode group, bool resizable) : this (group)
 public UMLControlPointGroup(UMLElement group, bool resizable)
     : this(group)
 {
     for (int i = 0; i < ((int) Location.Total); i++)
     {
         _p[i].Moveable = resizable;
     }
 }
コード例 #2
0
        public static UMLInterfaceRealization CreateNew(
			UMLDiagram ownerDiagram,
			UMLElement fromElement,
			UMLElement toElement )
        {
            UMLInterfaceRealization interfaceRealization = null;
            DI.GraphElement fromGE = fromElement.GraphElement;
            DI.GraphElement toGE = toElement.GraphElement;
            UML.BehavioredClassifier fromModelElement = MonoUML.Widgets.Helper.GetSemanticElement (fromGE) as UML.BehavioredClassifier;
            UML.Interface toModelElement = MonoUML.Widgets.Helper.GetSemanticElement (toGE) as UML.Interface;
            if (fromModelElement != null && toModelElement != null)
            {
                // creates the new InterfaceRealization in the model
                UML.InterfaceRealization interfaceRealizationModel = UML.Create.InterfaceRealization ();
                interfaceRealizationModel.Contract = toModelElement;
                interfaceRealizationModel.ImplementingClassifier = fromModelElement;
                fromModelElement.InterfaceRealization.Add(interfaceRealizationModel);
                // creates the graphical representation of the new InterfaceRealization
                DI.GraphEdge interfaceRealizationGE = new DI.GraphEdge ();
                //    model bridge to the UML model element (Actor)
                Uml2SemanticModelBridge bridge = new Uml2SemanticModelBridge ();
                bridge.Element = interfaceRealizationModel;
                interfaceRealizationGE.SemanticModel = bridge;
                // adds anchors and anchorages
                DI.GraphConnector cnn;
                cnn = new DI.GraphConnector ();
                cnn.GraphElement = fromGE;
                fromGE.Position.CopyTo (cnn.Position);
                fromGE.Anchorage.Add (cnn);
                interfaceRealizationGE.Anchor.Add (cnn);
                cnn = new DI.GraphConnector ();
                cnn.GraphElement = toGE;
                toGE.Position.CopyTo (cnn.Position);
                toGE.Anchorage.Add (cnn);
                interfaceRealizationGE.Anchor.Add (cnn);
                // adds waypoints
                DI.GraphNode gn = fromGE as DI.GraphNode;
                DI.Point f = (gn != null ? gn.Center : toGE.Position.Clone ());
                gn = toGE as DI.GraphNode;
                DI.Point t = (gn != null ? gn.Center : toGE.Position.Clone ());
                interfaceRealizationGE.Waypoints.Add (f);
                interfaceRealizationGE.Waypoints.Add (t);
                // adds the interfaceRealization to the diagram
                ownerDiagram.DIDiagram.Contained.Add (interfaceRealizationGE);
                interfaceRealization = new UMLInterfaceRealization (ownerDiagram, interfaceRealizationGE, interfaceRealizationModel);
                ownerDiagram.UMLCanvas.AddElement (interfaceRealization);
                Hub.Instance.Broadcaster.BroadcastElementChange(fromModelElement);
            }
            return interfaceRealization;
        }
コード例 #3
0
        //public UMLControlPointGroup (UMLNode group) : base ((CanvasGroup) group)
        public UMLControlPointGroup(UMLElement group)
            : base((CanvasGroup) group)
        {
            _element = group;
            _p = new UMLControlPoint [4];
            _frame = new CanvasRect (this);
            _frame.OutlineColor = DEFAULT_OUTLINE_COLOR;
            _frame.FillColorRgba = 0xfbfbfb15;
            _frame.WidthUnits = 1;
            _frame.Show ();

            for (int i = 0; i < ((int) Location.Total); i++)
            {
                _p[i] = new UMLControlPoint (this);
                _p[i].Moved += PointMoved;
            }
            Redraw ();
        }
コード例 #4
0
        public static void Execute(
			UMLDiagram owningDiagram, 
			UMLElement fromElement, 
			UMLElement toElement
		)
        {
            DI.GraphElement fromGE = fromElement.GraphElement;
            DI.GraphElement toGE = toElement.GraphElement;
            UML.UseCase includingCase = MonoUML.Widgets.Helper.GetSemanticElement (fromGE) as UML.UseCase;
            UML.UseCase addition = MonoUML.Widgets.Helper.GetSemanticElement (toGE) as UML.UseCase;
            if (includingCase != null && addition != null)
            {
                // creates the new Include in the model
                UML.Include includeModel = UML.Create.Include ();
                includingCase.Include.Add (includeModel);
                includeModel.IncludingCase = includingCase;
                includeModel.Addition = addition;
                // creates the graphical representation of the new Include
                UMLStereotypedEdge.CreateNewAndAdd (owningDiagram, includeModel, fromGE, toGE);
                Hub.Instance.Broadcaster.BroadcastElementChange (includingCase);
            }
        }
コード例 #5
0
        public static void Execute(
			UMLDiagram owningDiagram, 
			UMLElement fromElement, 
			UMLElement toElement
		)
        {
            DI.GraphElement fromGE = fromElement.GraphElement;
            DI.GraphElement toGE = toElement.GraphElement;
            UML.UseCase extension = MonoUML.Widgets.Helper.GetSemanticElement (fromGE) as UML.UseCase;
            UML.UseCase extendedCase = MonoUML.Widgets.Helper.GetSemanticElement (toGE) as UML.UseCase;
            if (extension != null && extendedCase != null)
            {
                // creates the new Extend in the model
                UML.Extend extendModel = UML.Create.Extend ();
                extension.Extend.Add (extendModel);
                extendModel.Extension = extension;
                extendModel.ExtendedCase = extendedCase;
                // creates the graphical representation of the new Extend
                UMLStereotypedEdge.CreateNewAndAdd (owningDiagram, extendModel, fromGE, toGE);
                Hub.Instance.Broadcaster.BroadcastElementChange (extension);
            }
        }
コード例 #6
0
ファイル: UMLDiagram.cs プロジェクト: MonoBrasil/historico
 internal void AddNewClassifier(UMLElement element, UML.Classifier classifier)
 {
     this.UMLCanvas.AddElement (element);
     UML.Element ns = ((MonoUML.DI.Uml2Bridge.Uml2SemanticModelBridge)this.DIDiagram.Namespace).Element;
     classifier.Owner = ns;
     UML.Package pkg = ns as UML.Package;
     if (pkg != null)
     {
         pkg.OwnedType.Add (classifier);
         Hub.Instance.Broadcaster.BroadcastElementChange(pkg);
     }
     else
     {
             Hub.Instance.AddNewUMLElement (classifier);
     }
 }
コード例 #7
0
ファイル: UMLDiagram.cs プロジェクト: MonoBrasil/historico
 internal void AddMapping(DI.GraphElement diElement, UMLElement umlcanvasElement)
 {
     _di2umlcanvas.Add (diElement, umlcanvasElement);
 }
コード例 #8
0
ファイル: UMLEntry.cs プロジェクト: MonoBrasil/historico
        public UMLEntry(
			UMLElement owner,
			DI.GraphNode graphNode,
			CanvasGroup group,
			bool isMovable,
			string text,
			string fontModifier
		)
            : base(group)
        {
            _graphNode = graphNode;
            Movable = isMovable;
            _owner = owner;
            _text = new CanvasText (this);
            _text.Text = (text == null ? System.String.Empty : text);
            _text.FillColor = "black";
            _text.CanvasEvent += EntryEvents;
            _text.Justification = Gtk.Justification.Left;
            _text.Anchor = Gtk.AnchorType.NorthWest;
            this.FontModifier = fontModifier;
            _root = group;
            X = _movable ? _graphNode.GlobalPosition.X : _graphNode.Position.X;
            Y = _movable ? _graphNode.GlobalPosition.Y : _graphNode.Position.Y;
            Show ();
        }
コード例 #9
0
ファイル: UMLSelector.cs プロジェクト: MonoBrasil/historico
        public void Select(UMLElement element)
        {
            if (element != null)
            {
                _selected_first = element;

                if (Empty)
                {
                    _selected_elements.Add(element);
                }
                else if (!_selected_elements.Contains(element))
                {
                    CleanSelection();
                    FirstElement = element;
                }
                element.Select();
            }
        }
コード例 #10
0
ファイル: UMLCanvas.cs プロジェクト: MonoBrasil/historico
		internal void StartActionExecution (ActionBase action)
		{
			CreateNodeAction createNode;
			CreateEdgeAction createEdge;
			if ((createNode = action as CreateNodeAction) != null)
			{
				createNode.Position.X = _pointer_x;
				createNode.Position.Y = _pointer_y;
				createNode.Execute ();
			}
			else if ((createEdge = action as CreateEdgeAction) != null)
			{
				_currentAction = createEdge;
				_association = true;
				_association_start = GetHoverElement (null);
			}
		}
コード例 #11
0
ファイル: UMLEdge.cs プロジェクト: MonoBrasil/historico
 private void ReplaceFromElement()
 {
     if (ReplaceFromModelElement ())
     {
         _from_element.Moved -= new UMLElementMovedHandler (FromNodeMoved);
         _from_element.Resized -= new UMLElementResizedHandler (FromNodeResized);
         DI.GraphConnector anchorage = (DI.GraphConnector)_graphEdge.Anchor [0];
         _from_element.GraphElement.Anchorage.Remove (anchorage);
         _from_element = _ownerDiagram.UMLCanvas.GetHoverElement (this);
         _from_element.Moved += new UMLElementMovedHandler (FromNodeMoved);
         _from_element.Resized += new UMLElementResizedHandler (FromNodeResized);
         _from_element.GraphElement.Anchorage.Add (anchorage);
         anchorage.GraphElement = _from_element.GraphElement;
         ((DI.Point) _graphEdge.Waypoints [0]).CopyTo (anchorage.Position);
     }
     CalculateDimensions ();
     EnsureEdgeVisibility ();
 }
コード例 #12
0
 public static void Execute(UMLDiagram owningDiagram, UMLElement representation)
 {
     Hub.Instance.DeleteElement (representation.GraphElement);
      representation.OwnerDiagram.Refresh ();
 }
コード例 #13
0
 public DeleteRepresentationAction(UMLDiagram owningDiagram, UMLElement representation)
     : base(owningDiagram)
 {
     _representation = representation;
 }
コード例 #14
0
ファイル: UMLSelector.cs プロジェクト: MonoBrasil/historico
        public void SelectItemsOnRectangle(ArrayList element_list)
        {
            double tmpx, tmpy;

            if (_rectangle.X1 > _rectangle.X2)
            {
                tmpx = _rectangle.X1;
                _rectangle.X1 = _rectangle.X2;
                _rectangle.X2 = tmpx;
            }

            if (_rectangle.Y1 > _rectangle.Y2)
            {
                tmpy = _rectangle.Y1;
                _rectangle.Y1 = _rectangle.Y2;
                _rectangle.Y2 = tmpy;
            }

            foreach (UMLElement element in element_list)
            {
                //if a element is inside the rectangle
                if (element != null
                    && element.X > _rectangle.X1
                    && element.Y > _rectangle.Y1
                    && element.X + element.Width < _rectangle.X2
                    && element.Y + element.Height < _rectangle.Y2)
                {
                    _selected_elements.Add(element);
                    element.Select();
                    _selected_first = element;
                }
            }
        }
コード例 #15
0
ファイル: UMLDiagram.cs プロジェクト: MonoBrasil/historico
 internal void AddNewElement(UMLElement graphicElement, UML.Element modelElement)
 {
     this.UMLCanvas.AddElement (graphicElement);
     UML.Element ns = ((MonoUML.DI.Uml2Bridge.Uml2SemanticModelBridge)this.DIDiagram.Namespace).Element;
     modelElement.Owner = ns;
     UML.Package pkg = ns as UML.Package;
     if (pkg != null)
     {
         pkg.OwnedElement.Add (modelElement);
         Hub.Instance.Broadcaster.BroadcastElementChange(pkg);
     }
     else
     {
         Hub.Instance.AddNewUMLElement (modelElement);
     }
 }
コード例 #16
0
ファイル: UMLEdge.cs プロジェクト: MonoBrasil/historico
 private void ReplaceToElement()
 {
     if (ReplaceToModelElement ())
     {
         _to_element.Moved -= new UMLElementMovedHandler (ToNodeMoved);
         _to_element.Resized -= new UMLElementResizedHandler (ToNodeResized);
         DI.GraphConnector anchorage = (DI.GraphConnector)_graphEdge.Anchor [1];
         _to_element.GraphElement.Anchorage.Remove (anchorage);
         _to_element = _ownerDiagram.UMLCanvas.GetHoverElement (this);
         _to_element.Moved += new UMLElementMovedHandler (ToNodeMoved);
         _to_element.Resized += new UMLElementResizedHandler (ToNodeResized);
         _to_element.GraphElement.Anchorage.Add (anchorage);
         anchorage.GraphElement = _to_element.GraphElement;
     }
     CalculateDimensions ();
     EnsureEdgeVisibility ();
 }
コード例 #17
0
ファイル: UMLCanvas.cs プロジェクト: MonoBrasil/historico
		public void AddElement (UMLElement element)
		{
			/*if (_elements.IndexOf (element) != -1)
			{
				MessageDialog md = new MessageDialog (
					null,
					DialogFlags.DestroyWithParent,
					Gtk.MessageType.Error,
					ButtonsType.Close,
					"Element is already drawn in the diagram");
				md.Run();
				md.Destroy();
			}
			else
			{*/
				element.ButtonPressed += NodeButtonPressedCb;
				element.Motioned += NodeMovedCb;
				/*
				//This will allow good UMLSelector-behavior (won't draw the rectangle)
				if (element is UMLNodeEntry)  
				{
					((UMLNodeEntry)element).EntryMoved += DisableSelectorEntryMoved;
					element.Resized += DisableSelectorResized;
				}
				*/
				element.Resized += NodeResizedCb;
				element.Selected += NodeSelected;
				//Particular Events
				if (element is UMLActor)
				{
					((UMLActor)element).NameChanged += NameChangedEvent;
				}
				_elements.Add (element);
			//}
		}
コード例 #18
0
ファイル: UMLEdge.cs プロジェクト: MonoBrasil/historico
 protected UMLEdge(UMLDiagram ownerDiagram, DI.GraphEdge graphEdge, bool forceRedraw)
     : base(ownerDiagram, graphEdge)
 {
     _graphEdge = graphEdge;
     DI.GraphConnector connector;
     _ends0 = new ArrayList (2);
     _ends1 = new ArrayList (2);
     connector = (DI.GraphConnector)graphEdge.Anchor [0];
     _from_element = ownerDiagram.GetUmlcanvasElement (connector.GraphElement);
     connector = (DI.GraphConnector)graphEdge.Anchor [1];
     _to_element = ownerDiagram.GetUmlcanvasElement (connector.GraphElement);
     _control_points = new ArrayList ();
     // control points and line segments
     //CreateControlPoints ();
     CreateLineSegments ();
     // From and To elements
     _from_element.Moved += FromNodeMoved;
     _from_element.Resized += FromNodeResized;
     _to_element.Moved += ToNodeMoved;
     _to_element.Resized += ToNodeResized;
     if (forceRedraw) { ForceRedraw (); }
 }
コード例 #19
0
ファイル: UMLCanvas.cs プロジェクト: MonoBrasil/historico
		// Verify if the current element was the last selected element
		private void NodeButtonPressedCb (object obj, Gdk.EventButton eb)
		{
			//System.Console.WriteLine ("NodeButtonPressedCb");
			//FIXME. When moving any UMLNodeEntryContained's UMLEntry
			if (_association)
			{
				if (_association_start == null)
				{
					_association_start = (UMLElement) obj;
					System.Console.WriteLine ("NodeButtonPressedCb> set association start.");
				}
				else if (_association_end == null)
				{
					//System.Console.WriteLine ("NodeButtonPressedCb> set association end.");
					_association_end = (UMLElement) obj;
					CreateEdgeAction createEdge = (CreateEdgeAction)_currentAction;
					createEdge.FromElement = _association_start;
					createEdge.ToElement = _association_end;
					createEdge.Execute ();
					_association = false;
					_association_start = _association_end = null;
				}
			}
			else 
			{
				_selector.Select ((UMLElement) obj);
				_element_selected = true;
			}
		}
コード例 #20
0
ファイル: UMLEntry.cs プロジェクト: MonoBrasil/historico
        public UMLEntry(
			UMLElement owner,
			DI.GraphNode graphNode,
			CanvasGroup group,
			bool isMovable,
			string text
		)
            : this(owner, graphNode, group, isMovable, text, null)
        {
        }
コード例 #21
0
        public static UMLAssociation CreateNew(
			UMLDiagram ownerDiagram,
			UMLElement fromElement,
			UMLElement toElement )
        {
            UMLAssociation association = null;
            DI.GraphElement fromGE = fromElement.GraphElement;
            DI.GraphElement toGE = toElement.GraphElement;
            UML.Classifier fromModelElement = MonoUML.Widgets.Helper.GetSemanticElement (fromGE) as UML.Classifier;
            UML.Classifier toModelElement = MonoUML.Widgets.Helper.GetSemanticElement (toGE) as UML.Classifier;
            if (fromModelElement != null && toModelElement != null)
            {
                // creates the new Association in the model
                UML.Association assocModel = UML.Create.Association ();
                UML.Property end0 = UML.Create.Property ();
                // the first end aims at the "TO" end
                end0.Type = toModelElement;
                assocModel.OwnedEnd.Add (end0);
                end0.OwningAssociation = assocModel;
                // the second (and last) end aims at the "FROM" end
                UML.Property end1 = UML.Create.Property ();
                end1.Type = fromModelElement;
                assocModel.OwnedEnd.Add (end1);
                end1.OwningAssociation = assocModel;
                // creates the graphical representation of the new Association
                DI.GraphEdge assocGE = new DI.GraphEdge ();
                //    graphical properties
                //    model bridge to the UML model element (Actor)
                Uml2SemanticModelBridge bridge = new Uml2SemanticModelBridge ();
                bridge.Element = assocModel;
                assocGE.SemanticModel = bridge;
                // adds anchors and anchorages
                DI.GraphConnector cnn;
                cnn = new DI.GraphConnector ();
                cnn.GraphElement = fromGE;
                fromGE.Anchorage.Add (cnn);
                fromGE.Position.CopyTo (cnn.Position);
                assocGE.Anchor.Add (cnn);
                cnn.GraphEdge.Add (assocGE);
                cnn = new DI.GraphConnector ();
                cnn.GraphElement = toGE;
                toGE.Anchorage.Add (cnn);
                toGE.Position.CopyTo (cnn.Position);
                assocGE.Anchor.Add (cnn);
                cnn.GraphEdge.Add (assocGE);
                // adds waypoints
                DI.GraphNode gn = fromGE as DI.GraphNode;
                DI.Point f = (gn != null ? gn.Center : toGE.Position.Clone ());
                gn = toGE as DI.GraphNode;
                DI.Point t = (gn != null ? gn.Center : toGE.Position.Clone ());
                assocGE.Waypoints.Add (f);
                assocGE.Waypoints.Add (t);
                // adds the name compartment
                DI.SimpleSemanticModelElement simpleBridge;
                DI.GraphNode nameCompartmentGN = new DI.GraphNode ();
                simpleBridge = new DI.SimpleSemanticModelElement ();
                simpleBridge.TypeInfo = "DirectedName";
                nameCompartmentGN.SemanticModel = simpleBridge;
                assocGE.Contained.Add (nameCompartmentGN);
                nameCompartmentGN.Container = assocGE;
                DI.Point.GetHalfWayPoint (fromGE.Position, toGE.Position).CopyTo (nameCompartmentGN.Position);
                DI.GraphNode keywordMetaclassGN = new DI.GraphNode ();
                simpleBridge = new DI.SimpleSemanticModelElement ();
                simpleBridge.TypeInfo = "Name";
                keywordMetaclassGN.SemanticModel = simpleBridge;
                nameCompartmentGN.Contained.Add (keywordMetaclassGN);
                keywordMetaclassGN.Container = nameCompartmentGN;
                // adds the association ends compartments
                DI.GraphNode endCompartment0 = UMLAssociationEnd.CreateNewGraphNode (end0);
                assocGE.Contained.Add (endCompartment0);
                endCompartment0.Container = assocGE;
                DI.GraphNode endCompartment1 = UMLAssociationEnd.CreateNewGraphNode (end1);
                assocGE.Contained.Add (endCompartment1);
                endCompartment1.Container = assocGE;
                // adds the association to the diagram
                ownerDiagram.DIDiagram.Contained.Add (assocGE);
                assocGE.Container = ownerDiagram.DIDiagram;
                association = new UMLAssociation (ownerDiagram, assocGE, assocModel);
                association._assocEnd0.SetPosition ((DI.Point) association._graphEdge.Waypoints [0]);
                association._assocEnd1.SetPosition ((DI.Point) association._graphEdge.Waypoints [1]);
                ownerDiagram.AddNewClassifier (association, assocModel);
            }
            return association;
        }
コード例 #22
0
ファイル: UMLSelector.cs プロジェクト: MonoBrasil/historico
 public void Clear()
 {
     _selected_elements.Clear ();
     _selected_first = null;
 }