/** * Create a new Polygon. This constructor is used when a new shape is created. * * @param parent the parent of this Shape. For example, if this text box is a cell * in a table then the parent is Table. */ public Polygon(Shape parent){ super(null, parent); _escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup); }
/** * Set the polygon vertices * * @param points the polygon vertices */ public void setPoints(Point2D[] points) { float[] xpoints = new float[points.length]; float[] ypoints = new float[points.length]; for (int i = 0; i < points.length; i++) { xpoints[i] = (float)points[i].getX(); ypoints[i] = (float)points[i].getY(); } setPoints(xpoints, ypoints); }
float right = findBiggest(xPoints); float bottom = findBiggest(yPoints); float left = findSmallest(xPoints); float top = findSmallest(yPoints); EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, (int)((right - left)*POINT_DPI/MASTER_DPI))); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, (int)((bottom - top)*POINT_DPI/MASTER_DPI)));
float right = findBiggest(xPoints); float bottom = findBiggest(yPoints); float left = findSmallest(xPoints); float top = findSmallest(yPoints); AbstractEscherOptRecord opt = getEscherOptRecord(); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, Units.pointsToMaster(right - left))); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, Units.pointsToMaster(bottom - top)));
/** * Create a new Polygon. This constructor is used when a new shape is created. * * @param parent the parent of this Shape. For example, if this text box is a cell * in a table then the parent is Table. */ public Polygon(ShapeContainer<HSLFShape,HSLFTextParagraph> parent){ super((EscherContainerRecord)null, parent); createSpContainer(ShapeType.NOT_PRIMITIVE, parent instanceof HSLFGroupShape); }
/** * Set the polygon vertices * * @param points the polygon vertices */ public void setPoints(Point2D[] points) { float[] xpoints = new float[points.length]; float[] ypoints = new float[points.length]; for (int i = 0; i < points.length; i++) { xpoints[i] = (float)points[i].getX(); ypoints[i] = (float)points[i].getY(); } setPoints(xpoints, ypoints); }