Class: DrawioDsl::Schema::Line
- Defined in:
- lib/drawio_dsl/schema/line.rb
Overview
Text represents lines, usually used for drawing a connection between two elements.
Direct Known Subclasses
Dash, Dash24, Dash32, Dash44, DashDot, DashDotDot, DashLongDash, Dot, DotDotDot, Double, DoubleDash, DoubleDot, LongDash, Solid
Constant Summary
Constants included from Formatters::Factory
Formatters::Factory::FORMATTERS
Class Attribute Summary collapse
-
.default_design ⇒ Object
readonly
Returns the value of attribute default_design.
-
.default_stroke ⇒ Object
readonly
Returns the value of attribute default_stroke.
-
.default_waypoint ⇒ Object
readonly
Returns the value of attribute default_waypoint.
Instance Attribute Summary collapse
-
#design ⇒ Object
Returns the value of attribute design.
-
#end_arrow ⇒ Object
Returns the value of attribute end_arrow.
-
#entry_point ⇒ Object
compass_point2 = :n, :ne, :e, :se, :s, :sw, :w, :nw.
-
#exit_point ⇒ Object
compass_point1 = :n, :ne, :e, :se, :s, :sw, :w, :nw.
-
#source ⇒ Object
Returns the value of attribute source.
-
#start_arrow ⇒ Object
Returns the value of attribute start_arrow.
-
#stroke ⇒ Object
Returns the value of attribute stroke.
-
#target ⇒ Object
Returns the value of attribute target.
-
#waypoint ⇒ Object
Returns the value of attribute waypoint.
Attributes inherited from Shape
#fill_color, #font_color, #glass, #gradient, #h, #html, #rounded, #shadow, #sketch, #stroke_color, #style_modifiers, #theme, #title, #value, #w, #white_space, #x, #y
Attributes inherited from Node
#classification, #id, #key, #nodes, #page, #parent
Class Method Summary collapse
Instance Method Summary collapse
- #add_base_modifiers ⇒ Object
-
#apply_defaults(args) ⇒ Object
def initialize(page, **args) args = :line super(page, **args) end.
- #default_configuration ⇒ Object
Methods inherited from Shape
#as_xml, #bg_theme_palette, configure_shape, #debug, #draw_element, #draw_line, #format, #initialize, #shape_defaults, #style, #theme_palette, #to_h
Methods included from Formatters::Factory
Methods inherited from Node
#add_node, #debug, #debug_detail, #debug_row, #initialize, #root?, #to_h
Constructor Details
This class inherits a constructor from DrawioDsl::Schema::Shape
Class Attribute Details
.default_design ⇒ Object (readonly)
Returns the value of attribute default_design.
9 10 11 |
# File 'lib/drawio_dsl/schema/line.rb', line 9 def default_design @default_design end |
.default_stroke ⇒ Object (readonly)
Returns the value of attribute default_stroke.
8 9 10 |
# File 'lib/drawio_dsl/schema/line.rb', line 8 def default_stroke @default_stroke end |
.default_waypoint ⇒ Object (readonly)
Returns the value of attribute default_waypoint.
10 11 12 |
# File 'lib/drawio_dsl/schema/line.rb', line 10 def default_waypoint @default_waypoint end |
Instance Attribute Details
#design ⇒ Object
Returns the value of attribute design.
28 29 30 |
# File 'lib/drawio_dsl/schema/line.rb', line 28 def design @design end |
#end_arrow ⇒ Object
Returns the value of attribute end_arrow.
26 27 28 |
# File 'lib/drawio_dsl/schema/line.rb', line 26 def end_arrow @end_arrow end |
#entry_point ⇒ Object
compass_point2 = :n, :ne, :e, :se, :s, :sw, :w, :nw
24 25 26 |
# File 'lib/drawio_dsl/schema/line.rb', line 24 def entry_point @entry_point end |
#exit_point ⇒ Object
compass_point1 = :n, :ne, :e, :se, :s, :sw, :w, :nw
23 24 25 |
# File 'lib/drawio_dsl/schema/line.rb', line 23 def exit_point @exit_point end |
#source ⇒ Object
Returns the value of attribute source.
21 22 23 |
# File 'lib/drawio_dsl/schema/line.rb', line 21 def source @source end |
#start_arrow ⇒ Object
Returns the value of attribute start_arrow.
25 26 27 |
# File 'lib/drawio_dsl/schema/line.rb', line 25 def start_arrow @start_arrow end |
#stroke ⇒ Object
Returns the value of attribute stroke.
27 28 29 |
# File 'lib/drawio_dsl/schema/line.rb', line 27 def stroke @stroke end |
#target ⇒ Object
Returns the value of attribute target.
22 23 24 |
# File 'lib/drawio_dsl/schema/line.rb', line 22 def target @target end |
#waypoint ⇒ Object
Returns the value of attribute waypoint.
29 30 31 |
# File 'lib/drawio_dsl/schema/line.rb', line 29 def waypoint @waypoint end |
Class Method Details
.configure_as(key, stroke: nil, design: nil, waypoint: :straight) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/drawio_dsl/schema/line.rb', line 12 def configure_as(key, stroke: nil, design: nil, waypoint: :straight) configure_shape(key, :line) @default_stroke = stroke @default_design = design @default_waypoint = waypoint end |
Instance Method Details
#add_base_modifiers ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/drawio_dsl/schema/line.rb', line 56 def add_base_modifiers cfg = KConfig.configuration.drawio @style_builder.add(cfg.stroke(stroke)) @style_builder.add(cfg.connector.waypoint(waypoint)) @style_builder.add(cfg.connector.design(design)) @style_builder.add(cfg.connector.compass_point(exit_point).exit_modifiers) @style_builder.add(cfg.connector.compass_point(entry_point).entry_modifiers) @style_builder.add(cfg.connector.arrow(start_arrow).start_modifiers) @style_builder.add(cfg.connector.arrow(end_arrow).end_modifiers) end |
#apply_defaults(args) ⇒ Object
def initialize(page, **args)
args[:classification] = :line
super(page, **args)
end
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/drawio_dsl/schema/line.rb', line 36 def apply_defaults(args) super(args) @source = args[:source] @target = args[:target] @exit_point = args[:exit_point] || args[:start_point] || :nw @entry_point = args[:entry_point] || args[:end_point] || :ne @start_arrow = args[:start_arrow] || :none @end_arrow = args[:end_arrow] || :simple @stroke = args[:stroke] || self.class.default_stroke @design = args[:design] || self.class.default_design @waypoint = args[:waypoint] || self.class.default_waypoint || :straight @fill_color = args[:fill_color] || theme_palette.fill_color @stroke_color = args[:stroke_color] || theme_palette.stroke_color end |
#default_configuration ⇒ Object
52 53 54 |
# File 'lib/drawio_dsl/schema/line.rb', line 52 def default_configuration KConfig.configuration.drawio.shape.default_line end |