示例#1
0
		///<summary>Relative to the center of the tooth. The sign is based on area of the mouth.  The magnitude is based on tooth width.  This will be used for the probing bars and horizontal lines.  Probably also for furcations.</summary>
		private float GetXShiftPerioSite(int intTooth,PerioSurf surf) {
			if(surf==PerioSurf.B || surf==PerioSurf.L) {
				return 0;
			}
			float xdirect=1;
			if(Tooth.IsMaxillary(intTooth)) {
				if(surf==PerioSurf.MB || surf==PerioSurf.ML) {
					if(ToothGraphic.IsRight(intTooth.ToString())) {//UR quadrant
						xdirect=1;
					}
					else {//UL
						xdirect=-1;
					}
				}
				else if(surf==PerioSurf.DB || surf==PerioSurf.DL) {
					if(ToothGraphic.IsRight(intTooth.ToString())) {//UR quadrant
						xdirect=-1;
					}
					else {//UL
						xdirect=1;
					}
				}
			}
			else {//mand
				if(surf==PerioSurf.MB || surf==PerioSurf.ML) {
					if(ToothGraphic.IsRight(intTooth.ToString())) {//LR quadrant
						xdirect=1;
					}
					else {//LL
						xdirect=-1;
					}
				}
				else if(surf==PerioSurf.DB || surf==PerioSurf.DL) {
					if(ToothGraphic.IsRight(intTooth.ToString())) {//LR quadrant
						xdirect=-1;
					}
					else {//LL
						xdirect=1;
					}
				}
			}
			float toothW=ToothGraphic.GetWidth(intTooth);
			float magnitude;
			switch(intTooth) {
				default:
					magnitude=.28f; break;
				case 1:
				case 2:
				case 15:
				case 16:
					magnitude=.32f; break;
				case 17:
				case 32:
				case 18:
				case 31:
					magnitude=.35f; break;
				case 3:
				case 14:
					magnitude=.38f; break;
				case 19:
				case 30:
					magnitude=.37f; break;
			}
			if(ListToothGraphics[intTooth.ToString()].IsImplant) {
				return 2f*xdirect;
			}
			return magnitude*toothW*xdirect;
		}
示例#2
0
		///<summary>Use GetFurcationValue first.  Then, this method returns the position in mm of the tip of the triangle or V relative to the center of the tooth.</summary>
		public PointF GetFurcationPos(int intTooth,PerioSurf surf) {
			float ysign=1;
			if(Tooth.IsMaxillary(intTooth)) {
				ysign=1;
			}
			else {//mand
				ysign=-1;
			}
			float xshift=GetXShiftPerioSite(intTooth,surf);
			return new PointF(xshift,ysign*9.5f);
		}
示例#3
0
		///<summary>Draws the short vertical lines that represent probing depths.  Use this on each site (3 per tooth face).  The z component will be 0.  The coordinates will be relative to the center of the tooth.  The line will always only have one segment.  It will return null if no line to draw at this site.  The color of the line will be pulled from a different method.</summary>
		public LineSimple GetProbingLine(int intTooth,PerioSurf surf,out Color color) {
			color=ColorProbing;
			if(!ListToothGraphics[intTooth.ToString()].Visible && !ListToothGraphics[intTooth.ToString()].IsImplant) {
				return null;
			}
			float xshift=GetXShiftPerioSite(intTooth,surf);
			int gm=0;
			int pd=0;//line length
			for(int i=0;i<ListPerioMeasure.Count;i++) {
				if(ListPerioMeasure[i].IntTooth!=intTooth) {
					continue;
				}
				if(ListPerioMeasure[i].SequenceType==PerioSequenceType.Probing) {
					switch(surf) {
						case PerioSurf.MB:
							pd=ListPerioMeasure[i].MBvalue;
							break;
						case PerioSurf.B:
							pd=ListPerioMeasure[i].Bvalue;
							break;
						case PerioSurf.DB:
							pd=ListPerioMeasure[i].DBvalue;
							break;
						case PerioSurf.ML:
							pd=ListPerioMeasure[i].MLvalue;
							break;
						case PerioSurf.L:
							pd=ListPerioMeasure[i].Lvalue;
							break;
						case PerioSurf.DL:
							pd=ListPerioMeasure[i].DLvalue;
							break;
					}
				}
				if(ListPerioMeasure[i].SequenceType==PerioSequenceType.GingMargin) {
					switch(surf) {
						case PerioSurf.MB:
							//Examples: 0, -1(null), 5, or 105(hyperplasia).  But the null is not even being considered.  So adjusting 100+ vals to -x would work.
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].MBvalue);//Converts the above examples to 0, 0, 5, and -5.
							break;
						case PerioSurf.B:
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].Bvalue);
							break;
						case PerioSurf.DB:
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].DBvalue);
							break;
						case PerioSurf.ML:
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].MLvalue);
							break;
						case PerioSurf.L:
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].Lvalue);
							break;
						case PerioSurf.DL:
							gm=PerioMeasures.AdjustGMVal(ListPerioMeasure[i].DLvalue);
							break;
					}
				}
			}
			if(pd==0 || pd==-1) {
				return null;
			}
			if(pd >= RedLimitProbing) {
				color=ColorProbingRed;
			}
			//CAL shouldn't be less than 0, so we need to draw probing lines down to zero if CAL is negative for some reason. (Or maybe we just let this happen so that dentists know something is wrong.
			if(Tooth.IsMaxillary(intTooth)) {
				return new LineSimple(xshift,gm,0,xshift,gm+pd,0);
			}
			else {//mand
				return new LineSimple(xshift,-gm,0,xshift,-(gm+pd),0);
			}
		}
示例#4
0
		///<summary>For a given tooth and surface, gets a point at which to draw bleeding or suppuration droplet.  Use this on each site (3 per tooth face). The coordinates will be relative to the center of the tooth.  It will return 0,0 if no droplet to draw at this site.  If isBleeding is false, then it gets suppuration.</summary>
		public PointF GetBleedingOrSuppuration(int intTooth,PerioSurf surf,bool isBleeding) {
			if(!ListToothGraphics[intTooth.ToString()].Visible && !ListToothGraphics[intTooth.ToString()].IsImplant) {
				return new PointF(0,0);
			}
			float xshift=GetXShiftPerioSite(intTooth,surf);
			float yshift=-1.5f;//max
			if(!Tooth.IsMaxillary(intTooth)) {
				yshift=1.5f;
			}
			int siteVal=-1;
			for(int i=0;i<ListPerioMeasure.Count;i++) {
				if(ListPerioMeasure[i].IntTooth!=intTooth) {
					continue;
				}
				if(ListPerioMeasure[i].SequenceType!=PerioSequenceType.Bleeding) {
					continue;
				}
				switch(surf) {
					case PerioSurf.MB:
						siteVal=ListPerioMeasure[i].MBvalue;
						break;
					case PerioSurf.B:
						siteVal=ListPerioMeasure[i].Bvalue;
						break;
					case PerioSurf.DB:
						siteVal=ListPerioMeasure[i].DBvalue;
						break;
					case PerioSurf.ML:
						siteVal=ListPerioMeasure[i].MLvalue;
						break;
					case PerioSurf.L:
						siteVal=ListPerioMeasure[i].Lvalue;
						break;
					case PerioSurf.DL:
						siteVal=ListPerioMeasure[i].DLvalue;
						break;
				}
				break;				
			}
			if(siteVal==-1 || siteVal==0) {
				return new PointF(0,0);
			}
			if(isBleeding) {
				if(((BleedingFlags)siteVal & BleedingFlags.Blood) == BleedingFlags.Blood) {
					return new PointF(xshift-.3f,yshift);//shift bleeding points slightly to left.
				}
				else {
					return new PointF(0,0);
				}
			}
			else {//suppuration
				if(((BleedingFlags)siteVal & BleedingFlags.Suppuration) == BleedingFlags.Suppuration) {
					return new PointF(xshift+.3f,yshift);//shift suppuration points slightly to right.
				}
				else {
					return new PointF(0,0);
				}
			}
		}
示例#5
0
		///<summary>Use this to test a site (there are 3 sites per tooth face).  If it returns 0, do not draw a furctation.  If it returns a number 1-3, then use GetFurcationPos to know where to put the triangle or V.</summary>
		public int GetFurcationValue(int intTooth,PerioSurf surf){
			for(int i=0;i<ListPerioMeasure.Count;i++){
				if(ListPerioMeasure[i].IntTooth!=intTooth) {
					continue;
				}
				if(ListPerioMeasure[i].SequenceType!=PerioSequenceType.Furcation){
					continue;
				}
				int meas=0;
				if(surf==PerioSurf.MB) {
					meas=ListPerioMeasure[i].MBvalue;
				}
				if(surf==PerioSurf.B) {
					meas=ListPerioMeasure[i].Bvalue;
				}
				if(surf==PerioSurf.DB) {
					meas=ListPerioMeasure[i].DBvalue;
				}
				if(surf==PerioSurf.ML) {
					meas=ListPerioMeasure[i].MLvalue;
				}
				if(surf==PerioSurf.L) {
					meas=ListPerioMeasure[i].Lvalue;
				}
				if(surf==PerioSurf.DL) {
					meas=ListPerioMeasure[i].DLvalue;
				}
				if(meas==-1) {
					return 0;
				}
				return meas;
			}
			return 0;
		}
示例#6
0
		private void DrawProbingBar(int intTooth,PerioSurf perioSurf){
			const float barWidthMM=0.6f;
			Color colorBar;
			LineSimple barPoints=TcData.GetProbingLine(intTooth,perioSurf,out colorBar);
			if(barPoints==null){
				return;
			}
			CustomVertex.PositionColored[] quadVerts=new CustomVertex.PositionColored[] {
			    new CustomVertex.PositionColored(barPoints.Vertices[0].X-barWidthMM/2f,barPoints.Vertices[0].Y,0,colorBar.ToArgb()),
			    new CustomVertex.PositionColored(barPoints.Vertices[0].X-barWidthMM/2f,barPoints.Vertices[1].Y,0,colorBar.ToArgb()),
			    new CustomVertex.PositionColored(barPoints.Vertices[0].X+barWidthMM/2f,barPoints.Vertices[1].Y,0,colorBar.ToArgb()),
			    new CustomVertex.PositionColored(barPoints.Vertices[0].X+barWidthMM/2f,barPoints.Vertices[0].Y,0,colorBar.ToArgb()),
			  };
			VertexBuffer vb=new VertexBuffer(typeof(CustomVertex.PositionColored),
				CustomVertex.PositionColored.StrideSize*quadVerts.Length,
			  device,Usage.WriteOnly,CustomVertex.PositionColored.Format,Pool.Managed);
			vb.SetData(quadVerts,0,LockFlags.None);
			int[] indicies=new int[] { 0,1,2,0,2,3 };
			IndexBuffer ib=new IndexBuffer(typeof(int),indicies.Length,device,Usage.None,Pool.Managed);
			ib.SetData(indicies,0,LockFlags.None);
			device.VertexFormat=CustomVertex.PositionColored.Format;
			device.SetStreamSource(0,vb,0);
			device.Indices=ib;
			device.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,quadVerts.Length,0,indicies.Length/3);
			ib.Dispose();
			vb.Dispose();
		}
示例#7
0
		private void DrawFurcationTriangle(int intTooth,PerioSurf perioSurf,bool maxillary,Matrix toothLineMat){
			int furcationValue=TcData.GetFurcationValue(intTooth,perioSurf);
			if(furcationValue<1 || furcationValue>3) {
				return;
			}
			PointF sitePos=TcData.GetFurcationPos(intTooth,perioSurf);
			DrawFurcationTriangle(sitePos.X,sitePos.Y,maxillary,toothLineMat,furcationValue);
		}
示例#8
0
		private void DrawDroplet(int intTooth,PerioSurf surf,bool isBleeding,bool maxillary) {
			PointF dropletPos=TcData.GetBleedingOrSuppuration(intTooth,surf,isBleeding);
			if(dropletPos.X==0 && dropletPos.Y==0){
				return;//No droplet to draw at this site.
			}
			Matrix saveWorldMat=device.Transform.World;
			device.Transform.World=Matrix.Translation(dropletPos.X,dropletPos.Y,0)*device.Transform.World;
			if(!maxillary){
				//When the droplet is for a mandibular tooth, flip the droplet about the x-axis (negate y values).
				device.Transform.World=Matrix.Scaling(1f,-1f,1f)*device.Transform.World;
			}
			Color dropletColor=TcData.ColorSuppuration;
			if(isBleeding){
				dropletColor=TcData.ColorBleeding;
			}
			DrawDroplet(0,0,dropletColor);
			device.Transform.World=saveWorldMat;
		}
示例#9
0
 ///<summary>Draws the short vertical lines that represent probing depths.  Use this on each site (3 per tooth face).  The z component will be 0.  The coordinates will be relative to the center of the tooth.  The line will always only have one segment.  It will return null if no line to draw at this site.  The color of the line will be pulled from a different method.</summary>
 public LineSimple GetProbingLine(int intTooth,PerioSurf surf,out Color color)
 {
     color=ColorProbing;
     if(!ListToothGraphics[intTooth.ToString()].Visible && !ListToothGraphics[intTooth.ToString()].IsImplant) {
         return null;
     }
     float xshift=GetXShiftPerioSite(intTooth,surf);
     int gm=0;
     int pd=0;//line length
     for(int i=0;i<ListPerioMeasure.Count;i++) {
         if(ListPerioMeasure[i].IntTooth!=intTooth) {
             continue;
         }
         if(ListPerioMeasure[i].SequenceType==PerioSequenceType.Probing) {
             switch(surf) {
                 case PerioSurf.MB:
                     pd=ListPerioMeasure[i].MBvalue;
                     break;
                 case PerioSurf.B:
                     pd=ListPerioMeasure[i].Bvalue;
                     break;
                 case PerioSurf.DB:
                     pd=ListPerioMeasure[i].DBvalue;
                     break;
                 case PerioSurf.ML:
                     pd=ListPerioMeasure[i].MLvalue;
                     break;
                 case PerioSurf.L:
                     pd=ListPerioMeasure[i].Lvalue;
                     break;
                 case PerioSurf.DL:
                     pd=ListPerioMeasure[i].DLvalue;
                     break;
             }
         }
         if(ListPerioMeasure[i].SequenceType==PerioSequenceType.GingMargin) {
             switch(surf) {
                 case PerioSurf.MB:
                     gm=ListPerioMeasure[i].MBvalue;
                     break;
                 case PerioSurf.B:
                     gm=ListPerioMeasure[i].Bvalue;
                     break;
                 case PerioSurf.DB:
                     gm=ListPerioMeasure[i].DBvalue;
                     break;
                 case PerioSurf.ML:
                     gm=ListPerioMeasure[i].MLvalue;
                     break;
                 case PerioSurf.L:
                     gm=ListPerioMeasure[i].Lvalue;
                     break;
                 case PerioSurf.DL:
                     gm=ListPerioMeasure[i].DLvalue;
                     break;
             }
         }
     }
     if(gm==-1) {
         gm=0;
     }
     if(pd==0 || pd==-1) {
         return null;
     }
     if(pd >= RedLimitProbing) {
         color=ColorProbingRed;
     }
     if(Tooth.IsMaxillary(intTooth)) {
         return new LineSimple(xshift,gm,0,xshift,gm+pd,0);
     }
     else {//mand
         return new LineSimple(xshift,-gm,0,xshift,-(gm+pd),0);
     }
 }
示例#10
0
		///<summary>Used in LoadData.</summary>
		private Point GetCell(int examIndex,PerioSequenceType seqType,int intTooth,PerioSurf surf){
			int col=0;
			int row=0;
			if(intTooth<=16){
				col=(intTooth*3)-2;//left-most column
				if(surf==PerioSurf.B || surf==PerioSurf.L){
					col++;
				}
				if(intTooth<=8){
					if(surf==PerioSurf.MB || surf==PerioSurf.ML)
						col+=2;
				}
				else{//9-16
					if(surf==PerioSurf.DB || surf==PerioSurf.DL)
						col+=2;
				}
			}
			else{//17-32
				col=((33-intTooth)*3)-2;//left-most column
				if(surf==PerioSurf.B || surf==PerioSurf.L){
					col++;
				}
				if(intTooth>=25){
					if(surf==PerioSurf.MB || surf==PerioSurf.ML)
						col+=2;
				}
				else{//17-24
					if(surf==PerioSurf.DB || surf==PerioSurf.DL)
						col+=2;
				}
			}
			int section;
			if(intTooth<=16){
				if(surf==PerioSurf.MB || surf==PerioSurf.B || surf==PerioSurf.DB){
					section=0;
				}
				else{//Lingual
					section=1;
				}
			}
			else{//17-32
				if(surf==PerioSurf.MB || surf==PerioSurf.B || surf==PerioSurf.DB){
					section=3;
				}
				else{//Lingual
					section=2;
				}
			}
			row=GetTableRow(examIndex,section,seqType);
			return new Point(col,row);
		}
示例#11
0
		///<summary>Used in SaveCurExam to retrieve data from grid to save it.</summary>
		private int GetCellBleedValue(int examIndex,int intTooth,PerioSurf surf){
			Point curCell=GetCell(examIndex,PerioSequenceType.Probing,intTooth,surf);
			if(curCell.X==-1 || curCell.Y==-1){
				return 0;
			}
			return (int)DataArray[curCell.X,curCell.Y].Bleeding;
		}
示例#12
0
		///<summary>Used in SaveCurExam to retrieve data from grid to save it.</summary>
		private int GetCellValue(int examIndex,PerioSequenceType seqType,int intTooth,PerioSurf surf){
			Point curCell=GetCell(examIndex,seqType,intTooth,surf);
			if(curCell.X==-1 || curCell.Y==-1){
				return -1;
			}
			//if(intTooth==4)
			//MessageBox.Show(DataArray[curCell.X,curCell.Y].Text);
			if(DataArray[curCell.X,curCell.Y].Text==null || DataArray[curCell.X,curCell.Y].Text==""){
				//MessageBox.Show("empty");
				return -1;
			}
			//MessageBox.Show("full");
			return PIn.Int(DataArray[curCell.X,curCell.Y].Text);
		}