private void FormPerioGraphic_Load(object sender, EventArgs e) { //ComputerPref localComputerPrefs=ComputerPrefs.GetForLocalComputer(); toothChart.DeviceFormat = new ToothChartDirectX.DirectXDeviceFormat(ComputerPrefs.LocalComputer.DirectXFormat); //Must be set before draw mode toothChart.DrawMode = DrawingMode.DirectX; toothChart.SetToothNumberingNomenclature((ToothNumberingNomenclature)PrefC.GetInt(PrefName.UseInternationalToothNumbers)); toothChart.ColorBackground = Color.White; toothChart.ColorText = Color.Black; try { toothChart.PerioMode = true; } catch (Exception ex) { MsgBox.Show(this, ex.Message); DialogResult = DialogResult.Abort; Close(); return; } List <Def> listDefs = Defs.GetDefsForCategory(DefCat.MiscColors, true); toothChart.ColorBleeding = listDefs[1].ItemColor; toothChart.ColorSuppuration = listDefs[2].ItemColor; toothChart.ColorProbing = PrefC.GetColor(PrefName.PerioColorProbing); toothChart.ColorProbingRed = PrefC.GetColor(PrefName.PerioColorProbingRed); toothChart.ColorGingivalMargin = PrefC.GetColor(PrefName.PerioColorGM); toothChart.ColorCAL = PrefC.GetColor(PrefName.PerioColorCAL); toothChart.ColorMGJ = PrefC.GetColor(PrefName.PerioColorMGJ); toothChart.ColorFurcations = PrefC.GetColor(PrefName.PerioColorFurcations); toothChart.ColorFurcationsRed = PrefC.GetColor(PrefName.PerioColorFurcationsRed); toothChart.RedLimitProbing = PrefC.GetInt(PrefName.PerioRedProb); toothChart.RedLimitFurcations = PrefC.GetInt(PrefName.PerioRedFurc); List <PerioMeasure> listMeas = PerioMeasures.GetAllForExam(_perioExamCur.PerioExamNum); //compute CAL's for each site. If a CAL is valid, pass it in. PerioMeasure measureProbe; PerioMeasure measureGM; int gm; int pd; int calMB; int calB; int calDB; int calML; int calL; int calDL; for (int t = 1; t <= 32; t++) { measureProbe = null; measureGM = null; for (int i = 0; i < listMeas.Count; i++) { if (listMeas[i].IntTooth != t) { continue; } if (listMeas[i].SequenceType == PerioSequenceType.Probing) { measureProbe = listMeas[i]; } if (listMeas[i].SequenceType == PerioSequenceType.GingMargin) { measureGM = listMeas[i]; } } if (measureProbe == null || measureGM == null) { continue; //to the next tooth } //mb calMB = -1; gm = measureGM.MBvalue; //MBvalue must stay over 100 for hyperplasia, because that's how we're storing it in ToothChartData.ListPerioMeasure. if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.MBvalue; if (measureGM.MBvalue != -1 && pd != -1) { calMB = gm + pd; if (calMB < 0) { calMB = 0; //CALs can't be negative } } //B calB = -1; gm = measureGM.Bvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.Bvalue; if (measureGM.Bvalue != -1 && pd != -1) { calB = gm + pd; if (calB < 0) { calB = 0; } } //DB calDB = -1; gm = measureGM.DBvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.DBvalue; if (measureGM.DBvalue != -1 && pd != -1) { calDB = gm + pd; if (calDB < 0) { calDB = 0; } } //ML calML = -1; gm = measureGM.MLvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.MLvalue; if (measureGM.MLvalue != -1 && pd != -1) { calML = gm + pd; if (calML < 0) { calML = 0; } } //L calL = -1; gm = measureGM.Lvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.Lvalue; if (measureGM.Lvalue != -1 && pd != -1) { calL = gm + pd; if (calL < 0) { calL = 0; } } //DL calDL = -1; gm = measureGM.DLvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.DLvalue; if (measureGM.DLvalue != -1 && pd != -1) { calDL = gm + pd; if (calDL < 0) { calDL = 0; } } if (calMB != -1 || calB != -1 || calDB != -1 || calML != -1 || calL != -1 || calDL != -1) { toothChart.AddPerioMeasure(t, PerioSequenceType.CAL, calMB, calB, calDB, calML, calL, calDL); } } for (int i = 0; i < listMeas.Count; i++) { if (listMeas[i].SequenceType == PerioSequenceType.SkipTooth) { toothChart.SetMissing(listMeas[i].IntTooth.ToString()); } else if (listMeas[i].SequenceType == PerioSequenceType.Mobility) { int mob = listMeas[i].ToothValue; Color color = Color.Black; if (mob >= PrefC.GetInt(PrefName.PerioRedMob)) { color = Color.Red; } if (mob != -1) //-1 represents no measurement taken. { toothChart.SetMobility(listMeas[i].IntTooth.ToString(), mob.ToString(), color); } } else { toothChart.AddPerioMeasure(listMeas[i]); } } for (int i = 0; i < _toothChartData.ListToothGraphics.Count; i++) { if (!_toothChartData.ListToothGraphics[i].IsImplant) //Only care about implants currently. { continue; } for (int j = 0; j < toothChart.TcData.ListToothGraphics.Count; j++) { if (toothChart.TcData.ListToothGraphics[j].ToothID == _toothChartData.ListToothGraphics[i].ToothID) { toothChart.TcData.ListToothGraphics[j] = _toothChartData.ListToothGraphics[i].Copy(toothChart.TcData.ListToothGraphics[j]); if (_toothChartData.ListToothGraphics[i].IsCrown) { toothChart.SetCrown(toothChart.TcData.ListToothGraphics[j].ToothID, _toothChartData.ListToothGraphics[i].colorImplant); } break; } } } }
//public List<PerioMeasure> ListPerioMeasures; public FormPerioGraphical(PerioExam perioExam, Patient patient) { PerioExamCur = perioExam; PatCur = patient; InitializeComponent(); //ComputerPref localComputerPrefs=ComputerPrefs.GetForLocalComputer(); toothChart.DeviceFormat = new ToothChartDirectX.DirectXDeviceFormat(ComputerPrefs.LocalComputer.DirectXFormat); //Must be set before draw mode toothChart.DrawMode = DrawingMode.DirectX; toothChart.SetToothNumberingNomenclature((ToothNumberingNomenclature)PrefC.GetInt(PrefName.UseInternationalToothNumbers)); toothChart.ColorBackground = Color.White; toothChart.ColorText = Color.Black; toothChart.PerioMode = true; toothChart.ColorBleeding = DefC.Short[(int)DefCat.MiscColors][1].ItemColor; toothChart.ColorSuppuration = DefC.Short[(int)DefCat.MiscColors][2].ItemColor; toothChart.ColorProbing = PrefC.GetColor(PrefName.PerioColorProbing); toothChart.ColorProbingRed = PrefC.GetColor(PrefName.PerioColorProbingRed); toothChart.ColorGingivalMargin = PrefC.GetColor(PrefName.PerioColorGM); toothChart.ColorCAL = PrefC.GetColor(PrefName.PerioColorCAL); toothChart.ColorMGJ = PrefC.GetColor(PrefName.PerioColorMGJ); toothChart.ColorFurcations = PrefC.GetColor(PrefName.PerioColorFurcations); toothChart.ColorFurcationsRed = PrefC.GetColor(PrefName.PerioColorFurcationsRed); toothChart.RedLimitProbing = PrefC.GetInt(PrefName.PerioRedProb); toothChart.RedLimitFurcations = PrefC.GetInt(PrefName.PerioRedFurc); List <PerioMeasure> listMeas = PerioMeasures.GetAllForExam(PerioExamCur.PerioExamNum); //compute CAL's for each site. If a CAL is valid, pass it in. PerioMeasure measureProbe; PerioMeasure measureGM; int gm; int pd; int calMB; int calB; int calDB; int calML; int calL; int calDL; for (int t = 1; t <= 32; t++) { measureProbe = null; measureGM = null; for (int i = 0; i < listMeas.Count; i++) { if (listMeas[i].IntTooth != t) { continue; } if (listMeas[i].SequenceType == PerioSequenceType.Probing) { measureProbe = listMeas[i]; } if (listMeas[i].SequenceType == PerioSequenceType.GingMargin) { measureGM = listMeas[i]; } } if (measureProbe == null || measureGM == null) { continue; //to the next tooth } //mb calMB = -1; gm = measureGM.MBvalue; //MBvalue must stay over 100 for hyperplasia, because that's how we're storing it in ToothChartData.ListPerioMeasure. if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.MBvalue; if (measureGM.MBvalue != -1 && pd != -1) { calMB = gm + pd; if (calMB < 0) { calMB = 0; //CALs can't be negative } } //B calB = -1; gm = measureGM.Bvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.Bvalue; if (measureGM.Bvalue != -1 && pd != -1) { calB = gm + pd; if (calB < 0) { calB = 0; } } //DB calDB = -1; gm = measureGM.DBvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.DBvalue; if (measureGM.DBvalue != -1 && pd != -1) { calDB = gm + pd; if (calDB < 0) { calDB = 0; } } //ML calML = -1; gm = measureGM.MLvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.MLvalue; if (measureGM.MLvalue != -1 && pd != -1) { calML = gm + pd; if (calML < 0) { calML = 0; } } //L calL = -1; gm = measureGM.Lvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.Lvalue; if (measureGM.Lvalue != -1 && pd != -1) { calL = gm + pd; if (calL < 0) { calL = 0; } } //DL calDL = -1; gm = measureGM.DLvalue; if (gm > 100) //hyperplasia { gm = 100 - gm; //e.g. 100-103=-3 } pd = measureProbe.DLvalue; if (measureGM.DLvalue != -1 && pd != -1) { calDL = gm + pd; if (calDL < 0) { calDL = 0; } } if (calMB != -1 || calB != -1 || calDB != -1 || calML != -1 || calL != -1 || calDL != -1) { toothChart.AddPerioMeasure(t, PerioSequenceType.CAL, calMB, calB, calDB, calML, calL, calDL); } } for (int i = 0; i < listMeas.Count; i++) { if (listMeas[i].SequenceType == PerioSequenceType.SkipTooth) { toothChart.SetMissing(listMeas[i].IntTooth.ToString()); } else if (listMeas[i].SequenceType == PerioSequenceType.Mobility) { int mob = listMeas[i].ToothValue; Color color = Color.Black; if (mob >= PrefC.GetInt(PrefName.PerioRedMob)) { color = Color.Red; } toothChart.SetMobility(listMeas[i].IntTooth.ToString(), mob.ToString(), color); } else { toothChart.AddPerioMeasure(listMeas[i]); } } /* * toothChart.SetMissing("13"); * toothChart.SetMissing("14"); * toothChart.SetMissing("18"); * toothChart.SetMissing("25"); * toothChart.SetMissing("26"); * toothChart.SetImplant("14",Color.Gray); * //Movements are too low of a priority to test right now. We might not even want to implement them. * //toothChart.MoveTooth("4",0,0,0,0,-5,0); * //toothChart.MoveTooth("16",0,20,0,-3,0,0); * //toothChart.MoveTooth("24",15,2,0,0,0,0); * toothChart.SetMobility("2","3",Color.Red); * toothChart.SetMobility("7","2",Color.Red); * toothChart.SetMobility("8","2",Color.Red); * toothChart.SetMobility("9","2",Color.Red); * toothChart.SetMobility("10","2",Color.Red); * toothChart.SetMobility("16","3",Color.Red); * toothChart.SetMobility("24","2",Color.Red); * toothChart.SetMobility("31","3",Color.Red); * toothChart.AddPerioMeasure(1,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1); * toothChart.AddPerioMeasure(2,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1); * toothChart.AddPerioMeasure(3,PerioSequenceType.Furcation,-1,2,-1,1,-1,-1); * toothChart.AddPerioMeasure(5,PerioSequenceType.Furcation,1,-1,-1,-1,-1,-1); * toothChart.AddPerioMeasure(30,PerioSequenceType.Furcation,-1,-1,-1,-1,3,-1); * for(int i=1;i<=32;i++) { * //string tooth_id=i.ToString(); * //bleeding and suppuration on all MB sites * //bleeding only all DL sites * //suppuration only all B sites * //blood=1, suppuration=2, both=3 * toothChart.AddPerioMeasure(i,PerioSequenceType.Bleeding, 3,2,-1,-1,-1,1); * toothChart.AddPerioMeasure(i,PerioSequenceType.GingMargin,0,1,1,1,0,0); * toothChart.AddPerioMeasure(i,PerioSequenceType.Probing, 3,2,3,4,2,3); * toothChart.AddPerioMeasure(i,PerioSequenceType.CAL, 3,3,4,5,2,3);//basically GingMargin+Probing, unless one of them is -1 * toothChart.AddPerioMeasure(i,PerioSequenceType.MGJ, 5,5,5,6,6,6); * }*/ }