ShapeCollection
ShapeCollection class
Collection of Shapes.
Properties
| Name | Type | Description |
|---|---|---|
| Count | int | |
| Item (int) | Shape |
Methods
| Name | Description |
|---|---|
| add | Add the shape in the collection. |
| remove | Remove the shape from the collection. |
| removeDependsOn | Remove the shapes including DEPENDSON shapes from the collection. |
| unGroup | UnGroup the shape. |
| group | Group 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.
| Parameter | Type | Description |
|---|---|---|
| item | Shape |
Returns: ID
remove(item)
Remove the shape from the collection.
| Parameter | Type | Description |
|---|---|---|
| item | Shape | Shape |
removeDependsOn(item)
Remove the shapes including DEPENDSON shapes from the collection.
| Parameter | Type | Description |
|---|---|---|
| item | Shape | Shape |
unGroup(groupShape)
UnGroup the shape.
| Parameter | Type | Description |
|---|---|---|
| groupShape | Shape | the group shape. |
group(groupItems)
Group the shapes.
The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.
| Parameter | Type | Description |
|---|---|---|
| groupItems | Shape[] | 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.
| Parameter | Type | Description |
|---|---|---|
| name | String |
getShape(ID) (2 of 2)
Gets the element at the specified ID.
| Parameter | Type | Description |
|---|---|---|
| ID | long |
getShapeIncludingChild(name) (1 of 2)
Gets the element including it’s child shape at the specified name.
| Parameter | Type | Description |
|---|---|---|
| name | String |
getShapeIncludingChild(id) (2 of 2)
Gets the element including it’s child shape at the specified id.
| Parameter | Type | Description |
|---|---|---|
| id | int |
clear()
removeAt(index)
iterator()
Reserved for internal use.