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

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