Class: Archimate::DataModel::Bounds
Instance Attribute Summary
#parent_attribute_name, #struct_instance_variables
Class Method Summary
collapse
Instance Method Summary
collapse
#ancestors, #build_index, #clone, #compact!, #delete, #diff, #dup, #element_by_id, #id, #in_model, #in_model=, #initialize, #parent, #parent=, #path, #primitive?, #referenced_identified_nodes, #set, #with
Class Method Details
.zero ⇒ Object
10
11
12
|
# File 'lib/archimate/data_model/bounds.rb', line 10
def self.zero
Archimate::DataModel::Bounds.new(x: 0, y: 0, width: 0, height: 0)
end
|
Instance Method Details
#bottom ⇒ Object
30
31
32
|
# File 'lib/archimate/data_model/bounds.rb', line 30
def bottom
top + height
end
|
#inside?(other) ⇒ Boolean
62
63
64
65
66
67
|
# File 'lib/archimate/data_model/bounds.rb', line 62
def inside?(other)
left > other.left &&
right < other.right &&
top > other.top &&
bottom < other.bottom
end
|
#is_above?(other) ⇒ Boolean
42
43
44
|
# File 'lib/archimate/data_model/bounds.rb', line 42
def is_above?(other)
bottom < other.top
end
|
#is_below?(other) ⇒ Boolean
46
47
48
|
# File 'lib/archimate/data_model/bounds.rb', line 46
def is_below?(other)
top > other.bottom
end
|
#is_left_of?(other) ⇒ Boolean
54
55
56
|
# File 'lib/archimate/data_model/bounds.rb', line 54
def is_left_of?(other)
right < other.left
end
|
#is_right_of?(other) ⇒ Boolean
50
51
52
|
# File 'lib/archimate/data_model/bounds.rb', line 50
def is_right_of?(other)
left > other.right
end
|
#left ⇒ Object
38
39
40
|
# File 'lib/archimate/data_model/bounds.rb', line 38
def left
x || 0
end
|
#reduced_by(val) ⇒ Object
58
59
60
|
# File 'lib/archimate/data_model/bounds.rb', line 58
def reduced_by(val)
Bounds.new(x: left + val, y: top + val, width: width - val * 2, height: height - val * 2)
end
|
#right ⇒ Object
34
35
36
|
# File 'lib/archimate/data_model/bounds.rb', line 34
def right
left + width
end
|
#to_s ⇒ Object
14
15
16
|
# File 'lib/archimate/data_model/bounds.rb', line 14
def to_s
"Bounds(x: #{x}, y: #{y}, width: #{width}, height: #{height})"
end
|
#top ⇒ Object
26
27
28
|
# File 'lib/archimate/data_model/bounds.rb', line 26
def top
y || 0
end
|
#x_range ⇒ Object
18
19
20
|
# File 'lib/archimate/data_model/bounds.rb', line 18
def x_range
Range.new(left, right)
end
|
#y_range ⇒ Object
22
23
24
|
# File 'lib/archimate/data_model/bounds.rb', line 22
def y_range
Range.new(top, bottom)
end
|