asposediagram.api

Class ShapeCollection

Collection of Shapes.

Example:

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

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

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

for (it = page.getShapes().iterator(); it.hasNext();) {
    shape = it.next();
    if (shape.getName() == "Process1") {
        for (prop_it = shape.getProps().iterator(); prop_it.hasNext();) {
            prop = prop_it.next();
            console.log(prop.getLabel().getValue() + ": " + prop.getValue().getVal());
        }
        break;
    }
}

Property Getters/Setters Summary
methodgetCount()
Gets the number of elements actually contained in the collection.
methodget(index)
Gets the element at the specified index.
 
Method Summary
methodadd(item)
Add the shape in the collection.
methodclear()
Removes all elements from collection.
methodgetShape(name)
Gets the element at the specified name.
methodgetShape(ID)
Gets the element at the specified ID.
methodgetShapeIncludingChild(id)
Gets the element including it's child shape at the specified id.
methodgetShapeIncludingChild(name)
Gets the element including it's child shape at the specified name.
methodgroup(groupItems)
Group the shapes.
methodisExist(index)
Is exist item in the collection.
methoditerator()
Supports a simple iteration over a nongeneric collection.
methodremove(item)
Remove the shape from the collection.
methodremoveDependsOn(item)
Remove the shapes including DEPENDSON shapes from the collection.
methodunGroup(groupShape)
UnGroup the shape.
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
        Gets the number of elements actually contained in the collection.
      • get : Shape 

        Shape get(index)
        
        Gets the element at the specified index.
        Parameters:
        index -
        Returns:
    • Method Detail

      • add

        int add(item)
        Add the shape in the collection.
        Parameters:
        item: Shape -
        Returns:
        ID
      • remove

         remove(item)
        Remove the shape from the collection.
        Parameters:
        item: Shape - Shape
      • removeDependsOn

         removeDependsOn(item)
        Remove the shapes including DEPENDSON shapes from the collection.
        Parameters:
        item: Shape - Shape
      • unGroup

         unGroup(groupShape)
        UnGroup the shape.
        Parameters:
        groupShape: Shape - the group shape.
      • group

        Shape group(groupItems)
        Group the shapes. The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.
        Parameters:
        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

        Shape getShape(name)
        Gets the element at the specified name.
        Parameters:
        name: String -
        Returns:
      • getShapeIncludingChild

        Shape getShapeIncludingChild(name)
        Gets the element including it's child shape at the specified name.
        Parameters:
        name: String -
        Returns:
      • getShapeIncludingChild

        Shape getShapeIncludingChild(id)
        Gets the element including it's child shape at the specified id.
        Parameters:
        name -
        Returns:
      • getShape

        Shape getShape(ID)
        Gets the element at the specified ID.
        Parameters:
        ID: long -
        Returns:
      • iterator

        Iterator iterator()
        Supports a simple iteration over a nongeneric collection.
        Returns:
      • isExist

        boolean isExist(index)
        Is exist item in the collection.
        Parameters:
        index: int - index of element.
        Returns:
      • clear

         clear()
        Removes all elements from collection.