private static void DistanceChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { VectorTranslateTransform3D v = (VectorTranslateTransform3D)d; v.update(); }
public void MakeView(Step st) { if (this.vp == null) { this.vp = new Viewport3D(); } else { this.vp.Children.Clear(); } if (this.bCloneTran) { this.tran = new StepViewTransform(st, false); } else { this.tran = StepViewTransform.GetViewTransformFor(st); } this.m3dgrp = SetupView(this.vp, this.tran); this.cs = st.Result; ModelVisual3D myModelVisual3D = new ModelVisual3D(); myModelVisual3D.Content = this.m3dgrp; this.vp.Children.Add(myModelVisual3D); if (this.bAnimate) { this.movers = new List <VectorTranslateTransform3D>(); } else { this.movers = null; } this.bunch = st.GetBunch(this.bAnimate); this.models = new List <PartialModel>(); List <Face> highlights; if (this.bShowHighlights) { highlights = st.GetHighlightedFacesForThisStep(); } else { highlights = null; } if (this.bunch.notmoving != null) { foreach (TriBag bag in this.bunch.notmoving) { MakeModels(bag, null, highlights); if (this.bShowLines) { MakeLineVisual(bag.lines, null); } if (this.bShowFaceLabels) { foreach (Face f in st.facesToBeLabeled) { if (bag.solid == f.solid) { CreateFaceLabel(this.vp, f, null); } } } } } if (this.bunch.moving != null) { TranslateTransform3D ttmove = new TranslateTransform3D(0, 0, 0); VectorTranslateTransform3D vtt = new VectorTranslateTransform3D(ttmove, this.bunch.vec, 0); this.movers.Add(vtt); foreach (TriBag bag in this.bunch.moving) { MakeModels(bag, ttmove, highlights); if (this.bShowLines) { MakeLineVisual(bag.lines, ttmove); } if (this.bShowFaceLabels) { foreach (Face f in st.facesToBeLabeled) { if (bag.solid == f.solid) { CreateFaceLabel(this.vp, f, ttmove); } } } } } if (this.bShowAnnotations) { CreateAnnotations(st.annotations_PP); } if (this.bShowAxes) { CreateAxes(); } foreach (PartialModel pm in this.models) { this.m3dgrp.Children.Add(pm.gm3d); } if ( (this.width > 0) && (this.height > 0) ) { this.vp.Width = this.width; this.vp.Height = this.height; this.vp.Measure(new Size(this.width, this.height)); this.vp.Arrange(new Rect(0, 0, this.width, this.height)); this.vp.UpdateLayout(); wpfmisc.FixLines(this.vp); if (this.bAutoZoom) { wpfmisc.AutoZoom(this.vp, this.tran); wpfmisc.FixLines(this.vp); } if (this.bStaticLines) { List <ScreenSpaceLines3D> remove = new List <ScreenSpaceLines3D>(); List <ModelVisual3D> add = new List <ModelVisual3D>(); foreach (ModelVisual3D mv3d in this.vp.Children) { if (mv3d is ScreenSpaceLines3D) { ScreenSpaceLines3D ss = mv3d as ScreenSpaceLines3D; ModelVisual3D plain = new ModelVisual3D(); plain.Content = ss.Content; add.Add(plain); remove.Add(ss); } } foreach (ModelVisual3D mv3d in add) { this.vp.Children.Add(mv3d); } foreach (ScreenSpaceLines3D ss in remove) { this.vp.Children.Remove(ss); } } } }