Esempio n. 1
0
        public void ParseComponent_Value(string css, CssComponent expectedBlock)
        {
            var parser    = CreateParser(css);
            var component = parser.ParseComponent();

            Assert.That(component, Is.EqualTo(expectedBlock));
        }
Esempio n. 2
0
        public void ParseDeclaration(string css, CssComponent expectedDeclaration)
        {
            var parser      = CreateParser(css);
            var declaration = parser.ParseDeclaration();

            Assert.That(declaration, Is.EqualTo(expectedDeclaration));
        }
Esempio n. 3
0
        public void ParseDeclarationList_SingleDeclaration(string css, CssComponent expectedDeclaration)
        {
            var parser       = CreateParser(css);
            var declarations = parser.ParseDeclarationList().ToList();

            Assert.That(declarations, Is.EquivalentTo(new[] { expectedDeclaration }));
        }
Esempio n. 4
0
            private CssAtRule ConsumeAtRule(CssToken token)
            {
                var name    = token.StringValue;
                var grammar = _grammar.GetAtRuleGrammar(name);

                if (grammar == null)
                {
                    // At rule not supported by grammar
                    SkipAtRule();
                    return(null);
                }

                CssComponent prelude = null;
                CssBlock     block   = null;

                if (TryRead(out token))
                {
                    var preludeScope = new AtRulePreludeScope(this, grammar);
                    prelude = grammar.ParseAtRulePrelude(preludeScope);
                    if (token.TokenType == CssTokenType.LeftCurlyBracket)
                    {
                        var blockScope = new RuleBlockScope(this, grammar);
                        block = new CssBlock(CssBlockType.CurlyBrackets, _grammar.ParseAtRuleBlock(blockScope));
                    }
                }

                return(grammar.CreateAtRule(name, prelude ?? CssComponent.Empty, block));
            }
Esempio n. 5
0
 public virtual CssAtRule CreateAtRule(string name, CssComponent prelude, CssBlock block)
 {
     return(new CssAtRule(name, prelude, block));
 }
Esempio n. 6
0
 public virtual CssQualifiedRule CreateQualifiedRule(CssComponent prelude, CssBlock block)
 {
     return(new CssQualifiedRule(prelude, block));
 }
Esempio n. 7
0
        private void FillTGeneral()
        {
            //Example of custom T section
            CrossSectionComponent css = new CrossSectionComponent();

            css.Name = "CSS1";
            css.Id   = 6;


            LineSegment2D seg = null;

            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = -0.002, Y = -0.1 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = 0.002, Y = -0.1 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = 0.002, Y = -0.002 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = 0.002, Y = 0.002 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = 0.002, Y = 0.1 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = -0.002, Y = 0.1 }; outline.Segments.Add(seg);
            //seg = new LineSegment2D(); seg.EndPoint = new Point2D() { X = -0.002, Y = 0.002 }; outline.Segments.Add(seg);

            {
                CssComponent comp = new CssComponent();
                comp.Material = new ReferenceElement(openStructModel.MatSteel.First());
                comp.Phase    = 0;
                var reg     = new Region2D();
                var outline = new PolyLine2D();
                outline.StartPoint = new Point2D()
                {
                    X = -0.15, Y = 0.002
                };
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = -0.15, Y = -0.002
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = 0.15, Y = -0.002
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = 0.15, Y = 0.002
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = -0.15, Y = 0.002
                }; outline.Segments.Add(seg);
                reg.Outline   = outline;
                comp.Geometry = reg;
                css.Components.Add(comp);
            }
            {
                CssComponent comp = new CssComponent();
                comp.Material = new ReferenceElement(openStructModel.MatSteel.First());
                comp.Phase    = 0;
                var reg     = new Region2D();
                var outline = new PolyLine2D();
                outline.StartPoint = new Point2D()
                {
                    X = -0.002, Y = -0.002
                };
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = -0.002, Y = -0.1
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = 0.002, Y = -0.1
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = 0.002, Y = 0.002
                }; outline.Segments.Add(seg);
                seg = new LineSegment2D(); seg.EndPoint = new Point2D()
                {
                    X = -0.002, Y = -0.002
                }; outline.Segments.Add(seg);
                reg.Outline   = outline;
                comp.Geometry = reg;
                css.Components.Add(comp);
            }


            openStructModel.AddObject(css);
        }