GeometryShape

Inheritance: java.lang.Object, com.aspose.slides.Shape

All Implemented Interfaces: com.aspose.slides.IGeometryShape

public abstract class GeometryShape extends Shape implements IGeometryShape

Represents the parent class for all geometric shapes.

Methods

Method Description
getGeometryPaths() Returns the copy of path of the geometry shape.
setGeometryPath(IGeometryPath geometryPath) Updates shape geometry from IGeometryPath object.
setGeometryPaths(IGeometryPath[] geometryPaths) Updates shape geometry from array of IGeometryPath.
getShapeStyle() Returns shape’s style object.
getShapeType() Returns or sets the geometry preset type.
setShapeType(int value) Returns or sets the geometry preset type.
getAdjustments() Returns a collection of shape’s adjustment values.
createShapeElements() Creates and returns array of shape’s elements.

getGeometryPaths()

public final IGeometryPath[] getGeometryPaths()

Returns the copy of path of the geometry shape. Coordinates are relative to the left top corner of the shape.


Presentation pres = new Presentation();
 try {
     GeometryShape shape = (GeometryShape) pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
     IGeometryPath geometryPath = shape.getGeometryPaths()[0];
     geometryPath.lineTo(100, 50, 1);
     geometryPath.lineTo(100, 50, 4);
     shape.setGeometryPath(geometryPath);
     pres.save("output.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: com.aspose.slides.IGeometryPath[] - Array of IGeometryPath

setGeometryPath(IGeometryPath geometryPath)

public final void setGeometryPath(IGeometryPath geometryPath)

Updates shape geometry from IGeometryPath object. Coordinates must be relative to the left top corner of the shape. Changes the type of the shape (ShapeType(#getShapeType/#setShapeType(int))) to ShapeType#Custom.


Presentation pres = new Presentation();
 try {
     GeometryShape shape = (GeometryShape) pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
     GeometryPath geometryPath0 = new GeometryPath();
     geometryPath0.moveTo(0, 0);
     geometryPath0.lineTo(shape.getWidth(), 0);
     geometryPath0.lineTo(shape.getWidth(), shape.getHeight()/3);
     geometryPath0.lineTo(0, shape.getHeight() / 3);
     geometryPath0.closeFigure();
     GeometryPath geometryPath1 = new GeometryPath();
     geometryPath1.moveTo(0, shape.getHeight()/3 * 2);
     geometryPath1.lineTo(shape.getWidth(), shape.getHeight() / 3 * 2);
     geometryPath1.lineTo(shape.getWidth(), shape.getHeight());
     geometryPath1.lineTo(0, shape.getHeight());
     geometryPath1.closeFigure();
     shape.setGeometryPaths(new GeometryPath[] { geometryPath0, geometryPath1});
     pres.save("output.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

Parameter Type Description
geometryPath IGeometryPath Geometry path

setGeometryPaths(IGeometryPath[] geometryPaths)

public final void setGeometryPaths(IGeometryPath[] geometryPaths)

Updates shape geometry from array of IGeometryPath. Coordinates must be relative to the left top corner of the shape. Changes the type of the shape (ShapeType(#getShapeType/#setShapeType(int))) to ShapeType#Custom.


Presentation pres = new Presentation();
 try {
     GeometryShape shape = (GeometryShape)pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
     IGeometryPath geometryPath = shape.getGeometryPaths()[0];
     geometryPath.lineTo(100, 50, 1);
     geometryPath.lineTo(100, 50, 4);
     shape.setGeometryPath(geometryPath);
     pres.save("output.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

Parameter Type Description
geometryPaths com.aspose.slides.IGeometryPath[] Array geometry paths

getShapeStyle()

public final IShapeStyle getShapeStyle()

Returns shape’s style object. Read-only IShapeStyle.

Returns: IShapeStyle

getShapeType()

public int getShapeType()

Returns or sets the geometry preset type. Note: on value changing all adjustment values will reset to their default values. Read/write ShapeType.

Returns: int

setShapeType(int value)

public void setShapeType(int value)

Returns or sets the geometry preset type. Note: on value changing all adjustment values will reset to their default values. Read/write ShapeType.

Parameters:

Parameter Type Description
value int

getAdjustments()

public final IAdjustValueCollection getAdjustments()

Returns a collection of shape’s adjustment values. Read-only IAdjustValueCollection.

Returns: IAdjustValueCollection

createShapeElements()

public final IShapeElement[] createShapeElements()

Creates and returns array of shape’s elements.

Returns: com.aspose.slides.IShapeElement[] - Array of ShapeElement