Example #1
0
        //==============using new architecture (container) =================
        public BraceVisual3D addNewBrace()
        {
            BraceVisual3D brace = null;
            GumVisual3D   gum   = this.parent;

            gum.braceDictionaries.TryGetValue(this.Id, out brace);
            //TODO: If multiple brace in one teeth?

            if (brace == null)
            {
                brace = new BraceVisual3D(Colors.Yellow, this, true);
                bc.Children.Add(brace);
                gum.braces.Add(brace);

                gum.braceDictionaries.Add(this.Id, brace);

                /*if (selectedPoint != null)
                 * {
                 *  Transform3DGroup transformGroup = new Transform3DGroup();
                 *  transformGroup.Children.Add(new TranslateTransform3D(ToWorld(selectedPoint.ToVector3D())));
                 *  brace.Transform = transformGroup;
                 * }*/
            }

            return(brace);
        }
Example #2
0
        /// <summary>
        /// @Deprecated
        /// Not used anymore since changes in CONTAINER design.
        /// <see cref="findTeeth"/>
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        internal TeethVisual3D selectTeeth(int p)
        {
            TeethVisual3D teeth = null;
            String        pStr  = p.ToString("00");

            foreach (var g in gums)
            {
                GumVisual3D gum = g.Value;
                if (gum != null)
                {
                    foreach (var t in gum.Children)
                    {
                        if (t is TeethVisual3D)
                        {
                            teeth = (TeethVisual3D)t;
                            //Console.WriteLine(teeth.Id);
                            if (Regex.IsMatch(teeth.Id, @"teeth" + pStr))
                            //if (teeth.Id.StartsWith("teeth" + pStr))
                            {
                                //teeth.showHideManipulator();
                                selectedGum       = gum;
                                gum.selectedTeeth = teeth;
                                break;
                            }
                        }
                    }
                }
            }
            return(teeth);
        }
Example #3
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();
            }
        }
Example #4
0
 protected static void TargetTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     //detect
     if (d is TeethVisual3D)
     {
         TeethVisual3D dt  = (TeethVisual3D)d;
         GumVisual3D   gum = dt.Parent;
         foreach (var t in gum.Children)
         {
             if (t is TeethVisual3D)
             {
                 TeethVisual3D teeth = (TeethVisual3D)t;
                 if (!teeth.Equals(d))
                 {
                     if (teeth.IsInside(dt))
                     {
                         Console.WriteLine(dt.Id + "TargetTransformChanged. TODO: detect collision detections" + teeth.Id);
                     }
                 }
             }
             else
             if (t is BraceVisual3D)
             {
             }
         }
     }
 }
Example #5
0
        //Add new GUM to GumContainer
        public GumVisual3D addNewGum(string id)
        {
            GumVisual3D gum = null;

            gum = new GumVisual3D(this, id);
            gums.Add(gum.Id, gum);
            selectedGum = gum;
            gc.Children.Add(gum);
            return(gum);
        }
Example #6
0
        private void Traverse <T>(Visual3D visual, Transform3D transform, Action <T, Transform3D> action)
            where T : Model3D
        {
            var childTransform = Transform3DHelper.CombineTransform(visual.Transform, transform);
            var model          = GetModel(visual);

            if (model != null)
            {
                if (jawVisual != null)
                {
                }
                else if (rawVisual != null)
                {
                }

                if (visual is TeethVisual3D)
                {
                    TeethVisual3D t = (TeethVisual3D)visual;
                    this.writer.WriteLine(string.Format("g jaw_{0}", t.Id));
                }
                else if (visual is GumVisual3D)
                {
                    GumVisual3D t = (GumVisual3D)visual;
                    this.writer.WriteLine(string.Format("g jaw_{0}", t.Id));
                }
                else if (visual is BraceVisual3D)
                {
                    BraceVisual3D t = (BraceVisual3D)visual;
                    this.writer.WriteLine(string.Format("g jaw_{0}", t.Id));
                }
                else if (visual is WireVisual3D)
                {
                }
                else
                {
                    this.writer.WriteLine(string.Format("g jaw_group{0}", this.groupNo++));
                }

                if (visual is Manipulator || visual is BoundingBoxWireFrameVisual3D)
                {
                }
                else
                {
                    TraverseModel(model, childTransform, action);
                }
            }

            foreach (var child in GetChildren(visual))
            {
                Traverse(child, childTransform, action);
            }
        }
Example #7
0
        internal void deleteBrace()
        {
            BraceVisual3D brace = null;
            GumVisual3D   gum   = this.parent;

            gum.braceDictionaries.TryGetValue(this.Id, out brace);
            //TODO: If multiple brace in one teeth?

            if (brace != null)
            {
                cleanManipulator();
                bc.Children.Remove(brace);
                gum.braces.Remove(brace);
                gum.braceDictionaries.Remove(this.Id);
                gum.Parent.removeWire(brace);
                brace = null;
            }
        }
Example #8
0
        //Using Container
        internal TeethVisual3D findTeeth(int p)
        {
            TeethVisual3D teeth = null;
            String        pStr  = p.ToString("00");

            foreach (var t in tc.Children)
            {
                if (t is TeethVisual3D)
                {
                    teeth = (TeethVisual3D)t;
                    if (Regex.IsMatch(teeth.Id, @"teeth" + pStr))
                    {
                        //teeth.showHideManipulator();
                        selectedGum = teeth.Parent;
                        selectedGum.selectedTeeth = teeth;
                        break;
                    }
                }
            }
            return(teeth);
        }
        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();
            }

        }
Example #10
0
 /// <summary>
 /// @Deprecated
 /// <see cref="updateTeethMap"/>
 /// </summary>
 /// <param name="oldid"></param>
 /// <param name="newid"></param>
 internal void updateTeethMapOld(string oldid, string newid)
 {
     //find the existing new id
     foreach (var g in gums)
     {
         GumVisual3D gum = g.Value;
         if (gum != null)
         {
             foreach (var t in gum.Children)
             {
                 if (t is TeethVisual3D)
                 {
                     TeethVisual3D teeth = (TeethVisual3D)t;
                     if (teeth.Id.Equals(newid))
                     {
                         teeth.Id = oldid;
                         selectedGum.selectedTeeth.Id = newid;
                         break;
                     }
                 }
             }
         }
     }
 }
Example #11
0
 public TeethVisual3D(GumVisual3D parent)
     : this(Colors.Pink, parent)
 {
 }
 internal void showHideManipulator(GumVisual3D gum)
 {
     //gum.clearManipulator();
     gum.cleanManipulator();
 }
 private TeethVisual3D getTeethVisualFromGum(String gs, GumVisual3D gum)
 {
     TeethVisual3D teeth = null;
     var dp = gs.Split('.');
     //foreach (var t in gum.Children)
     foreach (var t in gum.tc.Children)
     {
         TeethVisual3D tt = (TeethVisual3D)t;
         //if (tt.Id.StartsWith(dp[0]))
         if (Regex.IsMatch(tt.Id, @""+dp[0]))
         {
             teeth = tt;
             break;
         }
     }
     return teeth;
 }
Example #14
0
 public void hide(GumVisual3D t)
 {
     this.Children.Remove(t);
 }
 public void hide(GumVisual3D t)
 {
     this.Children.Remove(t);
 }
 public void show(GumVisual3D t)
 {
     this.Children.Add(t);
 }
 public TeethVisual3D(GumVisual3D parent)
     : this(Colors.Pink, parent)
 {
 }
Example #18
0
 //Add new GUM to GumContainer
 public GumVisual3D addNewGum(string id)
 {
     GumVisual3D gum = null;
     gum = new GumVisual3D(this,id);
     gums.Add(gum.Id, gum);
     selectedGum = gum;
     gc.Children.Add(gum);
     return gum;
 }
Example #19
0
 public void show(GumVisual3D t)
 {
     this.Children.Add(t);
 }
Example #20
0
 //Using Container
 internal TeethVisual3D findTeeth(int p)
 {
     TeethVisual3D teeth = null;
     String pStr = p.ToString("00");
     foreach (var t in tc.Children)
     {
         if (t is TeethVisual3D)
         {
             teeth = (TeethVisual3D)t;
             if (Regex.IsMatch(teeth.Id, @"teeth" + pStr))
             {
                 //teeth.showHideManipulator();
                 selectedGum = teeth.Parent;
                 selectedGum.selectedTeeth = teeth;
                 break;
             }
         }
     }
     return teeth;
 }
Example #21
0
 /// <summary>
 /// @Deprecated
 /// Not used anymore since changes in CONTAINER design.
 /// <see cref="findTeeth"/>
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 internal TeethVisual3D selectTeeth(int p)
 {
     TeethVisual3D teeth = null;
     String pStr = p.ToString("00");
     foreach (var g in gums)
     {
         GumVisual3D gum = g.Value;
         if (gum != null)
         {
             foreach (var t in gum.Children)
             {
                 if (t is TeethVisual3D)
                 {
                     teeth = (TeethVisual3D)t;
                     //Console.WriteLine(teeth.Id);
                     if(Regex.IsMatch(teeth.Id, @"teeth" + pStr))
                     //if (teeth.Id.StartsWith("teeth" + pStr))
                     {
                         //teeth.showHideManipulator();
                         selectedGum = gum;
                         gum.selectedTeeth = teeth;
                         break;
                     }
                 }
             }
         }
     }
     return teeth;
 }
Example #22
0
 internal void showHideManipulator(GumVisual3D gum)
 {
     //gum.clearManipulator();
     gum.cleanManipulator();
 }