private void movePlanets()
        {
            try
            {
                cleanForUpdate();
                double angleStep          = 0,
                       orbitalPeriodRatio = (route.ObjectOuter.OrbitalPeriod / route.ObjectInner.OrbitalPeriod);

                if (route.ObjectInner.ParentObjectIndex == route.ObjectFrom.ParentObjectIndex)
                {
                    angleStep   = (180 - route.DeparturePhaseAngle) / 190;
                    angleOuter += angleStep;
                    angleInner += angleStep * orbitalPeriodRatio;
                }
                else
                {
                    angleStep   = Math.Abs((route.DeparturePhaseAngle + 180 + Math.Truncate(route.Rotations) * 360) / 190);
                    angleOuter += angleStep / orbitalPeriodRatio;
                    angleInner += angleStep;
                }

                line1EndPoint      = SMath.FindNextPointByAngleAndDistance(centerPoint, innerRadius, angleInner);
                line2EndPoint      = SMath.FindNextPointByAngleAndDistance(centerPoint, outerRadius, angleOuter);
                innerPlanetPoint   = new Point(line1EndPoint.X - planetSize.Width / 2, line1EndPoint.Y - planetSize.Height / 2);
                outerPlanetPoint   = new Point(line2EndPoint.X - planetSize.Width / 2, line2EndPoint.Y - planetSize.Height / 2);
                InnerPlanet.Margin = new Thickness(innerPlanetPoint.X, innerPlanetPoint.Y, 0, 0);
                OuterPlanet.Margin = new Thickness(outerPlanetPoint.X, outerPlanetPoint.Y, 0, 0);
                this.DrawCanvas.Children.Add(InnerPlanet);
                this.DrawCanvas.Children.Add(OuterPlanet);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void update(Size maxSize, Size canvasSize, Size planetSize)
        {
            /// note that the starting point of canvas (0,0) is the left top corner.
            try
            {
                cleanCanvas();
                this.planetSize = planetSize;
                SelestialObject sun = IO.objList[IO.objList.Count - 1];
                //double rel = (route.ObjectInner.OrbitalPeriod / route.ObjectOuter.OrbitalPeriod) ;
                outerOrbitSize = maxSize;
                innerOrbitSize = new Size(outerOrbitSize.Width * rel, outerOrbitSize.Height * rel);
                arcSize        = new Size(innerOrbitSize.Width / 4, innerOrbitSize.Height / 4);
                sunSize        = new Size(planetSize.Width * 2, planetSize.Height * 2);

                innerRadius = innerOrbitSize.Width / 2;
                outerRadius = outerOrbitSize.Width / 2;
                arcRadius   = arcSize.Width;

                centerPoint      = new Point(canvasSize.Width / 2, canvasSize.Height / 2);
                outerOrbitPoint  = new Point(canvasSize.Width - outerOrbitSize.Width, canvasSize.Height - outerOrbitSize.Height);
                innerOrbitPoint  = new Point(centerPoint.X - innerRadius, centerPoint.Y - innerRadius);
                sunPoint         = new Point(centerPoint.X - sunSize.Width / 2, centerPoint.Y - sunSize.Height / 2);
                line1EndPoint    = new Point(centerPoint.X + innerRadius, centerPoint.Y);
                line2EndPoint    = SMath.FindNextPointByAngleAndDistance(centerPoint, outerRadius, route.DeparturePhaseAngle);
                innerPlanetPoint = new Point(line1EndPoint.X - planetSize.Width / 2, line1EndPoint.Y - planetSize.Height / 2);
                outerPlanetPoint = new Point(line2EndPoint.X - planetSize.Width / 2, line2EndPoint.Y - planetSize.Height / 2);
                arcStartPoint    = new Point(centerPoint.X + arcRadius, centerPoint.Y);
                arcEndPoint      = SMath.FindNextPointByAngleAndDistance(centerPoint, arcRadius, route.DeparturePhaseAngle);

                line        = Shapes.lineShape(centerPoint, line1EndPoint, Brushes.White);
                line2       = Shapes.lineShape(centerPoint, line2EndPoint, Brushes.White);
                OuterOrbit  = Shapes.orbitShape(outerOrbitPoint, outerOrbitSize, route.ObjectOuter.objectColour);
                InnerOrbit  = Shapes.orbitShape(innerOrbitPoint, innerOrbitSize, route.ObjectInner.objectColour);
                InnerPlanet = Shapes.planetShape(innerPlanetPoint, planetSize, route.ObjectInner.objectColour);
                OuterPlanet = Shapes.planetShape(outerPlanetPoint, planetSize, route.ObjectOuter.objectColour);
                Sun         = Shapes.planetShape(sunPoint, sunSize, Brushes.Yellow);
                SweepDirection dir = (route.DeparturePhaseAngle < 0) ? SweepDirection.Clockwise : SweepDirection.Counterclockwise;
                anglePath       = Shapes.arcShape(arcStartPoint, arcEndPoint, arcSize, Brushes.SkyBlue, 90, dir);
                AngleText       = Shapes.textBlock(route.strPhAngle, new Point(arcEndPoint.X + 30, arcEndPoint.Y + 10), 14, Brushes.SkyBlue);
                InnerPlanetText = Shapes.textBlock(route.ObjectInner.Name, new Point(innerPlanetPoint.X - planetSize.Width - 15, innerPlanetPoint.Y - 15), 16, route.ObjectInner.objectColour);
                OuterPlanetText = Shapes.textBlock(route.ObjectOuter.Name, new Point(outerPlanetPoint.X - planetSize.Width - 15, outerPlanetPoint.Y - 15), 16, route.ObjectOuter.objectColour);
                SunText         = Shapes.textBlock(sun.Name, new Point(sunPoint.X - sunSize.Width, sunPoint.Y + 20), 16, sun.objectColour);


                if (route.ObjectInner.ParentObjectIndex == route.ObjectFrom.ParentObjectIndex)
                {
                    HTOArrivalPath    = Shapes.arcShape(line1EndPoint, new Point(0, centerPoint.Y), new Size(83, 100), Brushes.LightSeaGreen, 90, dir);
                    HTODeparturePath  = Shapes.arcShape(new Point(0, centerPoint.Y), line1EndPoint, new Size(83, 100), Brushes.Gray, 90, dir);
                    rocketPath        = Shapes.animationShape(new Point(line1EndPoint.X - 6, line1EndPoint.Y), new Point(6, centerPoint.Y), new Size(83, 100), 90, dir);
                    TransferOrbitText = Shapes.textBlock("", new Point(10, centerPoint.Y - 20), 10, Brushes.LightGreen);
                }
                else
                {
                    HTOArrivalPath = Shapes.arcShape(line2EndPoint, SMath.FindNextPointByAngleAndDistance(centerPoint, innerRadius, 180 + route.DeparturePhaseAngle),
                                                     new Size(83, 100), Brushes.LightSeaGreen, 90 - route.DeparturePhaseAngle, SweepDirection.Counterclockwise);
                    HTODeparturePath = Shapes.arcShape(line2EndPoint, SMath.FindNextPointByAngleAndDistance(centerPoint, innerRadius, 180 + route.DeparturePhaseAngle),
                                                       new Size(83, 100), Brushes.Gray, 90 - route.DeparturePhaseAngle, SweepDirection.Clockwise);
                    rocketPath = Shapes.animationShape(
                        SMath.FindNextPointByAngleAndDistance(centerPoint, outerRadius - 6, route.DeparturePhaseAngle),
                        SMath.FindNextPointByAngleAndDistance(centerPoint, innerRadius - 6, 180 + route.DeparturePhaseAngle),
                        new Size(83, 100), 90 - route.DeparturePhaseAngle, SweepDirection.Counterclockwise);
                    TransferOrbitText = Shapes.textBlock("", SMath.FindNextPointByAngleAndDistance(centerPoint, innerRadius, 180 + route.DeparturePhaseAngle), 10, Brushes.LightGreen);
                }

                TransferOrbitText.Inlines.Clear();
                for (int i = 8; i < route.ToShortRunList().Count - 2; i++)
                {
                    TransferOrbitText.Inlines.Add(route.ToShortRunList()[i]);
                }
                rocketPath.Freeze();
                SunText.ToolTip         = sun.Name;
                Sun.ToolTip             = sun.Name;
                InnerOrbit.ToolTip      = route.ObjectInner.Name;
                InnerPlanetText.ToolTip = route.ObjectInner.Name;
                InnerPlanet.ToolTip     = route.ObjectInner.Name;
                OuterOrbit.ToolTip      = route.ObjectOuter.Name;
                OuterPlanetText.ToolTip = route.ObjectOuter.Name;
                OuterPlanet.ToolTip     = route.ObjectOuter.Name;
                AngleText.ToolTip       = route.strPhAngle;
                anglePath.ToolTip       = route.strPhAngle;
                line.ToolTip            = route.strPhAngle;
                line2.ToolTip           = route.strPhAngle;
                rocketImageInit();

                this.DrawCanvas.Children.Add(HTOArrivalPath);
                this.DrawCanvas.Children.Add(HTODeparturePath);
                this.DrawCanvas.Children.Add(OuterOrbit);
                this.DrawCanvas.Children.Add(InnerOrbit);
                this.DrawCanvas.Children.Add(line);
                this.DrawCanvas.Children.Add(line2);
                this.DrawCanvas.Children.Add(InnerPlanet);
                this.DrawCanvas.Children.Add(OuterPlanet);
                this.DrawCanvas.Children.Add(anglePath);
                this.DrawCanvas.Children.Add(Sun);
                this.DrawCanvas.Children.Add(AngleText);
                this.DrawCanvas.Children.Add(InnerPlanetText);
                this.DrawCanvas.Children.Add(SunText);
                this.DrawCanvas.Children.Add(OuterPlanetText);
                this.DrawCanvas.Children.Add(TransferOrbitText);
            }
            catch (Exception)
            {
                throw;
            }
        }