Class: Layout::Layer

Inherits:
Object
  • Object
show all

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.add_layer(true)
new_layer.name = "A new layer"

Version:

  • LayOut 2018

Constant Summary #

Layout::Layer::UNSHARELAYERACTION_CLEAR
Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE
Layout::Layer::UNSHARELAYERACTION_COPYTOALLPAGES
Layout::Layer::SHARELAYERACTION_CLEAR
Layout::Layer::SHARELAYERACTION_KEEPONEPAGE
Layout::Layer::SHARELAYERACTION_MERGEALLPAGES

Instance Method Summary # collapse

Instance Method Details

#==(other) ⇒ Boolean

The #== method checks to see if the two Layout::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:

Returns:

  • (Boolean)

Version:

  • LayOut 2018

#documentLayout::Document

The #document method returns the Document that the Layout::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

Returns:

Version:

  • LayOut 2018

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

The #layer_instance method returns a Layout::LayerInstance from the Layout::Layer. If the Layout::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 Layout::Layer is not shared and no page is provided

Version:

  • LayOut 2018

#locked=(locked) ⇒ Object

The #locked= method sets whether the Layout::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 Layout::Layer, false to unlock it

Raises:

Version:

  • LayOut 2018

#locked?Boolean

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

Examples:

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

Returns:

  • (Boolean)
  • (Boolean)

Version:

  • LayOut 2018

#nameString

The #name method returns the name of the Layout::Layer.

Examples:

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

Returns:

Version:

  • LayOut 2018

#name=(name) ⇒ Object

The #name= sets the name of the Layout::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

#set_nonshared(page, unshare_action) ⇒ Object

The #set_nonshared method sets the Layout::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:

Raises:

Version:

  • LayOut 2018

#set_shared(page, share_action) ⇒ Object

The #set_shared method sets the Layout::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:

Raises:

Version:

  • LayOut 2018

#shared?Boolean

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

Examples:

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

Returns:

  • (Boolean)
  • (Boolean)

Version:

  • LayOut 2018