///<summary>Sets the specified permanent tooth to primary as follows: Sets ShowPrimary to true for the perm tooth. Makes pri tooth visible=true, repositions perm tooth by translating -Y. Moves primary tooth slightly to M or D sometimes for better alignment. And if 2nd primary molar, then because of the larger size, it must move all perm molars to distal. Ignores if invalid perm tooth.</summary> public void SetToPrimary(string toothID) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } if (ToothGraphic.IsPrimary(toothID)) { return; } ListToothGraphics[toothID].ShowPrimary = true; //ListToothGraphics[toothID].ShiftO-=12; ListToothGraphics[toothID].Visible = false; //instead of shiftO this.Invalidate(); if (!ToothGraphic.IsValidToothID(ToothGraphic.PermToPri(toothID))) { return; } ListToothGraphics[ToothGraphic.PermToPri(toothID)].Visible = true; } else { toothChart.SetToPrimary(toothID); } }
///<summary>A series of color settings will result in the last ones entered overriding earlier entries.</summary> public void SetSurfaceColors(string toothID, string surfaces, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].SetSurfaceColors(surfaces, color); Invalidate(); }
///<summary>Sets the specified permanent tooth to primary. Works as follows: Sets ShowPrimaryLetter to true for the perm tooth. Makes pri tooth visible=true. Also repositions perm tooth by translating -Y. Moves primary tooth slightly to M or D sometimes for better alignment. And if 2nd primary molar, then because of the larger size, it must move all perm molars to distal.</summary> public void SetPrimary(string toothID) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } if (Tooth.IsPrimary(toothID)) { return; } tcData.ListToothGraphics[toothID].ShiftO -= 12; if (ToothGraphic.IsValidToothID(Tooth.PermToPri(toothID))) //if there's a primary tooth at this location { tcData.ListToothGraphics[Tooth.PermToPri(toothID)].Visible = true; //show the primary. tcData.ListToothGraphics[toothID].ShowPrimaryLetter = true; } //first pri mand molars, shift slightly to M if (toothID == "21") { tcData.ListToothGraphics["J"].ShiftM += 0.5f; } if (toothID == "28") { tcData.ListToothGraphics["S"].ShiftM += 0.5f; } //second pri molars are huge, so shift distally for space //and move all the perm molars distally too if (toothID == "4") { tcData.ListToothGraphics["A"].ShiftM -= 0.5f; tcData.ListToothGraphics["1"].ShiftM -= 1; tcData.ListToothGraphics["2"].ShiftM -= 1; tcData.ListToothGraphics["3"].ShiftM -= 1; } if (toothID == "13") { tcData.ListToothGraphics["J"].ShiftM -= 0.5f; tcData.ListToothGraphics["14"].ShiftM -= 1; tcData.ListToothGraphics["15"].ShiftM -= 1; tcData.ListToothGraphics["16"].ShiftM -= 1; } if (toothID == "20") { tcData.ListToothGraphics["K"].ShiftM -= 1.2f; tcData.ListToothGraphics["17"].ShiftM -= 2.3f; tcData.ListToothGraphics["18"].ShiftM -= 2.3f; tcData.ListToothGraphics["19"].ShiftM -= 2.3f; } if (toothID == "29") { tcData.ListToothGraphics["T"].ShiftM -= 1.2f; tcData.ListToothGraphics["30"].ShiftM -= 2.3f; tcData.ListToothGraphics["31"].ShiftM -= 2.3f; tcData.ListToothGraphics["32"].ShiftM -= 2.3f; } Invalidate(); }
///<summary>Used for missing teeth. This should always be done before setting restorations, because a pontic will cause the tooth to become visible again except for the root. So if setMissing after a pontic, then the pontic can't show.</summary> public void SetMissing(string toothID) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].Visible = false; Invalidate(); }
public void SetMobility(string toothID, string mobility, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].Mobility = mobility; tcData.ListToothGraphics[toothID].colorMobility = color; Invalidate(); }
///<summary>This is just the same as SetMissing, except that it also hides the number from showing. This is used, for example, if premolars are missing, and ortho has completely closed the space. User will not be able to select this tooth because the number is hidden.</summary> public void SetHidden(string toothID) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].Visible = false; tcData.ListToothGraphics[toothID].HideNumber = true; Invalidate(); }
///<summary>This draws a big red extraction X right on top of the tooth. It's up to the calling application to figure out when it's appropriate to do this. Even if the tooth has been marked invisible, there's a good chance that this will still get drawn because a tooth can be set visible again for the drawing the pontic. So the calling application needs to figure out when it's appropriate to draw the X, and not set this otherwise.</summary> public void SetBigX(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].DrawBigX = true; tcData.ListToothGraphics[toothID].colorX = color; Invalidate(); }
///<summary>Set this tooth to show a sealant</summary> public void SetSealant(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].IsSealant = true; tcData.ListToothGraphics[toothID].colorSealant = color; Invalidate(); }
///<summary>Set this tooth to show a 'W' to indicate that the tooth is being watched.</summary> public void SetWatch(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].Watch = true; tcData.ListToothGraphics[toothID].colorWatch = color; Invalidate(); }
///<summary>This will mostly only be successful on certain anterior teeth. For others, it will just show F coloring.</summary> public void SetVeneer(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].SetSurfaceColors("BFV", color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.EnamelF, color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.DF, color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.MF, color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.IF, color); Invalidate(); }
///<summary>Set this tooth to show a BU or post.</summary> public void SetBU(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } //TcData.ListToothGraphics[toothID].IsBU=true; //TcData.ListToothGraphics[toothID].colorBU=color; //Buildups are now just another group, so tcData.ListToothGraphics[toothID].SetGroupVisibility(ToothGroupType.Buildup, true); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.Buildup, color); Invalidate(); }
///<summary>Moves position of tooth. Rotations first in order listed, then translations. Tooth doesn't get moved immediately, just when painting. All changes are cumulative and are in addition to any previous translations and rotations.</summary> public void MoveTooth(string toothID, float rotate, float tipM, float tipB, float shiftM, float shiftO, float shiftB) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].ShiftM += shiftM; tcData.ListToothGraphics[toothID].ShiftO += shiftO; tcData.ListToothGraphics[toothID].ShiftB += shiftB; tcData.ListToothGraphics[toothID].Rotate += rotate; tcData.ListToothGraphics[toothID].TipM += tipM; tcData.ListToothGraphics[toothID].TipB += tipB; Invalidate(); }
///<summary>This is used for crowns and for retainers. Crowns will be visible on missing teeth with implants. Crowns are visible on F and O views, unlike ponics which are only visible on F view. If the tooth is not visible, that should be set before this call, because then, this will set the root invisible.</summary> public void SetCrown(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].IsCrown = true; if (!tcData.ListToothGraphics[toothID].Visible) //tooth not visible, so set root invisible. { tcData.ListToothGraphics[toothID].SetGroupVisibility(ToothGroupType.Cementum, false); } tcData.ListToothGraphics[toothID].SetSurfaceColors("MODBLFIV", color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.Enamel, color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.EnamelF, color); this.Invalidate(); }
///<summary></summary> public void SetSurfaceColors(string toothID, string surfaces, Color color) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].SetSurfaceColors(surfaces, color); this.Invalidate(); } else { toothChart.SetSurfaceColors(toothID, surfaces, color); } }
///<summary>Used for missing teeth. This should always be done before setting restorations, because a pontic will cause the tooth to become visible again except for the root. So if setInvisible after a pontic, then the pontic can't show.</summary> public void SetInvisible(string toothID) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].Visible = false; this.Invalidate(); } else { toothChart.SetInvisible(toothID); } }
///<summary>This draws a big red extraction X right on top of the tooth. It's up to the calling application to figure out when it's appropriate to do this. Even if the tooth has been marked invisible, there's a good chance that this will still get drawn because a tooth can be set visible again for the drawing the pontic. So the calling application needs to figure out when it's appropriate to draw the X, and not set this otherwise.</summary> public void SetBigX(string toothID, Color color) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].DrawBigX = true; ListToothGraphics[toothID].colorX = color; } else { toothChart.SetBigX(toothID, color); } }
///<summary>Set this tooth to show a sealant</summary> public void SetSealant(string toothID, Color color) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].IsSealant = true; ListToothGraphics[toothID].colorSealant = color; } else { toothChart.SetSealant(toothID, color); } }
///<summary>This is used for any pontic, including bridges, full dentures, and partials. It is usually used on a tooth that has already been set invisible. This routine cuases the tooth to show again, but the root needs to be invisible. Then, it sets the entire crown to the specified color. If the tooth is already visible, then it does not set the root invisible.</summary> public void SetPontic(string toothID, Color color) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } tcData.ListToothGraphics[toothID].IsPontic = true; if (!tcData.ListToothGraphics[toothID].Visible) { //tooth not visible, but since IsPontic changes the visibility behavior of the tooth, we need to set the root invisible. tcData.ListToothGraphics[toothID].SetGroupVisibility(ToothGroupType.Cementum, false); } tcData.ListToothGraphics[toothID].SetSurfaceColors("MODBLFIV", color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.Enamel, color); tcData.ListToothGraphics[toothID].SetGroupColor(ToothGroupType.EnamelF, color); Invalidate(); }
///<summary>This is just the same as SetInvisible, except that it also hides the number from showing. This is used, for example, if premolars are missing, and ortho has completely closed the space. User will not be able to select this tooth because the number is hidden.</summary> public void HideTooth(string toothID) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].Visible = false; ListToothGraphics[toothID].HideNumber = true; this.Invalidate(); } else { toothChart.HideTooth(toothID); } }
///<summary>Draws the number and the rectangle behind it. Draws in the appropriate color</summary> private void DrawNumber(int intTooth, bool isSelected, bool isFullRedraw, Graphics g) { string tooth_id = intTooth.ToString(); string displayNum = intTooth.ToString(); bool hideNumber = false; string pri = ToothGraphic.PermToPri(tooth_id); try{ if (ToothGraphic.IsValidToothID(pri) && //pri is valid ListToothGraphics[pri].Visible) //and pri visible { tooth_id = pri; } if (isFullRedraw && ListToothGraphics[tooth_id].HideNumber) //if redrawing all numbers, and this is a "hidden" number { return; //skip } displayNum = tooth_id; if (useInternational) { displayNum = ToothGraphic.ToInternat(displayNum); } hideNumber = ListToothGraphics[tooth_id].HideNumber; } catch { //must be design mode. } RectangleF rec = GetNumberRec(tooth_id, g); if (isSelected) { g.FillRectangle(new SolidBrush(colorBackHighlight), rec); if (!hideNumber) //Only draw if number is not hidden. { g.DrawString(displayNum, Font, new SolidBrush(colorTextHighlight), rec.X, rec.Y); } } else { g.FillRectangle(new SolidBrush(colorBackground), rec); if (!hideNumber) //Only draw if number is not hidden. { g.DrawString(displayNum, Font, new SolidBrush(colorText), rec.X, rec.Y); } } }
///<summary>Used by mousedown and mouse move to set teeth selected or unselected. Also used externally to set teeth selected. Draws the changes also.</summary> public void SetSelected(int intTooth, bool setValue) { if (simpleMode) { Graphics g = this.CreateGraphics(); if (setValue) { ALSelectedTeeth.Add(intTooth); DrawNumber(intTooth, true, false, g); } else { ALSelectedTeeth.Remove(intTooth); DrawNumber(intTooth, false, false, g); } RectangleF recF = GetNumberRec(intTooth.ToString(), g); Rectangle rec = new Rectangle((int)recF.X, (int)recF.Y, (int)recF.Width, (int)recF.Height); Invalidate(rec); Application.DoEvents(); if (ALSelectedTeeth.Count == 0) { selectedTeeth = new string[0]; } else { selectedTeeth = new string[ALSelectedTeeth.Count]; for (int i = 0; i < ALSelectedTeeth.Count; i++) { if (ToothGraphic.IsValidToothID(ToothGraphic.PermToPri(ALSelectedTeeth[i].ToString())) && //pri is valid ListToothGraphics[ALSelectedTeeth[i].ToString()].ShowPrimary) //and set to show pri { selectedTeeth[i] = ToothGraphic.PermToPri(ALSelectedTeeth[i].ToString()); } else { selectedTeeth[i] = ((int)ALSelectedTeeth[i]).ToString(); } } } g.Dispose(); } else { toothChart.SetSelected(intTooth, setValue); } }
///<summary>Returns the ToothGraphic with the given toothID.</summary> public ToothGraphic this[string toothID] { get { if (toothID != "implant" && !ToothGraphic.IsValidToothID(toothID)) { throw new ArgumentException("Tooth ID not valid: " + toothID); } for (int i = 0; i < List.Count; i++) { if (((ToothGraphic)List[i]).ToothID == toothID) { return((ToothGraphic)List[i]); } } return(null); } set { //List[index]=value; } }
///<summary>This is used for any pontic, including bridges, full dentures, and partials. It is usually used on a tooth that has already been set invisible. This routine sets the tooth to visible again, but makes the root invisible. Then, it sets the entire crown to the specified color. If the tooth was not initially invisible, then it does not set the root invisible. Any connector bars for bridges are set separately.</summary> public void SetPontic(string toothID, Color color) { if (simpleMode) { if (!ToothGraphic.IsValidToothID(toothID)) { return; } ListToothGraphics[toothID].IsPontic = true; if (!ListToothGraphics[toothID].Visible) //tooth not visible, so set root invisible. { ListToothGraphics[toothID].SetGroupVisibility(ToothGroupType.Cementum, false); } ListToothGraphics[toothID].SetSurfaceColors("MODBLFIV", color); ListToothGraphics[toothID].SetGroupColor(ToothGroupType.Enamel, color); } else { toothChart.SetPontic(toothID, color); } }