Class: CTioga2::Graphics::Styles::OrientedLineStyle
- Inherits:
-
ArrowStyle
- Object
- BasicStyle
- LineStyle
- StrokeStyle
- ArrowStyle
- CTioga2::Graphics::Styles::OrientedLineStyle
- Defined in:
- lib/ctioga2/graphics/styles/arrows.rb
Overview
This class represents all the stylistic information necessary to draw a line parallel to a certain direction, indicated by an angle (default to horizontal)
Constant Summary
Constants inherited from ArrowStyle
Constants inherited from BasicStyle
BasicStyle::AllStyles, BasicStyle::OldAttrAccessor
Instance Method Summary collapse
-
#draw_oriented_arrow(t, xo, yo, len) ⇒ Object
len is a dimension.
Methods inherited from ArrowStyle
Methods inherited from StrokeStyle
Methods inherited from LineStyle
Methods inherited from BasicStyle
alias_for, aliases, attr_accessor, attribute_type, attribute_types, attributes, convert_string_hash, defined_aliases, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, normalize_hash, normalize_in, normalize_out, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other, #use_defaults_from
Instance Method Details
#draw_oriented_arrow(t, xo, yo, len) ⇒ Object
len is a dimension
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/ctioga2/graphics/styles/arrows.rb', line 170 def draw_oriented_arrow(t, xo, yo, len) angle = @angle || 0.0 dx,dy = *len.to_figure(t, angle) case @origin || Tioga::FigureConstants::LEFT_JUSTIFIED when Tioga::FigureConstants::LEFT_JUSTIFIED x1, y1 = xo, yo x2, y2 = xo + dx, yo + dy when Tioga::FigureConstants::CENTERED x1, y1 = xo - 0.5 * dx, yo - 0.5 * dy x2, y2 = xo + 0.5 * dx, yo + 0.5 * dy when Tioga::FigureConstants::RIGHT_JUSTIFIED x1, y1 = xo - dx, yo - dy x2, y2 = xo, yo end draw_arrow(t, x1, y1, x2, y2) end |