示例#1
0
        protected override void AddTerminals()
        {
            InputOutputElement ioElement = LinkedObject as InputOutputElement;
            //add the Output
            GraphicBaseElement element = GraphicObjectFactory.CreateInstance(typeof(Terminal), ioElement.Outputs[0]);

            element.Location = new PointF(GraphicConstants.GraphicSignalWidth, GraphicConstants.GraphicSignalHeight / 2);
            AddTerminal(element as GraphicTerminal);
        }
示例#2
0
        /// <summary>
        /// Adds terminals when needed
        /// </summary>
        protected virtual void AddTerminals()
        {
            InputOutputElement ioElement = LinkedObject as InputOutputElement;
            //add Outputs
            int count = CountTerminals(DirectionType.Output);

            while (count < ioElement.OutputCount)
            {
                GraphicBaseElement element = GraphicObjectFactory.CreateInstance(typeof(Terminal), ioElement.Outputs[count]);
                if (ioElement.Outputs[count].Negated)
                {
                    element.Location = new PointF(GraphicConstants.GraphicElementWidth,
                                                  GraphicConstants.GraphicElementUpperSpace + count * GraphicConstants.GraphicElementTerminalSpace - 3);
                }
                else
                {
                    element.Location = new PointF(GraphicConstants.GraphicElementWidth,
                                                  GraphicConstants.GraphicElementUpperSpace + count * GraphicConstants.GraphicElementTerminalSpace);
                }
                AddTerminal(element as GraphicTerminal);
                count++;
            }
            //add Inputs
            count = CountTerminals(DirectionType.Input);
            while (count < ioElement.InputCount)
            {
                GraphicBaseElement element = GraphicObjectFactory.CreateInstance(typeof(Terminal), ioElement.Inputs[count]);
                if (ioElement.Inputs[count].Negated)
                {
                    element.Location = new PointF(-GraphicConstants.GraphicTerminalWidth,
                                                  GraphicConstants.GraphicElementUpperSpace + count * GraphicConstants.GraphicElementTerminalSpace - 3);
                }
                else
                {
                    element.Location = new PointF(-GraphicConstants.GraphicTerminalWidth,
                                                  GraphicConstants.GraphicElementUpperSpace + count * GraphicConstants.GraphicElementTerminalSpace);
                }
                element.Angle = 180;
                AddTerminal(element as GraphicTerminal);
                count++;
            }
        }
        /// <summary>
        /// Adds terminals
        /// </summary>
        protected override void AddTerminals()
        {
            Macro macro = LinkedObject as Macro;

            foreach (SymbolPart part in m_Symbol)
            {
                if (part is PortPart)
                {
                    PortPart port = (PortPart)part;
                    Terminal term = macro.GetTerminalByName(port.Name);
                    if (term != null)
                    {
                        GraphicBaseElement element = GraphicObjectFactory.CreateInstance(typeof(Terminal), term);
                        element.Name     = port.Name;
                        element.Location = port.Location;
                        element.Angle    = port.Angle;
                        AddTerminal(element as GraphicTerminal);
                    }
                }
            }
        }