Example #1
0
        private void CheckBox(GTagBox box, Point inn, Point outt)
        {
            int delta = 2;

            Assert.IsTrue(box.InnerBoxLeftTop.X > inn.X - delta && box.InnerBoxLeftTop.X < inn.X + delta);
            Assert.IsTrue(box.InnerBoxLeftTop.Y > inn.Y - delta && box.InnerBoxLeftTop.Y < inn.Y + delta);

            Assert.IsTrue(box.OutterBoxLeftTop.X > outt.X - delta && box.OutterBoxLeftTop.X < outt.X + delta);
            Assert.IsTrue(box.OutterBoxLeftTop.Y > outt.Y - delta && box.OutterBoxLeftTop.Y < outt.Y + delta);
        }
        private void ShowRootPath()
        {
            //如果配置不需要显示,则直接返回
            if (!NeedShowRootPath())
            {
                return;
            }
            if (RootTag == null)
            {
                return;
            }

            connectCanvas.Children.Clear();

            //需要显示从全局根到当前视图根节点之间的路径
            //查找出所有从当前视图根节点到全局根节点之间的中间节点
            List <GUTag> connect = new List <GUTag>();
            GUTag        from    = RootTag;
            GUTag        tmp     = from;

            connect.Add(from);
            while (connect.Count < 20 && tmp != null)
            {
                List <GUTag> ps = TagDB.QueryTagParent(tmp);
                if (ps.Count > 0)
                {
                    tmp = ps[0];
                    connect.Add(tmp);
                }
                else
                {
                    break;
                }
            }
            connect.Reverse();

            //显示所有中间节点
            double X = 0;

            foreach (GUTag u in connect)
            {
                GTagBox gt = new GTagBox(5, u, X, 0, 1);
                TagBox  tx = UIElementFactory.CreateTagBox(gt, null);
                tx.HideCircle();

                X += gt.OutterBox.Width;
                if (tx.ContextMenu == null)
                {
                    tx.ContextMenu          = TagAreaMenu;
                    tx.MouseLeftButtonDown += Tag_MouseLeftButtonDown;
                    tx.MouseDoubleClick    += Tag_MouseDoubleClick;
                }
                connectCanvas.Children.Add(tx);
            }
        }
Example #3
0
        /// <summary>

        /// </summary>
        /// <param name="parent"></param>
        /// <param name="child"></param>
        /// <param name="l"></param>
        private static void SetBezierStyle(GTagBox parent, GTagBox child, Path l)
        {
            if (Math.Min(parent.Level, child.Level) == 0)
            {
                l.Stroke          = new SolidColorBrush(GetColor(parent.Distance + 1, parent.Level + 1));
                l.StrokeThickness = StaticCfg.Ins.StrokeThickness * 1.5;
                //l.StrokeDashArray = CfgTagGraph.Ins.StrokeDashArray;
            }
            else
            {
                l.Stroke          = new SolidColorBrush(GetColor(parent.Distance + 1, parent.Level + 1));
                l.StrokeThickness = StaticCfg.Ins.StrokeThickness;
                //l.StrokeDashArray = CfgTagGraph.Ins.StrokeDashArray;
            }
        }
Example #4
0
 public TagBox New(GTagBox g)
 {
     if (TagBoxGarbage.Count > 0)
     {
         sttReuseTag++;
         TagBox b = TagBoxGarbage[0] as TagBox;
         TagBoxGarbage.RemoveAt(0);
         b.Visibility = System.Windows.Visibility.Visible;
         return(b);
     }
     else
     {
         sttNewTag++;
         return(new TagBox(g));
     }
 }
Example #5
0
        public static TagBox CreateTagBox(GTagBox g, TreeLayoutEnv env)
        {
            TagBox b = (env == null)?new TagBox(g): env.New(g);

            b.FontFamily    = StaticCfg.Ins.GFontF;
            b.FontSize      = g.FontSize;
            b.Height1       = g.InnerBox.Height;
            b.Width1        = g.InnerBox.Width;
            b.Margin        = new Thickness(g.InnerBox.X - 10, g.InnerBox.Y, 0, 0);
            b.TextAlignment = TextAlignment.Center;
            b.GUTag         = g.Tag;
            b.Background1   = g.Distance;//new SolidColorBrush(GetColor(g.Distance,g.Level));
            //if (g.Distance >= 5) b.Foreground1 = g.Distance;// new SolidColorBrush(Colors.White);
            b.Foreground1 = g.Distance;

            return(b);
        }
Example #6
0
 public TagBox(GTagBox tagInf)
 {
     this.tagInf = tagInf;
     InitializeComponent();
 }