Ejemplo n.º 1
0
        ///<summary>Gets a list of the hidden teeth as strings. Includes "1"-"32", and "A"-"Z".</summary>
        public static ArrayList GetHiddenTeeth(ToothInitial[] initialList)
        {
            ArrayList hidden = new ArrayList();

            for (int i = 0; i < initialList.Length; i++)
            {
                if (initialList[i].InitialType == ToothInitialType.Hidden &&
                    Tooth.IsValidDB(initialList[i].ToothNum) &&
                    !Tooth.IsSuperNum(initialList[i].ToothNum))
                {
                    hidden.Add(initialList[i].ToothNum);
                }
            }
            return(hidden);
        }
Ejemplo n.º 2
0
        ///<summary>Gets a list of missing teeth as strings. Includes "1"-"32", and "A"-"Z".</summary>
        public static ArrayList GetMissingOrHiddenTeeth(ToothInitial[] initialList)
        {
            ArrayList missing = new ArrayList();

            for (int i = 0; i < initialList.Length; i++)
            {
                if ((initialList[i].InitialType == ToothInitialType.Missing || initialList[i].InitialType == ToothInitialType.Hidden) &&
                    Tooth.IsValidDB(initialList[i].ToothNum) &&
                    !Tooth.IsSuperNum(initialList[i].ToothNum))
                {
                    missing.Add(initialList[i].ToothNum);
                }
            }
            return(missing);
        }
Ejemplo n.º 3
0
        ///<summary>Gets a list of primary teeth as strings. Includes "1"-"32".</summary>
        public static ArrayList GetPriTeeth(ToothInitial[] initialList)
        {
            ArrayList pri = new ArrayList();

            for (int i = 0; i < initialList.Length; i++)
            {
                if (initialList[i].InitialType == ToothInitialType.Primary &&
                    Tooth.IsValidDB(initialList[i].ToothNum) &&
                    !Tooth.IsPrimary(initialList[i].ToothNum) &&
                    !Tooth.IsSuperNum(initialList[i].ToothNum))
                {
                    pri.Add(initialList[i].ToothNum);
                }
            }
            return(pri);
        }
Ejemplo n.º 4
0
        public static int CompareByToothNum(CanadianExtract x1, CanadianExtract x2)
        {
            string t1 = x1.ToothNum;
            string t2 = x2.ToothNum;

            if (t1 == null || t1 == "" || t2 == null || t2 == "")
            {
                return(0);               //should never happen
            }
            if (!Tooth.IsValidDB(t1) || !Tooth.IsValidDB(t2))
            {
                return(0);
            }
            if (Tooth.IsPrimary(t1) && !Tooth.IsPrimary(t2))
            {
                return(-1);
            }
            if (!Tooth.IsPrimary(t1) && Tooth.IsPrimary(t2))
            {
                return(1);
            }
            //so either both are primary or both are permanent.
            return(Tooth.ToInt(t1).CompareTo(Tooth.ToInt(t2)));
        }
Ejemplo n.º 5
0
        ///<summary>Draws the number and the rectangle behind it.  Draws in the appropriate color</summary>
        private void DrawNumber(string tooth_id, bool isSelected, bool isFullRedraw, Graphics g)
        {
            if (DesignMode)
            {
                return;
            }
            if (TcData == null)
            {
                return;                //trying to fix a designtime bug.
            }
            if (!Tooth.IsValidDB(tooth_id))
            {
                return;
            }
            if (TcData.ListToothGraphics[tooth_id] == null)
            {
                //throw new Exception(tooth_id+" null");
                return;                                            //for some reason, it's still getting to here in DesignMode
            }
            if (isFullRedraw)                                      //if redrawing all numbers
            {
                if (TcData.ListToothGraphics[tooth_id].HideNumber) //and this is a "hidden" number
                {
                    return;                                        //skip
                }
                if (Tooth.IsPrimary(tooth_id) &&
                    !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter)                       //but not set to show primary letters
                {
                    return;
                }
            }
            string    displayNum    = Tooth.GetToothLabelGraphic(tooth_id, TcData.ToothNumberingNomenclature);
            float     toMm          = 1f / TcData.ScaleMmToPix;
            float     labelWidthMm  = g.MeasureString(displayNum, Font).Width / TcData.ScaleMmToPix;
            float     labelHeightMm = ((float)Font.Height - .5f) / TcData.ScaleMmToPix;
            SizeF     labelSizeF    = new SizeF(labelWidthMm, (float)Font.Height / TcData.ScaleMmToPix);
            Rectangle rec           = TcData.GetNumberRecPix(tooth_id, labelSizeF);

            //Rectangle recPix=TcData.ConvertRecToPix(recMm);
            if (isSelected)
            {
                g.FillRectangle(new SolidBrush(TcData.ColorBackHighlight), rec);
            }
            else
            {
                g.FillRectangle(new SolidBrush(TcData.ColorBackground), rec);
            }
            if (TcData.ListToothGraphics[tooth_id].HideNumber)             //If number is hidden.
            //do not print string
            {
            }
            else if (Tooth.IsPrimary(tooth_id) &&
                     !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter)
            {
                //do not print string
            }
            else if (isSelected)
            {
                g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorTextHighlight), rec.X, rec.Y);
            }
            else
            {
                g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorText), rec.X, rec.Y);
            }
        }