Example usage for org.apache.poi.xdgf.usermodel XDGFShape getShapeType

List of usage examples for org.apache.poi.xdgf.usermodel XDGFShape getShapeType

Introduction

In this page you can find the example usage for org.apache.poi.xdgf.usermodel XDGFShape getShapeType.

Prototype

public String getShapeType() 

Source Link

Usage

From source file:com.bbn.poi.xdgf.parsers.VisioPageParser.java

License:Apache License

protected void collectShapes() {

    pageContents.visitShapes(new ShapeVisitor() {

        @Override/*from  ww w  . j  a  v  a 2  s.  c o m*/
        public org.apache.poi.xdgf.usermodel.shape.ShapeVisitorAcceptor getAcceptor() {
            return new ShapeDataAcceptor();
        };

        @Override
        public void visit(XDGFShape shape, AffineTransform globalTransform, int level) {

            ShapeData shapeData = new ShapeData(shape, globalTransform);

            if (shapeData.hasText && reassignTextNodeToParent(shape, shapeData)) {
                return;
            }

            String id = pageId + ": " + shape.getID();
            Vertex vertex = graph.addVertex(id);

            shapeData.vertex = vertex;

            // useful properties for later... 
            vertex.setProperty("label", shape.getTextAsString());
            vertex.setProperty("shapeId", shape.getID());

            vertex.setProperty("group", "");
            vertex.setProperty("groupId", "");
            vertex.setProperty("inSecondaryGroup", false);
            vertex.setProperty("is1d", shape.isShape1D());
            vertex.setProperty("name", shape.getName());
            vertex.setProperty("pageName", pageName);
            vertex.setProperty("symbolName", shape.getSymbolName());
            vertex.setProperty("type", shape.getShapeType());

            // this isn't actually accurate
            //vertex.setProperty("visible", shape.isVisible());

            // local coordinates
            vertex.setProperty("x", shapeData.getCenterX());
            vertex.setProperty("y", shapeData.getCenterY());

            helper.onCreate(shapeData, shape);

            shapesMap.put(shape.getID(), shapeData);
            shapes.add(shapeData);
        }
    });
}