Exemplo n.º 1
0
        public void SymbolOfRightHalfCircleIntegrationTest()
        {
            Shape shape = new RightHalfCircle(50, 96, 32);

            Symbol symbol1 = new Symbol("M82,64 A 32,32 0 0,1 82,128"); //absolute upper to lower
            Symbol symbol2 = new Symbol("M82,64 a 32,32 0 0,1 0,64");   //relative upper to lower
            Symbol symbol3 = new Symbol("M82,128 A 32,32 0 1,0 82,64"); //absolute lower to upper
            Symbol symbol4 = new Symbol("M82,128 a 32,32 0 1,0 0,-64"); //relative lower to upper
            Assert.True(symbol1.Contains(shape));
            Assert.True(symbol2.Contains(shape));
            Assert.True(symbol3.Contains(shape));
            Assert.True(symbol4.Contains(shape));
        }
Exemplo n.º 2
0
        public void SymbolOfUpperHalfCircleIntegrationTest()
        {
            Shape shape = new UpperHalfCircle(50, 64, 32);

            Symbol symbol1 = new Symbol("M18,64 A 32,32 0 0,1 82,64"); //absolute left to right
            Symbol symbol2 = new Symbol("M18,64 a 32,32 0 0,1 64,0");  //relative left to right
            Symbol symbol3 = new Symbol("M82,64 A 32,32 0 1,0 18,64"); //absolute right to left
            Symbol symbol4 = new Symbol("M82,64 a 32,32 0 1,0 -64,0"); //relative right to left
            Assert.True(symbol1.Contains(shape));
            Assert.True(symbol2.Contains(shape));
            Assert.True(symbol3.Contains(shape));
            Assert.True(symbol4.Contains(shape));
        }
Exemplo n.º 3
0
 public bool Contains(Symbol symbol)
 {
     return symbols.Contains(symbol);
 }
Exemplo n.º 4
0
        private void PutShapesIntoSymbols()
        {
            shapes = shapes.OrderBy(s => s.X).ToList();

            Symbol symbol = new Symbol();
            int adjust = 0;

            for (int i = 0; i < shapes.Count; i++)
            {
                Shape shape = shapes[i];

                if (shape.X <= symbol.Width || symbol.Width == 0)
                {
                    if (symbol.Width == 0)
                    {
                        adjust -= shape.X;
                    }
                    symbol.AddShape(shape, adjust);

                    if (shape.X + shape.Width > symbol.Width)
                    {
                        symbol.Width = shape.X + shape.Width;
                    }
                }
                else
                {
                    symbols.Add(symbol);
                    adjust -= symbol.Width; 
                    symbol = new Symbol();
                    symbol.AddShape(shape, adjust);
                }
            }

            if (symbols.Count > 0)
            {
                symbols.Add(symbol);
            }
        }