LayoutFarm.WebDom.CssRuleSetGroup.GetPropertyDeclIter C# (CSharp) Method

GetPropertyDeclIter() public method

public GetPropertyDeclIter ( ) : IEnumerable
return IEnumerable
        public IEnumerable<WebDom.CssPropertyDeclaration> GetPropertyDeclIter()
        {
            if (_assignments != null)
            {
                var decls = this._assignments.GetDeclarations();
                foreach (var decl in decls.Values)
                {
                    yield return decl;
                }
            }
        }
        public WebDom.CssPropertyDeclaration GetPropertyDeclaration(WebDom.WellknownCssPropertyName wellknownPropName)

Usage Example

Example #1
0
        VgVisualElement CreateTextElem(VgVisualElement parentNode, SvgElement elem, SvgTextSpec textspec)
        {
            //text render element
            VgVisualElement vgVisElem = new VgVisualElement(WellknownSvgElementName.Text, textspec, _vgVisualDoc);

            vgVisElem.DomElem = elem;
            //some att

            if (textspec.Class != null && _activeSheet1 != null)
            {
                //resolve style definition
                LayoutFarm.WebDom.CssRuleSetGroup ruleSetGroup = _activeSheet1.GetRuleSetForClassName(textspec.Class);
                if (ruleSetGroup != null)
                {
                    //assign
                    foreach (LayoutFarm.WebDom.CssPropertyDeclaration propDecl in ruleSetGroup.GetPropertyDeclIter())
                    {
                        switch (propDecl.WellknownPropertyName)
                        {
                        case LayoutFarm.WebDom.WellknownCssPropertyName.Font:
                            //set font detail
                            break;

                        case LayoutFarm.WebDom.WellknownCssPropertyName.FontStyle:
                            //convert font style
                            break;

                        case LayoutFarm.WebDom.WellknownCssPropertyName.FontSize:
                            textspec.FontSize = propDecl.GetPropertyValue(0).AsLength();
                            break;

                        case LayoutFarm.WebDom.WellknownCssPropertyName.FontFamily:
                            textspec.FontFace = propDecl.GetPropertyValue(0).ToString();
                            break;

                        case LayoutFarm.WebDom.WellknownCssPropertyName.Fill:
                            textspec.FillColor = LayoutFarm.WebDom.Parser.CssValueParser.ParseCssColor(propDecl.GetPropertyValue(0).ToString());
                            break;

                        case LayoutFarm.WebDom.WellknownCssPropertyName.Unknown:
                        {
                            switch (propDecl.UnknownRawName)
                            {
                            case "fill":
                                //svg
                                break;
                            }
                        }
                        break;
                        }
                    }
                }
            }


            ReEvaluateArgs a = new ReEvaluateArgs(_containerWidth, _containerHeight, _emHeight); //temp fix

            textspec.ActualX = ConvertToPx(textspec.X, ref a);
            textspec.ActualY = ConvertToPx(textspec.Y, ref a);


            AssignAttributes(textspec);

            //text x,y


            parentNode.AddChildElement(vgVisElem);
            return(vgVisElem);
        }