public void TranslateToOrigin(HTNode node)
        {
            HTDrawNode drawNode = draw.FindDrawNode(node);

            draw.TranslateToOrigin(drawNode);
            return;
        }
Esempio n. 2
0
        public HTDraw(HTModel model, HTView view)
        {
            drawToHTNodeMap = new Dictionary<HTNode, HTDrawNode>();

            this.view = view;
            this.model = model;
            HTModelNode root = model.GetRoot();
            sOrigin = new HTCoordS();
            sMax = new HTCoordS();

            ray = new double[4];
            ray[0] = model.GetLength();

            for (int i = 1; i < ray.Length; i++)
            {
                ray[i] = (ray[0] + ray[i - 1]) / (1 + (ray[0] * ray[i - 1]));
            }

            if (root.IsLeaf())
            {
                drawRoot = new HTDrawNode(null, root, this);
            }
            else
            {
                drawRoot = new HTDrawNodeComposite(null, (HTModelNodeComposite)root, this);
            }
            return;
        }
Esempio n. 3
0
        public HTDraw(HTModel model, HTView view)
        {
            drawToHTNodeMap = new Dictionary <HTNode, HTDrawNode>();

            this.view  = view;
            this.model = model;
            HTModelNode root = model.GetRoot();

            sOrigin = new HTCoordS();
            sMax    = new HTCoordS();

            ray    = new double[4];
            ray[0] = model.GetLength();

            for (int i = 1; i < ray.Length; i++)
            {
                ray[i] = (ray[0] + ray[i - 1]) / (1 + (ray[0] * ray[i - 1]));
            }

            if (root.IsLeaf())
            {
                drawRoot = new HTDrawNode(null, root, this);
            }
            else
            {
                drawRoot = new HTDrawNodeComposite(null, (HTModelNodeComposite)root, this);
            }
            return;
        }
Esempio n. 4
0
        override internal void FastMode(bool mode)
        {
            base.FastMode(mode);
            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                child.FastMode(mode);
            }
        }
Esempio n. 5
0
        override internal void EndTranslation()
        {
            base.EndTranslation();

            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                child.EndTranslation();
            }
        }
Esempio n. 6
0
        override public String ToString()
        {
            String     result = base.ToString();
            HTDrawNode child  = null;

            result += "\n\tChildren :";
            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child   = (HTDrawNode)i.Current;
                result += "\n\t-> " + child.GetName();
            }
            return(result);
        }
Esempio n. 7
0
        override internal void DrawNodes(Graphic g)
        {
            if (fastMode == false)
            {
                base.DrawNodes(g);

                HTDrawNode child = null;
                for (IEnumerator i = Children(); i.MoveNext();)
                {
                    child = (HTDrawNode)i.Current;
                    child.DrawNodes(g);
                }
            }
        }
Esempio n. 8
0
        public void MouseClicked(object sender, MouseEventArgs e)
        {
            // TODO: is shift down -> model.restore()
            Debug.WriteLine("MouseClicked!!");
            clickPoint.X = (int)e.GetPosition((UIElement)sender).X;
            clickPoint.Y = (int)e.GetPosition((UIElement)sender).Y;

            HTDrawNode node = model.FindNode(clickPoint);

            if (node != null)
            {
                model.TranslateToOrigin(node);
            }
        }
Esempio n. 9
0
        override internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
        {
            base.RefreshScreenCoordinates(sOrigin, sMax);
            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                child.RefreshScreenCoordinates(sOrigin, sMax);
                HTGeodesic geod = (HTGeodesic)geodesics[child];
                if (geod != null)
                {
                    geod.RefreshScreenCoordinates(sOrigin, sMax);
                }
            }
        }
Esempio n. 10
0
        override internal void Restore()
        {
            base.Restore();
            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                child.Restore();
                HTGeodesic geod = (HTGeodesic)geodesics[child];
                if (geod != null)
                {
                    geod.Rebuild();
                }
            }
        }
Esempio n. 11
0
        override internal void DrawBranches(Graphic g)
        {
            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                HTGeodesic geod = (HTGeodesic)geodesics[child];

                if (geod != null)
                {
                    geod.Draw(g, child.GetBranchColor());
                }
                child.DrawBranches(g);
            }
        }
Esempio n. 12
0
        internal HTDrawNodeComposite(HTDrawNodeComposite father, HTModelNodeComposite node, HTDraw model)
            : base(father, node, model)
        {
            this.node      = node;
            this.children  = new ObservableCollection <HTDrawNode>();
            this.geodesics = new Dictionary <HTDrawNode, HTGeodesic>();

            HTModelNode childNode = null;
            HTDrawNode  child     = null;
            HTDrawNode  brother   = null;
            bool        first     = true;
            bool        second    = false;

            for (IEnumerator i = node.Children(); i.MoveNext();)
            {
                childNode = (HTModelNode)i.Current;
                if (childNode.IsLeaf())
                {
                    child = new HTDrawNode(this, childNode, model);
                }
                else
                {
                    child = new HTDrawNodeComposite(this, (HTModelNodeComposite)childNode, model);
                }
                AddChild(child);
                if (first)
                {
                    brother = child;
                    first   = false;
                    second  = true;
                }
                else if (second)
                {
                    child.SetBrother(brother);
                    brother.SetBrother(child);
                    brother = child;
                    second  = false;
                }
                else
                {
                    child.SetBrother(brother);
                    brother = child;
                }
            }
        }
Esempio n. 13
0
        internal HTDrawNodeComposite(HTDrawNodeComposite father, HTModelNodeComposite node, HTDraw model)
            : base(father, node, model)
        {
            this.node = node;
            this.children = new ObservableCollection<HTDrawNode>();
            this.geodesics = new Dictionary<HTDrawNode, HTGeodesic>();

            HTModelNode childNode = null;
            HTDrawNode child = null;
            HTDrawNode brother = null;
            bool first = true;
            bool second = false;
            for (IEnumerator i = node.Children(); i.MoveNext(); )
            {
                childNode = (HTModelNode)i.Current;
                if (childNode.IsLeaf())
                {
                    child = new HTDrawNode(this, childNode, model);
                }
                else
                {
                    child = new HTDrawNodeComposite(this, (HTModelNodeComposite)childNode, model);
                }
                AddChild(child);
                if (first)
                {
                    brother = child;
                    first = false;
                    second = true;
                }
                else if (second)
                {
                    child.SetBrother(brother);
                    brother.SetBrother(child);
                    brother = child;
                    second = false;
                }
                else
                {
                    child.SetBrother(brother);
                    brother = child;
                }
            }
        }
Esempio n. 14
0
        override internal HTDrawNode FindNode(HTCoordS zs)
        {
            HTDrawNode result = base.FindNode(zs);

            if (result != null)
            {
                return(result);
            }
            else
            {
                HTDrawNode child = null;
                for (IEnumerator i = Children(); i.MoveNext();)
                {
                    child  = (HTDrawNode)i.Current;
                    result = child.FindNode(zs);
                    if (result != null)
                    {
                        return(result);
                    }
                }
                return(null);
            }
        }
Esempio n. 15
0
        override internal int GetSpace()
        {
            int space = base.GetSpace();

            if (children.Count > 0)
            {
                HTDrawNode child = (HTDrawNode)children[0];
                HTCoordS   zC    = child.GetScreenCoordinates();
                int        dC    = zs.GetDistance(zC);

                if (space == -1)
                {
                    return(dC);
                }
                else
                {
                    return(Math.Min(space, dC));
                }
            }
            else
            {
                return(space);
            }
        }
Esempio n. 16
0
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
Esempio n. 17
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
Esempio n. 18
0
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
Esempio n. 19
0
 public HTNodeLabel(HTDrawNode node)
 {
     this.node = node;
 }
Esempio n. 20
0
 void AddChild(HTDrawNode child)
 {
     children.Add(child);
     geodesics.Add(child, new HTGeodesic(GetCoordinates(), child.GetCoordinates()));
 }
Esempio n. 21
0
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }
Esempio n. 22
0
 public HTNodeLabel(HTDrawNode node)
 {
     this.node = node;
 }
Esempio n. 23
0
 void AddChild(HTDrawNode child)
 {
     children.Add(child);
     geodesics.Add(child, new HTGeodesic(GetCoordinates(), child.GetCoordinates()));
 }
Esempio n. 24
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
Esempio n. 25
0
        internal HTDrawNode FindDrawNode(HTNode htNode)
        {
            HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode];

            return(drawNode);
        }
Esempio n. 26
0
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }