Inheritance: SvgVisualElement
Ejemplo n.º 1
0
        static void CreateSvgCircle(SvgElement parentNode, HtmlElement elem)
        {
            SvgCircleSpec spec  = new SvgCircleSpec();
            SvgCircle     shape = new SvgCircle(spec, elem);

            parentNode.AddChild(shape);
            //translate attribute
            foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
            {
                WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;

                switch (wellknownName)
                {
                case WebDom.WellknownName.Svg_Cx:
                {
                    spec.X = UserMapUtil.ParseGenericLength(attr.Value);
                } break;

                case WebDom.WellknownName.Svg_Cy:
                {
                    spec.Y = UserMapUtil.ParseGenericLength(attr.Value);
                } break;

                case WellknownName.Svg_R:
                {
                    spec.Radius = UserMapUtil.ParseGenericLength(attr.Value);
                } break;

                case WebDom.WellknownName.Svg_Fill:
                {
                    spec.ActualColor = CssValueParser.GetActualColor(attr.Value);
                } break;

                case WebDom.WellknownName.Svg_Stroke:
                {
                    spec.StrokeColor = CssValueParser.GetActualColor(attr.Value);
                } break;

                case WebDom.WellknownName.Svg_Stroke_Width:
                {
                    spec.StrokeWidth = UserMapUtil.ParseGenericLength(attr.Value);
                } break;

                case WebDom.WellknownName.Svg_Transform:
                {
                    //TODO: parse svg transform function
                } break;

                default:
                {
                    //other attrs
                } break;
                }
            }
        }
Ejemplo n.º 2
0
 static void CreateSvgCircle(SvgElement parentNode, HtmlElement elem)
 {
     SvgCircleSpec spec = new SvgCircleSpec();
     SvgCircle shape = new SvgCircle(spec, elem);
     parentNode.AddChild(shape);
     //translate attribute            
     foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
     {
         WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;
         switch (wellknownName)
         {
             case WebDom.WellknownName.Svg_Cx:
                 {
                     spec.X = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Cy:
                 {
                     spec.Y = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WellknownName.Svg_R:
                 {
                     spec.Radius = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Fill:
                 {
                     spec.ActualColor = CssValueParser.GetActualColor(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Stroke:
                 {
                     spec.StrokeColor = CssValueParser.GetActualColor(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Stroke_Width:
                 {
                     spec.StrokeWidth = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Transform:
                 {
                     //TODO: parse svg transform function  
                 }
                 break;
             default:
                 {
                     //other attrs
                 }
                 break;
         }
     }
 }