Ejemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var pwrData = new DataCurveInfo
            {
                Data            = CopyUtil.DeepCopy(this.Model.PwrCtrlPara.PowerCurve),
                ShowAbs         = this.Model.PwrCtrlPara.ShowAbs,
                SpeedUnit       = UnitObserverFacade.Instance.SpeedUnitObserver.UnitType,
                Speed           = this.Model.CutSpeed,
                Freq            = this.Model.PulseFrequency,
                PowerPercentage = this.Model.PowerPercent
            };
            var freData = new DataCurveInfo
            {
                Data            = CopyUtil.DeepCopy(this.Model.PwrCtrlPara.FreqCurve),
                ShowAbs         = this.Model.PwrCtrlPara.ShowAbs,
                SpeedUnit       = UnitObserverFacade.Instance.SpeedUnitObserver.UnitType,
                Speed           = this.Model.CutSpeed,
                Freq            = this.Model.PulseFrequency,
                PowerPercentage = this.Model.PowerPercent
            };

            var frm = new FrmPowerEdit(pwrData, freData);

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                this.Model.PwrCtrlPara.PowerCurve.Points = CopyUtil.DeepCopy(frm.PwrData.Data.Points);
                this.Model.PwrCtrlPara.FreqCurve.Points  = CopyUtil.DeepCopy(frm.FreqData.Data.Points);
                this.InitializeCurve();
            }
        }
Ejemplo n.º 2
0
        public void CopyAttrobutesToInstance()
        {
            int    producerId      = 1;
            string producerCountry = "BL";
            string producerName    = "Blem";

            int    requestId      = 1;
            string requestCountry = "SK";


            UpdateProducerRequest request = new UpdateProducerRequest
            {
                Id      = requestId,
                Country = requestCountry
            };
            Producer producer = new Producer
            {
                Id      = producerId,
                Country = producerCountry,
                Name    = producerName,
            };

            CopyUtil.CopyAttributesToInstance(request, producer);

            Assert.AreEqual(requestId, producer.Id);
            Assert.AreEqual(requestCountry, producer.Country);
            Assert.IsNull(producer.Name);

            Assert.IsNull(producer.File);
            Assert.IsNull(producer.Products);
            Assert.IsNull(producer.FileId);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a unique copy of a player object's sprite animator so that skins are unique to each player.
        /// </summary>
        /// <param name="playerObject">The player object with the sprite animator component.</param>
        private void MakeUniqueSpriteAnimator(GameObject playerObject)
        {
            var localPlayer = HeroController.instance;
            // Copy over mesh filter variables
            var meshFilter = playerObject.GetComponent <MeshFilter>();
            var mesh       = meshFilter.mesh;
            var localMesh  = localPlayer.GetComponent <MeshFilter>().sharedMesh;

            mesh.vertices  = localMesh.vertices;
            mesh.normals   = localMesh.normals;
            mesh.uv        = localMesh.uv;
            mesh.triangles = localMesh.triangles;
            mesh.tangents  = localMesh.tangents;

            // Copy mesh renderer material
            var meshRenderer = playerObject.GetComponent <MeshRenderer>();

            meshRenderer.material = new Material(localPlayer.GetComponent <MeshRenderer>().material);

            // Copy over animation library
            var spriteAnimator = playerObject.GetComponent <tk2dSpriteAnimator>();

            // Make a smart copy of the sprite animator library so we can
            // modify the animator without having to worry about other player objects
            spriteAnimator.Library = CopyUtil.SmartCopySpriteAnimation(
                localPlayer.GetComponent <tk2dSpriteAnimator>().Library,
                playerObject
                );
        }
Ejemplo n.º 4
0
 public virtual void Copy(SingleDot singleDot)
 {
     base.Copy(singleDot);
     this.P1         = singleDot.P1;
     this.GroupParam = CopyUtil.DeepCopy(singleDot.GroupParam);
     this.IsSelected = singleDot.IsSelected;
 }
Ejemplo n.º 5
0
 public void DoMicroConnect(List <IDrawObject> drawObjects, List <List <MicroConnectModel> > parms, bool isUpdate)
 {
     if (drawObjects == null || drawObjects.Count == 0)
     {
         return;
     }
     if (isUpdate)
     {
         var oldParams = CopyUtil.DeepCopy(drawObjects.Select(e => e.MicroConnParams).ToList());
         for (int i = 0; i < drawObjects.Count; i++)
         {
             drawObjects[i].MicroConnParams = CopyUtil.DeepCopy(parms[i]);
             drawObjects[i].Update();
         }
         if (this.undoRedoBuffer.CanCapture)
         {
             this.undoRedoBuffer.AddCommand(new EditCommandMicroConnect(drawObjects, oldParams));
         }
     }
     else
     {
         if (this.undoRedoBuffer.CanCapture)
         {
             this.undoRedoBuffer.AddCommand(new EditCommandMicroConnect(drawObjects, parms));
         }
     }
 }
Ejemplo n.º 6
0
        public override bool DoRedo(IModel dataModel)
        {
            var temp = CopyUtil.DeepCopy(this.curParams);

            this.curParams = CopyUtil.DeepCopy(this.oldParams);
            this.oldParams = temp;
            dataModel.DoMicroConnect(this.drawObjects, this.curParams, true);
            return(true);
        }
Ejemplo n.º 7
0
        public override bool DoUndo(IModel dataModel)
        {
            var temp = CopyUtil.DeepCopy(this.curParams);

            this.curParams = CopyUtil.DeepCopy(this.oldParams);
            this.oldParams = temp;
            dataModel.DoCornerRing(this.drawObjects, this.curParams);
            return(true);
        }
Ejemplo n.º 8
0
        public UCPointMoveCutPara(PointMoveCutModel model) : this()
        {
            this.Model = this.mvvmContext1.GetViewModel <PointMoveCutModel>();
            CopyUtil.CopyModel(this.Model, model ?? DefaultParaHelper.GetDefaultPointMoveModel());
            this.InitializeBindings();
            var monitor = new UnitMonitor(this, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
        }
Ejemplo n.º 9
0
 public EditCommandSetLeadwire(List <IDrawObject> drawObjects, List <LineInOutParamsModel> leadwireModels, List <LineInOutParamsModel> leadwireModelOlds)
 {
     this.drawObjects = drawObjects;
     for (int i = 0; i < leadwireModels.Count; i++)
     {
         this.leadwireModels.Add(CopyUtil.DeepCopy(leadwireModels[i]));
     }
     this.leadwireModelOlds = leadwireModelOlds;
 }
Ejemplo n.º 10
0
        public UCLayerCoolingPara(LayerCoolingModel layerCooling) : this()
        {
            this.Model = this.mvvmContext1.GetViewModel <LayerCoolingModel>();
            CopyUtil.CopyModel(this.Model, layerCooling ?? DefaultParaHelper.GetDefaultLayerCoolingModel());
            this.InitializeBindings();
            var monitor = new UnitMonitor(this, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
        }
Ejemplo n.º 11
0
        private void InitializeCurve()
        {
            this.chartControlCurve.Clear();
            this.chartControlCurve.AddCurve(new Curve
            {
                Id       = this.id,
                Points   = CopyUtil.DeepCopyBaseOnJSon(this.Curve.Data.Points),
                DisColor = this.id == PWR_CURVE_ID ? Color.Red: Color.Blue,
                Pattern  = this.Curve.Data.Pattern
            });

            string xLegend = null;
            string yLegend = null;
            double xMax    = 0;
            double yMax    = 0;

            bool showAbs = this.Curve.ShowAbs;

            if (showAbs)
            {
                string str1 = this.Curve.SpeedUnit.GetDescription();
                xLegend      = $"Speed({str1})";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(W)" : "Frequency(Hz)";
                xMax         = double.Parse(SpeedUnitConverter.Convert(this.Curve.Speed));
                yMax         = Constants.MaxPower * this.Curve.PowerPercentage / 100.0;
                this.xSuffix = str1;
                this.ySuffix = this.id == PWR_CURVE_ID ? "W" : "Hz";
            }
            else
            {
                xLegend      = "Speed(%)";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(%)" : "Frequency(%)";
                xMax         = 100;
                yMax         = 100;
                this.xSuffix = "%";
                this.ySuffix = "%";
            }

            this.chartControlCurve.XLengend = xLegend;
            this.chartControlCurve.YLengend = yLegend;
            this.chartControlCurve.XMax     = xMax;
            this.chartControlCurve.YMax     = yMax;

            this.UpdateDGV();
            this.checkAbs.Checked            = showAbs;
            this.cmbPatternPwr.SelectedIndex = (int)this.Curve.Data.Pattern;

            if (this.id == PWR_CURVE_ID)
            {
                this.dgvCurve.Columns[1].HeaderText = "Power";
            }
            else
            {
                this.dgvCurve.Columns[1].HeaderText = "Frequency";
            }
        }
Ejemplo n.º 12
0
        public FrmLayerConfig(LayerConfigModel layerConfig) : this()
        {
            this.Model = mvvmContext1.GetViewModel <LayerConfigModel>();
            CopyUtil.CopyModel(this.Model, layerConfig ?? DefaultParaHelper.GetDefaultLayerConfigModel());
            this.InitializeBindings();
            this.InitializePointMoveCutParaPage();
            var monitor = new UnitMonitor(this.tPageLayerGlobal, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
        }
Ejemplo n.º 13
0
        public UCLayerEvaporatePara(LayerEvaporateModel layerEvaporate) : this()
        {
            this.Model = this.mvvmContext1.GetViewModel <LayerEvaporateModel>();
            CopyUtil.CopyModel(this.Model, layerEvaporate ?? DefaultParaHelper.GetDefaultLayerEvaporateModel());
            this.InitializeBindings();
            this.InitializeCurve();
            var monitor = new UnitMonitor(this, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
            UnitObserverFacade.Instance.SpeedUnitObserver.UnitChanged += x => this.InitializeCurve();
        }
Ejemplo n.º 14
0
    public void PushFrame(Matrix <NodeModel> model)
    {
        if (null == model)
        {
            return;
        }
        // end if
        Matrix <NodeModel> copy = CopyUtil.DeepCopyByBin(model);

        m_ModelStack.Push(copy);
    } // end PushFrame
Ejemplo n.º 15
0
 public FrmConnectKnife(ConnectKnifeModel connectKnife) : this()
 {
     this.Model = CopyUtil.DeepCopy(connectKnife);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new ConnectKnifeModel();
         }
         this.mvvmContext1.SetViewModel(typeof(ConnectKnifeModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 16
0
 public FrmCurveSmoothing(CurveSmoothingModel curveSmoothing) : this()
 {
     this.Model = CopyUtil.DeepCopy(curveSmoothing);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new CurveSmoothingModel();
         }
         this.mvvmContext1.SetViewModel(typeof(CurveSmoothingModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 17
0
        public FrmLayerConfig(LayerConfigModel layerConfig, List <int> layers) : this()
        {
            this.Model  = mvvmContext1.GetViewModel <LayerConfigModel>();
            this.layers = layers;
            CopyUtil.CopyModel(this.Model, layerConfig ?? DefaultParaHelper.GetDefaultLayerConfigModel());
            this.InitializeBindings();
            this.InitializeTabPages(layers);
            this.UcLayer_OnPathRecoolingChanged(false, "冷却参数");
            this.UcLayer_OnEvaporationFilmChanged(false, "蒸发参数");
            var monitor = new UnitMonitor(this.tPageLayerGlobal, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
        }
Ejemplo n.º 18
0
 public FrmDeleteSmallFigure(DeleteSmallFigureModel deleteSmallFigure) : this()
 {
     this.Model = CopyUtil.DeepCopy(deleteSmallFigure);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new DeleteSmallFigureModel();
         }
         this.mvvmContext1.SetViewModel(typeof(DeleteSmallFigureModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 19
0
 public FrmArrayAnnular(ArrayAnnularModel arrayAnnular) : this()
 {
     this.Model = CopyUtil.DeepCopy(arrayAnnular);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new ArrayAnnularModel();
         }
         this.mvvmContext1.SetViewModel(typeof(ArrayAnnularModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 20
0
 public FrmMachineCount(MachineCountModel machineCount) : this()
 {
     this.Model = CopyUtil.DeepCopy(machineCount);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new MachineCountModel();
         }
         this.mvvmContext1.SetViewModel(typeof(MachineCountModel), this.Model);
         InitializeBindings();
     }
 }
Ejemplo n.º 21
0
 public FrmMergeConnectLine(MergeConnectLineModel mergeConnectLine) : this()
 {
     this.Model = CopyUtil.DeepCopy(mergeConnectLine);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new MergeConnectLineModel();
         }
         this.mvvmContext1.SetViewModel(typeof(MergeConnectLineModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 22
0
 public FrmAutoLayout(AutoLayoutModel autoLayout) : this()
 {
     this.Model = CopyUtil.DeepCopy(autoLayout);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new AutoLayoutModel();
         }
         this.mvvmContext1.SetViewModel(typeof(AutoLayoutModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 23
0
 public FrmMultiContourConnectCut(MultiContourConnectCutModel multiContourConnectCut) : this()
 {
     this.Model = CopyUtil.DeepCopy(multiContourConnectCut);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new MultiContourConnectCutModel();
         }
         this.mvvmContext1.SetViewModel(typeof(MultiContourConnectCutModel), this.Model);
         this.InitializeBindings();
     }
 }
Ejemplo n.º 24
0
 public FrmUserConfig(UserConfigModel userConfig) : this()
 {
     this.Model = CopyUtil.DeepCopy(userConfig);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model == null)
         {
             this.Model = new UserConfigModel();
         }
         this.mvvmContext1.SetViewModel(typeof(UserConfigModel), this.Model);
         InitializeBindings();
         InitializeBindings();
     }
 }
Ejemplo n.º 25
0
        public FigureUnit Take(string id)
        {
            FigureUnit figure = null;

            try
            {
                var temp = this.figureMap[id];
                figure = CopyUtil.DeepCopy <FigureUnit>(temp);
            }
            catch
            {
            }
            return(figure);
        }
Ejemplo n.º 26
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            int index = this.tabControlEditor.SelectedTabPageIndex;

            if (index == 0)
            {
                this.FreqData.Data.Points = CopyUtil.DeepCopyBaseOnJSon(this.PwrData.Data.Points);
                this.freComponent?.UpdateCurveData(this.FreqData);
            }
            else
            {
                this.PwrData.Data.Points = CopyUtil.DeepCopyBaseOnJSon(this.FreqData.Data.Points);
                this.pwrComponent?.UpdateCurveData(this.PwrData);
            }
        }
Ejemplo n.º 27
0
 public FrmLineFlyingCut(LineFlyingCutModel lineFlyingCut) : this()
 {
     this.Model = CopyUtil.DeepCopy(lineFlyingCut);
     if (!this.mvvmContext1.IsDesignMode)
     {
         if (this.Model != null)
         {
             this.mvvmContext1.SetViewModel(typeof(LineFlyingCutModel), this.Model);
         }
         else
         {
             this.Model = this.mvvmContext1.GetViewModel <LineFlyingCutModel>();
         }
         InitializeBindings();
     }
 }
Ejemplo n.º 28
0
        public void DoInnerCut(List <IDrawObject> drawObjects)
        {
            if (drawObjects == null || drawObjects.Count == 0)
            {
                return;
            }
            var oldParams = CopyUtil.DeepCopy(drawObjects.Select(e => e.CompensationParam).ToList());

            for (int i = 0; i < drawObjects.Count; i++)
            {
                drawObjects[i].SetInnerCut();
            }
            if (this.undoRedoBuffer.CanCapture)
            {
                this.undoRedoBuffer.AddCommand(new EditCommandCompensation(drawObjects, oldParams));
            }
        }
Ejemplo n.º 29
0
        private static List <IDrawObject> ConvertToMultiSegLine(Circle circle, List <BridgePoints> bridges)
        {
            List <IDrawObject> retObjects = new List <IDrawObject>();

            if (bridges.Count == 2)
            {
                bridges[0].Point2.Bulge = BulgeHelper.GetBulgeFromTwoPointsAndCenter(circle.Center, bridges[0].Point2.Point, bridges[1].Point1.Point, circle.IsClockwise);;
                retObjects.Add(new MultiSegmentLineBase()
                {
                    IsCloseFigure = false,
                    LayerId       = circle.LayerId,
                    GroupParam    = CopyUtil.DeepCopy(circle.GroupParam),
                    Points        = new List <UnitPointBulge>()
                    {
                        bridges[0].Point2, bridges[1].Point1
                    }
                });

                bridges[1].Point2.Bulge = BulgeHelper.GetBulgeFromTwoPointsAndCenter(circle.Center, bridges[1].Point2.Point, bridges[0].Point1.Point, circle.IsClockwise);;
                retObjects.Add(new MultiSegmentLineBase()
                {
                    IsCloseFigure = false,
                    LayerId       = circle.LayerId,
                    GroupParam    = CopyUtil.DeepCopy(circle.GroupParam),
                    Points        = new List <UnitPointBulge>()
                    {
                        bridges[1].Point2, bridges[0].Point1
                    }
                });
            }
            else if (bridges.Count == 1)
            {
                bridges[0].Point2.Bulge = BulgeHelper.GetBulgeFromTwoPointsAndCenter(circle.Center, bridges[0].Point2.Point, bridges[0].Point1.Point, circle.IsClockwise);;
                retObjects.Add(new MultiSegmentLineBase()
                {
                    IsCloseFigure = false,
                    LayerId       = circle.LayerId,
                    GroupParam    = CopyUtil.DeepCopy(circle.GroupParam),
                    Points        = new List <UnitPointBulge>()
                    {
                        bridges[0].Point2, bridges[0].Point1
                    }
                });
            }
            return(retObjects);
        }
Ejemplo n.º 30
0
        public void DoCornerRing(List <IDrawObject> drawObjects, List <CornerRingModel> parms)
        {
            if (drawObjects == null || drawObjects.Count == 0)
            {
                return;
            }
            var oldParams = CopyUtil.DeepCopy(drawObjects.Select(e => e.CornerRingParam).ToList());

            for (int i = 0; i < drawObjects.Count; i++)
            {
                ((IDrawTranslation)drawObjects[i]).DoCornerRing(parms[i]);
            }
            if (this.undoRedoBuffer.CanCapture)
            {
                this.undoRedoBuffer.AddCommand(new EditCommandCornerRing(drawObjects, oldParams));
            }
        }