Inheritance: SvgVisualElement
Exemple #1
0
        static void CreateSvgPolyline(SvgElement parentNode, HtmlElement elem)
        {
            SvgPolylineSpec spec  = new SvgPolylineSpec();
            SvgPolyline     shape = new SvgPolyline(spec, elem);

            parentNode.AddChild(shape);
            foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
            {
                WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;
                switch (wellknownName)
                {
                case WebDom.WellknownName.Svg_Points:
                {
                    //parse points
                    spec.Points = ParsePointList(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;
                }
            }
        }
Exemple #2
0
 static void CreateSvgPolyline(SvgElement parentNode, HtmlElement elem)
 {
     SvgPolylineSpec spec = new SvgPolylineSpec();
     SvgPolyline shape = new SvgPolyline(spec, elem);
     parentNode.AddChild(shape);
     foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
     {
         WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;
         switch (wellknownName)
         {
             case WebDom.WellknownName.Svg_Points:
                 {
                     //parse points
                     spec.Points = ParsePointList(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;
         }
     }
 }