public bool pointFitsArc(MyPoint point, MyArc arc, checkType comparePrecision) { double radius = Mathematics.FindDist(arc.CenterPoint, arc.StartPoint); bool pointFits = false; switch (comparePrecision) { case checkType.clickPrecision: pointFits = Math.Abs(Mathematics.FindDist(point, arc.CenterPoint) - radius) < visualizer.pointLocality / 2.0; break; case checkType.doublePrecision: pointFits = Math.Abs(Mathematics.FindDist(point, arc.CenterPoint) - radius) < 0.000000001; break; case checkType.boundPrecision: pointFits = Math.Abs(Mathematics.FindDist(point, arc.CenterPoint) - radius) < radius * ProjectForm.toch; break; } if (pointFits) { return(Mathematics.checkValidPointOnArc(point, arc)); } return(false); }
private checkType[] getCheckTypeFromPanel() { checkType[] checkTypes = new checkType[checkPanel.Controls.Count]; int i = 0; foreach (CheckTypeInputPanel inputPanel in checkPanel.Controls) { checkType checkType = new checkType(inputPanel.nameBox.text, int.Parse(inputPanel.weightBox.Text)); checkType.typeColor = inputPanel.checkTypeColor; checkTypes[i] = checkType; i++; } return(checkTypes); }
//增加判断是添加设备还是删除设备 public checkList(checkType c) { InitializeComponent(); if (c == checkType.Insert) { this.label1.Text = "请选择添加的歌单"; this.type = checkType.Insert; } else { this.label1.Text = "请选择删除的歌单"; this.type = checkType.Delete; } }
public static bool LuhnValidate(string number, checkType type) { if (type == checkType.Luhn) { return(LuhnValidate(number)); } if (type == checkType.Visa) { return(ValidateVisa(number)); } return(false); }
/// <summary> /// 节点回合 /// </summary> /// <param name="tagName">树节点标识</param> public void Round(tagType tagName) { checkType check = round(tagName); switch (check) { case checkType.LessRound: log.Default.Throw("缺少回合节点 : " + tagName.ToString() + @" " + nodes.JoinString(@" ", value => value.Key.Tag.ToString()), false, false); break; case checkType.UnknownRound: log.Default.Throw("未知的回合节点 : " + tagName.ToString() + @" " + nodes.JoinString(@" ", value => value.Key.Tag.ToString()), false, false); break; } }
/// <summary> /// 节点回合 /// </summary> /// <param name="tagName">树节点标识</param> public void Round(tagType tagName) { checkType check = round(tagName, false); switch (check) { case checkType.LessRound: log.Error.Throw("缺少回合节点 : " + tagName.ToString() + @" " + nodes.JoinString(@" ", value => value.Key.Tag.ToString()), new System.Diagnostics.StackFrame(), false); break; case checkType.UnknownRound: log.Error.Throw("未知的回合节点 : " + tagName.ToString() + @" " + nodes.JoinString(@" ", value => value.Key.Tag.ToString()), new System.Diagnostics.StackFrame(), false); break; } }
/// <summary> /// Esegue il controllo specifico del tipo scelto /// </summary> /// <param name="typ"></param> /// <returns></returns> bool Check(checkType typ) { bool ok = false; switch(typ) { case checkType.Conti_Unique: ok = Riga.CheckUnique(this.conti); // verifica unicità dei numeri dei conti if (!ok) lstErr.Add("Conti duplicati."); break; case checkType.OpStandard_Unique: // Verifica unicità dei numeri dei conti ok = Riga.CheckUnique(this.opStandard); if (!ok) lstErr.Add("Operazioni standard duplicate."); break; case checkType.OpStd_ContiValid: // Verifica che i conti delle opStandard esistano ok = true; foreach(OpStandard os in this.opStandard) { foreach(int nc in os.Conti()) { bool found = false; foreach(Conto c in this.cntTotali) { if (c.numero == Math.Abs(nc)) found = true; } if(!found) { ok = false; lstErr.Add("Operazione standard <" + os.numero + "> con numero di conto non valido."); } } } break; case checkType.Op_ContiValid: // Verifica che i conti delle Operazioni esistano ok = true; foreach (Operazione op in this.opTotali) { foreach (int nc in op.Conti()) { bool found = false; foreach (Conto c in this.cntTotali) { if (c.numero == Math.Abs(nc)) found = true; } if (!found) { ok = false; lstErr.Add("Operazione <" + op.descrizione + "> del <" + op.data + "> con numero di conto non valido."); } } } break; case checkType.Op_OpStdValid: // Verifica che le opStandard delle Operazioni esistano ok = true; foreach(Operazione op in this.opTotali) { bool found = false; if(op.tipostd == 0) { found = true; } else { foreach (OpStandard os in this.opStandard) { if (os.numero == op.tipostd) found = true; } } if (!found) { ok = false; lstErr.Add("Operazione <" + op.descrizione + "> del <" + op.data + "> con numero di operazione standard non valido."); } } break; case checkType.Op_Consuntivo_old: // DateTime olderDate = DateTime.Now; DateTime olderDate = DateTime.Now.Date.AddDays(-1); ok = true; foreach (Operazione op in this.opTotali) { DateTime dt = Riga.String2DateTime(op.data); if((olderDate >= dt)&&(!op.consuntivo)) { ok = false; lstErr.Add("Operazione <" + op.descrizione + "> del <" + op.data + "> non impostata come consuntivo."); } } break; default: throw new Exception("Caso CheckType non gestito."); } return ok; }
public bool pointFitsArc(double x, double y, MyArc arc, checkType comparePrecision) { return(pointFitsArc(new MyPoint(x, y, MyPoint.PointType.IsGeometryPoint), arc, comparePrecision)); }