Example:
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("Layers.vsdx");
// get Visio page
page = diagram.getPages().getPage("Page-1");
// initialize a new Layer class object
layer = new aspose.diagram.Layer();
// set Layer name
layer.getName().setValue("Layer1");
// set Layer Visibility
layer.getVisible().setValue(aspose.diagram.BOOL.TRUE);
// set the color checkbox of Layer
layer.setColorChecked(aspose.diagram.BOOL.TRUE);
// add Layer to the particular page sheet
page.getPageSheet().getLayers().add(layer);
// get shape by ID
shape = page.getShapes().getShape(3);
// assign shape to this new Layer
shape.getLayerMem().getLayerMember().setValue((layer.getIX()).toString());
diagram.save("out-AddLayer.vsdx", aspose.diagram.SaveFileFormat.VSDX);
| Constructor Summary |
|---|
Layer()
Constructor. |
| Property Getters/Setters Summary | ||
|---|---|---|
method | getActive() | |
Specifies whether a layer is active. Shapes that are not preassigned to layers are assigned to the active layer(s) when dropped on the drawing page.
|
||
method | getColor() | |
The index of the color in the color table used toThe index of the color in the color table used to display the layer or An RGB value specifying a custom color not in the color table (for example, #ff9900 ). display the layer
|
||
method | getColorTrans() | |
Determines the degree of transparency for a layer or shape's text color, from 0 (completely opaque) to 1 (completely transparent).
|
||
method | getDel() | |
method | setDel(value) | |
| A flag indicating whether the element has been deleted locally. A value of 1 indicates that the element was deleted locally. The value of the property is BOOL integer constant. | ||
method | getGlue() | |
Specifies whether shapes belonging to the layer can be glued to.
|
||
method | isColorChecked() | |
method | setColorChecked(value) | |
| A flag indicating whether the element has been checked locally. A value of 1 indicates that the element was checked locally. The value of the property is BOOL integer constant. | ||
method | getIX() | |
method | setIX(value) | |
| The zero-based index of the element within its parent element. | ||
method | getLock() | |
Specifies whether shapes belonging to the layer are locked against being selected or edited.
|
||
method | getName() | |
Name element specifies the name of a layer.
|
||
method | getNameUniv() | |
Specifies the universal name of a layer.
|
||
method | getPrint() | |
Specifies whether shapes belonging to the layer are printed when the drawing is printed.
|
||
method | getSnap() | |
Specifies whether other shapes can snap to shapes assigned to the layer. Shapes assigned to the layer can snap to other shapes, but other shapes cannot snap to them.
|
||
method | getStatus() | |
Specifies whether the layer is a valid layer for a document.
|
||
method | getVisible() | |
Specifies whether shapes belonging to the layer are visible on the drawing page.
|
||
int getIX() / setIX(value)
int getDel() / setDel(value)
ColorValue getColor()
int isColorChecked() / setColorChecked(value)
BoolValue getStatus()
BoolValue getVisible()
BoolValue getPrint()
BoolValue getActive()
BoolValue getLock()
BoolValue getSnap()
BoolValue getGlue()
DoubleValue getColorTrans()