/** If a trajectory has only one node, the player is not displayed. To fix that situation, the node is duplicated with a slightly different location.
         * Both old and new nodes are linked through a side.
         *
         * @param scene
         */
        public static void fixSingleNode(Scene scene)
        {
            Trajectory trajectory = scene.getTrajectory();

            if (trajectory != null)
            {
                if (trajectory.getNodes().Count == 1)
                {
                    Trajectory.Node node1 = trajectory.getNodes()[0];
                    trajectory.addNode(node1.getID() + "Dupl", node1.getX() + 1, node1.getY(), node1.getScale());
                    trajectory.addSide(node1.getID(), node1.getID() + "Dupl", 1);
                }
            }
        }
        /**
         * Checks pairs of nodes with duplicate ids. One of the nodes is removed.
         * @param nodes
         */
        private static void fixDuplicateNodes(Scene scene)
        {
            Trajectory trajectory = scene.getTrajectory();

            if (trajectory != null)
            {
                // Iterate through nodes.
                for (int i = 0; i < trajectory.getNodes().Count; i++)
                {
                    Trajectory.Node node1 = trajectory.getNodes()[i];
                    for (int j = 0; j < trajectory.getNodes().Count; j++)
                    {
                        Trajectory.Node node2 = trajectory.getNodes()[j];
                        if (i != j && node1.getID().Equals(node2.getID()))
                        {
                            trajectory.getNodes().RemoveAt(j);
                            i--; j--;
                        }
                    }
                }
            }
        }