private void figureTree_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (!initialized)
            {
                return;
            }

            if (e.Node.Tag != null && e.Node.Tag is Linepoint)
            {
                Linepoint lp = (Linepoint)e.Node.Tag;

                lp.PointType = e.Node.Checked ? PointType.Line : PointType.Move;

                e.Node.Text = lp.ToString();

                TreeNode parent = figureTree.SelectedNode.Parent;
                if (parent != null)
                {
                    Lineset ls = (Lineset)parent.Tag;
                    Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name);
                }
            }
            else
            {
                if (e.Node.Checked)
                {
                    e.Node.Checked = false;
                }
            }
        }
        internal void AddFigurePoint(IPlace place)
        {
            TreeNode  parent;
            Linepoint pnt = new Linepoint(place.RA * 15 - 180, place.Dec, PointType.Line, place.Name != Language.GetLocalizedText(90, "No Object") ? place.Name : null);

            if (figureTree.SelectedNode.Tag is Linepoint)
            {
                parent = figureTree.SelectedNode.Parent;

                Lineset ls = (Lineset)parent.Tag;

                Linepoint lp = (Linepoint)figureTree.SelectedNode.Tag;

                int index = ls.Points.FindIndex(delegate(Linepoint target) { return(target == lp); }) + 1;

                ls.Points.Insert(index, pnt);

                TreeNode child;
                if (index >= parent.Nodes.Count)
                {
                    child = parent.Nodes.Add(pnt.ToString());
                }
                else
                {
                    child = parent.Nodes.Insert(index, pnt.ToString());
                }
                child.Tag               = pnt;
                child.Checked           = pnt.PointType != PointType.Move;
                figureTree.SelectedNode = child;
                Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name);
            }
            else
            {
                parent = figureTree.SelectedNode;
                Lineset ls = (Lineset)figureTree.SelectedNode.Tag;
                ls.Points.Add(pnt);
                TreeNode child = parent.Nodes.Add(pnt.ToString());
                child.Tag               = pnt;
                child.Checked           = pnt.PointType != PointType.Move;
                figureTree.SelectedNode = child;
                Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name);
            }
        }
        internal void AddFigurePoint(IPlace place)
        {
            TreeNode parent;
            var pnt = new Linepoint(place.RA * 15 - 180, place.Dec, PointType.Line, place.Name != Language.GetLocalizedText(90, "No Object") ? place.Name : null);
            if (figureTree.SelectedNode.Tag is Linepoint)
            {
                parent = figureTree.SelectedNode.Parent;

                var ls = (Lineset)parent.Tag;

                var lp = (Linepoint)figureTree.SelectedNode.Tag;

                var index = ls.Points.FindIndex(delegate(Linepoint target) { return target == lp; }) + 1;

                ls.Points.Insert(index, pnt);

                TreeNode child;
                if (index >= parent.Nodes.Count)
                {
                    child = parent.Nodes.Add(pnt.ToString());
                }
                else
                {
                    child = parent.Nodes.Insert(index, pnt.ToString());
                }
                child.Tag = pnt;
                child.Checked = pnt.PointType != PointType.Move;
                figureTree.SelectedNode = child;
                Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name);
            }
            else
            {
                parent = figureTree.SelectedNode;
                var ls = (Lineset)figureTree.SelectedNode.Tag;
                ls.Points.Add( pnt);
                var child = parent.Nodes.Add( pnt.ToString());
                child.Tag = pnt;
                child.Checked = pnt.PointType != PointType.Move;
                figureTree.SelectedNode = child;
                Earth3d.MainWindow.constellationsFigures.ResetConstellation(ls.Name);
            }
        }
 private void figureTree_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
 {
     if (e.Node != null && e.Node.Tag is Linepoint)
     {
         if (e.Node.Tag is Linepoint)
         {
             Linepoint lp = (Linepoint)e.Node.Tag;
             //((Convert.ToDouble(line.Substring(0, 10)) / 24.0 * 360) - 180)
             TourPlace p = new TourPlace(lp.ToString(), (lp.RA + 180) / 360 * 24, lp.Dec, Classification.Unidentified, "", ImageSetType.Sky, -1);
             p.Distance = 1.0;
             //Earth3d.MainWindow.SetLabelText(lp.ToString(), (lp.RA + 180) / 360 * 24, lp.Dec, 1.0);
             Constellations.SelectedSegment = lp;
         }
     }
     else
     {
         if (e.Node.Checked)
         {
             Earth3d.MainWindow.SetLabelText(null, false);
             Constellations.SelectedSegment = null;
         }
     }
 }