sketchup-api-stubs 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/SketchUp/Geom/BoundingBox.rb +17 -20
- data/SketchUp/Geom/Bounds2d.rb +172 -0
- data/SketchUp/Geom/LatLong.rb +31 -16
- data/SketchUp/Geom/OrientedBounds2d.rb +102 -0
- data/SketchUp/Geom/Point2d.rb +365 -0
- data/SketchUp/Geom/Point3d.rb +121 -110
- data/SketchUp/Geom/PolygonMesh.rb +30 -21
- data/SketchUp/Geom/Transformation.rb +8 -4
- data/SketchUp/Geom/Transformation2d.rb +125 -0
- data/SketchUp/Geom/UTM.rb +43 -37
- data/SketchUp/Geom/Vector2d.rb +497 -0
- data/SketchUp/Geom/Vector3d.rb +143 -131
- data/SketchUp/Layout.rb +25 -0
- data/SketchUp/Layout/AngularDimension.rb +569 -0
- data/SketchUp/Layout/AutoTextDefinition.rb +417 -0
- data/SketchUp/Layout/AutoTextDefinitions.rb +186 -0
- data/SketchUp/Layout/ConnectionPoint.rb +70 -0
- data/SketchUp/Layout/Document.rb +458 -0
- data/SketchUp/Layout/Ellipse.rb +29 -0
- data/SketchUp/Layout/Entities.rb +155 -0
- data/SketchUp/Layout/Entity.rb +363 -0
- data/SketchUp/Layout/FormattedText.rb +349 -0
- data/SketchUp/Layout/Grid.rb +131 -0
- data/SketchUp/Layout/Group.rb +261 -0
- data/SketchUp/Layout/Image.rb +86 -0
- data/SketchUp/Layout/Label.rb +371 -0
- data/SketchUp/Layout/Layer.rb +222 -0
- data/SketchUp/Layout/LayerInstance.rb +128 -0
- data/SketchUp/Layout/Layers.rb +232 -0
- data/SketchUp/Layout/LinearDimension.rb +563 -0
- data/SketchUp/Layout/LockedEntityError.rb +10 -0
- data/SketchUp/Layout/LockedLayerError.rb +11 -0
- data/SketchUp/Layout/Page.rb +187 -0
- data/SketchUp/Layout/PageInfo.rb +393 -0
- data/SketchUp/Layout/Pages.rb +216 -0
- data/SketchUp/Layout/Path.rb +326 -0
- data/SketchUp/Layout/Rectangle.rb +174 -0
- data/SketchUp/Layout/SketchUpModel.rb +522 -0
- data/SketchUp/Layout/Style.rb +1520 -0
- data/SketchUp/Layout/Table.rb +290 -0
- data/SketchUp/Layout/TableCell.rb +149 -0
- data/SketchUp/Layout/TableColumn.rb +139 -0
- data/SketchUp/Layout/TableRow.rb +135 -0
- data/SketchUp/Sketchup/Animation.rb +7 -4
- data/SketchUp/Sketchup/ArcCurve.rb +10 -10
- data/SketchUp/Sketchup/AttributeDictionaries.rb +13 -4
- data/SketchUp/Sketchup/AttributeDictionary.rb +12 -12
- data/SketchUp/Sketchup/Color.rb +68 -78
- data/SketchUp/Sketchup/ComponentDefinition.rb +60 -60
- data/SketchUp/Sketchup/ComponentInstance.rb +57 -55
- data/SketchUp/Sketchup/DefinitionList.rb +34 -17
- data/SketchUp/Sketchup/Drawingelement.rb +19 -21
- data/SketchUp/Sketchup/Edge.rb +22 -24
- data/SketchUp/Sketchup/Entities.rb +173 -162
- data/SketchUp/Sketchup/Entity.rb +71 -55
- data/SketchUp/Sketchup/Face.rb +45 -44
- data/SketchUp/Sketchup/Group.rb +47 -49
- data/SketchUp/Sketchup/Image.rb +16 -0
- data/SketchUp/Sketchup/ImageRep.rb +226 -0
- data/SketchUp/Sketchup/InstancePath.rb +13 -13
- data/SketchUp/Sketchup/Layer.rb +15 -17
- data/SketchUp/Sketchup/Material.rb +40 -30
- data/SketchUp/Sketchup/Materials.rb +40 -22
- data/SketchUp/Sketchup/Menu.rb +5 -5
- data/SketchUp/Sketchup/Model.rb +230 -228
- data/SketchUp/Sketchup/Page.rb +32 -0
- data/SketchUp/Sketchup/Pages.rb +3 -4
- data/SketchUp/Sketchup/RenderingOptions.rb +21 -16
- data/SketchUp/Sketchup/SectionPlane.rb +64 -0
- data/SketchUp/Sketchup/Selection.rb +20 -28
- data/SketchUp/Sketchup/ShadowInfo.rb +14 -14
- data/SketchUp/Sketchup/Text.rb +24 -26
- data/SketchUp/Sketchup/Texture.rb +28 -12
- data/SketchUp/Sketchup/Vertex.rb +14 -11
- data/SketchUp/Sketchup/View.rb +126 -116
- data/SketchUp/UI/Command.rb +17 -17
- data/SketchUp/UI/HtmlDialog.rb +8 -5
- data/SketchUp/UI/Notification.rb +1 -1
- data/SketchUp/UI/Toolbar.rb +13 -14
- data/SketchUp/UI/WebDialog.rb +55 -59
- data/SketchUp/_top_level.rb +139 -27
- data/SketchUp/{Array.rb → array.rb} +167 -30
- data/SketchUp/{Geom.rb → geom.rb} +9 -7
- data/SketchUp/{LanguageHandler.rb → languagehandler.rb} +15 -15
- data/SketchUp/{Length.rb → length.rb} +15 -15
- data/SketchUp/{Numeric.rb → numeric.rb} +19 -19
- data/SketchUp/sketchup.rb +167 -156
- data/SketchUp/{SketchupExtension.rb → sketchupextension.rb} +27 -27
- data/SketchUp/{String.rb → string.rb} +1 -1
- data/SketchUp/ui.rb +113 -87
- metadata +46 -9
@@ -0,0 +1,222 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This is the interface to a LayOut Layer Definition. A layer definition
|
5
|
+
# specifies the document-wide information about a layer. To access the entities
|
6
|
+
# on a layer for a given page, use {Layout::LayerInstance}.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # Grab a handle to an existing LayOut document.
|
10
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
11
|
+
#
|
12
|
+
# new_layer = doc.add_layer(true)
|
13
|
+
# new_layer.name = "A new layer"
|
14
|
+
#
|
15
|
+
# @version LayOut 2018
|
16
|
+
class Layout::Layer
|
17
|
+
|
18
|
+
# Constants
|
19
|
+
|
20
|
+
SHARELAYERACTION_CLEAR = nil # Stub value.
|
21
|
+
SHARELAYERACTION_KEEPONEPAGE = nil # Stub value.
|
22
|
+
SHARELAYERACTION_MERGEALLPAGES = nil # Stub value.
|
23
|
+
|
24
|
+
UNSHARELAYERACTION_CLEAR = nil # Stub value.
|
25
|
+
UNSHARELAYERACTION_COPYTOALLPAGES = nil # Stub value.
|
26
|
+
UNSHARELAYERACTION_COPYTOONEPAGE = nil # Stub value.
|
27
|
+
|
28
|
+
# Instance Methods
|
29
|
+
|
30
|
+
# The {#==} method checks to see if the two {Layout::Layer}s are equal.
|
31
|
+
# This checks whether the Ruby Objects are pointing to the same internal
|
32
|
+
# object.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
36
|
+
# document = doc.pages.first.document
|
37
|
+
# doc.layers.first == document.layers.first
|
38
|
+
#
|
39
|
+
# @param [Layout::Layer] other
|
40
|
+
#
|
41
|
+
# @return [Boolean]
|
42
|
+
#
|
43
|
+
# @version LayOut 2018
|
44
|
+
def ==(other)
|
45
|
+
end
|
46
|
+
|
47
|
+
# The {#document} method returns the {Layout::Document} that the {Layout::Layer}
|
48
|
+
# belongs to.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
52
|
+
# first_layer = doc.layers.first
|
53
|
+
# # layer_doc should reference the same document as doc
|
54
|
+
# layer_doc = first_layer.document
|
55
|
+
#
|
56
|
+
# @return [Layout::Document]
|
57
|
+
#
|
58
|
+
# @version LayOut 2018
|
59
|
+
def document
|
60
|
+
end
|
61
|
+
|
62
|
+
# The {#layer_instance} method returns a {Layout::LayerInstance} from the
|
63
|
+
# {Layout::Layer}. If the {Layout::Layer} is shared, a {Layout::Page} does not
|
64
|
+
# have to be provided.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
68
|
+
# layers = doc.layers
|
69
|
+
# page = doc.pages.first
|
70
|
+
# layer_instance = layers.first.layer_instance(page)
|
71
|
+
#
|
72
|
+
# @overload layer_instance
|
73
|
+
#
|
74
|
+
# @return [Layout::LayerInstance]
|
75
|
+
#
|
76
|
+
# @overload layer_instance(page)
|
77
|
+
#
|
78
|
+
# @param [Layout::Page] page
|
79
|
+
# @return [Layout::LayerInstance]
|
80
|
+
#
|
81
|
+
# @raise [ArgumentError] if the {Layout::Layer} is not shared and no page is
|
82
|
+
# provided
|
83
|
+
#
|
84
|
+
# @version LayOut 2018
|
85
|
+
def layer_instance(page)
|
86
|
+
end
|
87
|
+
|
88
|
+
# The {#locked=} method sets whether the {Layout::Layer} is locked.
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
92
|
+
# layers = doc.layers
|
93
|
+
# layers.first.locked = false
|
94
|
+
#
|
95
|
+
# @param [Boolean] locked
|
96
|
+
# +true+ to lock the {Layout::Layer}, +false+ to
|
97
|
+
# unlock it
|
98
|
+
#
|
99
|
+
# @raise [ArgumentError] if the {Layout::Layer} could not be locked because
|
100
|
+
# there must be at least one unlocked, visible {Layout::Layer}
|
101
|
+
#
|
102
|
+
# @version LayOut 2018
|
103
|
+
def locked=(locked)
|
104
|
+
end
|
105
|
+
|
106
|
+
# The {#locked?} method returns whether the {Layout::Layer} is locked.
|
107
|
+
#
|
108
|
+
# @example
|
109
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
110
|
+
# layers = doc.layers
|
111
|
+
# is_locked = layer.first.locked?
|
112
|
+
#
|
113
|
+
# @return [Boolean]
|
114
|
+
#
|
115
|
+
# @return [Boolean]
|
116
|
+
#
|
117
|
+
# @version LayOut 2018
|
118
|
+
def locked?
|
119
|
+
end
|
120
|
+
|
121
|
+
# The {#name} method returns the name of the {Layout::Layer}.
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
125
|
+
# layers = doc.layers
|
126
|
+
# layer_name = layers.first.name
|
127
|
+
#
|
128
|
+
# @return [String]
|
129
|
+
#
|
130
|
+
# @version LayOut 2018
|
131
|
+
def name
|
132
|
+
end
|
133
|
+
|
134
|
+
# The {#name=} sets the name of the {Layout::Layer}.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
138
|
+
# layers = doc.layers
|
139
|
+
# layers.first.name = "Base layer"
|
140
|
+
#
|
141
|
+
# @param [String] name
|
142
|
+
#
|
143
|
+
# @raise [ArgumentError] if name is an empty string
|
144
|
+
#
|
145
|
+
# @version LayOut 2018
|
146
|
+
def name=(name)
|
147
|
+
end
|
148
|
+
|
149
|
+
# The {#set_nonshared} method sets the {Layout::Layer} to non-shared.
|
150
|
+
#
|
151
|
+
# The unshare action can be one of the following values:
|
152
|
+
# [+Layout::Layer::UNSHARELAYERACTION_CLEAR+]
|
153
|
+
# [+Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE+]
|
154
|
+
# [+Layout::Layer::UNSHARELAYERACTION_COPYTOALLPAGES+]
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
158
|
+
# layers = doc.layers
|
159
|
+
# page = doc.pages.first
|
160
|
+
# layers.first.set_nonshared(page, Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE);
|
161
|
+
#
|
162
|
+
# @param [Layout::Page] page
|
163
|
+
# The {Layout::Page} with the {Layout::Layer} to be
|
164
|
+
# non-shared.
|
165
|
+
#
|
166
|
+
# @param [Integer] unshare_action
|
167
|
+
# The share action that specifies what to do
|
168
|
+
# with {Layout::Entity}s after the {Layout::Layer} is non-shared.
|
169
|
+
#
|
170
|
+
# @raise [ArgumentError] if unshare_action is not a valid value
|
171
|
+
#
|
172
|
+
# @raise [LockedLayerError] if the {Layout::Layer} is locked
|
173
|
+
#
|
174
|
+
# @version LayOut 2018
|
175
|
+
def set_nonshared(page, unshare_action)
|
176
|
+
end
|
177
|
+
|
178
|
+
# The {#set_shared} method sets the {Layout::Layer} to shared.
|
179
|
+
#
|
180
|
+
# The share action can be one of the following values:
|
181
|
+
# [+Layout::Layer::SHARELAYERACTION_CLEAR+]
|
182
|
+
# [+Layout::Layer::SHARELAYERACTION_KEEPONEPAGE+]
|
183
|
+
# [+Layout::Layer::SHARELAYERACTION_MERGEALLPAGES+]
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
187
|
+
# layers = doc.layers
|
188
|
+
# page = doc.pages.first
|
189
|
+
# layers.first.set_shared(page, Layout::Layer::SHARELAYERACTION_KEEPONEPAGE);
|
190
|
+
#
|
191
|
+
# @param [Layout::Page] page
|
192
|
+
# The {Layout::Page} with the {Layout::Layer} to be
|
193
|
+
# shared.
|
194
|
+
#
|
195
|
+
# @param [Integer] share_action
|
196
|
+
# The share action that specifies what to do with
|
197
|
+
# {Layout::Entity}s after the {Layout::Layer} is shared.
|
198
|
+
#
|
199
|
+
# @raise [ArgumentError] if share_action is not a valid value
|
200
|
+
#
|
201
|
+
# @raise [Layout::LockedLayerError] if the {Layout::Layer} is locked
|
202
|
+
#
|
203
|
+
# @version LayOut 2018
|
204
|
+
def set_shared(page, share_action)
|
205
|
+
end
|
206
|
+
|
207
|
+
# The {#shared?} method returns whether the {Layout::Layer} is shared.
|
208
|
+
#
|
209
|
+
# @example
|
210
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
211
|
+
# layers = doc.layers
|
212
|
+
# is_shared = layers.first.shared?
|
213
|
+
#
|
214
|
+
# @return [Boolean]
|
215
|
+
#
|
216
|
+
# @return [Boolean]
|
217
|
+
#
|
218
|
+
# @version LayOut 2018
|
219
|
+
def shared?
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# References an instance of a {Layout::Layer}. A {Layout::LayerInstance}
|
5
|
+
# provides access to the {Layout::Entity}s that are on it, as well as their
|
6
|
+
# draw order. {Layout::Group}s are not included in the list of {Layout::Entity}s
|
7
|
+
# associated with a {Layout::LayerInstance}, since the group hierarchy has no
|
8
|
+
# effect on entity draw order. Each {Layout::Page} has one
|
9
|
+
# {Layout::LayerInstance} for each {Layout::Layer} in the {Layout::Document}.
|
10
|
+
# Non-shared {Layout::LayerInstance}s are unique per {Layout::Page}, while
|
11
|
+
# shared {Layout::LayerInstance}s are shared across all {Layout::Page}s of the
|
12
|
+
# {Layout::Document}.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
16
|
+
# layers = doc.layers
|
17
|
+
# pages = doc.pages
|
18
|
+
# layers.each do |layer|
|
19
|
+
# layer_instance = layer.layer_instance(pages.first)
|
20
|
+
# entities = layer_instance.entities
|
21
|
+
# entities.each do |entity|
|
22
|
+
# new_index = rand(entities.length - 1)
|
23
|
+
# layer_instance.reorder_entity(entity, new_index)
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# @version LayOut 2018
|
28
|
+
class Layout::LayerInstance
|
29
|
+
|
30
|
+
# Instance Methods
|
31
|
+
|
32
|
+
# The {#==} method checks to see if the two {Layout::LayerInstance}s are equal.
|
33
|
+
# This checks whether the Ruby Objects are pointing to the same internal
|
34
|
+
# object.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
38
|
+
# document = doc.pages.first.document
|
39
|
+
# doc.page.layer_instances.first == document.page.layer_instances.first
|
40
|
+
#
|
41
|
+
# @param [Layout::LayerInstance] other
|
42
|
+
#
|
43
|
+
# @return [Boolean]
|
44
|
+
#
|
45
|
+
# @version LayOut 2018
|
46
|
+
def ==(other)
|
47
|
+
end
|
48
|
+
|
49
|
+
# The {#definition} method returns the {Layout::Layer} of the
|
50
|
+
# {Layout::LayerInstance}.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# layer_def = layer_instance.definition
|
54
|
+
#
|
55
|
+
# @return [Layout::Layer]
|
56
|
+
#
|
57
|
+
# @version LayOut 2018
|
58
|
+
def definition
|
59
|
+
end
|
60
|
+
|
61
|
+
# The {#entities} method returns the {Layout::Entities} on the
|
62
|
+
# {Layout::LayerInstance}.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
66
|
+
# layers = doc.layers
|
67
|
+
# pages = doc.pages
|
68
|
+
# first_layer = layers.first
|
69
|
+
# entities = first_layer.layer_instance.entities
|
70
|
+
#
|
71
|
+
# @return [Layout::Entities]
|
72
|
+
#
|
73
|
+
# @version LayOut 2018
|
74
|
+
def entities
|
75
|
+
end
|
76
|
+
|
77
|
+
# The {#entity_index} method returns the index of the {Layout::Entity} on the
|
78
|
+
# {Layout::LayerInstance}.
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
82
|
+
# layers = doc.layers
|
83
|
+
# pages = doc.pages
|
84
|
+
# instance = layers.first.layer_instance
|
85
|
+
# instance.entities.each_with_index { |entity, index|
|
86
|
+
# puts "#{index} == #{instance.entity_index(entity)}"
|
87
|
+
# }
|
88
|
+
#
|
89
|
+
# @param [Layout::Entity] entity
|
90
|
+
# The entity to get the index of.
|
91
|
+
#
|
92
|
+
# @raise [ArgumentError] if entity is not on the {Layout::LayerInstance}
|
93
|
+
#
|
94
|
+
# @return [Integer]
|
95
|
+
#
|
96
|
+
# @version LayOut 2018
|
97
|
+
def entity_index(entity)
|
98
|
+
end
|
99
|
+
|
100
|
+
# The {#reorder_entity} method moves the {Layout::Entity} to the specified
|
101
|
+
# index.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
105
|
+
# layers = doc.layers
|
106
|
+
# pages = doc.pages
|
107
|
+
# first_layer = layers.first
|
108
|
+
# first_layer.set_shared(pages.first, SHARELAYERACTION_KEEPONEPAGE);
|
109
|
+
# layer_instance = first_layer.layer_instance
|
110
|
+
# entities = layer_instance.entities
|
111
|
+
# # put the first entity into the back of the layer
|
112
|
+
# layer_instance.reorder_entity(entities.first, (entities.length - 1))
|
113
|
+
#
|
114
|
+
# @param [Layout::Entity] entity
|
115
|
+
# The {Layout::Entity} to reorder
|
116
|
+
#
|
117
|
+
# @param [Integer] index
|
118
|
+
# The desired index of the {Layout::Entity}
|
119
|
+
#
|
120
|
+
# @raise [IndexError] if index is out of range
|
121
|
+
#
|
122
|
+
# @raise [ArgumentError] if entity is not on the {Layout::LayerInstance}
|
123
|
+
#
|
124
|
+
# @version LayOut 2018
|
125
|
+
def reorder_entity(entity, index)
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
@@ -0,0 +1,232 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Layers class is a container class for all layers in a {Layout::Document}.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# # Grab a handle to the currently active document's layers
|
8
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
9
|
+
# layers = doc.layers
|
10
|
+
#
|
11
|
+
# # From here, we can add layers to or remove them from the document
|
12
|
+
# layers.add("New Layer")
|
13
|
+
# layers.remove(layers[0])
|
14
|
+
#
|
15
|
+
# @version LayOut 2018
|
16
|
+
class Layout::Layers
|
17
|
+
|
18
|
+
# Includes
|
19
|
+
|
20
|
+
include Enumerable
|
21
|
+
|
22
|
+
# Instance Methods
|
23
|
+
|
24
|
+
# The {#[]} method returns a value from the array of {Layout::Layer}s.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
28
|
+
# layers = doc.layers
|
29
|
+
# layer = layers[2]
|
30
|
+
#
|
31
|
+
# @param [Integer] index
|
32
|
+
# The index of the {Layout::Layer} to return.
|
33
|
+
#
|
34
|
+
# @raise [IndexError] if index is out of range
|
35
|
+
#
|
36
|
+
# @return [Layout::Layer]
|
37
|
+
#
|
38
|
+
# @version LayOut 2018
|
39
|
+
def [](index)
|
40
|
+
end
|
41
|
+
|
42
|
+
# The {#active} method returns the active {Layout::Layer} in the
|
43
|
+
# {Layout::Document}.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
47
|
+
# layer = doc.layers.active
|
48
|
+
#
|
49
|
+
# @return [Layout::Layer]
|
50
|
+
#
|
51
|
+
# @version LayOut 2018
|
52
|
+
def active
|
53
|
+
end
|
54
|
+
|
55
|
+
# The {#active=} method sets the active {Layout::Layer} that will be
|
56
|
+
# displayed the next time the {Layout::Document} is opened. This value will
|
57
|
+
# change whenever the {Layout::Layer} is changed in the {Layout::Document} in
|
58
|
+
# LayOut.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
62
|
+
# layers = doc.layers
|
63
|
+
# layers.active = layers[0]
|
64
|
+
#
|
65
|
+
# @overload active=(layer)
|
66
|
+
#
|
67
|
+
# @param [Layout::Layer] layer The {Layout::Layer} to set as the initial one
|
68
|
+
# @return [Layout::Layer]
|
69
|
+
#
|
70
|
+
# @raise [ArgumentError] if layer does not belong to the {Layout::Document}
|
71
|
+
# @raise [ArgumentError] if layer is locked or hidden on the current
|
72
|
+
# {Layout::Page}
|
73
|
+
#
|
74
|
+
# @overload active=(index)
|
75
|
+
#
|
76
|
+
# @param [Integer] index The index of {Layout::Layer} the to set as the
|
77
|
+
# initial one
|
78
|
+
# @return [Layout::Layer]
|
79
|
+
#
|
80
|
+
# @raise [ArgumentError] if index is out of range
|
81
|
+
# @raise [ArgumentError] if the {Layout::Layer} is locked or hidden on the
|
82
|
+
# current {Layout::Page}
|
83
|
+
#
|
84
|
+
# @version LayOut 2018
|
85
|
+
def active=(layer)
|
86
|
+
end
|
87
|
+
|
88
|
+
# The {#add} method adds a new {Layout::Layer} to the {Layout::Document}.
|
89
|
+
# The newly added {Layout::Layer} will be the last one in the
|
90
|
+
# {Layout::Document}.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
94
|
+
# new_layer = doc.layers.add
|
95
|
+
#
|
96
|
+
# @overload add(shared = false)
|
97
|
+
#
|
98
|
+
# @param [Boolean] shared +true+ to make the {Layout::Layer} shared, +false+
|
99
|
+
# for non-shared.
|
100
|
+
# @return [Layout::Layer] The newly added {Layout::Layer}.
|
101
|
+
#
|
102
|
+
# @overload add(name, shared = false)
|
103
|
+
#
|
104
|
+
# @param [String] name The name for the new layer.
|
105
|
+
# @param [Boolean] shared +true+ to make the {Layout::Layer} shared, +false+
|
106
|
+
# for non-shared.
|
107
|
+
# @return [Layout::Layer] The newly added {Layout::Layer}.
|
108
|
+
#
|
109
|
+
# @version LayOut 2018
|
110
|
+
def add(*args)
|
111
|
+
end
|
112
|
+
|
113
|
+
# The {#each} method iterates through all of the {Layout::Layer}s.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
117
|
+
# layers = doc.layers
|
118
|
+
# layers.each { |layer|
|
119
|
+
# puts layer.name
|
120
|
+
# }
|
121
|
+
#
|
122
|
+
# @version LayOut 2018
|
123
|
+
#
|
124
|
+
# @yieldparam [Layout::Layer] layer
|
125
|
+
def each
|
126
|
+
end
|
127
|
+
|
128
|
+
# The {#index} method returns the index of the {Layout::Layer}, or +nil+ if
|
129
|
+
# it doesn't exist in the {Layout::Document}.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
133
|
+
# layers = doc.layers
|
134
|
+
# layer_index = layers.index(layers.first) # Returns 0
|
135
|
+
#
|
136
|
+
# @param [Layout::Layer] layer
|
137
|
+
#
|
138
|
+
# @return [Integer, nil]
|
139
|
+
#
|
140
|
+
# @version LayOut 2018
|
141
|
+
def index(layer)
|
142
|
+
end
|
143
|
+
|
144
|
+
# The {#length} method returns the number of {Layout::Layer}s.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
148
|
+
# layers = doc.layers
|
149
|
+
# num_layers = layers.length
|
150
|
+
#
|
151
|
+
# @return [Integer]
|
152
|
+
#
|
153
|
+
# @version LayOut 2018
|
154
|
+
def length
|
155
|
+
end
|
156
|
+
|
157
|
+
# The {#remove} method deletes the given {Layout::Layer} from the
|
158
|
+
# {Layout::Document}.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
162
|
+
# layers = doc.layers
|
163
|
+
# layers.remove(layers[0])
|
164
|
+
#
|
165
|
+
# @overload remove(layer, delete_entities = false)
|
166
|
+
#
|
167
|
+
# @param [Layout::Layer] layer The {Layout::Layer} to be removed
|
168
|
+
# @param [Boolean] delete_entities Whether the {Layout::Entity}s on the
|
169
|
+
# deleted {Layout::Layer} should be deleted as well
|
170
|
+
#
|
171
|
+
# @raise [ArgumentError] if the {Layout::Layer} is not in the
|
172
|
+
# {Layout::Document}
|
173
|
+
# @raise [ArgumentError] if the {Layout::Layer} is the only one in the
|
174
|
+
# {Layout::Document}
|
175
|
+
#
|
176
|
+
# @overload remove(index, delete_entities = false)
|
177
|
+
#
|
178
|
+
# @param [Integer] index The index of the {Layout::Layer} to be removed
|
179
|
+
# @param [Boolean] delete_entities Whether the {Layout::Entity}s on the
|
180
|
+
# deleted {Layout::Layer} should be deleted as well
|
181
|
+
#
|
182
|
+
# @raise [IndexError] if index is out of range
|
183
|
+
# @raise [ArgumentError] if the {Layout::Layer} is the only one in the
|
184
|
+
# {Layout::Document}
|
185
|
+
#
|
186
|
+
# @version LayOut 2018
|
187
|
+
def remove(*args)
|
188
|
+
end
|
189
|
+
|
190
|
+
# The {#reorder} method moves a {Layout::Layer} to a different index
|
191
|
+
# within the {Layout::Document}'s list of layers. This will move the
|
192
|
+
# {Layout::Layer} such that its new index becomes new_index.
|
193
|
+
#
|
194
|
+
# @example
|
195
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
196
|
+
# layers = doc.layers
|
197
|
+
# layers.reorder(layers[1], 3)
|
198
|
+
#
|
199
|
+
# @overload reorder(layer, new_index)
|
200
|
+
#
|
201
|
+
# @param [Layout::Layer] layer The {Layout::Layer} to be reordered
|
202
|
+
# @param [Integer] new_index The index to put the {Layout::Layer} at
|
203
|
+
#
|
204
|
+
# @raise [ArgumentError] if the {Layout::Layer} is not in the
|
205
|
+
# {Layout::Document}
|
206
|
+
# @raise [IndexError] if new_index is out of range
|
207
|
+
#
|
208
|
+
# @overload reorder(index, new_index)
|
209
|
+
#
|
210
|
+
# @param [Integer] index The index of the {Layout::Layer} to be reordered
|
211
|
+
# @param [Integer] new_index The index to put the {Layout::Layer} at
|
212
|
+
#
|
213
|
+
# @raise [IndexError] if index or new_index are out of range
|
214
|
+
#
|
215
|
+
# @version LayOut 2018
|
216
|
+
def reorder(layer, new_index)
|
217
|
+
end
|
218
|
+
|
219
|
+
# The {#length} method returns the number of {Layout::Layer}s.
|
220
|
+
#
|
221
|
+
# @example
|
222
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
223
|
+
# layers = doc.layers
|
224
|
+
# num_layers = layers.length
|
225
|
+
#
|
226
|
+
# @return [Integer]
|
227
|
+
#
|
228
|
+
# @version LayOut 2018
|
229
|
+
def size
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|