private SVGExplorer(Drawing d, SVGExplorer parent, ExpolorerRoot r)
 {
     drawing     = d;
     root        = r;
     this.parent = parent;
     initialize();
 }
        public MainWindow()
        {
            InitializeComponent();
            //FileSvgReader fr = new FileSvgReader(false, false,
            //	new DirectoryInfo(Environment.CurrentDirectory),
            //	null);

            //var dg = fr.Read("data/test.svg");
            //var d = new SVGExplorer(dg, fr.DrawingDocument);


            var d = new SVGExplorer("data/test.svg");

            Content                      = d.view;
            d["star"].look.fill          = Brushes.Black;
            d["star"].events.mouse.DOWN += (s, e) => {
                var r = d["rect815"];
                r.look.toggleVisibility();
            };
            //var t = d["path821"].view.RenderTransform;
            //d["path821"].view.RenderTransform = new MatrixTransform();

            //var tg = new TransformGroup();
            //tg.v
            //tg.Children.Add(new TranslateTransform());
            d["path821"].transform.pivot.toMassCenter();
            d["rect815"].events.mouse.DOWN += (s, e) => {
                //d["rect815"].transform.rotation += 30;
                //d["path821"].transform.rotation += 30;
                var o = d["path821"];
                o.transform.x += 30;
                if (o.transform.x > 300)
                {
                    o.transform.x = 0;
                }

                o.transform.scale *= 1.5;
                //o.transform.scale = (0.5, 0.7);
                if (o.transform.scale > 3)
                {
                    o.transform.scale = 1;
                }
                o.transform.rotation += 20;


                ////d["path821"].look.fill = Brushes.Red;

                //var v = d["path821"].view;
                //var rt = v.RenderTransform;
                //rt.Value.Scale(0.5, 0.5);
                //v.RenderTransform = rt;
                //var m = rt as MatrixTransform;
                //m.Matrix = Matrix.Multiply(rt.Value,
                //	new RotateTransform(30).Value);
                //m.Matrix.
                ////m.Matrix.Rotate(30);
                ////rt.Value =  new ScaleTransform(0.5, 0.5);
                ////v.RenderTransform = new ScaleTransform(0.5, 0.5);
            };
        }
        private void initialize()
        {
            name = name ?? root.getDrawingID(drawing);

            if (drawing is DrawingGroup dg)
            {
                drawing = null;
                view    = new SVGView();
                view.RenderTransform = dg.Transform;
                SVGView v = null; SVGExplorer e = null;
                foreach (var d in dg.Children)
                {
                    var ch = new SVGExplorer(d, this, root);
                    //if (d is GlyphRunDrawing grd)
                    //	grd.GlyphRun..Characters = "xxx".ToList();
                    childs.Add(ch);
                    if (ch.name != null)
                    {
                        namesMap.Add(ch.name, ch);
                    }
                    if (ch.drawing != null)
                    {
                        view.AddDrawing(ch.drawing);
                        if (v != null)
                        {
                            ch.promote();
                        }
                    }
                    else
                    {
                        view.Children.Add(ch.view);
                        v = ch.view;
                    }
                }
            }
        }
 /// <summary>Creates new apparance that is bound to given element.</summary>
 /// <param name="target"></param>
 public Apparance(SVGExplorer target)
 {
     this.t = target;
 }