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

            draw.TranslateToOrigin(drawNode);
            return;
        }
示例#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;
        }
示例#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;
        }
示例#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);
            }
        }
示例#5
0
        override internal void EndTranslation()
        {
            base.EndTranslation();

            HTDrawNode child = null;

            for (IEnumerator i = Children(); i.MoveNext();)
            {
                child = (HTDrawNode)i.Current;
                child.EndTranslation();
            }
        }
示例#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);
        }
示例#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);
                }
            }
        }
示例#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);
            }
        }
示例#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);
                }
            }
        }
示例#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();
                }
            }
        }
示例#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);
            }
        }
示例#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;
                }
            }
        }
示例#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;
                }
            }
        }
示例#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);
            }
        }
示例#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);
            }
        }
示例#16
0
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
示例#17
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
示例#18
0
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
示例#19
0
 public HTNodeLabel(HTDrawNode node)
 {
     this.node = node;
 }
示例#20
0
 void AddChild(HTDrawNode child)
 {
     children.Add(child);
     geodesics.Add(child, new HTGeodesic(GetCoordinates(), child.GetCoordinates()));
 }
示例#21
0
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }
示例#22
0
 public HTNodeLabel(HTDrawNode node)
 {
     this.node = node;
 }
示例#23
0
 void AddChild(HTDrawNode child)
 {
     children.Add(child);
     geodesics.Add(child, new HTGeodesic(GetCoordinates(), child.GetCoordinates()));
 }
示例#24
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
示例#25
0
        internal HTDrawNode FindDrawNode(HTNode htNode)
        {
            HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode];

            return(drawNode);
        }
示例#26
0
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }