Class: CTioga2::Graphics::Styles::MarkerStringStyle

Inherits:
BasicStyle
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/texts.rb

Overview

The style for a string marker. Hmmm, this is somewhat redundant with TiogaPrimitiveCall::MarkerOptions and I don’t like that.

Constant Summary

Constants inherited from BasicStyle

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicStyle

alias_for, attr_accessor, attribute_type, attribute_types, attributes, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other

Constructor Details

#initializeMarkerStringStyle

Returns a new instance of MarkerStringStyle.



280
281
282
283
284
285
# File 'lib/ctioga2/graphics/styles/texts.rb', line 280

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

#modeObject

The rendering mode.



278
279
280
# File 'lib/ctioga2/graphics/styles/texts.rb', line 278

def mode
  @mode
end

Instance Method Details

#draw_marker(t, marker, x, y) ⇒ Object

Draws the string marker at the given location



297
298
299
300
301
302
# File 'lib/ctioga2/graphics/styles/texts.rb', line 297

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



289
290
291
292
293
294
# File 'lib/ctioga2/graphics/styles/texts.rb', line 289

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_scaleObject

Returns the true vertical scale of the marker



305
306
307
# File 'lib/ctioga2/graphics/styles/texts.rb', line 305

def real_vertical_scale
  return (@vertical_scale || 1.0) * (@scale || 1.0)
end