示例#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));
        }
示例#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));
        }
示例#3
0
 public bool Contains(Symbol symbol)
 {
     return symbols.Contains(symbol);
 }
示例#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);
            }
        }