コード例 #1
0
ファイル: TimelinerView.cs プロジェクト: yousafgill/Timeliner
        public SvgDocument BuildSVGRoot()
        {
            //draw self

            //clear
            SvgRoot.Children.Clear();
            FRulerGroup.Children.Clear();
            FTrackGroup.Children.Clear();
            FTrackGroup.Transforms.Clear();
            FOverlaysGroup.Children.Clear();
            FOverlaysGroup.Transforms.Clear();

            SvgRoot.Children.Add(Definitions);
            Ruler.AddToSceneGraphAt(FRulerGroup);

            var menuOffset = new SvgTranslate(0, Ruler.Height);

            FTrackGroup.Transforms.Add(menuOffset);
            FTrackGroup.Children.Add(Background);

            SvgRoot.Children.Add(FTrackGroup);
            SvgRoot.Children.Add(FRulerGroup);

            FOverlaysGroup.Transforms.Add(menuOffset);
            FOverlaysGroup.Children.Add(Selection);
            FOverlaysGroup.Children.Add(TimeBar);
            FOverlaysGroup.Children.Add(MouseTimeLine);
            FOverlaysGroup.Children.Add(MainMenu);
            FOverlaysGroup.Children.Add(Ruler.Menu);
            SvgRoot.Children.Add(FOverlaysGroup);

            return(SvgRoot);
        }
コード例 #2
0
        // Search for all texts in document tree
        public SvgGroup CutAllTextElements(SvgGroup root, float tx, float ty)
        {
            List <SvgElement> texts = new List <SvgElement>();
            SvgTranslate      trans = root.Transforms[0] as SvgTranslate;

            if (trans != null)
            {
                tx += trans.X;
                ty += trans.Y;
            }

            for (int i = 0; i < root.Children.Count; i++)
            {
                SvgElement child = root.Children[i];
                if (child is SvgGroup)
                {
                    CutAllTextElements(child as SvgGroup, tx, ty);
                }
                else if (child is SvgText)
                {
                    SvgText text = child as SvgText;
                    if (text.Children[0] is SvgTextSpan span)
                    {
                        text.Text       = span.Text;
                        text.TextAnchor = span.TextAnchor;
                        text.FontSize   = span.FontSize;
                        text.FontWeight = span.FontWeight;
                    }

                    text.Children.Clear();
                    text.X[0] = new SvgUnit(text.X[0].Value + tx);
                    text.Y[0] = new SvgUnit(text.Y[0].Value + ty);
                    _svgTexts.Add(text);
                    texts.Add(child);
                }
            }

            foreach (SvgElement se in texts)
            {
                root.Children.Remove(se);
            }
            return(root);
        }
コード例 #3
0
 public void Show(PointF point)
 {
     Transforms[0] = new SvgTranslate(Math.Max(0, point.X - FWidth / 2f), Math.Max(0, point.Y - FHeight / 2f));
     Visible       = true;
 }