Esempio n. 1
0
        /// <summary>
        /// 将点胶程序解析为绘图程序
        /// </summary>
        /// <param name="fluidProgram"></param>
        /// <param name="workpiece"></param>
        /// <param name="patterns"></param>
        public void ParseFluidProgram(FluidProgram fluidProgram, out DrawWorkPiece drawWorkpiece, out List <DrawPattern> drawPatterns)
        {
            //初始化
            this.fluidProgram   = fluidProgram;
            this._drawWorkpiece = null;
            if (this._drawPatterns == null)
            {
                this._drawPatterns = new List <DrawPattern>();
            }
            else
            {
                this._drawPatterns.Clear();
            }

            #region 首先构建drawPatterns
            for (int i = 0; i < this.fluidProgram.Patterns.Count; i++)
            {
                //为drawPattern赋值原点
                PointF patternOrigin = new PointF(0, 0);
                //patternOrigin.X = (float)this.fluidProgram.Patterns[i].Origin.X;
                //patternOrigin.Y = (float)this.fluidProgram.Patterns[i].Origin.Y;
                DrawPattern drawPattern = new DrawPattern(patternOrigin);

                _drawPatterns.Add(drawPattern);

                //为drawPattern添加绘图指令
                for (int j = 0; j < this.fluidProgram.Patterns[i].CmdLineList.Count; j++)
                {
                    this.Parse(this.fluidProgram.Patterns[i].CmdLineList[j], _drawPatterns[i]);
                }
            }
            #endregion

            #region 构建drawWorkpiece

            //为drawWorkpiece赋原点
            PointF _workpieceOrigin = new PointF(0, 0);
            _drawWorkpiece = new DrawWorkPiece(_workpieceOrigin);

            //为drawWorkpiece添加绘图指令
            for (int i = 0; i < this.fluidProgram.Workpiece.CmdLineList.Count; i++)
            {
                this.Parse(this.fluidProgram.Workpiece.CmdLineList[i], _drawWorkpiece);
            }

            #endregion

            drawWorkpiece = _drawWorkpiece;
            drawPatterns  = _drawPatterns;
        }
Esempio n. 2
0
        public void Update(FluidProgram fluidProgram)
        {
            DrawWorkPiece      drawWorkpiece;
            List <DrawPattern> drawPatterns;

            drawingParser.ParseFluidProgram(fluidProgram, out drawWorkpiece, out drawPatterns);

            this.patterns = drawPatterns;

            foreach (var item in drawPatterns)
            {
                item.SetupAll();
            }

            this.workPiece = null;
            this.workPiece = drawWorkpiece;
            this.workPiece.SetupAll();
            this.enterPatternNo = patterns.Count - 1;
        }