예제 #1
0
        public DrawingCommands(MainWindow win)
        {
            _win = win;

            _win.CommandBindings.Add(new CommandBinding(LinesChainCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new LinesChainCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(CircleCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new CircleCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(EllipseCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new EllipseCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(ArcCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new ArcCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(XlineCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new XlineCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(RectangleCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new RectangleCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(PolylineCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new PolylineCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));

            _win.CommandBindings.Add(new CommandBinding(RayCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new RayCmd();
                _win.Drawing.OnCommand(cmd);
            }, null));
        }
예제 #2
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;
     }
 }
예제 #3
0
        public Arc(ArcCmd arcCmd)
        {
            //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  = arcCmd.Start;
            middle = arcCmd.Middle;
            end    = arcCmd.End;
            center = arcCmd.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;
            }
        }