/// <summary>
 /// 向该 Block 添加一个 OutputPin
 /// </summary>
 /// <param name="to_add"></param>
 public virtual void Add(Cld_FCOutput to_add)
 {
     this.Cld_FCOutput_List.Add(to_add);
     to_add.Cld_FCBlock_ID    = this.ID;
     to_add.Prj_Controller_ID = this.Prj_Controller_ID;
     to_add.Prj_Document_ID   = this.Prj_Document_ID;
     to_add.Prj_Sheet_ID      = this.Prj_Sheet_ID;
 }
        /// <summary>
        /// 创建一个 OutputPin
        /// </summary>
        /// <returns></returns>
        public virtual Cld_FCOutput New_FCOutput()
        {
            Cld_FCOutput result = new Cld_FCOutput();

            result.Cld_FCBlock_ID    = this.ID;
            result.Prj_Controller_ID = this.Prj_Controller_ID;
            result.Prj_Document_ID   = this.Prj_Document_ID;
            result.Prj_Sheet_ID      = this.Prj_Sheet_ID;
            return(result);
        }
예제 #3
0
 /// <summary>
 /// 根据ID获得Cld_FCBlock
 /// </summary>
 /// <param name="condition">ID type:int</param>
 /// <returns></returns>
 public Cld_FCOutput GetCld_FCOutput_By_ID(int condition)
 {
     using (ITransaction transaction = session.BeginTransaction()){
         try{
             Cld_FCOutput result = this.session.Get <Cld_FCOutput>(condition);
             transaction.Commit();
             return(result);
         }catch (Exception e) {
             transaction.Rollback();
             throw e;
         }
     }
 }
예제 #4
0
        public LogicPin(Cld_FCOutput pin, LogicSymbol symbol)
        {
            this.Type = LogicObjectType.Pin;

            this.pinType = LogicPinType.Output;
            this.pinName = pin.PinName;
            this.pinValue = "0";
            // 必须先给pinValue赋值
            this.PointName = pin.PointName;
            this.Visible = pin.Visible;
            this.point1 = this.point2 = new PointF(pin.Cld_FCBlock.X + pin.X, pin.Cld_FCBlock.Y + pin.Y);
            this.GenerateSubmitGraphicsByPin(symbol);
        }
예제 #5
0
 public virtual bool Compare(Cld_FCOutput arg)
 {
     if (this.ID != arg.ID)
     {
         throw new Exception("id should be equal");
     }
     if (this.PinName != arg.PinName || this.PointName != arg.PointName ||
         this.InitialValue != arg.InitialValue || this.Point != arg.Point ||
         this.Visible != arg.Visible || this.Description != arg.Description ||
         this.Cld_FCBlock_ID != arg.Cld_FCBlock_ID || this.Prj_Sheet_ID != arg.Prj_Sheet_ID ||
         this.Prj_Document_ID != arg.Prj_Document_ID || this.Prj_Controller_ID != arg.Prj_Controller_ID
         )
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #6
0
        /// <summary>
        /// 生成一条连接两个Pin的线
        /// </summary>
        /// <param name="startPin">起始Pin</param>
        /// <param name="endPin">结束Pin</param>
        /// <returns>表示一条线的字符串</returns>
        public string GenerateSignalData(Cld_FCOutput startPin, Cld_FCInput endPin)
        {
            Cld_FCBlock startBlock = startPin.Cld_FCBlock;
            Cld_FCBlock endBlock = endPin.Cld_FCBlock;
            IList startInputList = startBlock.Cld_FCInput_List;
            IList startOutputList = startBlock.Cld_FCOutput_List;
            IList endInputList = endBlock.Cld_FCInput_List;
            IList endOutputList = endBlock.Cld_FCOutput_List;
            PointF startPoint = new PointF(startBlock.X + startPin.X, startBlock.Y + startPin.Y);
            PointF endPoint = new PointF(endBlock.X + endPin.X, endBlock.Y + endPin.Y);

            StringBuilder signalDatails = new StringBuilder();

            const float spacing = 8f;       // 相邻两个输入引脚的延伸长度差值
            const float pinLength = 16f;    // 引脚的最小延伸长度


            int startPinIndex;
            int endPinIndex;

            // 添加开始点
            signalDatails.Append(startPoint.X + "_" + startPoint.Y + "{"
                + startBlock.AlgName + "." + startPin.PinName + "},");

            if (startPoint.Y != endPoint.Y)
            {
                // 起止点的垂直坐标不在同一直线上,需要增加折点

                if (startPoint.Y < endPoint.Y)
                {
                    startPinIndex = startPin.PinIndex;
                    endPinIndex = endPin.PinIndex;
                }
                else
                {
                    startPinIndex = startOutputList.Count - startPin.PinIndex - 1;
                    endPinIndex = endInputList.Count - endPin.PinIndex - 1;
                }

                PointF point = new PointF();
                point.Y = startPoint.Y;
                float firstX = startPoint.X + pinLength + spacing * startPinIndex;  // 第一个折点的 X 坐标
                float lastX = endPoint.X - pinLength - spacing * endPinIndex;       // 最后一个折点的 X 坐标

                if (firstX < lastX)
                {
                    point.X = lastX;
                }
                else
                {
                    if (startPoint.X < endPoint.X)
                    {
                        point.X = (endPoint.X + startPoint.X) / 2;
                    }
                    else
                    {
                        point.X = firstX;
                        signalDatails.Append(point.X + "_" + point.Y + ",");

                        point.Y = Math.Abs(endPoint.Y + startPoint.Y) / 2;
                        signalDatails.Append(point.X + "_" + point.Y + ",");

                        point.X = lastX;
                    }
                }

                signalDatails.Append(point.X + "_" + point.Y + "," + point.X + "_" + endPoint.Y + ",");
            }
            else if (startPoint.X > endPoint.X)
            {
                // 起止点垂直坐标相同,但起点比终点水平坐标值大

                float upHeight = (float)(endPoint.Y - endBlock.Y);
                float downHeight = (float)(endBlock.Y + endBlock.Symbol.height - endPoint.Y);

                float FirstX;
                float lastX;
                float signalY;

                if (upHeight < downHeight)
                {
                    // 从Block上面折回
                    FirstX = startPoint.X + pinLength + spacing * startPin.PinIndex;
                    signalY = (float)(endBlock.Y - pinLength - spacing * endPin.PinIndex);
                    lastX = endPoint.X - pinLength - spacing * endPin.PinIndex;
                }
                else
                {

                    FirstX = startPoint.X + pinLength + spacing
                        * (startOutputList.Count - startPin.PinIndex - 1);
                    signalY = (float)(endBlock.Y + endBlock.Symbol.height + pinLength + spacing
                        * (endInputList.Count - endPin.PinIndex - 1));
                    lastX = endPoint.X - pinLength - spacing
                        * (endInputList.Count - endPin.PinIndex - 1);
                }

                signalDatails.Append(FirstX + "_" + startPoint.Y + "," + FirstX + "_" + signalY + ","
                    + lastX + "_" + signalY + "," + lastX + "_" + endPoint.Y + ",");
            }

            // 添加结束点
            signalDatails.Append(endPoint.X + "_" + endPoint.Y + "{"
                + endBlock.AlgName + "." + endPin.PinName + "};");

            return signalDatails.ToString();
        }
 /// <summary>
 /// 向该 Block 添加一个 OutputPin
 /// </summary>
 /// <param name="to_add"></param>
 public virtual void Add(Cld_FCOutput to_add)
 {
     this.Cld_FCOutput_List.Add(to_add);
     to_add.Cld_FCBlock_ID = this.ID;
     to_add.Prj_Controller_ID = this.Prj_Controller_ID;
     to_add.Prj_Document_ID = this.Prj_Document_ID;
     to_add.Prj_Sheet_ID = this.Prj_Sheet_ID;
 }
 /// <summary>
 /// 创建一个 OutputPin
 /// </summary>
 /// <returns></returns>
 public virtual Cld_FCOutput New_FCOutput()
 {
     Cld_FCOutput result = new Cld_FCOutput();
     result.Cld_FCBlock_ID = this.ID;
     result.Prj_Controller_ID = this.Prj_Controller_ID;
     result.Prj_Document_ID = this.Prj_Document_ID;
     result.Prj_Sheet_ID = this.Prj_Sheet_ID;
     return result;
 }
 /// <summary>
 /// 创建一个 OutputPin
 /// </summary>
 /// <returns></returns>
 public virtual Cld_FCOutput New_FCOutput()
 {
     Cld_FCOutput result = new Cld_FCOutput();
     result.Cld_FCBlock_ID = this.ID;
     result.Cld_FCBlock = this;
     result.Prj_Controller_ID = this.Prj_Controller_ID;
     result.Prj_Controller = this.Prj_Controller;
     result.Prj_Document_ID = this.Prj_Document_ID;
     result.Prj_Document = this.Prj_Document;
     result.Prj_Sheet_ID = this.Prj_Sheet_ID;
     result.Prj_Sheet = this.Prj_Sheet;
     this.Cld_FCOutput_List.Add(result);
     return result;
 }