Beispiel #1
0
 public HTAction(HTDraw model)
 {
     this.model = model;
     startPoint = new HTCoordE();
     endPoint   = new HTCoordE();
     clickPoint = new HTCoordS();
 }
Beispiel #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;
            }
        }
Beispiel #3
0
 public HTAction(HTDraw model)
 {
     this.model = model;
     startPoint = new HTCoordE();
     endPoint = new HTCoordE();
     clickPoint = new HTCoordS();
 }
Beispiel #4
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;
        }
Beispiel #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));
            }
        }
Beispiel #6
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;
        }
Beispiel #7
0
 internal virtual HTDrawNode FindNode(HTCoordS zs)
 {
     if (label.Contains(zs))
     {
         return(this);
     }
     else
     {
         return(null);
     }
 }
Beispiel #8
0
 internal bool Contains(HTCoordS zs)
 {
     int length = GetDistance(zs);
     if (length <= ZONE_LENGTH)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #9
0
        internal bool Contains(HTCoordS zs)
        {
            int length = GetDistance(zs);

            if (length <= ZONE_LENGTH)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #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);
                }
            }
        }
Beispiel #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);
     }
 }
Beispiel #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));
     }
 }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #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;
 }
Beispiel #20
0
 internal virtual HTDrawNode FindNode(HTCoordS zs)
 {
     if (label.Contains(zs))
     {
         return this;
     }
     else
     {
         return null;
     }
 }
Beispiel #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;
 }
Beispiel #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));
 }
Beispiel #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)));
        }
Beispiel #24
0
 public HTCoordS(HTCoordS z)
 {
     this.X = z.X;
     this.Y = z.Y;
 }
Beispiel #25
0
 internal virtual void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     zs.ProjectionEtoS(ze, sOrigin, sMax);
 }
Beispiel #26
0
 internal HTDrawNode FindNode(HTCoordS zs)
 {
     return(drawRoot.FindNode(zs));
 }
Beispiel #27
0
 internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     a.ProjectionEtoS(za, sOrigin, sMax);
     b.ProjectionEtoS(zb, sOrigin, sMax);
     c.ProjectionEtoS(zc, sOrigin, sMax);
 }
Beispiel #28
0
 internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     a.ProjectionEtoS(za, sOrigin, sMax);
     b.ProjectionEtoS(zb, sOrigin, sMax);
     c.ProjectionEtoS(zc, sOrigin, sMax);
 }
Beispiel #29
0
 public HTCoordS(HTCoordS z)
 {
     this.X = z.X;
     this.Y = z.Y;
 }
        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);
                }
            }
        }
 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;
     }
 }
Beispiel #32
0
 internal HTDrawNode FindNode(HTCoordS zs)
 {
     return drawRoot.FindNode(zs);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #35
0
 internal virtual void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax)
 {
     zs.ProjectionEtoS(ze, sOrigin, sMax);
 }