Exemplo n.º 1
0
        public NozzleCheck(NozzleCheckCmd nozzleCheckCmd, CoordinateCorrector coordinateCorrector)
        {
            this.NozzleCheckCmd = nozzleCheckCmd;
            Log.Dprint("nozzle check dot position : " + nozzleCheckCmd.Position + ", real : " + position);
            this.position = coordinateCorrector.Correct(nozzleCheckCmd.RunnableModule,
                                                        nozzleCheckCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
            this.ModelFindPrm    = nozzleCheckCmd.ModelFindPrm;
            this.GrayCheckPrm    = nozzleCheckCmd.GrayCheckPrm;
            this.CheckThm        = nozzleCheckCmd.CheckThm;
            this.IsOkAlarm       = nozzleCheckCmd.IsOkAlarm;
            this.param           = nozzleCheckCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetDotParam(nozzleCheckCmd.DotStyle);
            this.isWeightControl = nozzleCheckCmd.IsWeightControl;
            this.weight          = nozzleCheckCmd.Weight;
            this.isGlobal        = nozzleCheckCmd.isGlobal;
            this.nozzleStyle     = nozzleCheckCmd.NozzleStyle;
            this.RunnableModule  = nozzleCheckCmd.RunnableModule;
            Program = nozzleCheckCmd.RunnableModule.CommandsModule.Program;

            if (nozzleCheckCmd.AssociatedMeasureHeightCmd != null)
            {
                curMeasureHeightValue = nozzleCheckCmd.AssociatedMeasureHeightCmd.RealHtValue;
            }
            else
            {
                curMeasureHeightValue = this.RunnableModule.MeasuredHt;
            }
        }
Exemplo n.º 2
0
 public Dot(DotCmd dotCmd, CoordinateCorrector coordinateCorrector)
 {
     //this.Valve = dotCmd.Valve;
     this.RunnableModule = dotCmd.RunnableModule;
     if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
     {
         this.Valve = ValveType.Valve1;
     }
     else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
     {
         this.Valve = ValveType.Both;
     }
     else
     {
         this.Valve = ValveType.Valve2;
     }
     position = coordinateCorrector.Correct(dotCmd.RunnableModule, dotCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Log.Dprint("Dot position : " + dotCmd.Position + ", real : " + position);
     param           = dotCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetDotParam(dotCmd.DotStyle);
     isWeightControl = dotCmd.IsWeightControl;
     weight          = dotCmd.Weight;
     this.isAssign   = dotCmd.IsAssign;
     this.numShots   = dotCmd.NumShots;
     Program         = dotCmd.RunnableModule.CommandsModule.Program;
     if (dotCmd.AssociatedMeasureHeightCmd != null)
     {
         curMeasureHeightValue = dotCmd.AssociatedMeasureHeightCmd.RealHtValue;
     }
     else
     {
         curMeasureHeightValue = this.RunnableModule.MeasuredHt;
     }
     this.Tilt = dotCmd.Tilt;
 }
Exemplo n.º 3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (_isDrawing)
            {
                _buttonClicks++;
                if (_buttonClicks == 1)
                {
                    trackBar1.Enabled = false;
                    button3.Enabled   = false;
                    button4.Enabled   = false;
                    button5.Enabled   = false;

                    _bmpBeforeDrawing = (Bitmap)pictureBox1.Image;
                    _drawing          = (Bitmap)_bmpBeforeDrawing.Clone();

                    _isDrawing = true;

                    _start = pictureBox1.PointToClient(Cursor.Position);
                    _end   = new Point(0, 0);
                    Factor.UnCountFactor(ref _start, _factor);

                    Distance.CalculateBonders(ref _start, ref _end, pictureBox1, _factor, _history.AllFiguresRecords());

                    _stp.DrawPoint(ref _drawing, _start, _factor);

                    pictureBox1.Image = _drawing;
                    _drawing          = (Bitmap)_bmpBeforeDrawing.Clone();
                }
                else
                {
                    trackBar1.Enabled = true;
                    button3.Enabled   = true;
                    button4.Enabled   = true;
                    button5.Enabled   = true;

                    _buttonClicks = 0;

                    _end = pictureBox1.PointToClient(Cursor.Position);
                    Factor.UnCountFactor(ref _end, _factor);

                    _history.RemoveFigureAfterByIndex(_historyIterator.Current);

                    _drawing = (Bitmap)_bmpBeforeDrawing.Clone();
                    CoordinateCorrector.CorrectAngle(_start, ref _end);

                    Distance.CalculateBonders(ref _start, ref _end, pictureBox1, _factor, _history.AllFiguresRecords());

                    _f.FirstLocationPoint  = _start;
                    _f.SecondLocationPoint = _end;

                    _history.AddFigure((Figure)_f.Clone());
                    _historyIterator.HistoryUpdate(_history.CountFigures(), _history.CountFigures());
                    _f.Draw(ref _drawing, _start, _end, _factor);

                    pictureBox1.Image = _drawing;
                    _drawing          = null;
                }
            }
        }
Exemplo n.º 4
0
        public SymbolLines(SymbolLinesCmd symbolLinesCmd, CoordinateCorrector coordinateCorrector)
        {
            this.RunnableModule = symbolLinesCmd.RunnableModule;
            this.Program        = symbolLinesCmd.RunnableModule.CommandsModule.Program;
            if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
            {
                this.Valve = ValveType.Valve1;
            }
            else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
            {
                this.Valve = ValveType.Both;
            }
            else
            {
                this.Valve = ValveType.Valve2;
            }
            this.symbolLinesCmd = symbolLinesCmd;
            this.arcSpeed       = this.symbolLinesCmd.ArcSpeed;
            this.oriSymbols     = symbolLinesCmd.Symbls;
            if (Machine.Instance.Valve1.RunMode == ValveRunMode.Look)
            {
                curMeasureHeightValue = Machine.Instance.Robot.CalibPrm.SafeZ;
            }
            else
            {
                foreach (SymbolLine item in symbolLinesCmd.Symbls)
                {
                    if (item.MHCmdList.Count > 0)//至少有个首点
                    {
                        this.LaserZDelta      = item.MHCmdList[0].ZPos - Machine.Instance.Robot.CalibPrm.SafeZ;
                        curMeasureHeightValue = item.MHCmdList[0].RealHtValue + this.LaserZDelta;
                        break;
                    }
                }
            }
            // 校准当前多线段所有轨迹
            this.oriSymbols = new List <SymbolLine>();

            foreach (SymbolLine item in symbolLinesCmd.Symbls)
            {
                SymbolLine symbol = item.Clone() as SymbolLine;
                symbol.Correct(this.RunnableModule, coordinateCorrector);
                symbol.AddOffset();
                if (symbol.MHList == null)
                {
                    symbol.MHList = new List <MeasureHeight>();
                }
                symbol.MHList.Clear();
                //校正测高点
                foreach (var mhCmd in item.MHCmdList)
                {
                    symbol.MHList.Add(new MeasureHeight(mhCmd, coordinateCorrector));
                }
                this.oriSymbols.Add(symbol);
            }

            this.OffsetX = symbolLinesCmd.OffsetX;
            this.OffsetY = symbolLinesCmd.OffsetY;
        }
Exemplo n.º 5
0
 public Blobs(BlobsCmd blobsCmd, CoordinateCorrector coordinateCorrector)
 {
     this.BlobsCmd  = blobsCmd;
     this.BlobsTool = blobsCmd.BlobsTool;
     this.Position  = coordinateCorrector.Correct(blobsCmd.RunnableModule, blobsCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Program        = blobsCmd.RunnableModule.CommandsModule.Program;
     this.SavePath  = blobsCmd.SavePath;
 }
Exemplo n.º 6
0
 public Barcode(BarcodeCmd barcodeCmd, CoordinateCorrector coordinateCorrector)
 {
     this.BarcodeCmd     = barcodeCmd;
     this.BarcodePrm     = barcodeCmd.BarcodePrm;
     this.position       = coordinateCorrector.Correct(barcodeCmd.RunnableModule, barcodeCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Program             = barcodeCmd.RunnableModule.CommandsModule.Program;
     this.RunnableModule = barcodeCmd.RunnableModule;
 }
Exemplo n.º 7
0
 public Mark(MarkCmd markCmd, CoordinateCorrector coordinateCorrector)
 {
     this.MarkCmd  = markCmd;
     this.Position = coordinateCorrector.Correct(markCmd.RunnableModule,
                                                 markCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     this.ModelFindPrm   = markCmd.ModelFindPrm;
     this.RunnableModule = markCmd.RunnableModule;
     Program             = markCmd.RunnableModule.CommandsModule.Program;
     this.IsFromFile     = markCmd.IsFromFile;
 }
Exemplo n.º 8
0
 /// <summary>
 /// 运行时的校准
 /// </summary>
 /// <param name="runnableModule"></param>
 /// <param name="coordinateCorrector"></param>
 public void Correct(RunnableModule runnableModule, CoordinateCorrector coordinateCorrector)
 {
     foreach (PointD item in this.symbolPoints)
     {
         // 校正后的机械坐标(运行时,每个symbolPoint已经是实际的相机机械坐标了)
         PointD newPoint = coordinateCorrector.Correct(runnableModule, item, Executor.Instance.Program.ExecutantOriginOffset);
         // 相对系统坐标
         item.X = newPoint.X;
         item.Y = newPoint.Y;
     }
 }
Exemplo n.º 9
0
        public MultiTraces(MultiTracesCmd multiTracesCmd, CoordinateCorrector coordinateCorrector)
        {
            this.RunnableModule = multiTracesCmd.RunnableModule;
            if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
            {
                this.Valve = ValveType.Valve1;
            }
            else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
            {
                this.Valve = ValveType.Both;
            }
            else
            {
                this.Valve = ValveType.Valve2;
            }

            foreach (var item in multiTracesCmd.Traces)
            {
                TraceBase newTrace = item.Clone() as TraceBase;
                if (newTrace is TraceLine)
                {
                    TraceLine traceLine = newTrace as TraceLine;
                    traceLine.Start = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceLine.Start, Executor.Instance.Program.ExecutantOriginOffset);
                    traceLine.End   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceLine.End, Executor.Instance.Program.ExecutantOriginOffset);
                }
                else
                {
                    TraceArc traceArc = newTrace as TraceArc;
                    traceArc.Start = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.Start, Executor.Instance.Program.ExecutantOriginOffset);
                    traceArc.Mid   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.Mid, Executor.Instance.Program.ExecutantOriginOffset);
                    traceArc.End   = coordinateCorrector.Correct(multiTracesCmd.RunnableModule, traceArc.End, Executor.Instance.Program.ExecutantOriginOffset);
                }

                //newTrace.Param = multiTracesCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(newLine.LineStyle);
                this.traces.Add(newTrace);
                Log.Dprint(string.Format("{0}: {1}", item.GetType(), item));
            }
            //param = multiTracesCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(multiTracesCmd.LineStyle);
            isWeightControl     = multiTracesCmd.IsWeightControl;
            wholeWeight         = multiTracesCmd.WholeWeight;
            this.OffsetX        = multiTracesCmd.OffsetX;
            this.OffsetY        = multiTracesCmd.OffsetY;
            Program             = multiTracesCmd.RunnableModule.CommandsModule.Program;
            this.multiTracesCmd = multiTracesCmd;
            if (multiTracesCmd.AssociatedMeasureHeightCmd != null)
            {
                curMeasureHeightValue = multiTracesCmd.AssociatedMeasureHeightCmd.RealHtValue;
            }
            else
            {
                curMeasureHeightValue = this.RunnableModule.MeasuredHt;
            }
        }
Exemplo n.º 10
0
 public MeasureHeight(MeasureHeightCmd measureHeightCmd, CoordinateCorrector coordinateCorrector)
 {
     position = coordinateCorrector.Correct(measureHeightCmd.RunnableModule, measureHeightCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Log.Dprint("MeasureHeight position : " + measureHeightCmd.Position + ", real : " + position);
     Program               = measureHeightCmd.RunnableModule.CommandsModule.Program;
     this.RunnableModule   = measureHeightCmd.RunnableModule;
     this.StandardHt       = measureHeightCmd.StandardHt;
     this.ToleranceMax     = measureHeightCmd.ToleranceMax;
     this.ToleranceMin     = measureHeightCmd.ToleranceMin;
     this.ZPos             = measureHeightCmd.ZPos;
     this.MeasureHeightCmd = measureHeightCmd;
 }
Exemplo n.º 11
0
 public BadMark(BadMarkCmd badMarkCmd, CoordinateCorrector coordinateCorrector)
 {
     this.BadMarkCmd = badMarkCmd;
     this.Position   = coordinateCorrector.Correct(badMarkCmd.RunnableModule,
                                                   badMarkCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     this.FindType       = badMarkCmd.FindType;
     this.IsOkSkip       = badMarkCmd.IsOkSkip;
     this.ModelFindPrm   = badMarkCmd.ModelFindPrm;
     this.GrayCheckPrm   = badMarkCmd.GrayCheckPrm;
     this.RunnableModule = badMarkCmd.RunnableModule;
     Program             = badMarkCmd.RunnableModule.CommandsModule.Program;
 }
Exemplo n.º 12
0
        public Line(LineCmd lineCmd, CoordinateCorrector coordinateCorrector)
        {
            //this.Valve = lineCmd.Valve;
            this.RunnableModule = lineCmd.RunnableModule;
            if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
            {
                this.Valve = ValveType.Valve1;
            }
            else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
            {
                this.Valve = ValveType.Both;
            }
            else
            {
                this.Valve = ValveType.Valve2;
            }
            PointD start, end;

            foreach (LineCoordinate line in lineCmd.LineCoordinateList)
            {
                start = coordinateCorrector.Correct(lineCmd.RunnableModule, line.Start, Executor.Instance.Program.ExecutantOriginOffset);
                end   = coordinateCorrector.Correct(lineCmd.RunnableModule, line.End, Executor.Instance.Program.ExecutantOriginOffset);
                LineCoordinate newLine = new LineCoordinate(start, end);
                newLine.Weight         = line.Weight;
                newLine.LineStyle      = line.LineStyle;
                newLine.Param          = lineCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(newLine.LineStyle);
                newLine.LookOffsetRevs = line.LookOffsetRevs;
                newLine.LookOffset     = line.LookOffset;
                newLine.Repetition     = line.Repetition;
                lineCoordinateList.Add(newLine);

                lineCoordinateDic.Add(newLine, this);

                Log.Dprint("Line start : " + line.Start + ", real : " + start);
                Log.Dprint("Line end : " + line.End + ", real : " + end);
            }
            param           = lineCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(lineCmd.LineStyle);
            isWeightControl = lineCmd.IsWeightControl;
            wholeWeight     = lineCmd.WholeWeight;
            Program         = lineCmd.RunnableModule.CommandsModule.Program;
            this.lineCmd    = lineCmd;
            if (lineCmd.AssociatedMeasureHeightCmd != null)
            {
                curMeasureHeightValue = lineCmd.AssociatedMeasureHeightCmd.RealHtValue;
            }
            else
            {
                curMeasureHeightValue = this.RunnableModule.MeasuredHt;
            }
            this.Tilt = this.lineCmd.Tilt;
        }
Exemplo n.º 13
0
        public MoveXy(MoveXyCmd moveXyCmd, CoordinateCorrector coordinateCorrector)
        {
            Program             = moveXyCmd.RunnableModule.CommandsModule.Program;
            this.RunnableModule = moveXyCmd.RunnableModule;
            if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode || this.RunnableModule.Mode == ModuleMode.DualFallow)
            {
                this.Valve = ValveType.Valve1;
            }
            else
            {
                this.Valve = ValveType.Valve2;
            }
            position = coordinateCorrector.Correct(moveXyCmd.RunnableModule, moveXyCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);

            this.toSafeZ = moveXyCmd.ToSafeZ;
        }
Exemplo n.º 14
0
        /// <summary>
        /// 传入SymbolLinesCmd集合,如果有需要手动校正的点,则弹出窗体
        /// </summary>
        /// <param name="symbolLinesCmd"></param>
        /// <param name="coordinateCorrector"></param>
        public void SetData(List <SymbolLinesCmd> symbolLinesCmd, CoordinateCorrector coordinateCorrector)
        {
            this.symbolLinesCmd      = symbolLinesCmd;
            this.coordinateCorrector = coordinateCorrector;

            if (NeedTeach())
            {
                Machine.Instance.IsProducting = false;
                this.ParseSymbolLinesCmds();
                Machine.Instance.Robot.ManualMovePosXY(this.modifyPoints[0].PointWithCorrect);
                this.ShowDialog();
            }
            else
            {
                this.Close();
            }
        }
Exemplo n.º 15
0
 public Measure(MeasureCmd measureCmd, CoordinateCorrector coordinateCorrector)
 {
     this.MeasureCmd = measureCmd;
     this.MeasurePrm = measureCmd.MeasurePrm;
     this.position   = coordinateCorrector.Correct(measureCmd.RunnableModule, measureCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Program         = measureCmd.RunnableModule.CommandsModule.Program;
     this.SavePath   = measureCmd.SavePath;
     //this.NeedMeasureHeight = measureCmd.NeedMeasureHeight;
     this.MeasureContent = measureCmd.MeasureContent;
     if (measureCmd.MeasureContent.HasFlag(MeasureContents.GlueHeight) && measureCmd.MeasureHeightCmds != null && measureCmd.MeasureHeightCmds.Count == 2)
     {
         this.MeasurePrm.ToleranceMax = measureCmd.ToleranceMax;
         this.MeasurePrm.ToleranceMin = measureCmd.ToleranceMin;
         this.MeasureHeights          = new List <MeasureHeight>();
         foreach (MeasureHeightCmd item in measureCmd.MeasureHeightCmds)
         {
             this.MeasureHeights.Add(new MeasureHeight(item, coordinateCorrector));
         }
     }
 }
Exemplo n.º 16
0
 public Arc(ArcCmd arcCmd, CoordinateCorrector coordinateCorrector)
 {
     //this.Valve = arcCmd.Valve;
     this.RunnableModule = arcCmd.RunnableModule;
     if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
     {
         this.Valve = ValveType.Valve1;
     }
     else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
     {
         this.Valve = ValveType.Both;
     }
     else
     {
         this.Valve = ValveType.Valve2;
     }
     start  = coordinateCorrector.Correct(arcCmd.RunnableModule, arcCmd.Start, Executor.Instance.Program.ExecutantOriginOffset);
     middle = coordinateCorrector.Correct(arcCmd.RunnableModule, arcCmd.Middle, Executor.Instance.Program.ExecutantOriginOffset);
     end    = coordinateCorrector.Correct(arcCmd.RunnableModule, arcCmd.End, Executor.Instance.Program.ExecutantOriginOffset);
     center = coordinateCorrector.Correct(arcCmd.RunnableModule, arcCmd.Center, Executor.Instance.Program.ExecutantOriginOffset);
     Log.Dprint("Arc start " + arcCmd.Start + ", real : " + start);
     Log.Dprint("Arc middle " + arcCmd.Middle + ", real : " + middle);
     Log.Dprint("Arc end " + arcCmd.End + ", real : " + end);
     Log.Dprint("Arc center " + arcCmd.Center + ", real : " + center);
     r               = MathUtils.Distance(Center, Start);
     Degree          = arcCmd.Degree;
     length          = Math.Abs(arcCmd.Degree) / 360f * 2 * Math.PI * r;
     param           = arcCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetLineParam(arcCmd.LineStyle);
     isWeightControl = arcCmd.IsWeightControl;
     weight          = arcCmd.Weight;
     Program         = arcCmd.RunnableModule.CommandsModule.Program;
     if (arcCmd.AssociatedMeasureheightCmd != null)
     {
         curMeasureHeightValue = arcCmd.AssociatedMeasureheightCmd.RealHtValue;
     }
     else
     {
         curMeasureHeightValue = this.RunnableModule.MeasuredHt;
     }
 }
Exemplo n.º 17
0
        ///<summary>
        /// Description	:Description
        /// Author      :liyi
        /// UpdateDate	:2019/06/11
        ///</summary>
        /// <param name="markCmdList"></param>
        /// <param name="coordinateCorrector"></param>
        /// <param name="isRowSort"></param>
        public FlyMarks(List <MarkCmd> markCmdList, CoordinateCorrector coordinateCorrector)
        {
            this.markCmdList = markCmdList;
            //初始化所有提前量
            foreach (MarkCmd item in markCmdList)
            {
                markPointsOffset.Add(item, new VectorD());
            }
            this.Program             = markCmdList[0].RunnableModule.CommandsModule.Program;
            this.coordinateCorrector = coordinateCorrector;
            this.isRowFirst          = Program.RuntimeSettings.FlyIsRowFirst;
            this.flySpeed            = Program.RuntimeSettings.FlySpeed;
            this.flyAcc         = Program.RuntimeSettings.FlyAcc;
            this.flyCornerSpeed = Program.RuntimeSettings.FlyCornerSpeed;
            this.flyPreDistance = Program.RuntimeSettings.FlyPreDistance;
            //飞行的行或列之间的间距判定值(半个相机视野)
            PointD view            = Machine.Instance.Camera.ToMachine(0, 0);
            double columnDistacnce = Math.Abs(view.X);
            double rowDistance     = Math.Abs(view.Y);
            double distance        = this.isRowFirst ? rowDistance : columnDistacnce;

            this.flyDistance = distance;
        }
Exemplo n.º 18
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new Measure(this, coordinateCorrector));
 }
Exemplo n.º 19
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new ConveyorBarcode(this));
 }
Exemplo n.º 20
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            //if (selectedItem != null)
            //{
            //    Factor.UnCountFactor(ref pos, _factor);
            //    History.RemoveOfficeFigureAfterByIndex(_historyIterator.Current);

            //    selectedItem.FirstLocationPoint = pos;

            //    if (!IsOptionalDrawing)
            //    {
            //        var tmpItem = selectedItem;
            //        var resCoor = CoordinateCorrector.CorrectOfficeCoordinate(ref tmpItem, bmp, _factor, History);
            //        selectedItem = tmpItem;
            //        if (resCoor)
            //        {
            //            selectedItem.Draw(ref bmp, selectedItem.FirstLocationPoint, _factor);
            //            History.AddOfficeFigure(selectedItem.Clone() as OfficeFigure);
            //            _historyIterator.HistoryUpdate(History.CountOfficeFigures(), History.CountOfficeFigures());
            //        }
            //        else
            //        {
            //            FormsHelper.FormWarningMeassage("Нельзя так разместить объект типа \"" + selectedItem.ToString() + "\"!" +
            //                Environment.NewLine + "Возможно объект пересекается с другими объектами.");
            //        }
            //    }
            //    else
            //    {
            //        if (++_buttonClicks == 1)
            //        {
            //            _start = pos;
            //        }
            //        else
            //        {
            //            _end = pos;
            //            _buttonClicks = 0;
            //            var tmp = selectedItem as TwistedPair;
            //            selectedItem.Draw(ref bmp, selectedItem.FirstLocationPoint, _factor);
            //            History.AddOfficeFigure(selectedItem.Clone() as OfficeFigure);
            //            _historyIterator.HistoryUpdate(History.CountOfficeFigures(), History.CountOfficeFigures());
            //        }
            //    }
            //}
            var currentPosition       = (PointF)pictureBox1.PointToClient(MousePosition);
            var selectedItem          = listBox1.SelectedItem as OfficeFigure;
            var isOptionalDrawing     = selectedItem is TwistedPair;
            var isNeedMoreDrawingArea = selectedItem is Switchboard;
            var bmp = (Bitmap)pictureBox1.Image;

            _buttonClicker.Click();

            if (!_buttonClicker.IsSecondClick())
            {
                BlockInstruments();
                _start = currentPosition;
                Factor.UnCountFactor(ref _start, _factor);
                SaveBmp(bmp);
                _stp.DrawPoint(ref bmp, _start, _factor);
                selectedItem.FirstLocationPoint = currentPosition;
                if (!isOptionalDrawing)
                {
                    _buttonClicker.RemoveStatistics();
                    History.RemoveOfficeFigureAfterByIndex(_historyIterator.Current);

                    var tmpItem = selectedItem;
                    var resCoor = true;
                    if (!isNeedMoreDrawingArea)
                    {
                        resCoor = CoordinateCorrector.CorrectOfficeCoordinate(ref tmpItem, bmp, _factor, History);  // Временный хак, сейчас можно поставить switch на стол
                    }
                    selectedItem = tmpItem;
                    if (resCoor)
                    {
                        RestoreBmp(ref bmp);
                        selectedItem.Draw(ref bmp, selectedItem.FirstLocationPoint, _factor);
                        History.AddOfficeFigure(selectedItem.Clone() as OfficeFigure);
                        _historyIterator.HistoryUpdate(History.CountOfficeFigures(), History.CountOfficeFigures());
                    }
                    else
                    {
                        FormsHelper.FormWarningMeassage("Нельзя так разместить объект типа \"" + selectedItem.ToString() + "\"!" +
                                                        Environment.NewLine + "Возможно объект пересекается с другими объектами.");
                        RestoreBmp(ref bmp);
                    }
                    UnBlockInstruments();
                }
            }
            else
            {
                RestoreBmp(ref bmp);
                _end = currentPosition;
                var twisted = selectedItem as TwistedPair;
                twisted.Points.Add(_end);
                History.RemoveOfficeFigureAfterByIndex(_historyIterator.Current);
                twisted.DrawLine(ref bmp, _start, _end, _factor, History);
                History.AddOfficeFigure(twisted);
                _historyIterator.HistoryUpdate(History.CountOfficeFigures(), History.CountOfficeFigures());
                twisted.Points.Clear();
                UnBlockInstruments();
            }



            pictureBox1.Image = bmp;
        }
Exemplo n.º 21
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new MoveAbsXy(this));
 }
Exemplo n.º 22
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new BadMark(this, coordinateCorrector));
 }
Exemplo n.º 23
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new Purge(this));
 }
Exemplo n.º 24
0
 public Result SpecialExcute(CoordinateCorrector coordinateCorrector)
 {
     return(new NozzleCheck(this, coordinateCorrector).CheckExecute());
 }
Exemplo n.º 25
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new NozzleCheck(this, coordinateCorrector));
 }
Exemplo n.º 26
0
 /// <summary>
 /// 根据当前Command生成对应的Directive指令
 /// </summary>
 /// <returns></returns>
 public abstract Directive ToDirective(CoordinateCorrector coordinateCorrector);
Exemplo n.º 27
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(new SymbolLines(this, coordinateCorrector));
 }
Exemplo n.º 28
0
        public ModifyPoint(SymbolLine symbolLine, int pointNo, SymbolLinesCmd symbolLinesCmd, CoordinateCorrector coordinateCorrector)
        {
            this.SymbolLine     = symbolLine;
            this.PointNo        = pointNo;
            this.SymbolLinesCmd = symbolLinesCmd;
            PointD point = new PointD(symbolLine.symbolPoints[pointNo].X, symbolLine.symbolPoints[pointNo].Y);

            this.PointWithCorrect = coordinateCorrector.Correct(symbolLinesCmd.RunnableModule, point, Executor.Instance.Program.ExecutantOriginOffset);
        }
Exemplo n.º 29
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     return(base.ToDirective(coordinateCorrector));
 }
Exemplo n.º 30
0
 public override Directive ToDirective(CoordinateCorrector coordinateCorrector)
 {
     //return new MoveAbsXy(this);
     return(new MoveToLocation(this));
 }