コード例 #1
0
ファイル: LogicPin.cs プロジェクト: BGCX261/ziliao-svn-to-git
        /// <summary>
        /// 生成Pin的子图(PinName,PinValue,PinLine)
        /// </summary>
        public void GenerateSubmitGraphics()
        {
            // 生成引脚上伸出的线

            if (this.point1 != this.point2)
            {
                this.pinLine = new LogicLine(this.Point1, this.Point2, Color.Black, DashStyle.Solid);
            }

            // 生成引脚名称文本
            if (this.pinName != null && this.pinName.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point2.X + 2f, this.Point2.Y - 5f),
                                                     new SizeF(28f, 10f), Align.MiddleLeft, Color.Black);
                }
                else
                {
                    this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                                                     new SizeF(28f, 10f), Align.MiddleRight, Color.Black);
                }
            }

            // 生成引脚值文本

            if (this.pinValue != null && this.pinValue.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point1.X - 30f, this.Point2.Y - 5f),
                                                      new SizeF(28f, 10f), Align.MiddleRight, Color.Black);
                }
                else
                {
                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point2.X + 2f, this.Point2.Y - 12f),
                                                      new SizeF(28f, 10f), Align.MiddleLeft, Color.Black);
                }

                // 动态属性(AiValueOut)
            }
        }
コード例 #2
0
        /// <summary>
        /// XDO
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXDOBlock(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.Location = block.Location;
            symbolTemp.Size = new SizeF(75f, 28f);

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] {
                symbolTemp.Location,
                new PointF(block.X + block.Width - block.Height / 2, block.Y),
                new PointF(block.X + block.Width, block.Y + block.Height / 2),
                new PointF(block.X + block.Width - block.Height / 2, block.Y + block.Height),
                new PointF(block.X, block.Y + block.Height) };

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

            LogicText parameterText = new LogicText();
            parameterText.Location = new PointF(block.X, block.Y + block.Height + 1f);
            parameterText.Width = block.Width;
            parameterText.Height = 11f;
            parameterText.Alignment = Align.TopCenter;

            LogicPin inputPin = null;
            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "Z")
                {
                    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";
                    }
                }
            }

            foreach (Cld_FCParameter para in block.Cld_FCParameter_List)
            {
                if (para.Name == "Addr")
                {
                    parameterText.Text = GetAddr(para.PValue);
                }
            }

            symbolTemp.Graphics.Add(bodyPolygon);
            symbolTemp.Graphics.Add(bodyText);
            symbolTemp.Graphics.Add(parameterText);
            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++)
                {
                    GenerateXPgDIReferer(block, i, referenceBlocks[i], symbols);
                }
            }
        }
コード例 #3
0
        private static void GenerateText(Cld_Graphic graphic, ArrayList symbols)
        {
            string staticAttributeString;
            if (graphic.Data.Contains("$$"))
            {
                staticAttributeString = graphic.Data.Substring(graphic.Data.IndexOf("$$") + 2);
            }
            else
            {
                staticAttributeString = graphic.Data;
            }

            string[] staticAttributes = staticAttributeString.Split(new string[] { "||" }, StringSplitOptions.None);

            LogicText text = new LogicText();
            text.Text = staticAttributes[0];
            if (staticAttributes[0].StartsWith("&"))
            {
                DynTagDef tagDef = new DynTagDef(staticAttributes[0].Substring(1), 1);
                text.Dynamics.Add(tagDef);
            }
            string[] location = staticAttributes[2].Split('_');
            text.Location = new PointF(Convert.ToSingle(location[0]), Convert.ToSingle(location[1]));
            text.Angle = Convert.ToInt32(staticAttributes[3]);
            FontStyle style = FontStyle.Regular;
            if (staticAttributes.Length > 7)
            {
                if (staticAttributes[7] == "1")
                    style = FontStyle.Bold;
                if (staticAttributes[8] == "1")
                    style |= FontStyle.Italic;
                if (staticAttributes[9] == "1")
                    style |= FontStyle.Underline;
            }
            text.Font = new Font(staticAttributes[4], Convert.ToSingle(staticAttributes[5]), style);

            string[] color = staticAttributes[6].Split('_');
            text.ForeColor = Color.FromArgb(Convert.ToInt32(color[0]), Convert.ToInt32(color[1]), Convert.ToInt32(color[2]));


            //if (staticAttributes[1] == "左上")
            //{
            //    text.Alignment = Align.TopLeft;
            //}
            //else if (staticAttributes[1] == "中上")
            //{
            //    text.Alignment = Align.TopCenter;
            //}
            //else if (staticAttributes[1] == "右上")
            //{
            //    text.Alignment = Align.TopRight;
            //}
            //else if (staticAttributes[1] == "左中")
            //{
            //    text.Alignment = Align.MiddleLeft;
            //}
            //else if (staticAttributes[1] == "居中")
            //{
            //    text.Alignment = Align.MiddleCenter;
            //}
            //else if (staticAttributes[1] == "右中")
            //{
            //    text.Alignment = Align.MiddleRight;
            //}
            //else if (staticAttributes[1] == "左下")
            //{
            //    text.Alignment = Align.BottomLeft;
            //}
            //else if (staticAttributes[1] == "中下")
            //{
            //    text.Alignment = Align.BottomCenter;
            //}
            //else if (staticAttributes[1] == "右下")
            //{
            //    text.Alignment = Align.BottomRight;
            //}
            //else
            //{
            //    throw new Exception("对齐方式不确定!");
            //}

            symbols.Add(text);
        }
コード例 #4
0
        /// <summary>
        /// 根据FCBlock构造Symbol
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        private static void GenerateCommonBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // 开始构造一个Symbol
            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.GeneralSymbol);
            symbolTemp.Location = block.Location;
            symbolTemp.Size = block.Size;

            // 主体矩形
            LogicRectangle symbolBody = new LogicRectangle();
            symbolBody.Location = block.Location;
            symbolBody.Size = block.Size;
            symbolTemp.Graphics.Add(symbolBody);

            #region 模块名称(内部,上中)

            // SymbolName
            LogicText symbolNameText = new LogicText();
            symbolNameText.Location = new PointF(block.X + 2f, block.Y + 1f);
            symbolNameText.Width = block.Width - 4f;
            symbolNameText.Height = LogicSymbol.HeadHeight - 3f;
            symbolNameText.Text = block.FunctionName;
            symbolNameText.Font = new Font(LogicText.DefaultFamily, 12, FontStyle.Bold);
            symbolNameText.Alignment = Align.TopCenter;
            symbolNameText.ForeColor = Color.Black;
            symbolTemp.Graphics.Add(symbolNameText);

            #endregion

            #region I/O引脚

            // 遍历输入引脚
            foreach (Cld_FCInput input in block.Cld_FCInput_List)
            {
                bool isConnected = input.PointName != null ? LogicPin.RegPointName.IsMatch(input.PointName) : false;
                if (input.Visible || isConnected)
                {
                    LogicPin pin = new LogicPin(input, symbolTemp);
                    symbolTemp.Graphics.Add(pin);

                    symbolTemp.InputCount++;
                }
            }

            // 遍历输出引脚
            foreach (Cld_FCOutput output in block.Cld_FCOutput_List)
            {
                bool enable = false;
                if (!output.Visible)
                {
                    foreach (Cld_FCInput input in block.Cld_FCInput_List)
                    {
                        if (input.Visible && input.PointName == output.PointName)
                        {
                            enable = true;
                            break;
                        }
                    }
                }
                if (output.Visible || enable)
                {
                    LogicPin pin = new LogicPin(output, symbolTemp);
                    symbolTemp.Graphics.Add(pin);
                    symbolTemp.OutputCount++;
                }
            }
            #endregion

            #region 输出块号

            // 块号:序号
            LogicText symbolIndexText = new LogicText();
            symbolIndexText.Location = new PointF(block.X + 2f, block.Y + block.Height - LogicSymbol.FootHeight + 2f);
            symbolIndexText.Width = block.Width - 4f;
            symbolIndexText.Height = LogicSymbol.FootHeight - 3f;
            symbolIndexText.Text = block.AlgName.Substring(block.AlgName.LastIndexOf('-') + 1) + ":" + block.Sequence;
            symbolTemp.Graphics.Add(symbolIndexText);

            #endregion

            #region 输出块的参数信息

            IList fcParameters = block.Cld_FCParameter_List;
            if (fcParameters.Count > 0)
            {
                symbolTemp.Height += LogicSymbol.ParaHeight;
                LogicText symbolParaText = new LogicText();
                symbolParaText.Location = new PointF(block.X, block.Y + block.Height + 1f);
                symbolParaText.Width = block.Width;
                symbolParaText.Height = LogicSymbol.ParaHeight - 2f;
                symbolParaText.Alignment = Align.TopCenter;
                symbolParaText.Text = "";

                foreach (Cld_FCParameter para in block.Cld_FCParameter_List)
                {
                    if (para.Name == "Num")
                    {
                        if (symbolParaText.Text.Length == 0)
                        {
                            symbolParaText.Text = "Num=" + para.PValue;
                        }
                        else
                        {
                            symbolParaText.Text = "Num=" + para.PValue + "," + symbolParaText.Text;
                        }
                    }
                    if (para.Name == "Mode")
                    {
                        if (symbolParaText.Text.Length == 0)
                        {
                            symbolParaText.Text = "Num=" + para.PValue;
                        }
                        else
                        {
                            symbolParaText.Text += ",Num=" + para.PValue;
                        }
                    }
                }

                symbolTemp.Graphics.Add(symbolParaText);
            }

            #endregion

            LogicPoke poke = new LogicPoke(block);
            // 操作方式
            symbolTemp.Graphics.Add(poke);

            symbols.Add(symbolTemp);
        }
コード例 #5
0
        private static LogicPoke NewSymbolPoke(Cld_FCBlock block, LogicText bodyText, IList<Cld_FCBlock> referenceBlocks)
        {
            IList<Cld_FCBlock> loopReferenceBlocks = bodyText.Text != "Null" ? CrossReference.GetLoopReference(bodyText.Text, block.ID) : null;
            DynCrossReference reference = null;
            if (referenceBlocks != null && referenceBlocks.Count > 0)
            {
                reference = new DynCrossReference();
                foreach (Cld_FCBlock refBlock in referenceBlocks)
                {
                    reference.AddReference(refBlock);
                }
            }
            if (loopReferenceBlocks != null && loopReferenceBlocks.Count > 0)
            {
                if (reference == null)
                {
                    reference = new DynCrossReference();
                }
                foreach (Cld_FCBlock refBlock in loopReferenceBlocks)
                {
                    reference.AddLoopReference(refBlock);
                }
            }

            LogicPoke poke = new LogicPoke(block);
            if (reference != null)
            {
                poke.Dynamics.Add(reference);
            }
            return poke;
        }
コード例 #6
0
        private static void GenerateXPgDIReferer(Cld_FCBlock block, int refererIndex, Cld_FCBlock refBlock, ArrayList symbols)
        {
            // 大小:35 x 30

            float edgeLength = 17.5f;             // 正六边形的边长



            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = new PointF((float)(block.X + block.Width + refererIndex * 35), block.Y + block.Height / 2 - 15f);
            symbolTemp.Size = new SizeF(35f, 30f);

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] { 
                new PointF(symbolTemp.X, symbolTemp.Y + 15f),
                new PointF(symbolTemp.X + edgeLength / 2, symbolTemp.Y),
                new PointF((float)(symbolTemp.X + edgeLength * 1.5), symbolTemp.Y),
                new PointF(symbolTemp.X + 35f, symbolTemp.Y + 15f),
                new PointF((float)(symbolTemp.X + edgeLength * 1.5), symbolTemp.Y + 30f),
                new PointF((float)(symbolTemp.X + edgeLength / 2), symbolTemp.Y + 30f)};


            LogicText pageIndexText = new LogicText();
            pageIndexText.Location = new PointF(symbolTemp.X + 8f, symbolTemp.Y + 3f);
            pageIndexText.Width = 19f;
            pageIndexText.Height = 11f;

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

            string[] ids = refBlock.AlgName.Split('-');
            pageIndexText.Text = ids[1];
            blockIndexText.Text = ids[2];

            symbolTemp.Graphics.Add(bodyPolygon);
            symbolTemp.Graphics.Add(pageIndexText);
            symbolTemp.Graphics.Add(blockIndexText);

            symbols.Add(symbolTemp);
        }
コード例 #7
0
ファイル: LogicPin.cs プロジェクト: BGCX261/ziliao-svn-to-git
        public void GenerateSubmitGraphicsByPin(LogicSymbol symbol)
        {
            if (symbol.SymbolType == LogicSymbolType.GeneralSymbol)
            {
                // 生成引脚名称文本
                if (this.pinName != null && this.pinName.Length > 0)
                {
                    if (this.pinType == LogicPinType.Input)
                    {
                        this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point2.X + 3f, this.Point2.Y - 5f),
                                                         new SizeF(27f, 10f), Align.MiddleLeft, Color.Black);
                    }
                    else if (this.Visible)
                    {
                        this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                                                         new SizeF(27f, 10f), Align.MiddleRight, Color.Black);
                    }
                }
            }

            // 生成引脚上伸出的线

            if (this.pinType == LogicPinType.Input)
            {
                if ((!this.Visible && this.pointName != null && RegPointName.IsMatch(this.pointName)) ||
                    (this.Visible && (this.pointName == null || this.pointName.Trim('?', ' ').Length == 0) &&
                     (this.pinValue == null || this.pinValue.Trim('?', ' ').Length == 0)))
                {
                    this.point1  = PointF.Subtract(this.point2, new SizeF(20f, 0f));
                    this.pinLine = new LogicLine(this.Point1, this.Point2, Color.Black, DashStyle.Solid);
                    if (symbol.X > this.point1.X)
                    {
                        symbol.Width += symbol.X - this.point1.X;
                        symbol.X      = this.point1.X;
                    }

                    if (this.PointName != null && RegPointName.IsMatch(this.PointName))
                    {
                        string str = this.PointName.Substring(this.PointName.IndexOf('-') + 1);
                        this.pinValue = "<" + str.Substring(str.IndexOf('-') + 1) + ">";
                    }
                }
            }

            // 生成引脚值文本

            if (this.pinValue != null && this.pinValue.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    // 输入值

                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                                                      new SizeF(27f, 10f), Align.MiddleRight, Color.Black);
                    if (symbol.X > this.point1.X - 30f)
                    {
                        symbol.Width += symbol.X - (this.point1.X - 30f);
                        symbol.X      = this.point1.X - 30f;
                    }
                }
                else
                {
                    // 输出值

                    this.pinValueText = new LogicText(this.pinValue, 7f, new PointF(this.Point2.X + 3f, this.Point2.Y - 12f),
                                                      new SizeF(27f, 10f), Align.MiddleLeft, Color.Black);

                    if (symbol.X + symbol.Width < this.point2.X + 30f)
                    {
                        symbol.Width += this.point2.X + 30f - symbol.X - symbol.Width;
                    }

                    if (symbol.SymbolType == LogicSymbolType.IOSymbol && symbol.Y > this.PinValueText.Y)
                    {
                        // 给 IO 块添加输出值文本后,需要调整块的高度和 Y 坐标
                        symbol.Height += symbol.Y - this.PinValueText.Y;
                        symbol.Y       = this.PinValueText.Y;
                    }

                    // 动态输出值

                    DynValueOut value = new DynValueOut(this.pointName, 0);
                    this.PinValueText.Dynamics.Add(value);
                }
            }
        }
コード例 #8
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);
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// XPgDI
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXPgDIBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:35 x 30
            // 输入:0; 输出:1; 参数:2

            block.Size = new SizeF(35f, 30f);
            float edgeLength = 17.5f;             // 正六边形的边长


            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = PointF.Subtract(block.Location, new SizeF(60f, 0f));
            symbolTemp.Size = SizeF.Add(block.Size, new SizeF(60f, 0f));

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] { 
                new PointF(block.X, block.Y + 15f),
                new PointF(block.X + edgeLength / 2, block.Y),
                new PointF((float)(block.X + edgeLength * 1.5), block.Y),
                new PointF(block.X + 35f, block.Y + 15f),
                new PointF((float)(block.X + edgeLength * 1.5), block.Y + 30f),
                new PointF((float)(block.X + edgeLength / 2), block.Y + 30f)};

            LogicLine bodyLine = new LogicLine();
            bodyLine.Point1 = bodyPolygon.Points[0];
            bodyLine.Point2 = bodyPolygon.Points[3];

            LogicText pageIndexText = new LogicText();
            pageIndexText.Location = new PointF(block.X + 8f, block.Y + 3f);
            pageIndexText.Width = 19f;
            pageIndexText.Height = 11f;

            LogicText blockIndexText = new LogicText();
            blockIndexText.Location = new PointF(block.X + 8f, block.Y + 16f);
            blockIndexText.Width = 19f;
            blockIndexText.Height = 11f;

            string[] id = block.AlgName.Split('-');
            pageIndexText.Text = id[1];
            blockIndexText.Text = id[2];

            LogicText textPointName = new LogicText();
            textPointName.Location = new PointF(block.X - 60f, block.Y + 2f);
            textPointName.Width = 58f;
            textPointName.Height = 11f;
            textPointName.Alignment = Align.BottomRight;

            LogicPin outputPin = null;
            foreach (Cld_FCOutput output in block.Cld_FCOutput_List)
            {
                if (output.PinName == "D")
                {
                    output.Point = "35_15";
                    outputPin = new LogicPin(output, symbolTemp);
                }
            }

            foreach (Cld_FCParameter para in block.Cld_FCParameter_List)
            {
                if (para.Name == "Page")
                {
                    if (para.PValue != null)
                    {
                        int pageIndex = Convert.ToInt32(para.PValue);
                        if (pageIndex > 0 && pageIndex < 65535)
                        {
                            pageIndexText.Text = para.PValue;
                        }
                        else
                        {
                            pageIndexText.Text = "?";
                        }
                    }
                    else
                    {
                        pageIndexText.Text = "?";
                    } 
                }
                else if (para.Name == "Block")
                {
                    if (para.PValue != null)
                    {
                        int blockIndex = Convert.ToInt32(para.PValue);
                        if (blockIndex > 0 && blockIndex < 65535)
                        {
                            blockIndexText.Text = para.PValue;
                        }
                        else
                        {
                            blockIndexText.Text = "?";
                        } 
                    }
                    else
                    {
                        blockIndexText.Text = "?";
                    }
                }
            }

            string[] functions = new string[] { "XDI", "XDO", "XNetDO", "XPgDO" };
            IList<string> canReferenceFunctions = new List<string>(functions);
            Cld_FCBlock referenceBlock = CrossReference.GetInputReference(block);
            if (referenceBlock != null)
            {
                if (canReferenceFunctions.Contains(referenceBlock.FunctionName))
                {
                    if (referenceBlock.FunctionName != "XPgDO")
                    {
                        foreach (Cld_FCInput pin in referenceBlock.Cld_FCInput_List)
                        {
                            if (pin.PinName == "GID" && pin.PointName != null && pin.PointName != "?")
                            {
                                textPointName.Text = pin.PointName;
                            }
                        }

                        if (textPointName.Text.Length == 0)
                        {
                            textPointName.Text = "NoDxTag";     // 引用块名称为空(不存在),GID == NULL
                        }
                    }
                }
                else
                {
                    textPointName.Text = "RefError";        // 引用错误
                    textPointName.ForeColor = Color.Red;
                }
            }
            else
            {
                textPointName.Text = "RefNoExist";          // 引用块不存在
                textPointName.ForeColor = Color.Red;
            }

            symbolTemp.Graphics.Add(bodyPolygon);
            symbolTemp.Graphics.Add(bodyLine);
            symbolTemp.Graphics.Add(pageIndexText);
            symbolTemp.Graphics.Add(blockIndexText);
            symbolTemp.Graphics.Add(textPointName);
            if (outputPin != null)
            {
                symbolTemp.Graphics.Add(outputPin);
            }

            LogicPoke poke = new LogicPoke(block);
            if (referenceBlock != null)
            {
                DynCrossReference refenence = new DynCrossReference();
                refenence.AddReference(referenceBlock);
                poke.Dynamics.Add(refenence);
            }
            symbolTemp.Graphics.Add(poke);

            symbols.Add(symbolTemp);
        }
コード例 #10
0
        /// <summary>
        /// XPgAO
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXPgAOBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:30 x 30
            // 输入:1; 输出:0; 参数:0

            block.Size = new SizeF(30f, 30f);

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

            LogicCircle bodyCircle = new LogicCircle();
            bodyCircle.CentrePoint = new PointF(block.X + 15f, block.Y + 15f);
            bodyCircle.Radius = 15f;

            LogicText blockIndexText = new LogicText();
            blockIndexText.Location = new PointF(block.X + 5f, block.Y + 10f);
            blockIndexText.Width = 20f;
            blockIndexText.Height = 11f;
            blockIndexText.Text = block.AlgName.Substring(block.AlgName.LastIndexOf('-') + 1);

            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_15";
                        inputPin = new LogicPin(pin, symbolTemp);
                    }
                }
            }

            symbolTemp.Graphics.Add(bodyCircle);
            symbolTemp.Graphics.Add(blockIndexText);
            if (inputPin != null)
            {
                symbolTemp.Graphics.Add(inputPin);
            }

            IList<Cld_FCBlock> referenceBlocks = CrossReference.GetOutputReference(block);

            LogicPoke poke = new LogicPoke(block);
            if (referenceBlocks.Count > 0)
            {
                DynCrossReference reference = new DynCrossReference();
                foreach (Cld_FCBlock refBlock in referenceBlocks)
                {
                    reference.AddReference(refBlock);
                }
                poke.Dynamics.Add(reference);
            }
            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);
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// XPgAI
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXPgAIBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:30 x 30
            // 输入:0; 输出:1; 参数:2

            block.Size = new SizeF(30f, 30f);

            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = PointF.Subtract(block.Location, new SizeF(60f, 0f));
            symbolTemp.Size = SizeF.Add(block.Size, new SizeF(60f, 0f));

            LogicCircle bodyCircle = new LogicCircle();
            bodyCircle.CentrePoint = new PointF(block.X + 15f, block.Y + 15f);
            bodyCircle.Radius = 15f;

            LogicLine bodyLine = new LogicLine();
            bodyLine.Point1 = new PointF(block.X, block.Y + 15f);
            bodyLine.Point2 = new PointF(block.X + 30f, block.Y + 15f);

            LogicText pageIndexText = new LogicText();
            pageIndexText.Location = new PointF(block.X + 5f, block.Y + 3f);
            pageIndexText.Width = 20f;
            pageIndexText.Height = 11f;
            pageIndexText.Text = "Null";

            LogicText blockIndexText = new LogicText();
            blockIndexText.Location = new PointF(block.X + 5f, block.Y + 16f);
            blockIndexText.Width = 20f;
            blockIndexText.Height = 11f;
            blockIndexText.Text = "Null";

            LogicText textPointName = new LogicText();
            textPointName.Location = new PointF(block.X - 60f, bodyCircle.Point1.Y + 2f);
            textPointName.Width = 58f;
            textPointName.Height = 11f;
            textPointName.Alignment = Align.BottomRight;

            LogicPin outputPin = null;
            foreach (Cld_FCOutput output in block.Cld_FCOutput_List)
            {
                if (output.PinName == "Y")
                {
                    output.Point = "30_15";
                    outputPin = new LogicPin(output, symbolTemp);
                }
            }

            foreach (Cld_FCParameter para in block.Cld_FCParameter_List)
            {
                if (para.Name == "Page" && para.PValue != null)
                {
                    int pageIndex = Convert.ToInt32(para.PValue);
                    if (pageIndex > 0 && pageIndex < 65535)
                    {
                        pageIndexText.Text = para.PValue;
                    }
                    else
                    {
                        pageIndexText.Text = "?";
                    }
                }
                else if (para.Name == "Block" && para.PValue != null)
                {
                    int blockIndex = Convert.ToInt32(para.PValue);
                    if (blockIndex > 0 && blockIndex < 65535)
                    {
                        blockIndexText.Text = para.PValue;
                    }
                    else
                    {
                        blockIndexText.Text = "?";
                    }
                }
            }

            string[] functons = new string[] { "XAI", "XAO", "XPI", "XNetAO", "XPgAO" };
            IList<string> canReferenceFunctions = new List<string>(functons);
            Cld_FCBlock referenceBlock = CrossReference.GetInputReference(block);
            if (referenceBlock != null)
            {
                if (canReferenceFunctions.Contains(referenceBlock.FunctionName))
                {
                    if (referenceBlock.FunctionName != "XPgAO")
                    {
                        foreach (Cld_FCInput pin in referenceBlock.Cld_FCInput_List)
                        {
                            if (pin.PinName == "GID" && pin.PointName != null && pin.PointName != "?")
                            {
                                textPointName.Text = pin.PointName;
                            }
                        }

                        if (textPointName.Text.Length == 0)
                        {
                            textPointName.Text = "NoAxTag";     // 引用块名称为空(不存在),GID == NULL
                        }
                    }
                }
                else
                {
                    textPointName.Text = "RefError";        // 引用错误
                    textPointName.ForeColor = Color.Red;
                }
            }
            else
            {
                textPointName.Text = "RefNoExist";          // 引用块不存在
                textPointName.ForeColor = Color.Red;
            }

            symbolTemp.Graphics.Add(bodyCircle);
            symbolTemp.Graphics.Add(bodyLine);
            symbolTemp.Graphics.Add(pageIndexText);
            symbolTemp.Graphics.Add(blockIndexText);
            symbolTemp.Graphics.Add(textPointName);
            if (outputPin != null)
            {
                symbolTemp.Graphics.Add(outputPin);
            }

            LogicPoke poke = new LogicPoke(block);
            if (referenceBlock != null)
            {
                DynCrossReference refenence = new DynCrossReference();
                refenence.AddReference(referenceBlock);
                poke.Dynamics.Add(refenence);
            }
            symbolTemp.Graphics.Add(poke);

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

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

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

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] { 
                new PointF(block.X, block.Y + block.Height / 2),
                new PointF(block.X + block.Height / 2, block.Y),
                new PointF(block.X + block.Width - block.Height / 2, block.Y),
                new PointF(block.X + block.Width, block.Y + block.Height / 2),
                new PointF(block.X + block.Width - block.Height / 2, block.Y + block.Height),
                new PointF(block.X + block.Height / 2, block.Y + block.Height)};

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

            LogicPin inputPin = null;
            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "Z")
                {
                    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(bodyPolygon);
            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++)
                {
                    GenerateXPgDIReferer(block, i, referenceBlocks[i], symbols);
                }
            }
        }
コード例 #13
0
ファイル: LogicPin.cs プロジェクト: BGCX261/ziliao-svn-to-git
        public void GenerateSubmitGraphicsByPin(LogicSymbol symbol)
        {
            if (symbol.SymbolType == LogicSymbolType.GeneralSymbol)
            {
                // 生成引脚名称文本
                if (this.pinName != null && this.pinName.Length > 0)
                {
                    if (this.pinType == LogicPinType.Input)
                    {
                        this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point2.X + 3f, this.Point2.Y - 5f),
                            new SizeF(27f, 10f), Align.MiddleLeft, Color.Black);
                    }
                    else if (this.Visible)
                    {
                        this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                            new SizeF(27f, 10f), Align.MiddleRight, Color.Black);
                    }
                }
            }

            // 生成引脚上伸出的线
            if (this.pinType == LogicPinType.Input)
            {
                if ((!this.Visible && this.pointName != null && RegPointName.IsMatch(this.pointName))
                    || (this.Visible && (this.pointName == null || this.pointName.Trim('?',' ').Length == 0)
                    && (this.pinValue == null || this.pinValue.Trim('?', ' ').Length == 0)))
                {
                    this.point1 = PointF.Subtract(this.point2, new SizeF(20f, 0f));
                    this.pinLine = new LogicLine(this.Point1, this.Point2, Color.Black, DashStyle.Solid);
                    if (symbol.X > this.point1.X)
                    {
                        symbol.Width += symbol.X - this.point1.X;
                        symbol.X = this.point1.X;
                    }

                    if (this.PointName != null && RegPointName.IsMatch(this.PointName))
                    {
                        string str = this.PointName.Substring(this.PointName.IndexOf('-') + 1);
                        this.pinValue = "<" + str.Substring(str.IndexOf('-') + 1) + ">";
                    }
                }
            }

            // 生成引脚值文本
            if (this.pinValue != null && this.pinValue.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    // 输入值
                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                        new SizeF(27f, 10f), Align.MiddleRight, Color.Black);
                    if (symbol.X > this.point1.X - 30f)
                    {
                        symbol.Width += symbol.X - (this.point1.X - 30f);
                        symbol.X = this.point1.X - 30f;
                    }
                }
                else
                {
                    // 输出值
                    this.pinValueText = new LogicText(this.pinValue, 7f, new PointF(this.Point2.X + 3f, this.Point2.Y - 12f),
                                    new SizeF(27f, 10f), Align.MiddleLeft, Color.Black);

                    if (symbol.X + symbol.Width < this.point2.X + 30f)
                    {
                        symbol.Width += this.point2.X + 30f - symbol.X - symbol.Width;
                    }

                    if (symbol.SymbolType == LogicSymbolType.IOSymbol && symbol.Y > this.PinValueText.Y)
                    {
                        // 给 IO 块添加输出值文本后,需要调整块的高度和 Y 坐标
                        symbol.Height += symbol.Y - this.PinValueText.Y;
                        symbol.Y = this.PinValueText.Y;
                    }

                    // 动态输出值
                    DynValueOut value = new DynValueOut(this.pointName, 0);
                    this.PinValueText.Dynamics.Add(value);
                }
            }
        }
コード例 #14
0
ファイル: LogicPin.cs プロジェクト: BGCX261/ziliao-svn-to-git
        /// <summary>
        /// 生成Pin的子图(PinName,PinValue,PinLine)
        /// </summary>
        public void GenerateSubmitGraphics()
        {
            // 生成引脚上伸出的线
            if (this.point1 != this.point2)
            {
                this.pinLine = new LogicLine(this.Point1, this.Point2, Color.Black, DashStyle.Solid);

            }

            // 生成引脚名称文本
            if (this.pinName != null && this.pinName.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point2.X + 2f, this.Point2.Y - 5f),
                                    new SizeF(28f, 10f), Align.MiddleLeft, Color.Black);
                }
                else
                {
                    this.pinNameText = new LogicText(this.pinName, 8f, new PointF(this.Point1.X - 30f, this.Point1.Y - 5f),
                                    new SizeF(28f, 10f), Align.MiddleRight, Color.Black);
                }
            }

            // 生成引脚值文本
            if (this.pinValue != null && this.pinValue.Length > 0)
            {
                if (this.pinType == LogicPinType.Input)
                {
                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point1.X - 30f, this.Point2.Y - 5f),
                                    new SizeF(28f, 10f), Align.MiddleRight, Color.Black);
                }
                else
                {
                    this.pinValueText = new LogicText(this.pinValue, 8f, new PointF(this.Point2.X + 2f, this.Point2.Y - 12f),
                                    new SizeF(28f, 10f), Align.MiddleLeft, Color.Black);
                }

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

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

            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = block.Location;
            symbolTemp.Size = new SizeF(75f, 28f);

            LogicRectangle bodyRectangle = new LogicRectangle();
            bodyRectangle.Location = block.Location;
            bodyRectangle.Size = new SizeF(67.5f, 15f);

            // 右端的半圆


            LogicArc bodyArc = new LogicArc();
            bodyArc.CentrePoint = new PointF(block.X + 67.5f, block.Y + 7.5f);
            bodyArc.Radius = 7.5f;
            bodyArc.StartAngle = -90;
            bodyArc.EndAngle = 90;

            // GID,块中间显示的文本


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

            // Addr,块下方显示的参数文本(数据存储位置不确定) //WangXiang
            LogicText parameterText = new LogicText();
            parameterText.Location = new PointF(bodyRectangle.X + 2f, bodyRectangle.Y + bodyRectangle.Height + 1f);
            parameterText.Width = bodyText.Width;
            parameterText.Height = 11f;
            parameterText.Alignment = Align.TopCenter;

            LogicPin inputPin = null;
            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "Rst")
                {
                    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";
                    }
                }
            }

            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);
                }
            }

            foreach (Cld_FCParameter para in block.Cld_FCParameter_List)
            {
                if (para.Name == "Addr")
                {
                    parameterText.Text = GetAddr(para.PValue);
                }
            }

            symbolTemp.Graphics.Add(bodyRectangle);
            symbolTemp.Graphics.Add(bodyArc);
            symbolTemp.Graphics.Add(bodyText);
            symbolTemp.Graphics.Add(parameterText);
            if (inputPin != null)
            {
                symbolTemp.Graphics.Add(inputPin);
            }
            if (outputPin != null)
            {
                symbolTemp.Graphics.Add(outputPin);
            }

            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);
                }
            }
        }
コード例 #16
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);
        }
コード例 #17
0
        /// <summary>
        /// XPgDO
        /// </summary>
        /// <param name="textWriter"></param>
        /// <param name="fcblock"></param>
        /// <param name="bll"></param>
        private static void GenerateXPgDOBlock(Cld_FCBlock block, ArrayList symbols)
        {
            // Body大小:35 x 30
            // 输入:1; 输出:0; 参数:0

            block.Size = new SizeF(35f, 30f);
            float edgeLength = 17.5f;

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

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] { 
                new PointF(block.X, block.Y + 15f),
                new PointF(block.X + edgeLength / 2, block.Y),
                new PointF((float)(block.X + edgeLength * 1.5), block.Y),
                new PointF(block.X + 35f, block.Y + 15f),
                new PointF((float)(block.X + edgeLength * 1.5), block.Y + 30f),
                new PointF((float)(block.X + edgeLength / 2), block.Y + 30f)};

            LogicText bodyText = new LogicText();
            bodyText.Location = new PointF(block.X + 8f, block.Y + 10f);
            bodyText.Width = 19f;
            bodyText.Height = 11f;
            bodyText.Text = block.AlgName.Substring(block.AlgName.LastIndexOf('-') + 1);

            LogicPin inputPin = null;
            foreach (Cld_FCInput pin in block.Cld_FCInput_List)
            {
                if (pin.PinName == "Z")
                {
                    if (pin.Visible || (pin.PointName != null && LogicPin.RegPointName.IsMatch(pin.PointName)))
                    {
                        pin.Point = "0_15";
                        inputPin = new LogicPin(pin, symbolTemp);
                    }
                }
            }

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

            IList<Cld_FCBlock> referenceBlocks = CrossReference.GetOutputReference(block);

            LogicPoke poke = new LogicPoke(block);
            if (referenceBlocks.Count > 0)
            {
                DynCrossReference reference = new DynCrossReference();
                foreach (Cld_FCBlock refBlock in referenceBlocks)
                {
                    reference.AddReference(refBlock);
                }
                poke.Dynamics.Add(reference);
            }
            symbolTemp.Graphics.Add(poke);

            symbols.Add(symbolTemp);

            if (referenceBlocks.Count > 0)
            {
                for (int i = 0; i < referenceBlocks.Count; i++)
                {
                    GenerateXPgDIReferer(block, i, referenceBlocks[i], symbols);
                }
            }

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

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

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

            LogicPolygon bodyPolygon = new LogicPolygon();
            bodyPolygon.Points = new PointF[] { 
                new PointF(block.X, block.Y + block.Height / 2),
                new PointF(block.X + block.Height / 2, block.Y),
                new PointF(block.X + block.Width - block.Height / 2, block.Y),
                new PointF(block.X + block.Width, block.Y + block.Height / 2),
                new PointF(block.X + block.Width - block.Height / 2, block.Y + block.Height),
                new PointF(block.X + block.Height / 2, block.Y + block.Height)};

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

            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 == "D")
                {
                    pin.Point = "75_7.5";
                    outputPin = new LogicPin(pin, symbolTemp);
                }
            }

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

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

            symbols.Add(symbolTemp);
        }
コード例 #19
0
        private static void GenerateXPgAIReferer(Cld_FCBlock block, int refererIndex, Cld_FCBlock refBlock, ArrayList symbols)
        {
            // 大小:30 x 30

            LogicSymbol symbolTemp = new LogicSymbol(LogicSymbolType.IOSymbol);
            symbolTemp.Location = new PointF((float)(block.X + block.Width + refererIndex * 30), block.Y + block.Height / 2 - 15f);
            symbolTemp.Size = new SizeF(30f, 30f);

            LogicCircle bodyCircle = new LogicCircle();
            bodyCircle.CentrePoint = new PointF(symbolTemp.X + 15f, symbolTemp.Y + 15f);
            bodyCircle.Radius = 15f;

            LogicText pageIndexText = new LogicText();
            pageIndexText.Location = new PointF(symbolTemp.X + 5f, symbolTemp.Y + 3f);
            pageIndexText.Width = 20f;
            pageIndexText.Height = 11f;

            LogicText blockIndexText = new LogicText();
            blockIndexText.Location = new PointF(symbolTemp.X + 5f, symbolTemp.Y + 16f);
            blockIndexText.Width = 20f;
            blockIndexText.Height = 11f;

            string[] ids = refBlock.AlgName.Split('-');
            pageIndexText.Text = ids[1];
            blockIndexText.Text = ids[2];

            symbolTemp.Graphics.Add(bodyCircle);
            symbolTemp.Graphics.Add(pageIndexText);
            symbolTemp.Graphics.Add(blockIndexText);

            symbols.Add(symbolTemp);
        }