private ToothType GetAllPointsUpper() { int idx_up = Idx_Templates(UpperToothList); if (idx_up > 0) { SmileDesign_Page currentPage = (System.Windows.Application.Current.MainWindow.Content) as SmileDesign_Page; ToothType uppertooth = currentPage.ToothControl.UpperTooth[idx_up - 1]; ToothType sizechaged = new ToothType(); Point minPoint = Numerics.GetMinXY_Tooth(uppertooth); Point maxPoint = Numerics.GetMaxXY_Tooth(uppertooth); double nosewidth = ((LineGeometry)(currentPage.noseline_R.Data)).StartPoint.X - ((LineGeometry)(currentPage.noseline_L.Data)).StartPoint.X; ratiox = nosewidth / (maxPoint.X - minPoint.X); foreach (var temp in uppertooth) { TeethType changed = new TeethType(); foreach (var teethtemp in (TeethType)temp) { PointViewModel pt = teethtemp; pt.X *= ratiox; pt.Y *= ratiox; changed.Add(pt); } sizechaged.Add(changed); } return(sizechaged); } //return ((SmileDesign_Page)(Application.Current.MainWindow).Content).ToothControl.UpperTooth[idx_up - 1]; return(null); }
public MainWindow() { InitializeComponent(); DataContext = new MainViewModel(); // Set data for UpperTooth. UpperTooth = new ToothList(); UpperGuide = new Point(450, 100); for (int k = 0; k < 5; k++) { ToothType template = new ToothType(); for (int i = 0; i < 6; i++) { TeethType teeth = new TeethType(); for (int j = 0; j < 10; j++) { if (i >= 0 && i < 3) { teeth.Add(new PointViewModel(UpperX[k, i, j] + UpperGuide.X, UpperY[k, i, j] + UpperGuide.Y, j)); } else { teeth.Add(new PointViewModel(-1 * UpperX[k, i - 3, j] + UpperGuide.X, UpperY[k, i - 3, j] + UpperGuide.Y, j)); } } template.Add(teeth); } UpperTooth.Add(template); } // Set data for LowerTooth. LowerTooth = new ToothList(); LowerGuide = new Point(450, 300); for (int k = 0; k < 5; k++) { ToothType tooth = new ToothType(); for (int i = 0; i < 4; i++) { TeethType teeth = new TeethType(); for (int j = 0; j < 10; j++) { if (i >= 0 && i < 2) { teeth.Add(new PointViewModel(LowerX[k, i, j] + LowerGuide.X, LowerY[k, i, j] + LowerGuide.Y, j)); } else { teeth.Add(new PointViewModel(-1 * LowerX[k, i - 2, j] + LowerGuide.X, LowerY[k, i - 2, j] + LowerGuide.Y, j)); } } tooth.Add(teeth); } LowerTooth.Add(tooth); } // Set global dictionary. dic = new Dictionary <string, int>(); dic.Add("CanineL", 5); dic.Add("LateralIncisorL", 4); dic.Add("CentralIncisorL", 3); dic.Add("CentralIncisorR", 0); dic.Add("LateralIncisorR", 1); dic.Add("CanineR", 2); }