Package org.apache.poi.hssf.model

Examples of org.apache.poi.hssf.model.PolygonShape


        HSSFPatriarch patriarch = sh.createDrawingPatriarch();

        HSSFPolygon polygon = patriarch.createPolygon(new HSSFClientAnchor());
        polygon.setPolygonDrawArea( 100, 100 );
        polygon.setPoints( new int[]{0, 90, 50}, new int[]{5, 5, 44} );
        PolygonShape polygonShape = HSSFTestModelHelper.createPolygonShape(1024, polygon);
        polygon.setShapeId(1024);

        assertEquals(polygon.getEscherContainer().getChildRecords().size(), 4);
        assertEquals(polygonShape.getSpContainer().getChildRecords().size(), 4);

        //sp record
        byte[] expected = polygonShape.getSpContainer().getChild(0).serialize();
        byte[] actual = polygon.getEscherContainer().getChild(0).serialize();

        assertEquals(expected.length, actual.length);
        assertArrayEquals(expected, actual);

        expected = polygonShape.getSpContainer().getChild(2).serialize();
        actual = polygon.getEscherContainer().getChild(2).serialize();

        assertEquals(expected.length, actual.length);
        assertArrayEquals(expected, actual);

        expected = polygonShape.getSpContainer().getChild(3).serialize();
        actual = polygon.getEscherContainer().getChild(3).serialize();

        assertEquals(expected.length, actual.length);
        assertArrayEquals(expected, actual);

        ObjRecord obj = polygon.getObjRecord();
        ObjRecord objShape = polygonShape.getObjRecord();

        expected = obj.serialize();
        actual = objShape.serialize();

        assertEquals(expected.length, actual.length);
View Full Code Here


        HSSFPolygon polygon = patriarch.createPolygon(new HSSFClientAnchor());
        polygon.setPolygonDrawArea( 100, 100 );
        polygon.setPoints( new int[]{0, 90, 50, 90}, new int[]{5, 5, 44, 88} );

        PolygonShape polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon);

        EscherArrayProperty verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES);
        EscherArrayProperty verticesProp2 = ((EscherOptRecord)polygonShape.getSpContainer().getChildById(EscherOptRecord.RECORD_ID))
                .lookup(EscherProperties.GEOMETRY__VERTICES);

        assertEquals(verticesProp1.getNumberOfElementsInArray(), verticesProp2.getNumberOfElementsInArray());
        assertEquals(verticesProp1.toXml(""), verticesProp2.toXml(""));
       
        polygon.setPoints(new int[]{1,2,3}, new int[] {4,5,6});
        assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3});
        assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6});

        polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon);
        verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES);
        verticesProp2 = ((EscherOptRecord)polygonShape.getSpContainer().getChildById(EscherOptRecord.RECORD_ID))
                .lookup(EscherProperties.GEOMETRY__VERTICES);

        assertEquals(verticesProp1.getNumberOfElementsInArray(), verticesProp2.getNumberOfElementsInArray());
        assertEquals(verticesProp1.toXml(""), verticesProp2.toXml(""));
    }
View Full Code Here

        HSSFPatriarch patriarch = sh.createDrawingPatriarch();

        HSSFPolygon polygon = patriarch.createPolygon(new HSSFClientAnchor());
        polygon.setPolygonDrawArea( 100, 100 );
        polygon.setPoints( new int[]{0, 90, 50}, new int[]{5, 5, 44} );
        PolygonShape polygonShape = HSSFTestModelHelper.createPolygonShape(1024, polygon);
        polygon.setShapeId(1024);

        assertEquals(polygon.getEscherContainer().getChildRecords().size(), 4);
        assertEquals(polygonShape.getSpContainer().getChildRecords().size(), 4);

        //sp record
        byte[] expected = polygonShape.getSpContainer().getChild(0).serialize();
        byte[] actual = polygon.getEscherContainer().getChild(0).serialize();

        assertEquals(expected.length, actual.length);
        assertTrue(Arrays.equals(expected, actual));

        expected = polygonShape.getSpContainer().getChild(2).serialize();
        actual = polygon.getEscherContainer().getChild(2).serialize();

        assertEquals(expected.length, actual.length);
        assertTrue(Arrays.equals(expected, actual));

        expected = polygonShape.getSpContainer().getChild(3).serialize();
        actual = polygon.getEscherContainer().getChild(3).serialize();

        assertEquals(expected.length, actual.length);
        assertTrue(Arrays.equals(expected, actual));

        ObjRecord obj = polygon.getObjRecord();
        ObjRecord objShape = polygonShape.getObjRecord();

        expected = obj.serialize();
        actual = objShape.serialize();

        assertEquals(expected.length, actual.length);
View Full Code Here

        HSSFPolygon polygon = patriarch.createPolygon(new HSSFClientAnchor());
        polygon.setPolygonDrawArea( 100, 100 );
        polygon.setPoints( new int[]{0, 90, 50, 90}, new int[]{5, 5, 44, 88} );

        PolygonShape polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon);

        EscherArrayProperty verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES);
        EscherArrayProperty verticesProp2 = ((EscherOptRecord)polygonShape.getSpContainer().getChildById(EscherOptRecord.RECORD_ID))
                .lookup(EscherProperties.GEOMETRY__VERTICES);

        assertEquals(verticesProp1.getNumberOfElementsInArray(), verticesProp2.getNumberOfElementsInArray());
        assertEquals(verticesProp1.toXml(""), verticesProp2.toXml(""));
       
        polygon.setPoints(new int[]{1,2,3}, new int[] {4,5,6});
        assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3}));
        assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6}));

        polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon);
        verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES);
        verticesProp2 = ((EscherOptRecord)polygonShape.getSpContainer().getChildById(EscherOptRecord.RECORD_ID))
                .lookup(EscherProperties.GEOMETRY__VERTICES);

        assertEquals(verticesProp1.getNumberOfElementsInArray(), verticesProp2.getNumberOfElementsInArray());
        assertEquals(verticesProp1.toXml(""), verticesProp2.toXml(""));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.model.PolygonShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.