ShapeCollection

ShapeCollection class

Collection of Shapes.

Properties

NameTypeDescription
Countint
Item (int)Shape

Methods

NameDescription
addAdd the shape in the collection.
removeRemove the shape from the collection.
removeDependsOnRemove the shapes including DEPENDSON shapes from the collection.
unGroupUnGroup the shape.
groupGroup the shapes.

The shape in the groupItems should not be grouped. The shape must be in this Shapes collection. | | getShape | Gets the element at the specified name. | | getShapeIncludingChild | Gets the element including it’s child shape at the specified name. | | clear | | | removeAt | | | iterator | Reserved for internal use. |

ShapeCollection.Count property

Type: int

ShapeCollection.Item (int) property

Type: Shape

add(item)

Add the shape in the collection.

ParameterTypeDescription
itemShape

Returns: ID

remove(item)

Remove the shape from the collection.

ParameterTypeDescription
itemShapeShape

removeDependsOn(item)

Remove the shapes including DEPENDSON shapes from the collection.

ParameterTypeDescription
itemShapeShape

unGroup(groupShape)

UnGroup the shape.

ParameterTypeDescription
groupShapeShapethe group shape.

group(groupItems)

Group the shapes.

The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.

ParameterTypeDescription
groupItemsShape[]the group items.

Returns: Return the group shape.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var java = require("java");

diagram = new aspose.diagram.Diagram("GroupShapes.vsdx");

// get page by name
page = diagram.getPages().getPage("Page-3");

ss = new Array(3);
// extract and assign shapes to the array
ss[0] = page.getShapes().getShape(15);
ss[1] = page.getShapes().getShape(16);
ss[2] = page.getShapes().getShape(17);

// Initialize an array of shapes
jss = java.newArray('com.aspose.diagram.Shape', ss);
// mark array shapes as group
page.getShapes().group(jss);

diagram.save("out-GroupShapes.vsdx", aspose.diagram.SaveFileFormat.VSDX);

getShape(name) (1 of 2)

Gets the element at the specified name.

ParameterTypeDescription
nameString

getShape(ID) (2 of 2)

Gets the element at the specified ID.

ParameterTypeDescription
IDlong

getShapeIncludingChild(name) (1 of 2)

Gets the element including it’s child shape at the specified name.

ParameterTypeDescription
nameString

getShapeIncludingChild(id) (2 of 2)

Gets the element including it’s child shape at the specified id.

ParameterTypeDescription
idint

clear()

removeAt(index)

iterator()

Reserved for internal use.