public ProfileEditorViewModel(RawProfile profile, EditStageTreeViewItem workViewModel, AxisSystem axisSystem) : base("Input Profile", workViewModel) { _rawProfile = profile; CurrentAxisSystem = axisSystem; DictionaryKey = CreateKeyboardShortcuts(CurrentAxisSystem); MoveListViewModels = new ObservableCollection <RawItemViewModel>(); var moveList = profile.GetMoveList(); foreach (var rawEntity2D in moveList) { //MoveListViewModels.Add(RawItemViewModel.GetViewModel(rawEntity2D, axisSystem)); MoveListViewModels.Add(GetViewModel(rawEntity2D)); } SelectedMoveViewModel = MoveListViewModels.LastOrDefault(); UpdatePreview(); UpdateMoveListOrientation(); }
/// <summary> /// Positions and orients the camera so that the given sphere fills the view</summary> /// <param name="sphere">Sphere to zoom to, in world space</param> public void ZoomOnSphere(Sphere3F sphere) { float d = sphere.Radius; if (d == 0) { d = 1; } // avoid getting too far away or too close if (d > FarZ) { d = FarZ; } else if (d < NearZ) { d = NearZ; } m_focusRadius = d; // The eye and the look-at-point are in what might be called the "world view" system. // So, the world coordinate of the sphere center needs to be xformed by AxisSystem. Vec3F lookAt; Vec3F up; GetViewVectors(out lookAt, out up); Vec3F lookAtPoint; AxisSystem.Transform(sphere.Center, out lookAtPoint); Vec3F eye = lookAtPoint - lookAt * d; Set(eye, lookAtPoint, up); // Adjust near plane if we're in perspective mode. Otherwise, we should leave it alone // because orthographic modes might need a large negative near-Z. if (ViewType == ViewTypes.Perspective) { float nearZ = Math.Abs(sphere.Radius) * 0.1f; nearZ = Math.Max(nearZ, 0.001f); PerspectiveNearZ = nearZ; } }
private static Dictionary <Key, Key> CreateKeyboardShortcuts(AxisSystem axisSystem) { switch (axisSystem) { case AxisSystem.Xz: { var d = new Dictionary <Key, Key>(); /* * * sistema diametro - z * */ d.Add(Key.Z, Key.X); d.Add(Key.X, Key.Y); d.Add(Key.U, Key.V); d.Add(Key.W, Key.U); return(d); } break; default: case AxisSystem.Xy: { return(new Dictionary <Key, Key>()); } } }