コード例 #1
0
        /// <summary>
        /// XNetAO
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXNetAOBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:75 x 15
            // 输入:1 + 1; 输出:0; 参数:n

            block.Size = new SizeF(75f, 15f);

            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Size = block.Size;
            symbolTemp.Location = block.Location;

            LogicRoundRectangle bodyRoundRectangle = new LogicRoundRectangle();
            bodyRoundRectangle.Location = block.Location;
            bodyRoundRectangle.Size = symbolTemp.Size;
            bodyRoundRectangle.XRadius = 7.5f;
            bodyRoundRectangle.YRadius = 7.5f;

            LogicText bodyText = new LogicText();
            bodyText.Location = new PointF(symbolTemp.X + 8f, symbolTemp.Y + 2f);
            bodyText.Width = symbolTemp.Width - 16f;
            bodyText.Height = symbolTemp.Height - 4f;

            LogicPin inputPin = null;
            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "X")
                {
                    if (pin.Visible || (pin.PointName != null && LogicPin.RegPointName.IsMatch(pin.PointName)))
                    {
                        pin.Point = "0_7.5";
                        inputPin = new LogicPin(pin, symbolTemp);
                    }
                }
                else if (pin.PinName == "GID")
                {
                    if (pin.PointName != null && pin.PointName != "?")
                    {
                        bodyText.Text = pin.PointName;
                    }
                    else
                    {
                        bodyText.Text = "Null";
                    }
                }
            }

            symbolTemp.Graphics.Add(bodyRoundRectangle);
            symbolTemp.Graphics.Add(bodyText);
            if (inputPin != null)
            {
                symbolTemp.Graphics.Add(inputPin);
            }

            IList<Cld_FCBlock> referenceBlocks = CrossReference.GetOutputReference(block);
            LogicPoke poke = NewSymbolPoke(block, bodyText, referenceBlocks);
            symbolTemp.Graphics.Add(poke);

            symbols.Add(symbolTemp);

            if (referenceBlocks.Count > 0)
            {
                for (int i = 0; i < referenceBlocks.Count; i++)
                {
                    GenerateXPgAIReferer(block, i, referenceBlocks[i], symbols);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// XNetAI
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXNetAIBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:75 x 15
            // 输入:0 + 1; 输出:1; 参数:2

            block.Size = new SizeF(75f, 15f);

            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = block.Location;
            symbolTemp.Size = block.Size;

            LogicRoundRectangle bodyRoundRectangle = new LogicRoundRectangle();
            bodyRoundRectangle.Location = block.Location;
            bodyRoundRectangle.Size = symbolTemp.Size;
            bodyRoundRectangle.XRadius = 7.5f;
            bodyRoundRectangle.YRadius = 7.5f;

            LogicText bodyText = new LogicText();
            bodyText.Location = new PointF(symbolTemp.X + 8f, symbolTemp.Y + 2f);
            bodyText.Width = symbolTemp.Width - 16f;
            bodyText.Height = 11f;

            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "GID")
                {
                    if (pin.PointName != null && pin.PointName != "?")
                    {
                        bodyText.Text = pin.PointName;
                    }
                    else
                    {
                        bodyText.Text = "Null";
                    }
                }
            }

            LogicPin outputPin = null;
            foreach (Cld_FCOutput pin in block.Cld_FCOutput_List)
            {
                if (pin.PinName == "Y")
                {
                    pin.Point = "75_7.5";
                    outputPin = new LogicPin(pin, symbolTemp);
                }
            }

            symbolTemp.Graphics.Add(bodyRoundRectangle);
            symbolTemp.Graphics.Add(bodyText);
            if (outputPin != null)
            {
                symbolTemp.Graphics.Add(outputPin);
            }

            LogicPoke poke = NewSymbolPoke(block, bodyText, null);
            symbolTemp.Graphics.Add(poke);

            symbols.Add(symbolTemp);
        }