示例#1
0
        private void RenderToothWatch(Graphics g, ToothGraphic toothGraphic)
        {
            float      toMm  = 1f / TcData.ScaleMmToPix;
            SolidBrush brush = new SolidBrush(toothGraphic.colorWatch);

            //Drawing a white silhouette around the colored watch W doesn't make sense here because unerupted teeth do not change color in this chart.
            if (ToothGraphic.IsRight(toothGraphic.ToothID))
            {
                if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                {
                    g.DrawString("W", Font, brush, new PointF(TcData.GetTransXpix(toothGraphic.ToothID) + toothGraphic.ShiftM - 6f, 0));
                }
                else
                {
                    g.DrawString("W", Font, brush, new PointF(TcData.GetTransXpix(toothGraphic.ToothID) + toothGraphic.ShiftM - 7f, Height - Font.Size - 8f));
                }
            }
            else
            {
                if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                {
                    g.DrawString("W", Font, brush, new PointF(TcData.GetTransXpix(toothGraphic.ToothID) - toothGraphic.ShiftM - 6f, 0));
                }
                else
                {
                    g.DrawString("W", Font, brush, new PointF(TcData.GetTransXpix(toothGraphic.ToothID) - toothGraphic.ShiftM - 7f, Height - Font.Size - 8f));
                }
            }
            brush.Dispose();
        }
        ///<summary>Gets the rectangle in pixels surrounding a tooth number.  Used to draw the box and to invalidate the area.</summary>
        private RectangleF GetNumberRec(string tooth_id, Graphics g)
        {
            float xPos = GetTransX(tooth_id);
            float yPos = Height / 2f;

            if (ToothGraphic.IsMaxillary(tooth_id))
            {
                yPos -= 14;
            }
            else
            {
                yPos += 3;
            }
            string displayNum = tooth_id;

            if (useInternational)
            {
                displayNum = ToothGraphic.ToInternat(displayNum);
            }
            float strWidth = g.MeasureString(displayNum, Font).Width;

            xPos -= strWidth / 2f;
            RectangleF rec = new RectangleF(xPos - 1, yPos - 1, strWidth, 12);   //this rec has origin at UL

            return(rec);
        }
 private float GetTransYocclusal(string tooth_id)
 {
     if (ToothGraphic.IsMaxillary(tooth_id))
     {
         return(Height / 2 - 48f);
     }
     return(Height / 2 + 48f);
 }
        ///<summary>In control coords rather than mm.</summary>
        private float GetTransYfacial(string tooth_id)
        {
            float basic = 30;

            if (ToothGraphic.IsMaxillary(tooth_id))
            {
                return(Height / 2 - basic);
            }
            return(Height / 2 + basic);
        }
示例#5
0
        ///<summary></summary>
        private void DrawToothOcclusal(ToothGraphic toothGraphic, Graphics g)
        {
            ToothGroup group;
            float      x, y;
            Pen        outline = new Pen(Color.Gray);

            for (int i = 0; i < toothGraphic.Groups.Count; i++)
            {
                group = (ToothGroup)toothGraphic.Groups[i];
                if (!group.Visible)
                {
                    continue;
                }
                x = TcData.GetTransXpix(toothGraphic.ToothID);
                y = TcData.GetTransYocclusalPix(toothGraphic.ToothID);
                float        sqB  = 4;      //half the size of the central square. B for Big.
                float        cirB = 9.5f;   //radius of outer circle
                float        sqS  = 3;      //S for small
                float        cirS = 8f;
                GraphicsPath path;
                SolidBrush   brush = new SolidBrush(group.PaintColor);
                string       dir;
                switch (group.GroupType)
                {
                case ToothGroupType.O:
                    g.FillRectangle(brush, x - sqB, y - sqB, 2f * sqB, 2f * sqB);
                    g.DrawRectangle(outline, x - sqB, y - sqB, 2f * sqB, 2f * sqB);
                    break;

                case ToothGroupType.I:
                    g.FillRectangle(brush, x - sqS, y - sqS, 2f * sqS, 2f * sqS);
                    g.DrawRectangle(outline, x - sqS, y - sqS, 2f * sqS, 2f * sqS);
                    break;

                case ToothGroupType.B:
                    if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                    {
                        path = GetPath("U", x, y, sqB, cirB);
                    }
                    else
                    {
                        path = GetPath("D", x, y, sqB, cirB);
                    }
                    g.FillPath(brush, path);
                    g.DrawPath(outline, path);
                    break;

                case ToothGroupType.F:
                    if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                    {
                        path = GetPath("U", x, y, sqS, cirS);
                    }
                    else
                    {
                        path = GetPath("D", x, y, sqS, cirS);
                    }
                    g.FillPath(brush, path);
                    g.DrawPath(outline, path);
                    break;

                case ToothGroupType.L:
                    if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                    {
                        dir = "D";
                    }
                    else
                    {
                        dir = "U";
                    }
                    if (ToothGraphic.IsAnterior(toothGraphic.ToothID))
                    {
                        path = GetPath(dir, x, y, sqS, cirS);
                    }
                    else
                    {
                        path = GetPath(dir, x, y, sqB, cirB);
                    }
                    g.FillPath(brush, path);
                    g.DrawPath(outline, path);
                    break;

                case ToothGroupType.M:
                    if (ToothGraphic.IsRight(toothGraphic.ToothID))
                    {
                        dir = "R";
                    }
                    else
                    {
                        dir = "L";
                    }
                    if (ToothGraphic.IsAnterior(toothGraphic.ToothID))
                    {
                        path = GetPath(dir, x, y, sqS, cirS);
                    }
                    else
                    {
                        path = GetPath(dir, x, y, sqB, cirB);
                    }
                    g.FillPath(brush, path);
                    g.DrawPath(outline, path);
                    break;

                case ToothGroupType.D:
                    if (ToothGraphic.IsRight(toothGraphic.ToothID))
                    {
                        dir = "L";
                    }
                    else
                    {
                        dir = "R";
                    }
                    if (ToothGraphic.IsAnterior(toothGraphic.ToothID))
                    {
                        path = GetPath(dir, x, y, sqS, cirS);
                    }
                    else
                    {
                        path = GetPath(dir, x, y, sqB, cirB);
                    }
                    g.FillPath(brush, path);
                    g.DrawPath(outline, path);
                    break;
                }
                //group.PaintColor
                //Gl.glCallList(displayListOffset+toothGraphic.GetIndexForDisplayList(group));
            }
        }
        ///<summary>Only called when in simple graphical mode.</summary>
        private void DrawFacialView(ToothGraphic toothGraphic, Graphics g)
        {
            float x, y;

            x = GetTransX(toothGraphic.ToothID);
            y = GetTransYfacial(toothGraphic.ToothID);
            if (toothGraphic.Visible ||
                (toothGraphic.IsCrown && toothGraphic.IsImplant) ||
                toothGraphic.IsPontic)
            {
                //DrawTooth(toothGraphic,g);
            }
            float w = 0;

            if (!ToothGraphic.IsPrimary(toothGraphic.ToothID))
            {
                w = ToothGraphic.GetWidth(toothGraphic.ToothID) / WidthProjection * (float)Width;
            }
            if (!ToothGraphic.IsPrimary(toothGraphic.ToothID) && (!toothGraphic.Visible || toothGraphic.IsPontic))
            {
                if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                {
                    g.FillRectangle(new SolidBrush(colorBackSimple), x - w / 2f, 0, w, Height / 2f - 20);
                }
                else
                {
                    g.FillRectangle(new SolidBrush(colorBackSimple), x - w / 2f, Height / 2f + 20, w, Height / 2f - 20);
                }
            }
            if (toothGraphic.DrawBigX)
            {
                float halfxwidth = 6;
                float xheight    = 58;
                float offsetofx  = 73;
                //toothGraphic.colorX
                if (ToothGraphic.IsMaxillary(toothGraphic.ToothID))
                {
                    g.DrawLine(new Pen(toothGraphic.colorX), x - halfxwidth, Height / 2f - offsetofx - xheight, x + halfxwidth, Height / 2f - offsetofx);
                    g.DrawLine(new Pen(toothGraphic.colorX), x + halfxwidth, Height / 2f - offsetofx - xheight, x - halfxwidth, Height / 2f - offsetofx);
                }
                else                  //Mandible
                {
                    g.DrawLine(new Pen(toothGraphic.colorX), x - halfxwidth, Height / 2f + offsetofx + xheight, x + halfxwidth, Height / 2f + offsetofx);
                    g.DrawLine(new Pen(toothGraphic.colorX), x + halfxwidth, Height / 2f + offsetofx + xheight, x - halfxwidth, Height / 2f + offsetofx);
                }
            }
            if (toothGraphic.Visible && toothGraphic.IsRCT)             //draw RCT
            //x=,y= etc
            //toothGraphic.colorRCT
            //?
            {
            }
            if (toothGraphic.Visible && toothGraphic.IsBU)             //BU or Post
            //?
            {
            }
            if (toothGraphic.IsImplant)
            {
                //?
            }
        }