Class: CTioga2::Graphics::Styles::MarkerStringStyle
- Inherits:
-
BasicStyle
- Object
- BasicStyle
- CTioga2::Graphics::Styles::MarkerStringStyle
- Defined in:
- lib/ctioga2/graphics/styles/texts.rb
Overview
The style for a string marker. Hmmm, this is somewhat redundant with MarkerStyle and I don’t like that.
Worse than that, it’s not the same options !
Constant Summary
Constants inherited from BasicStyle
BasicStyle::AllStyles, BasicStyle::OldAttrAccessor
Instance Attribute Summary collapse
-
#mode ⇒ Object
The rendering mode.
Instance Method Summary collapse
-
#draw_marker(t, marker, x, y) ⇒ Object
Draws the string marker at the given location.
-
#draw_string_marker(t, text, x, y) ⇒ Object
Draws the string marker at the given location.
-
#initialize ⇒ MarkerStringStyle
constructor
A new instance of MarkerStringStyle.
-
#real_vertical_scale ⇒ Object
Returns the true vertical scale of the marker.
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
Constructor Details
#initialize ⇒ MarkerStringStyle
Returns a new instance of MarkerStringStyle.
285 286 287 288 289 290 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 285 def initialize # It make sense to use both by default, as it would be # confusing to provide both fill_ and stroke_color that # don't have effects by default... @mode = Tioga::FigureConstants::FILL_AND_STROKE end |
Instance Attribute Details
#mode ⇒ Object
The rendering mode.
283 284 285 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 283 def mode @mode end |
Instance Method Details
#draw_marker(t, marker, x, y) ⇒ Object
Draws the string marker at the given location
302 303 304 305 306 307 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 302 def draw_marker(t, marker, x, y) dict = self.to_hash dict['marker'] = marker dict['at'] = [x, y] t.show_marker(dict) end |
#draw_string_marker(t, text, x, y) ⇒ Object
Draws the string marker at the given location
294 295 296 297 298 299 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 294 def draw_string_marker(t, text, x, y) dict = self.to_hash dict['text'] = text dict['at'] = [x, y] t.show_marker(dict) end |
#real_vertical_scale ⇒ Object
Returns the true vertical scale of the marker
310 311 312 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 310 def real_vertical_scale return (@vertical_scale || 1.0) * (@scale || 1.0) end |