Class: Archimate::DataModel::Location
- Inherits:
-
Object
- Object
- Archimate::DataModel::Location
- Includes:
- Comparison
- Defined in:
- lib/archimate/data_model/location.rb
Overview
Graphical node type. It can contain child node types. This is LocationType/LocationGroup in the XSD.
Instance Attribute Summary collapse
-
#x ⇒ Float
readonly
The x (towards the right, associated with width) attribute from the Top,Left (i.e. 0,0) corner of the diagram to the Top, Left corner of the bounding box of the concept.
-
#y ⇒ Float
readonly
The y (towards the bottom, associated with height) attribute from the Top,Left (i.e. 0,0) corner of the diagram to the Top, Left corner of the bounding box of the concept.
Instance Method Summary collapse
-
#initialize(x:, y:) ⇒ Location
constructor
A new instance of Location.
-
#inside?(bounds) ⇒ Boolean
Returns true if this location is inside the bounds argument.
- #to_s ⇒ Object
Methods included from Comparison
#==, #[], #dig, #each, #hash, included, #inspect, #pretty_print, #to_h
Constructor Details
#initialize(x:, y:) ⇒ Location
Returns a new instance of Location.
27 28 29 30 |
# File 'lib/archimate/data_model/location.rb', line 27 def initialize(x:, y:) @x = x.to_i @y = y.to_i end |
Instance Attribute Details
#x ⇒ Float (readonly)
the XSD has this as a NonNegativeInteger
The x (towards the right, associated with width) attribute from the Top,Left (i.e. 0,0) corner of the diagram to the Top, Left corner of the bounding box of the concept.
19 |
# File 'lib/archimate/data_model/location.rb', line 19 model_attr :x, writable: true |
#y ⇒ Float (readonly)
the XSD has this as a NonNegativeInteger
The y (towards the bottom, associated with height) attribute from the Top,Left (i.e. 0,0) corner of the diagram to the Top, Left corner of the bounding box of the concept.
25 |
# File 'lib/archimate/data_model/location.rb', line 25 model_attr :y, writable: true |
Instance Method Details
#inside?(bounds) ⇒ Boolean
Returns true if this location is inside the bounds argument
38 39 40 41 |
# File 'lib/archimate/data_model/location.rb', line 38 def inside?(bounds) bounds.x_range.cover?(x) && bounds.y_range.cover?(y) end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/archimate/data_model/location.rb', line 32 def to_s "Location(x: #{x}, y: #{y})" end |