Esempio n. 1
0
        public static CustomAttributeEditorTeeth CreateCustomAttributEditorTeeth(Teeth model)
        {
            var teeth = new CustomAttributeEditorTeeth();

            teeth.Type = "Teeth";
            //TODO: assign the model data to the editor
            teeth.Id = model.Id;

            String tn = model.Id;
            Match  mt = Regex.Match(tn, @"teeth\d\d");

            if (mt.Value == "")
            {
                mt = Regex.Match(tn, @"teeth\d"); tn = mt.Value.Substring("teeth".Length, 1);
            }
            else
            {
                tn = mt.Value.Substring("teeth".Length, 2);
            }
            //tn = tn.Substring("teeth".Length, 2);
            int itn = 0;

            int.TryParse(tn, out itn);
            teeth.TeethNumber = itn;

            teeth.Length = model.Length;

            return(teeth);
        }
Esempio n. 2
0
        public TeethVisual3D(Color color, GumVisual3D p)
        {
            if (p != null)
            {
                this.parent = p;
                gc          = this.parent.gc;
                tc          = this.parent.tc;
                bc          = this.parent.bc;
                wc          = this.parent.wc;

                Id = p.Id + "_teeth" + tc.Children.Count.ToString("00") + "." + p.Parent.patient.Id;

                if (model == null)
                {
                    model = new Teeth();
                }
                model.Id     = Id;
                model.Length = 0.0;

                sample(color);

                //addTeethRoot();
                //showHideBoundingBox();
            }
        }
Esempio n. 3
0
        public TeethRootVisual3D(Color color, TeethVisual3D p)
        {
            if (p != null)
            {
                this.parent = p;
                gc          = this.parent.gc;
                tc          = this.parent.tc;
                bc          = this.parent.bc;
                wc          = this.parent.wc;

                Id = p.Id + "_rootth" + tc.Children.Count.ToString("00") + "." + p.Parent.Parent.patient.Id;

                if (model == null)
                {
                    model = new Teeth();
                }
                model.Id     = Id;
                model.Length = 0.0;

                sample(color);

                //Adding Teeth Label
                //TextVisual3D text = new TextVisual3D();
                //text.Text = Id.ToString();
                //this.Children.Add(text);

                //showHideBoundingBox();
            }
        }
Esempio n. 4
0
    public void ImportFinal(GameObject f_obj)
    {
        // Exit the app if final directory does not exist.
        teeth      = GameObject.Find("/Teeth").GetComponent <Teeth>();
        controller = GameObject.Find("/Controller").GetComponent <Controller>();
        if (!Directory.Exists(controller.final_dir_path))
        {
            Debug.Log("No such directory: " + controller.final_dir_path);
            Controller.QuitApp();
        }

        Teeth f_teeth;

        f_teeth = f_obj.GetComponent <Teeth>();
        for (int i = 0; i < Teeth.TOOTH_NUM; i++)
        {
            string src_path = controller.final_dir_path + i.ToString() + ".stl";
            f_obj.GetComponent <Teeth>().obj[i] = new GameObject();
            if (!File.Exists(src_path))
            {
                continue;
            }

            f_obj.GetComponent <Teeth>().obj[i].AddComponent <MeshFilter>();
            f_teeth.obj[i].GetComponent <MeshFilter>().mesh = Parabox.STL.pb_Stl_Importer.Import(src_path)[0];
        }
    }
        private void AddTeeth(OdontogramVM o, Teeth teeth)
        {
            TeethVM teethVM = new TeethVM {
                Id_Teeth      = teeth.Id_Teeth,
                Id_Odontogram = teeth.Id_Odontogram,
                UpperCervical = teeth.UpperCervical,
                Vestibular    = teeth.Vestibular,
                Oclusal       = teeth.Oclusal,
                Palatino      = teeth.Palatino,
                Distal        = teeth.Distal,
                Mesial        = teeth.Mesial,
                LowerServical = teeth.LowerServical,
                General       = teeth.General
            };

            if (_UpperMap.ContainsKey(teeth.Id_Teeth))
            {
                o.upperTeeth[_UpperMap[teeth.Id_Teeth]] = teethVM;
            }
            if (_UpperTemporalMap.ContainsKey(teeth.Id_Teeth))
            {
                o.upperTemporalTeeth[_UpperTemporalMap[teeth.Id_Teeth]] = teethVM;
            }
            if (_LowerTemporalMap.ContainsKey(teeth.Id_Teeth))
            {
                o.lowerTemporalTeeth[_LowerTemporalMap[teeth.Id_Teeth]] = teethVM;
            }
            if (_LowerMap.ContainsKey(teeth.Id_Teeth))
            {
                o.lowerTeeth[_LowerMap[teeth.Id_Teeth]] = teethVM;
            }
        }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     teeth      = GameObject.Find("/Teeth").GetComponent <Teeth>();
     controller = GameObject.Find("/Controller").GetComponent <Controller>();
     text       = this.GetComponent <Text>();
     pre_pos    = Vector3.zero; pre_v1 = Vector3.zero; pre_v3 = Vector3.zero;
     t_id       = -1;
     axis       = (uint)Controller.AXIS.non;
 }
Esempio n. 7
0
        public static List <Point> TeethToList(Teeth teeth)
        {
            List <Point> list = new List <Point>();

            foreach (PointViewModel p in teeth.Points)
            {
                list.Add(new Point(p.X, p.Y));
            }
            return(list);
        }
Esempio n. 8
0
 protected override void OnBarUpdate()
 {
     if (CurrentBar < 8)
     {
         return;
     }
     Jaw.Set(SMMA(Median, 13)[8]);
     Teeth.Set(SMMA(Median, 8)[5]);
     Lips.Set(SMMA(Median, 5)[3]);
 }
Esempio n. 9
0
        public void Execute(TeethDto request)
        {
            _validator.ValidateAndThrow(request);

            var tooth = new Teeth
            {
                ToothNumber = request.ToothNumber
            };

            _context.Teeth.Add(tooth);
            _context.SaveChanges();
        }
Esempio n. 10
0
        private static ListBoxItem FindSymmetryPoint(FrameworkElement frameworkElement)
        {
            var dic = ((MainWindow)Application.Current.MainWindow).dic;

            PointViewModel dot = (PointViewModel)(((ListBoxItem)frameworkElement).Content);

            DependencyObject t = frameworkElement;

            while (true)
            {
                t = VisualTreeHelper.GetParent(t);
                if (t is Teeth)
                {
                    break;
                }
            }

            int idx_me  = dic[((Teeth)t).Name];
            int idx_you = idx_me + (idx_me >= 0 && idx_me < 3 ? +3 : -3);

            var   parent   = VisualTreeHelper.GetParent(t);
            Teeth sysTeeth = new Teeth();;

            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
            {
                if (VisualTreeHelper.GetChild(parent, i) is Teeth)
                {
                    sysTeeth = VisualTreeHelper.GetChild(parent, i) as Teeth;
                    var myKey = dic.FirstOrDefault(p => p.Value == idx_you).Key;
                    if (myKey == sysTeeth.Name)
                    {
                        break;
                    }
                }
            }

            ListBox lb = new ListBox();

            foreach (DependencyObject c in LogicalTreeHelper.GetChildren(sysTeeth))
            {
                foreach (var cc in LogicalTreeHelper.GetChildren(c))
                {
                    if (cc is ListBox)
                    {
                        lb = cc as ListBox;
                        break;
                    }
                }
            }

            return((ListBoxItem)(lb.ItemContainerGenerator.ContainerFromIndex(dot.S)));
        }
        private static ListBoxItem FindSymmetryPoint(FrameworkElement frameworkElement)
        {
            PointViewModel dot        = ((frameworkElement as ListBoxItem).Content) as PointViewModel;
            var            listcanvas = VisualTreeHelper.GetParent(frameworkElement as DependencyObject) as Canvas;
            var            listbox_me = VisualTreeHelper.GetParent(listcanvas) as ListBox;
            Teeth          me         = ViewUtils.FindParent(listbox_me, Type.GetType("Process_Page.ToothTemplate.Teeth")) as Teeth;

            var main    = ((SmileDesign_Page)(Application.Current.MainWindow.Content)) as SmileDesign_Page;
            int idx_me  = main.ToothControl.dic[me.Name];
            int idx_you = idx_me + (idx_me >= 0 && idx_me < 3 ? +3 : -3);

            var     parent      = me.Parent as Grid;
            var     myKey       = main.ToothControl.dic.FirstOrDefault(p => p.Value == idx_you).Key;
            Teeth   you         = parent.FindName(myKey) as Teeth;
            ListBox listBox_you = you.FindName("list") as ListBox;

            return((ListBoxItem)(listBox_you.ItemContainerGenerator.ContainerFromIndex(dot.I)));
        }
Esempio n. 12
0
        public static List <Point> TeethToList(Teeth teeth)
        {
            List <Point> list = new List <Point>();

            //Teeth th = teeth as Teeth;
            //if (teeth.GetType() == Type.GetType("MeditSmile2D.View.DrawTeeth"))
            //    th = (DrawTeeth)teeth;
            //else if (teeth.GetType() == Type.GetType("MeditSmile2D.View.WrapTeeth"))
            //    th = teeth as WrapTeeth;
            //else if (teeth.GetType() == Type.GetType("MeditSmile2D.View.RotateTeeth"))
            //    th = teeth as RotateTeeth;

            foreach (PointViewModel p in teeth.Points)
            {
                list.Add(new Point(p.X, p.Y));
            }
            return(list);
        }
Esempio n. 13
0
        public static Point GetMinPointTeeth(Teeth t)
        {
            double minX = double.MaxValue;
            double minY = double.MaxValue;

            foreach (PointViewModel point in t.Points)
            {
                if (point.X < minX)
                {
                    minX = point.X;
                }
                if (point.Y < minY)
                {
                    minY = point.Y;
                }
            }
            return(new Point(minX, minY));
        }
Esempio n. 14
0
        public static Point GetMaxPointTeeth(Teeth t)
        {
            double maxX = double.MinValue;
            double maxY = double.MinValue;

            foreach (PointViewModel point in t.Points)
            {
                if (point.X > maxX)
                {
                    maxX = point.X;
                }
                if (point.Y > maxY)
                {
                    maxY = point.Y;
                }
            }
            return(new Point(maxX, maxY));
        }
Esempio n. 15
0
 // Start is called before the first frame update
 void Start()
 {
     src_dir_path   = Application.dataPath + src_dir_path;
     final_dir_path = Application.dataPath + final_dir_path;
     teeth          = GameObject.Find("/Teeth").GetComponent <Teeth>();
     // Import teeth.
     import.ImportInit();
     // Transform teeth to correct position.
     tooth_transform.Init();
     if (SteamVR.active)
     {
         tooth_transform.SetCorrectPosition();
     }
     // Initivlize decoded pre position, position and rotation.
     decode_pos = new Vector3[Teeth.TOOTH_NUM];
     decode_rot = new Vector3[Teeth.TOOTH_NUM];
     // Initialize debug classes.
     bound_box.Init();
     debug_vec.Init();
 }
Esempio n. 16
0
    // Update is called once per frame
    void Update()
    {
        //Jane Powers
        if (Currentpower == 0)
        {
            Destroy(GameObject.Find("Shield(Clone)"));
        }
        if (character == 1 && Input.GetMouseButton(0) && Currentpower > 0)
        {
            Currentpower  -= 1.0f;
            powerbar.value = PowerBar();
            if (createshield == false)
            {
                GameObject BeamClone = Instantiate(shield, new Vector3(Player.transform.position.x, Player.transform.position.y + 0.5f, Player.transform.position.z), Quaternion.Euler(0, 0, 0)) as GameObject;
                BeamClone.transform.parent = GameObject.Find("Walk+Shoot1").transform;
                createshield = true;
            }
            if (GameObject.Find("Shield(Clone)").transform.localScale.z < 4)
            {
                GameObject.Find("Shield(Clone)").transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
            }
        }
        else if (!Input.GetMouseButton(0))
        {
            Destroy(GameObject.Find("Shield(Clone)"));
            createshield = false;
        }

        //Chilly Powers
        if (Currentpower == 0)
        {
            Destroy(GameObject.Find("Frost(Clone)"));
        }
        if (character == 2 && Input.GetMouseButton(0))
        {
            Currentpower  -= 0.5f;
            powerbar.value = PowerBar();
            // anim.SetFloat("Speed")
            if (createice == false)
            {
                Vector3    playerPos       = Player.transform.position;
                Vector3    playerDirection = Player.transform.forward;
                Quaternion playerRotation  = Player.transform.rotation;
                float      spawnDistance   = 2;
                Vector3    spawnPos        = playerPos + playerDirection * spawnDistance;

                ParticleSystem FrostClone = Instantiate(ice, new Vector3(spawnPos.x, spawnPos.y + 1f, spawnPos.z), playerRotation) as ParticleSystem;
                FrostClone.transform.Rotate(playerRotation.x, playerRotation.y, playerRotation.z);
                //FrostClone.transform.Translate(Player.transform.position.x, Player.transform.position.y, Player.transform.position.z);
                FrostClone.transform.parent = GameObject.Find("Walk+Shoot1").transform;
                createice = true;
            }
        }
        else if (!Input.GetMouseButton(0))
        {
            Destroy(GameObject.Find("Frost(Clone)"));
            createice = false;
        }

        //Speedy Powers
        if (character == 3 && Input.GetKey(KeyCode.LeftShift))
        {
            Currentpower  -= 0.5f;
            powerbar.value = PowerBar();
            if (Currentpower > 0)
            {
                Player.GetComponent <Movement>().runSpeed = 20.0f;

                if (cam.fieldOfView < 80)
                {
                    cam.fieldOfView += 0.2f;
                }
            }
            if (Currentpower == 0)
            {
                Player.GetComponent <Movement>().runSpeed = 7.5f;
                if (cam.fieldOfView > 60)
                {
                    cam.fieldOfView -= 0.2f;
                }
            }
        }
        else
        {
            Player.GetComponent <Movement>().runSpeed = 7.5f;
            if (cam.fieldOfView > 60)
            {
                cam.fieldOfView -= 0.2f;
            }
        }

        //Shifty Powers
        if (character == 4 && Input.GetMouseButton(0) && Currentpower > 0)
        {
            Currentpower  -= 0.35f;
            powerbar.value = PowerBar();
            Base.GetComponent <Renderer>().enabled   = false;
            Braid.GetComponent <Renderer>().enabled  = false;
            Brow.GetComponent <Renderer>().enabled   = false;
            Lash.GetComponent <Renderer>().enabled   = false;
            High.GetComponent <Renderer>().enabled   = false;
            Teeth.GetComponent <Renderer>().enabled  = false;
            Tounge.GetComponent <Renderer>().enabled = false;
            invis = true;
        }
        else
        {
            Base.GetComponent <Renderer>().enabled   = true;
            Braid.GetComponent <Renderer>().enabled  = true;
            Brow.GetComponent <Renderer>().enabled   = true;
            Lash.GetComponent <Renderer>().enabled   = true;
            High.GetComponent <Renderer>().enabled   = true;
            Teeth.GetComponent <Renderer>().enabled  = true;
            Tounge.GetComponent <Renderer>().enabled = true;
            invis = false;
        }
        if (!Input.GetMouseButton(0))
        {
            Currentpower  += 0.25f;
            powerbar.value = PowerBar();
        }

        if (Currentpower < 0)
        {
            Currentpower = 0;
        }
        if (Currentpower > 100)
        {
            Currentpower = 100;
        }
        //button colors
        if (character == 1)
        {
            c1.GetComponent <Image>().color = Color.red;
        }
        else
        {
            c1.GetComponent <Image>().color = Color.white;
        }
        if (character == 2)
        {
            c2.GetComponent <Image>().color = Color.red;
        }
        else
        {
            c2.GetComponent <Image>().color = Color.white;
        }
        if (character == 3)
        {
            c3.GetComponent <Image>().color = Color.red;
        }
        else
        {
            c3.GetComponent <Image>().color = Color.white;
        }
        if (character == 4)
        {
            c4.GetComponent <Image>().color = Color.red;
        }
        else
        {
            c4.GetComponent <Image>().color = Color.white;
        }
    }
Esempio n. 17
0
 public void Init()
 {
     teeth = GameObject.Find("/Teeth").GetComponent <Teeth>();
 }
Esempio n. 18
0
        public void AcceptServiceTemplate()
        {
            if (ServiceTemplate != null)
            {
                string teethText         = null;
                string milkbyteTeethText = null;

                if (Teeth != Enums.Teeth.None)
                {
                    List <string> list = new List <string>();
                    foreach (Teeth tooth in Enum.GetValues(typeof(Teeth)))
                    {
                        if (tooth == Enums.Teeth.None)
                        {
                            continue;
                        }
                        if (Teeth.HasFlag(tooth))
                        {
                            list.Add(CaptionHelper.GetDisplayText(tooth));
                        }
                    }

                    teethText = string.Join(", ", list);
                }
                if (MilkByteTeeth != Enums.MilkByteTeeth.None)
                {
                    List <string> list = new List <string>();
                    foreach (MilkByteTeeth tooth in Enum.GetValues(typeof(MilkByteTeeth)))
                    {
                        if (tooth == Enums.MilkByteTeeth.None)
                        {
                            continue;
                        }
                        if (MilkByteTeeth.HasFlag(tooth))
                        {
                            list.Add(CaptionHelper.GetDisplayText(tooth));
                        }
                    }

                    milkbyteTeethText = string.Join(", ", list);
                }

                string replacement = !string.IsNullOrEmpty(teethText) && !string.IsNullOrEmpty(milkbyteTeethText) ?
                                     string.Concat(teethText, ", ", milkbyteTeethText) :
                                     string.Concat(teethText, milkbyteTeethText);

                CommonProtocol.Anamnez         = (serviceTemplate.Anamnez ?? string.Empty).Replace("{replacement}", replacement);
                CommonProtocol.Complain        = (serviceTemplate.Complain ?? string.Empty).Replace("{replacement}", replacement);
                CommonProtocol.ObjectiveStatus = (serviceTemplate.ObjectiveStatus ?? string.Empty).Replace("{replacement}", replacement);
                CommonProtocol.Recommendation  = (serviceTemplate.Recommendations ?? string.Empty).Replace("{replacement}", replacement);
                Usluga = serviceTemplate.Service;
                Diagnoses.Add(new MKBWithType(Session)
                {
                    Diagnose = serviceTemplate.Diagnose
                });

                OnChanged("CommonProtocol");
                OnChanged("Usluga");
                OnChanged("Diagnoses");

                CommonProtocol.Save();
            }
        }
Esempio n. 19
0
 public void Init()
 {
     teeth      = GameObject.Find("/Teeth").GetComponent <Teeth>();
     controller = GameObject.Find("/Controller").GetComponent <Controller>();
     pre_center = Vector3.zero; pre_v1 = Vector3.zero; pre_v3 = Vector3.zero;
 }
Esempio n. 20
0
    public void ImportInit()
    {
        teeth      = GameObject.Find("/Teeth").GetComponent <Teeth>();
        controller = GameObject.Find("/Controller").GetComponent <Controller>();

        // Exit the app if source directory does not exist.
        if (!Directory.Exists(controller.src_dir_path))
        {
            Debug.Log("No such directory: " + controller.src_dir_path);
            Controller.QuitApp();
        }

        // Import all stl models which are under data/separated/initial.
        int[] down_root_id = new int[2];    // These two teeth define the lingual position.
        down_root_id[0] = -1;
        for (int i = 0; i < Teeth.TOOTH_NUM; i++)
        {
            string   src_path = controller.src_dir_path + i.ToString() + ".stl";
            Mesh     mesh;
            Material material;

            if (!File.Exists(src_path))
            {
                continue;
            }

            // Update down_root_id.
            if (i >= 16)
            {
                if (down_root_id[0] == -1)
                {
                    down_root_id[0] = i;
                }
                down_root_id[1] = i;
            }

            mesh     = Parabox.STL.pb_Stl_Importer.Import(src_path)[0];
            material = new Material(Shader.Find("VR_Final_Project/MyPhongShader"));

            teeth.obj[i].GetComponent <MeshFilter>().mesh       = mesh;
            teeth.obj[i].GetComponent <MeshRenderer>().material = material;
        }

        // Set teeth parameters.
        teeth.param = new Tooth.ToothParam[Teeth.TOOTH_NUM];
        for (int i = 0; i < Teeth.TOOTH_NUM; i++)
        {
            teeth.param[i] = new Tooth.ToothParam(
                teeth.obj[i].GetComponent <MeshFilter>().mesh,
                new Vector3(),
                i
                );
        }
        // Set lingual's position and v2.
        Vector3 lingual_pos = (teeth.obj[down_root_id[0]].transform.TransformPoint(teeth.param[down_root_id[0]].GetCenter()) +
                               teeth.obj[down_root_id[1]].transform.TransformPoint(teeth.param[down_root_id[1]].GetCenter())) / 2.0f;

        for (int i = 0; i < Teeth.TOOTH_NUM; i++)
        {
            teeth.param[i].SetLingualPos(lingual_pos);
            teeth.param[i].SetPre();
            // Set mesh collider.
            teeth.obj[i].GetComponent <MeshCollider>().sharedMesh
                = teeth.obj[i].GetComponent <MeshFilter>().mesh;
        }

        // Set up, down, left and right.
        for (int i = 0; i < Teeth.TOOTH_NUM; i++)
        {
            Mesh mesh = teeth.obj[i].GetComponent <MeshFilter>().mesh;
            if (mesh.vertexCount == 0)
            {
                continue;
            }
            Vector3[]  vertices;
            Vector3    center          = teeth.param[i].GetCenter();
            Quaternion rotate_match_yz = Quaternion.FromToRotation(teeth.param[i].GetV1(), Vector3.up).normalized;
            rotate_match_yz = Quaternion.FromToRotation(rotate_match_yz * teeth.param[i].GetV3(), Vector3.forward).normalized *rotate_match_yz;

            vertices = mesh.vertices;
            for (int j = 0; j < mesh.vertexCount; j++)
            {
                // Move to origin and rotate to match yz axes.
                vertices[j] -= center;
                vertices[j]  = rotate_match_yz * vertices[j];

                // Update up, down, left, right.
                if (vertices[j].y > teeth.param[i].up)
                {
                    teeth.param[i].up = vertices[j].y;
                }
                else if (vertices[j].y < teeth.param[i].down)
                {
                    teeth.param[i].down = vertices[j].y;
                }
                if (vertices[j].z > teeth.param[i].right)
                {
                    teeth.param[i].right = vertices[j].z;
                }
                else if (vertices[j].z < teeth.param[i].left)
                {
                    teeth.param[i].left = vertices[j].z;
                }

                // Move back to initial position and rotate back to initial rotation.
                vertices[j]  = Quaternion.Inverse(rotate_match_yz) * vertices[j];
                vertices[j] += center;
            }
            teeth.obj[i].GetComponent <MeshFilter>().mesh.vertices = vertices;
        }
    }