コード例 #1
0
        public void TranslateToOrigin(HTNode node)
        {
            HTDrawNode drawNode = draw.FindDrawNode(node);

            draw.TranslateToOrigin(drawNode);
            return;
        }
コード例 #2
0
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
        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
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
        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
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
コード例 #17
0
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
コード例 #18
0
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
 internal void TranslateToOrigin(HTDrawNode node)
 {
     view.StopMouseListening();
     //AnimThread t = new AnimThread(node);
     //t.Start();
 }
コード例 #19
0
ファイル: HTNodeLabel.cs プロジェクト: wuyanna/HyperTree
 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
ファイル: HTDrawNode.cs プロジェクト: wuyanna/HyperTree
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }
コード例 #22
0
ファイル: HTNodeLabel.cs プロジェクト: wuyanna/HyperTree
 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
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
コード例 #25
0
ファイル: HTDraw.cs プロジェクト: wuyanna/HyperTree
        internal HTDrawNode FindDrawNode(HTNode htNode)
        {
            HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode];

            return(drawNode);
        }
コード例 #26
0
ファイル: HTDrawNode.cs プロジェクト: wuyanna/HyperTree
 internal void SetBrother(HTDrawNode brother)
 {
     this.brother = brother;
 }