예제 #1
0
 public HTAction(HTDraw model)
 {
     this.model = model;
     startPoint = new HTCoordE();
     endPoint   = new HTCoordE();
     clickPoint = new HTCoordS();
 }
예제 #2
0
        internal void Draw(Graphic g)
        {
            int fh    = 30;
            int space = node.GetSpace();

            // TODO:unfinished
            if (space >= fh)
            {
                active = true;
                HTCoordS zs    = node.GetScreenCoordinates();
                String   name  = node.GetName();
                Color    color = node.GetColor();

                height = fh + 2 * node.GetSize();
                width  = space + 10 + 2 * node.GetSize();
                x      = zs.X - (width / 2) - node.GetSize();
                y      = zs.Y - (fh / 2) - node.GetSize();

                g.DrawDot(zs.X, zs.Y, 3, color);
                g.DrawLabel(x, y, width, height, name, color);
            }
            else
            {
                active = false;
            }
        }
예제 #3
0
 public HTAction(HTDraw model)
 {
     this.model = model;
     startPoint = new HTCoordE();
     endPoint = new HTCoordE();
     clickPoint = new HTCoordS();
 }
예제 #4
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;
        }
예제 #5
0
        internal virtual int GetSpace()
        {
            int dF = -1;
            int dB = -1;

            if (father != null)
            {
                HTCoordS zF = father.GetScreenCoordinates();
                dF = zs.GetDistance(zF);
            }
            if (brother != null)
            {
                HTCoordS zB = brother.GetScreenCoordinates();
                dB = zs.GetDistance(zB);
            }

            if ((dF == -1) && (dB == -1))
            {
                return(int.MaxValue);
            }
            else if (dF == -1)
            {
                return(dB);
            }
            else if (dB == -1)
            {
                return(dF);
            }
            else
            {
                return(Math.Min(dF, dB));
            }
        }
예제 #6
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;
        }
예제 #7
0
 internal virtual HTDrawNode FindNode(HTCoordS zs)
 {
     if (label.Contains(zs))
     {
         return(this);
     }
     else
     {
         return(null);
     }
 }
예제 #8
0
 internal bool Contains(HTCoordS zs)
 {
     int length = GetDistance(zs);
     if (length <= ZONE_LENGTH)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #9
0
        internal bool Contains(HTCoordS zs)
        {
            int length = GetDistance(zs);

            if (length <= ZONE_LENGTH)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #10
0
        internal HTGeodesic(HTCoordE za, HTCoordE zb)
        {
            this.za = za;
            this.zb = zb;
            zc      = new HTCoordE();
            zo      = new HTCoordE();

            a = new HTCoordS();
            b = new HTCoordS();
            c = new HTCoordS();

            Rebuild();
        }
예제 #11
0
        internal HTGeodesic(HTCoordE za, HTCoordE zb)
        {
            this.za = za;
            this.zb = zb;
            zc = new HTCoordE();
            zo = new HTCoordE();

            a = new HTCoordS();
            b = new HTCoordS();
            c = new HTCoordS();

            Rebuild();
        }
예제 #12
0
        public HTDrawNode(HTDrawNodeComposite father, HTModelNode node, HTDraw model)
        {
            this.father = father;
            this.node = node;
            this.model = model;

            label = new HTNodeLabel(this);

            ze = new HTCoordE(node.GetCoordinates());
            oldZe = new HTCoordE(ze);
            zs = new HTCoordS();

            model.MapNode(node.GetNode(), this);
            return;
        }
예제 #13
0
        public HTDrawNode(HTDrawNodeComposite father, HTModelNode node, HTDraw model)
        {
            this.father = father;
            this.node   = node;
            this.model  = model;

            label = new HTNodeLabel(this);

            ze    = new HTCoordE(node.GetCoordinates());
            oldZe = new HTCoordE(ze);
            zs    = new HTCoordS();

            model.MapNode(node.GetNode(), this);
            return;
        }
예제 #14
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);
                }
            }
        }
예제 #15
0
 internal bool Contains(HTCoordS zs)
 {
     if (active)
     {
         if ((zs.X >= x) && (zs.X <= (x + width)) &&
             (zs.Y >= y) && (zs.Y <= (y + height)))
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         return node.GetScreenCoordinates().Contains(zs);
     }
 }
예제 #16
0
 internal bool Contains(HTCoordS zs)
 {
     if (active)
     {
         if ((zs.X >= x) && (zs.X <= (x + width)) &&
             (zs.Y >= y) && (zs.Y <= (y + height)))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(node.GetScreenCoordinates().Contains(zs));
     }
 }
예제 #17
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);
            }
        }
예제 #18
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);
            }
        }
예제 #19
0
 internal void ProjectionEtoS(HTCoordE ze, HTCoordS sOrigin, HTCoordS sMax)
 {
     x = (int)Math.Round(ze.X * sMax.X) + sOrigin.X;
     y = -(int)Math.Round(ze.Y * sMax.Y) + sOrigin.Y;
 }
예제 #20
0
 internal virtual HTDrawNode FindNode(HTCoordS zs)
 {
     if (label.Contains(zs))
     {
         return this;
     }
     else
     {
         return null;
     }
 }
예제 #21
0
 internal void ProjectionEtoS(HTCoordE ze, HTCoordS sOrigin, HTCoordS sMax)
 {
     x = (int)Math.Round(ze.X * sMax.X) + sOrigin.X;
     y = -(int)Math.Round(ze.Y * sMax.Y) + sOrigin.Y;
 }
예제 #22
0
 internal int GetDistance(HTCoordS z)
 {
     int d2 = (z.x - x) * (z.x - x) + (z.y - y) * (z.y - y);
     return (int)Math.Round(Math.Sqrt(d2));
 }
예제 #23
0
        internal int GetDistance(HTCoordS z)
        {
            int d2 = (z.x - x) * (z.x - x) + (z.y - y) * (z.y - y);

            return((int)Math.Round(Math.Sqrt(d2)));
        }
예제 #24
0
 public HTCoordS(HTCoordS z)
 {
     this.X = z.X;
     this.Y = z.Y;
 }
예제 #25
0
 internal virtual void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     zs.ProjectionEtoS(ze, sOrigin, sMax);
 }
예제 #26
0
파일: HTDraw.cs 프로젝트: wuyanna/HyperTree
 internal HTDrawNode FindNode(HTCoordS zs)
 {
     return(drawRoot.FindNode(zs));
 }
예제 #27
0
 internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     a.ProjectionEtoS(za, sOrigin, sMax);
     b.ProjectionEtoS(zb, sOrigin, sMax);
     c.ProjectionEtoS(zc, sOrigin, sMax);
 }
예제 #28
0
 internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     a.ProjectionEtoS(za, sOrigin, sMax);
     b.ProjectionEtoS(zb, sOrigin, sMax);
     c.ProjectionEtoS(zc, sOrigin, sMax);
 }
예제 #29
0
 public HTCoordS(HTCoordS z)
 {
     this.X = z.X;
     this.Y = z.Y;
 }
예제 #30
0
        internal override 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);
                }
            }
        }
예제 #31
0
 internal override 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;
     }
 }
예제 #32
0
파일: HTDraw.cs 프로젝트: wuyanna/HyperTree
 internal HTDrawNode FindNode(HTCoordS zs)
 {
     return drawRoot.FindNode(zs);
 }
예제 #33
0
 internal void ProjectionStoE(int x, int y, HTCoordS sOrigin, HTCoordS sMax)
 {
     this.X = (double)(x - sOrigin.X) / (double)sMax.X;
     this.Y = -((double)(y - sOrigin.Y) / (double)sMax.Y);
 }
예제 #34
0
 internal void ProjectionStoE(int x, int y, HTCoordS sOrigin, HTCoordS sMax)
 {
     this.X = (double)(x - sOrigin.X) / (double)sMax.X;
     this.Y = -((double)(y - sOrigin.Y) / (double)sMax.Y);
 }
예제 #35
0
 internal virtual void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     zs.ProjectionEtoS(ze, sOrigin, sMax);
 }