Пример #1
0
        /// <summary>
        /// creates and adds a new bone to the currently selected item
        /// </summary>
        private void AddBone()
        {
            if (SelectedItem == null)
            {
                throw new InvalidOperationException("No bone selected!");
            }

            var model = new Bone(parent: SelectedItem.Model, offset: new Vector3D(1, 0, 0));
            var vm    = new BoneVM(model, parent: SelectedItem);

            SelectedItem.Children.Add(vm);
            SelectedItem.Model.Children.Add(model);
            BoneVMMap.Add(model, vm);
        }
Пример #2
0
        /// <summary>
        /// creates new kinematic instance
        /// </summary>
        /// <param name="model">the underlying model</param>
        /// <param name="sensors">collection of registered sensors.</param>
        public KinematicVM(KinematicStructure model)
        {
            Model = model;

            // create the bone ViewModel tree
            Roots[0] = new BoneVM(model.Root, null);

            foreach (BoneVM item in Root)
            {
                BoneVMMap.Add(item.Model, item);
            }

            // setup commands
            AddBoneCommand        = new RelayCommand(AddBone, CanAddBone);
            RemoveBoneCommand     = new RelayCommand(RemoveBone, CanRemoveBone);
            ChangeSelectedCommand = new RelayCommand <RoutedPropertyChangedEventArgs <object> >(ChangeSelected);
        }
        public SensorBoneLinkVM(SensorBoneLink model, SensorVM sensor, BoneVM bone)
        {
            this.Model  = model;
            this.Sensor = sensor;
            this.Bone   = bone;

            // setup visuals
            Visual = new ModelVisual3D();

            csysVisual        = new CSysVisual3D();
            csysVisual.XColor = csysVisual.XColor.ChangeSaturationValue(0.3, 0.7);
            csysVisual.YColor = csysVisual.YColor.ChangeSaturationValue(0.3, 0.7);
            csysVisual.ZColor = csysVisual.ZColor.ChangeSaturationValue(0.3, 0.7);
            Visual.Children.Add(csysVisual);

            //accelerationVisual = new LinesVisual3D();
            //accelerationVisual.Color = Colors.Purple;
            //accelerationVisual.Points.Add(new Point3D(0, 0, 0));
            //accelerationVisual.Points.Add(new Point3D(0, 0, 0));
            //Visual.Children.Add(accelerationVisual);
        }