コード例 #1
0
            public void Visit(IPortLinkGlyph portLink)
            {
                WriteDefaults(portLink);
                _Writer.WriteElementString("FromPortName", portLink.FromPortName);
                _Writer.WriteElementString("SendIndex", portLink.SendIndex);
                _Writer.WriteElementString("ToPortName", portLink.ToPortName);

                foreach (IPortLinkContactPointGlyph contactPoint in portLink.ContactPoints)
                {
                    if (contactPoint.Parent != null)
                    {
                        IComponentGlyph comp = contactPoint.Parent as IComponentGlyph;
                        System.Diagnostics.Debug.Assert(comp != null);
                        _Writer.WriteStartElement("Component");
                        try
                        {
                            _Writer.WriteElementString("Id", comp.Id);
                            _Writer.WriteElementString("Name", comp.Name);
                        }
                        finally
                        {
                            _Writer.WriteEndElement();
                        }
                    }
                }
            }
コード例 #2
0
        void SavePortLinkGlyph(TextWriter sw, IPortLinkGlyph glyph)
        {
            SaveBounds(sw, "PORTLINK:", glyph);
            IGroupGlyph groupGlyph = glyph as IGroupGlyph;

            foreach (IGlyph contact in groupGlyph.ContactPoints)
            {
                if (contact.Parent != null)
                {
                    sw.WriteLine(contact.Parent.Id);
                }
                else
                {
                    sw.WriteLine("NOPARENT");
                }
            }

            SaveGlyphCommon(sw, glyph);

            IPortLinkGlyph link = glyph;

            SaveText(sw, "NAME", link.Name);
            SaveText(sw, "FROMPORTNAME", link.FromPortName);
            SaveText(sw, "TOPORTNAME", link.ToPortName);
            SaveText(sw, "SENDINDEX", link.SendIndex);
        }
コード例 #3
0
        void LoadPortLinkGlyph(TextReader sr)
        {
            string id;
            int    X, Y, width, height;

            LoadBounds(sr, out id, out X, out Y, out width, out height);
            string parentIdFrom = NextLine(sr);
            string parentIdTo   = NextLine(sr);

            _EntityLinkRel [id] = new StringPair(parentIdFrom, parentIdTo);
            IPortLinkGlyph glyph = _Factory.CreatePortLink(id, new Rectangle(X, Y, width, height));

            LoadGlyphCommon(sr, glyph);

            IPortLinkGlyph link = glyph;

            link.Name         = LoadText(sr, "NAME");
            link.FromPortName = LoadText(sr, "FROMPORTNAME", "");
            link.ToPortName   = LoadText(sr, "TOPORTNAME", "");
            link.SendIndex    = LoadText(sr, "SENDINDEX", "");

            BlankLine(sr);              // blank line
            _GlyphLookup.Add(id, glyph);
            _Glyphs.Add(glyph);
        }
コード例 #4
0
        protected void AddPortLinkToPortContext(IQPort port, IPortLinkGlyph portLink)
        {
            if (!_PortContext.Contains (port))
            {
                _PortContext.Add (port, new ArrayList ());
            }

            ArrayList list = _PortContext [port] as ArrayList;
            list.Add (portLink);
        }
コード例 #5
0
 protected IComponentGlyph GetComponent(IPortLinkGlyph portLink, TransitionContactEnd whichEnd)
 {
     foreach (IPortLinkContactPointGlyph contactPoint in portLink.ContactPoints)
     {
         if (contactPoint.WhichEnd == whichEnd)
         {
             return(GetComponent(portLink, contactPoint));
         }
     }
     return(null);
 }
コード例 #6
0
        protected void AddPortLinkToPortContext(IQPort port, IPortLinkGlyph portLink)
        {
            if (!_PortContext.Contains(port))
            {
                _PortContext.Add(port, new ArrayList());
            }

            ArrayList list = _PortContext [port] as ArrayList;

            list.Add(portLink);
        }
コード例 #7
0
 protected IComponentGlyph GetComponent(IPortLinkGlyph portLink, TransitionContactEnd whichEnd)
 {
     foreach (IPortLinkContactPointGlyph contactPoint in portLink.ContactPoints)
     {
         if (contactPoint.WhichEnd == whichEnd)
         {
             return GetComponent (portLink, contactPoint);
         }
     }
     return null;
 }
コード例 #8
0
        protected void LinkPorts(ComponentContext ctxFrom, ComponentContext ctxTo, IPortLinkGlyph portLink)
        {
            string fromPortName = portLink.FromPortName;
            string toPortName   = portLink.ToPortName;

            IQPort portFrom = GetPort(ctxFrom, fromPortName);
            IQPort toPort   = GetPort(ctxTo, toPortName);

            portFrom.QEvents += new QEventHandler(toPort.Receive);

            AddPortLinkToPortContext(portFrom, portLink);
        }
コード例 #9
0
        protected void LinkPorts(ComponentContext ctxFrom, ComponentContext ctxTo, IPortLinkGlyph portLink)
        {
            string fromPortName = portLink.FromPortName;
            string toPortName = portLink.ToPortName;

            IQPort portFrom = GetPort (ctxFrom, fromPortName);
            IQPort toPort = GetPort (ctxTo, toPortName);

            portFrom.QEvents += new QEventHandler(toPort.Receive);

            AddPortLinkToPortContext (portFrom, portLink);
        }
コード例 #10
0
            public int Compare(object x, object y)
            {
                if (x == y)
                {
                    return(0);
                }

                IPortLinkGlyph xPort = x as IPortLinkGlyph;
                IPortLinkGlyph yPort = y as IPortLinkGlyph;

                int fromPortComp = xPort.FromPortName.CompareTo(yPort.FromPortName);

                if (fromPortComp == 0)
                {
                    return(xPort.SendIndex.CompareTo(yPort.SendIndex));
                }
                return(fromPortComp);
            }
コード例 #11
0
        public override void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext GC)
        {
            if (_WhichEnd == TransitionContactEnd.To)
            {
                int height = this.Bounds.Width;
                pointer.Draw(GC, Centre(_OtherEnd.Bounds), Centre(this.Bounds), height, height);
            }
            else
            {
                base.Draw(GC);
            }

            IPortLinkGlyph portLink = Owner as IPortLinkGlyph;

            if (portLink != null)
            {
                string portName = "?NoName";
                switch (_WhichEnd)
                {
                case TransitionContactEnd.From:
                {
                    portName = portLink.FromPortName;
                    if (IsNotEmptyString(portLink.SendIndex))
                    {
                        portName = portName + "-" + portLink.SendIndex;
                    }
                } break;

                case TransitionContactEnd.To:
                {
                    portName = portLink.ToPortName;
                } break;
                }

                using (Brush brush = new System.Drawing.SolidBrush(GC.Color))
                {
                    Rectangle bounds = Bounds;
                    GC.DrawString(portName, brush, 12, new Point(bounds.Right, bounds.Bottom), false);
                }
            }
        }
コード例 #12
0
        protected IComponentGlyph GetComponent(IPortLinkGlyph portLink, IPortLinkContactPointGlyph contactPoint)
        {
            IComponentGlyph parent = contactPoint.Parent as IComponentGlyph;

            return(parent);
        }
コード例 #13
0
            public void Visit(IPortLinkGlyph portLink)
            {
                WriteDefaults (portLink);
                _Writer.WriteElementString ("FromPortName", portLink.FromPortName);
                _Writer.WriteElementString ("SendIndex", portLink.SendIndex);
                _Writer.WriteElementString ("ToPortName", portLink.ToPortName);

                foreach (IPortLinkContactPointGlyph contactPoint in portLink.ContactPoints)
                {
                    if (contactPoint.Parent != null)
                    {
                        IComponentGlyph comp = contactPoint.Parent as IComponentGlyph;
                        System.Diagnostics.Debug.Assert (comp != null);
                        _Writer.WriteStartElement ("Component");
                        try
                        {
                            _Writer.WriteElementString ("Id", comp.Id);
                            _Writer.WriteElementString ("Name", comp.Name);
                        }
                        finally
                        {
                            _Writer.WriteEndElement ();
                        }
                    }
                }
            }
コード例 #14
0
        void SavePortLinkGlyph(TextWriter sw, IPortLinkGlyph glyph)
        {
            SaveBounds (sw, "PORTLINK:", glyph);
            IGroupGlyph groupGlyph = glyph as IGroupGlyph;
            foreach (IGlyph contact in groupGlyph.ContactPoints)
            {
                if (contact.Parent != null)
                {
                    sw.WriteLine (contact.Parent.Id);
                }
                else
                {
                    sw.WriteLine ("NOPARENT");
                }
            }

            SaveGlyphCommon (sw, glyph);

            IPortLinkGlyph link = glyph;
            SaveText (sw, "NAME", link.Name);
            SaveText (sw, "FROMPORTNAME", link.FromPortName);
            SaveText (sw, "TOPORTNAME", link.ToPortName);
            SaveText (sw, "SENDINDEX", link.SendIndex);
        }
コード例 #15
0
 protected IComponentGlyph GetComponent(IPortLinkGlyph portLink, IPortLinkContactPointGlyph contactPoint)
 {
     IComponentGlyph parent = contactPoint.Parent as IComponentGlyph;
     return parent;
 }