Пример #1
0
        /// <summary>
        /// Move icon to position
        /// </summary>
        /// <param name="point"></param>
        public void MoveTo3D(Point point3d, Point point, int _positionOnPile)
        {
            if (State != StateEnum.Pile)
            {
                int speed = 250;
                PositionOnPile = _positionOnPile;
                LocationSave = Location;

                Location = new Point(point.X - ImageIcon.Width + (PositionOnPile*3),
                                     point.Y - ImageIcon.Height - (PositionOnPile*3));
                ImageIcon.Margin = new Thickness(Location.X, Location.Y, 0, 0);
                Label.Visibility = Visibility.Hidden;
                Label.Margin = new Thickness(Location.X - 20, Location.Y + ImageIcon.Height, 0, 0);
                State = StateEnum.Pile;

                newPosition = new Point3D(point3d.X, 0.5 + (5*_positionOnPile), point3d.Y);
                Vector3D computedPos = newPosition - location3d;

                //TranslateTransform3D trans = new TranslateTransform3D(computedPos);
                //_desktopGroundIcon.Transform = trans;

                Transform3DGroup transGroup = new Transform3DGroup();
                Transform3D transform = new TranslateTransform3D(computedPos);
                transGroup.Children.Add(transform);
                _desktopGroundIcon.Transform = transGroup;

                DoubleAnimation AnimationX = new DoubleAnimation();
                AnimationX.From = 0;
                AnimationX.To = computedPos.X;
                AnimationX.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
                transform.BeginAnimation(TranslateTransform3D.OffsetXProperty, AnimationX);

                DoubleAnimation AnimationY = new DoubleAnimation();
                AnimationY.From = 0;
                AnimationY.To = computedPos.Y;
                AnimationY.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
                transform.BeginAnimation(TranslateTransform3D.OffsetYProperty, AnimationY);

                DoubleAnimation AnimationZ = new DoubleAnimation();
                AnimationZ.From = 0;
                AnimationZ.To = computedPos.Z;
                AnimationZ.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
                transform.BeginAnimation(TranslateTransform3D.OffsetZProperty, AnimationZ);

                Timer timer = new Timer();
                timer.Interval = speed;
                timer.Tick += new EventHandler(timer_Tick);
                timer.Start();
            }
        }
Пример #2
0
        protected override void BeginTransition3D(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport)
        {
            Size size = transitionElement.RenderSize;

            Point3D origin = new Point3D(); // origin of 2nd face
            Vector3D u = new Vector3D(), v = new Vector3D(); // u & v vectors of 2nd face

            double angle = Angle;
            Point3D rotationCenter;
            Vector3D rotationAxis;
            RotateDirection direction = Direction;

            TranslateTransform3D translation = null;
            double angleRads = Angle * Math.PI / 180;
            if (direction == RotateDirection.Left || direction == RotateDirection.Right)
            {
                if (Contained)
                {
                    rotationCenter = new Point3D(direction == RotateDirection.Left ? size.Width : 0, 0, 0);
                    translation = new TranslateTransform3D();
                    DoubleAnimation x = new DoubleAnimation(direction == RotateDirection.Left ? -size.Width : size.Width, Duration);
                    translation.BeginAnimation(TranslateTransform3D.OffsetXProperty, x);
                }
                else
                {
                    rotationCenter = new Point3D(size.Width / 2, 0, size.Width / 2 * Math.Tan(angle / 2 * Math.PI / 180));
                }

                rotationAxis = new Vector3D(0, 1, 0);

                if (direction == RotateDirection.Left)
                {
                    u.X = -size.Width * Math.Cos(angleRads);
                    u.Z = size.Width * Math.Sin(angleRads);

                    origin.X = size.Width;
                }
                else
                {
                    u.X = -size.Width * Math.Cos(angleRads);
                    u.Z = -size.Width * Math.Sin(angleRads);

                    origin.X = -u.X;
                    origin.Z = -u.Z;
                }
                v.Y = size.Height;
            }
            else
            {
                if (Contained)
                {
                    rotationCenter = new Point3D(0, direction == RotateDirection.Up ? size.Height : 0, 0);
                    translation = new TranslateTransform3D();
                    DoubleAnimation y = new DoubleAnimation(direction == RotateDirection.Up ? -size.Height : size.Height, Duration);
                    translation.BeginAnimation(TranslateTransform3D.OffsetYProperty, y);
                }
                else
                {
                    rotationCenter = new Point3D(0, size.Height / 2, size.Height / 2 * Math.Tan(angle / 2 * Math.PI / 180));
                }

                rotationAxis = new Vector3D(1, 0, 0);

                if (direction == RotateDirection.Up)
                {
                    v.Y = -size.Height * Math.Cos(angleRads);
                    v.Z = size.Height * Math.Sin(angleRads);

                    origin.Y = size.Height;
                }
                else
                {
                    v.Y = -size.Height * Math.Cos(angleRads);
                    v.Z = -size.Height * Math.Sin(angleRads);

                    origin.Y = -v.Y;
                    origin.Z = -v.Z;
                }
                u.X = size.Width;
            }

            double endAngle = 180 - angle;
            if (direction == RotateDirection.Right || direction == RotateDirection.Up)
                endAngle = -endAngle;

            ModelVisual3D m1, m2;
            viewport.Children.Add(m1 = MakeSide(oldContent, new Point3D(), new Vector3D(size.Width, 0, 0), new Vector3D(0, size.Height, 0), endAngle, rotationCenter, rotationAxis, null));
            viewport.Children.Add(m2 = MakeSide(newContent, origin, u, v, endAngle, rotationCenter, rotationAxis, delegate
            {
                EndTransition(transitionElement, oldContent, newContent);
            }));

            m1.Transform = m2.Transform = translation;
        }
Пример #3
0
        public void ExplodeMoveTo3D()
        {
            int speed = 250;
            Vector3D computedPos = location3d - location3dSave;
            Location = LocationSave;

            Transform3DGroup transGroup = new Transform3DGroup();
            Transform3D transform = new TranslateTransform3D(computedPos);
            transGroup.Children.Add(transform);
            _desktopGroundIcon.Transform = transGroup;

            DoubleAnimation AnimationX = new DoubleAnimation();
            AnimationX.From = computedPos.X;
            AnimationX.To = 0;
            AnimationX.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
            transform.BeginAnimation(TranslateTransform3D.OffsetXProperty, AnimationX);

            DoubleAnimation AnimationY = new DoubleAnimation();
            AnimationY.From = computedPos.Y;
            AnimationY.To = 0;
            AnimationY.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
            transform.BeginAnimation(TranslateTransform3D.OffsetYProperty, AnimationY);

            DoubleAnimation AnimationZ = new DoubleAnimation();
            AnimationZ.From = computedPos.Z;
            AnimationZ.To = 0;
            AnimationZ.Duration = new Duration(TimeSpan.FromMilliseconds(speed));
            transform.BeginAnimation(TranslateTransform3D.OffsetZProperty, AnimationZ);

            Timer timer = new Timer();
            timer.Interval = speed;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();

            State = StateEnum.None;
            PileId = -1;
        }
Пример #4
0
        public void MoveIt(ServicePlatformElement source, ServiceInspectorStation destination, TimeSpan duration, int p)
        {
            duration = TimeSpan.FromSeconds(duration.TotalSeconds*GlobalTimeScale);

            LastActivity = "C->Ins";
            ServiceBoxElement box = source.ServiceBox;
            source.ServiceBox = null;
            source.Status = StationStatus.Empty;
            int qLen = destination.GetQueueLen;
            double srcX = box.Transformer.OffsetX;
            const double destenX = 16;
            double srcY = box.Transformer.OffsetY;

            double destenY = 0;

            if (p == 0)
            {
                destenY = 10 + (5*qLen);
                destination.PushBoxToQueue(box);
            }
            else if (p == 1)
            {
                destenY = 3;
                destination.Inspector1Box = box;
            }
            else if (p == 2)
            {
                destenY = -3;
                destination.Inspector2Box = box;
            }

            var daX = new DoubleAnimation {From = srcX, To = destenX, Duration = new Duration(duration)};
            var daY = new DoubleAnimation {From = srcY, To = destenY, Duration = new Duration(duration)};
            var newTransformer = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 2.1);
            box.Transform = newTransformer;
            box.Transformer = newTransformer;
            newTransformer.BeginAnimation(TranslateTransform3D.OffsetXProperty, daX);
            newTransformer.BeginAnimation(TranslateTransform3D.OffsetYProperty, daY);

            var robotTransform = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 0);
            World.Instance.MotherRobot.Transform = robotTransform;
            robotTransform.BeginAnimation(TranslateTransform3D.OffsetXProperty, daX);
            robotTransform.BeginAnimation(TranslateTransform3D.OffsetYProperty, daY);
        }
Пример #5
0
        public void MoveIt(ServicePlatformElement source, ServicePlatformElement destination, TimeSpan duration)
        {
            duration = TimeSpan.FromSeconds(duration.TotalSeconds*GlobalTimeScale);

            // Place Holder
            LastActivity = source + "->" + destination;

            ServiceBoxElement box = source.ServiceBox;
            source.ServiceBox = null;
            source.Status = StationStatus.Empty;

            destination.ServiceBox = box;

            double src = box.Transformer.OffsetX;
            double desten = 0;

            switch (destination.Name)
            {
                case "A":
                    //box.Transform = new TranslateTransform3D(-7.5, 0, 2.1);
                    desten = -7.5;
                    break;
                case "B":
                    //box.Transform = new TranslateTransform3D(0, 0, 2.1);
                    desten = 0;
                    break;
                case "C":
                    //box.Transform = new TranslateTransform3D(7.5, 0, 2.1);
                    desten = 7.5;
                    break;
            }

            var da = new DoubleAnimation {From = src, To = desten, Duration = new Duration(duration)};

            var newTransformer = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 2.1);
            box.Transform = newTransformer;
            box.Transformer = newTransformer;

            newTransformer.BeginAnimation(TranslateTransform3D.OffsetXProperty, da);

            var robotTransform = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 0);
            World.Instance.MotherRobot.Transform = robotTransform;
            robotTransform.BeginAnimation(TranslateTransform3D.OffsetXProperty, da);
        }
Пример #6
0
        Transform3DGroup GetModelTransforms(int index)
        {
            Transform3DGroup group = new Transform3DGroup();
            RotateTransform3D rotation = new RotateTransform3D();
            TranslateTransform3D tran = new TranslateTransform3D();

            tran.BeginAnimation(TranslateTransform3D.OffsetXProperty, null);
            tran.BeginAnimation(TranslateTransform3D.OffsetYProperty, null);
            tran.BeginAnimation(TranslateTransform3D.OffsetZProperty, null);

            var offsets = new Vector3D();

            this.CalculatePeiceLocation(index, out offsets, out rotation);

            tran.OffsetX = offsets.X;
            tran.OffsetY = offsets.Y;
            tran.OffsetZ = offsets.Z;

            group.Children.Add(tran);
            group.Children.Add(rotation);
            return group;
        }
Пример #7
0
        public void MoveIt(ServiceEntranceStation source, ServicePlatformElement destination, TimeSpan duration)
        {
            duration = TimeSpan.FromSeconds(duration.TotalSeconds*GlobalTimeScale);

            // Move one Box from Entrance Station and put it on StationA
            LastActivity = "EQ->A"; // One Possibility!
            ServiceBoxElement box = source.Dequeue();
            destination.ServiceBox = box;

            double src = box.Transformer.OffsetX;
            const double desten = -7.5;

            var da = new DoubleAnimation {From = src, To = desten, Duration = new Duration(duration)};
            var newTransformer = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 2.1);
            box.Transform = newTransformer;
            box.Transformer = newTransformer;
            newTransformer.BeginAnimation(TranslateTransform3D.OffsetXProperty, da);

            var robotTransform = new TranslateTransform3D(box.Transformer.OffsetX, box.Transformer.OffsetY, 0);
            World.Instance.MotherRobot.Transform = robotTransform;
            robotTransform.BeginAnimation(TranslateTransform3D.OffsetXProperty, da);
        }
Пример #8
0
      /// <summary/>
      protected override void BeginTransition(TransitionEventArgs e) {
         var viewport = AddViewport3D(e);
         var panel = (TransitionPanel)e.Source;
         var size = panel.RenderSize;

         Point3D origin = new Point3D(); // origin of 2nd face
         Vector3D u = new Vector3D(), v = new Vector3D(); // u & v vectors of 2nd face

         double angleRads = Angle.ToRadians();
         double halfAngleRads = (Angle / 2).ToRadians();
         Point3D rotationCenter;
         Vector3D rotationAxis;

         TranslateTransform3D translation = null;
         if (Direction.IsHorizontal()) {
            var RTL = (Direction == MoveDirection.Left);
            if (IsContained) {
               rotationCenter = new Point3D(RTL ? size.Width : 0, 0, 0);
               translation = new TranslateTransform3D();
               DoubleAnimation x = new DoubleAnimation(RTL ? -size.Width : size.Width, Duration);
               translation.BeginAnimation(TranslateTransform3D.OffsetXProperty, x);
            } else {
               rotationCenter = new Point3D(size.Width / 2, 0, size.Width / 2 * Math.Tan(halfAngleRads));
            }

            rotationAxis = new Vector3D(0, 1, 0);

            if (RTL) {
               u.X = -size.Width * Math.Cos(angleRads);
               u.Z = size.Width * Math.Sin(angleRads);
               origin.X = size.Width;
            } else {
               u.X = -size.Width * Math.Cos(angleRads);
               u.Z = -size.Width * Math.Sin(angleRads);
               origin.X = -u.X;
               origin.Z = -u.Z;
            }
            v.Y = size.Height;
         } else {
            var BTT = (Direction == MoveDirection.Up);
            if (IsContained) {
               rotationCenter = new Point3D(0, BTT ? size.Height : 0, 0);
               translation = new TranslateTransform3D();
               DoubleAnimation y = new DoubleAnimation(BTT ? -size.Height : size.Height, Duration);
               translation.BeginAnimation(TranslateTransform3D.OffsetYProperty, y);
            } else {
               rotationCenter = new Point3D(0, size.Height / 2, size.Height / 2 * Math.Tan(halfAngleRads));
            }

            rotationAxis = new Vector3D(1, 0, 0);

            if (BTT) {
               v.Y = -size.Height * Math.Cos(angleRads);
               v.Z = size.Height * Math.Sin(angleRads);
               origin.Y = size.Height;
            } else {
               v.Y = -size.Height * Math.Cos(angleRads);
               v.Z = -size.Height * Math.Sin(angleRads);
               origin.Y = -v.Y;
               origin.Z = -v.Z;
            }
            u.X = size.Width;
         }

         double endAngle = 180 - Angle;
         if (Direction == MoveDirection.Right || Direction == MoveDirection.Up) {
            endAngle = -endAngle;
         }

         var m1 = _createSide(e, e.BackSnapshot, new Point3D(), new Vector3D(size.Width, 0, 0), new Vector3D(0, size.Height, 0), endAngle, rotationCenter, rotationAxis);
         var m2 = _createSide(e, e.FrontSnapshot, origin, u, v, endAngle, rotationCenter, rotationAxis);
         viewport.Children.Add(m1);
         viewport.Children.Add(m2);
         m1.Transform = m2.Transform = translation;
      }
Пример #9
0
        internal void Unfocus()
        {
            if (_IsFocused)
            {
                Transform3DGroup t3dg = null;
                if (_Geometry.Transform == null)
                {
                    t3dg = new Transform3DGroup();
                    _Geometry.Transform = t3dg;
                }
                else
                    t3dg = _Geometry.Transform as Transform3DGroup;

                TranslateTransform3D tt = new TranslateTransform3D(0, 0, 0);
                t3dg.Children.Add(tt);
                DoubleAnimation da = new DoubleAnimation(2, _HighlightDuration);
                tt.BeginAnimation(TranslateTransform3D.OffsetZProperty, da);
                _IsFocused = false;
            }
        }
Пример #10
0
        private void Do3DAnimation(GradientBall ball, Point3D nextPosition)
        {
            Action animation = () =>
            {
                var speed = new Duration(new TimeSpan(0, 0, 3));
                Point3D currentPosition = ball.Offset;

                var animationX = new DoubleAnimation(currentPosition.X, nextPosition.X, speed);
                var animationY = new DoubleAnimation(currentPosition.Y, nextPosition.Y, speed);
                var animationZ = new DoubleAnimation(currentPosition.Z, nextPosition.Z, speed);

                var tt3D = new TranslateTransform3D(currentPosition.X, currentPosition.Y, currentPosition.Z);
                ball.Transform = tt3D;
                tt3D.BeginAnimation(TranslateTransform3D.OffsetXProperty, animationX);
                tt3D.BeginAnimation(TranslateTransform3D.OffsetYProperty, animationY);
                tt3D.BeginAnimation(TranslateTransform3D.OffsetZProperty, animationZ);
            };
            ball.Dispatcher.BeginInvoke(DispatcherPriority.Send, animation);
        }
Пример #11
0
 private void TorusSet(int x, int y, int z, int currcol)
 {
     switch (x)
     {
         case 0:
             {
                 switch (z)
                 {
                     case 0:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_049;
                                         tor = Torus_049Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_050;
                                         tor = Torus_050Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_051;
                                         tor = Torus_051Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_052;
                                         tor = Torus_052Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 1:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_053;
                                         tor = Torus_053Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_054;
                                         tor = Torus_054Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_055;
                                         tor = Torus_055Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_056;
                                         tor = Torus_056Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 2:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_057;
                                         tor = Torus_057Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_058;
                                         tor = Torus_058Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_059;
                                         tor = Torus_059Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_060;
                                         tor = Torus_060Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 3:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_061;
                                         tor = Torus_061Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_062;
                                         tor = Torus_062Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_063;
                                         tor = Torus_063Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_064;
                                         tor = Torus_064Container;
                                         break;
                                     }
                             }
                             break;
                         }
                 }
                 break;
             }
         case 1:
             {
                 switch (z)
                 {
                     case 0:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_033;
                                         tor = Torus_033Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_034;
                                         tor = Torus_034Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_035;
                                         tor = Torus_035Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_036;
                                         tor = Torus_036Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 1:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_037;
                                         tor = Torus_037Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_038;
                                         tor = Torus_038Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_039;
                                         tor = Torus_039Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_040;
                                         tor = Torus_040Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 2:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_041;
                                         tor = Torus_041Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_042;
                                         tor = Torus_042Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_043;
                                         tor = Torus_043Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_044;
                                         tor = Torus_044Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 3:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_045;
                                         tor = Torus_045Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_046;
                                         tor = Torus_046Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_047;
                                         tor = Torus_047Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_048;
                                         tor = Torus_048Container;
                                         break;
                                     }
                             }
                             break;
                         }
                 }
                 break;
             }
         case 2:
             {
                 switch (z)
                 {
                     case 0:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_017;
                                         tor = Torus_017Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_018;
                                         tor = Torus_018Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_019;
                                         tor = Torus_019Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_020;
                                         tor = Torus_020Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 1:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_021;
                                         tor = Torus_021Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_022;
                                         tor = Torus_022Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_023;
                                         tor = Torus_023Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_024;
                                         tor = Torus_024Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 2:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_025;
                                         tor = Torus_025Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_026;
                                         tor = Torus_026Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_027;
                                         tor = Torus_027Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_028;
                                         tor = Torus_028Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 3:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_029;
                                         tor = Torus_029Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_030;
                                         tor = Torus_030Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_031;
                                         tor = Torus_031Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_032;
                                         tor = Torus_032Container;
                                         break;
                                     }
                             }
                             break;
                         }
                 }
                 break;
             }
         case 3:
             {
                 switch (z)
                 {
                     case 0:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_001;
                                         tor = Torus_001Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_002;
                                         tor = Torus_002Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_003;
                                         tor = Torus_003Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_004;
                                         tor = Torus_004Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 1:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_005;
                                         tor = Torus_005Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_006;
                                         tor = Torus_006Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_007;
                                         tor = Torus_007Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_008;
                                         tor = Torus_008Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 2:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_009;
                                         tor = Torus_009Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_010;
                                         tor = Torus_010Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_011;
                                         tor = Torus_011Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_012;
                                         tor = Torus_012Container;
                                         break;
                                     }
                             }
                             break;
                         }
                     case 3:
                         {
                             switch (y)
                             {
                                 case 0:
                                     {
                                         thorus = Torus_013;
                                         tor = Torus_013Container;
                                         break;
                                     }
                                 case 1:
                                     {
                                         thorus = Torus_014;
                                         tor = Torus_014Container;
                                         break;
                                     }
                                 case 2:
                                     {
                                         thorus = Torus_015;
                                         tor = Torus_015Container;
                                         break;
                                     }
                                 case 3:
                                     {
                                         thorus = Torus_016;
                                         tor = Torus_016Container;
                                         break;
                                     }
                             }
                             break;
                         }
                 }
                 break;
             }
     }
     DiffuseMaterial DifMatBl = new DiffuseMaterial(RBrush);
     DiffuseMaterial DifMatB2 = new DiffuseMaterial(BBrush);
     System.Windows.Media.Media3D.TranslateTransform3D trtr3d =new TranslateTransform3D(0.0,20.0,0.0);
     System.Windows.Media.Media3D.Transform3DGroup trgroup =new Transform3DGroup();
     System.Windows.Media.Animation.DoubleAnimation dbAnim = new DoubleAnimation(0, TimeSpan.FromMilliseconds(1000), FillBehavior.HoldEnd);
     trtr3d.BeginAnimation(TranslateTransform3D.OffsetYProperty, dbAnim);
     trgroup.Children.Add(trtr3d);
     tor.Transform = trgroup;
     if (currcol == 1)
     {
         thorus.Material = DifMatBl;
     }
     else
     {
         thorus.Material = DifMatB2;
     }
 }
Пример #12
0
        public void Select( bool s )
        {
            Transform3DGroup xform = null;
            if( !( geometry.Transform is Transform3DGroup ) )
            {
                xform = new Transform3DGroup();
                geometry.Transform = xform;
            }
            else
                xform = geometry.Transform as Transform3DGroup;

            TranslateTransform3D translate = new TranslateTransform3D( 0, 0, 0 );
            xform.Children.Add( translate );
            
            double x = -PieGraph.Radius * Math.Sin(cStart+(cEnd-cStart)/2.0);
            double y = -PieGraph.Radius * Math.Cos(cStart+(cEnd-cStart)/2.0);

            DoubleAnimationUsingKeyFrames dax = new DoubleAnimationUsingKeyFrames();
            dax.Duration = TimeSpan.FromMilliseconds(500);
            dax.KeyFrames.Add(new SplineDoubleKeyFrame(s ? -0.25 * x : 0.25 * x, TimeSpan.FromMilliseconds(500), new KeySpline(0.0, 0.6, 0.0, 0.9)));

            DoubleAnimationUsingKeyFrames day = new DoubleAnimationUsingKeyFrames();
            day.Duration = TimeSpan.FromMilliseconds(500);
            day.KeyFrames.Add(new SplineDoubleKeyFrame(s ? -0.25 * y : 0.25 * y, TimeSpan.FromMilliseconds(500), new KeySpline(0.0, 0.6, 0.0, 0.9)));

            DoubleAnimationUsingKeyFrames daz = new DoubleAnimationUsingKeyFrames();
            daz.Duration = TimeSpan.FromMilliseconds(500);
            daz.KeyFrames.Add(new SplineDoubleKeyFrame(s ? -2 : 2, TimeSpan.FromMilliseconds(500), new KeySpline(0.0, 0.6, 0.0, 0.9)));

            translate.BeginAnimation(TranslateTransform3D.OffsetXProperty, dax);
            translate.BeginAnimation(TranslateTransform3D.OffsetYProperty, day);
            translate.BeginAnimation(TranslateTransform3D.OffsetZProperty, daz);
        }