123456789_123456789_123456789_123456789_123456789_

Class: Layout::Layer

Relationships
Inherits: Object

Overview

This is the interface to a LayOut Layer Definition. A layer definition specifies the document-wide information about a layer. To access the entities on a layer for a given page, use LayerInstance.

Examples:

# Grab a handle to an existing LayOut document.
doc = Layout::Document.open("C:/path/to/document.layout")

new_layer = doc.layers.add(true)
new_layer.name = "A new layer"

Version:

  • LayOut 2018

Constant Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#locked=(locked) (rw)

The #locked= method sets whether the Layer is locked.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layers.first.locked = false

Parameters:

  • locked (Boolean)

    true to lock the Layer, false to unlock it

Raises:

  • (ArgumentError)

    if the Layer could not be locked because there must be at least one unlocked, visible Layer

Version:

  • LayOut 2018

#locked?Boolean (rw)

The #locked? method returns whether the Layer is locked.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
is_locked = layer.first.locked?

Version:

  • LayOut 2018

#nameString (rw)

The #name method returns the name of the Layer.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layer_name = layers.first.name

Version:

  • LayOut 2018

#name=(name) (rw)

The #name= sets the name of the Layer.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layers.first.name = "Base layer"

Parameters:

Raises:

  • (ArgumentError)

    if name is an empty string

Version:

  • LayOut 2018

#shared?Boolean (readonly)

The #shared? method returns whether the Layer is shared.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
is_shared = layers.first.shared?

Version:

  • LayOut 2018

Instance Method Details

#==(other) ⇒ Boolean

The #== method checks to see if the two Layers are equal. This checks whether the Ruby Objects are pointing to the same internal object.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
document = doc.pages.first.document
doc.layers.first == document.layers.first

Parameters:

  • other (Layer)

Version:

  • LayOut 2018

#documentLayout::Document

The #document method returns the Document that the Layer belongs to.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_layer = doc.layers.first
# layer_doc should reference the same document as doc
layer_doc = first_layer.document

Version:

  • LayOut 2018

#layer_instanceLayout::LayerInstance #layer_instance(page) ⇒ Layout::LayerInstance

The #layer_instance method returns a LayerInstance from the Layer. If the Layer is shared, a Page does not have to be provided.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layer_instance = layers.first.layer_instance(page)

Overloads:

Raises:

  • (ArgumentError)

    if the Layer is not shared and no page is provided

Version:

  • LayOut 2018

#set_nonshared(page, unshare_action)

The #set_nonshared method sets the Layer to non-shared.

The unshare action can be one of the following values:

Layout::Layer::UNSHARELAYERACTION_CLEAR
Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE
Layout::Layer::UNSHARELAYERACTION_COPYTOALLPAGES

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layers.first.set_nonshared(page, Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE);

Parameters:

  • page (Layout::Page)

    The Page with the Layer to be non-shared.

  • unshare_action (Integer)

    The share action that specifies what to do with Entitys after the Layer is non-shared.

Raises:

  • (LockedLayerError)

    if the Layer is locked

  • (ArgumentError)

    if unshare_action is not a valid value

Version:

  • LayOut 2018

#set_shared(page, share_action)

The #set_shared method sets the Layer to shared.

The share action can be one of the following values:

Layout::Layer::SHARELAYERACTION_CLEAR
Layout::Layer::SHARELAYERACTION_KEEPONEPAGE
Layout::Layer::SHARELAYERACTION_MERGEALLPAGES

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layers.first.set_shared(page, Layout::Layer::SHARELAYERACTION_KEEPONEPAGE);

Parameters:

  • page (Layout::Page)

    The Page with the Layer to be shared.

  • share_action (Integer)

    The share action that specifies what to do with Entitys after the Layer is shared.

Raises:

Version:

  • LayOut 2018