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()
methodget(index)
 
Method Summary
methodadd(item)
Add the shape in the collection.
methodclear()
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.
methoditerator()
Reserved for internal use.
methodremove(item)
Remove the shape from the collection.
methodremoveAt(index)
methodremoveDependsOn(item)
Remove the shapes including DEPENDSON shapes from the collection.
methodunGroup(groupShape)
UnGroup the shape.
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
    • 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:
        id: int -
        Returns:
      • getShape

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

         clear()
      • removeAt

         removeAt(index)
      • iterator

        Iterator iterator()
        Reserved for internal use.