示例#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
        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
        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
 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
 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);
 }