public RawItemViewModel GetViewModel(RawEntity2D entity2D)
        {
            // todo , creare rispettivi viewModel
            if (entity2D is RawInitPoint2D)
            {
                var vm = new RawInitPointViewModel(entity2D as RawInitPoint2D, CurrentAxisSystem, this);
                vm.OnSourceUpdated += VmOnSourceUpdated;
                return(vm);
            }

            if (entity2D is RawLine2D)
            {
                var vm = new RawLineViewModel(entity2D as RawLine2D, CurrentAxisSystem, this);
                vm.OnSourceUpdated += VmOnSourceUpdated;
                return(vm);
            }

            if (entity2D is RawArc2D)
            {
                var vm = new RawArcViewModel(entity2D as RawArc2D, CurrentAxisSystem, this);
                vm.OnSourceUpdated += VmOnSourceUpdated;
                return(vm);
            }

            throw new NotImplementedException("ProfileEditorViewModel.GetViewModel");
        }
Beispiel #2
0
        static DummyProfileEditorViewModel()
        {
            MoveListViewModels = new List <RawEntity2D>();

            var profileSolver = new RawProfile(false);

            var ini = new RawInitPoint2D(profileSolver);

            ini.X.SetValue(true, 0);
            ini.Y.SetValue(true, 0);

            var line1 = new RawLine2D(profileSolver);

            line1.DeltaY.SetValue(true, 10);

            var line2 = new RawLine2D(profileSolver);

            line2.DeltaX.SetValue(true, -10);

            MoveListViewModels.Add(ini);
            MoveListViewModels.Add(line1);
            MoveListViewModels.Add(line2);

            SelectedMove = MoveListViewModels.LastOrDefault();

            // se cambio SelectedMove aggiorno currentMove
            CurrentMovement = new RawLineViewModel(line2, ProfileEditorViewModel.AxisSystem.Xy);


            //foreach (var rawEntity2D in MoveListViewModels)
            //    profileSolver.Add(rawEntity2D);

            //var profileSolved = profileSolver.GetProfileResult();

            //var listEntity = new List<IEntity2D>();

            //foreach (var entity2D in profileSolved.Source)
            //    listEntity.Add(entity2D);

            //Preview = new ObservableCollection<IEntity2D>(listEntity);
        }