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 TiogaPrimitiveCall::MarkerOptions and I don’t like that.
Constant Summary collapse
- MarkerOptions =
{ 'color' => 'color', 'stroke_color' => 'color', 'fill_color' => 'color', 'scale' => 'float', 'horizontal_scale' => 'float', 'vertical_scale' => 'float', 'angle' => 'float', 'justification' => 'justification', 'alignment' => 'alignment', }
Constants inherited from BasicStyle
Instance Attribute Summary collapse
-
#alignement ⇒ Object
The vertical alignment.
-
#angle ⇒ Object
The angle of the text.
-
#color ⇒ Object
Colors.
-
#fill_color ⇒ Object
Returns the value of attribute fill_color.
-
#font ⇒ Object
A number between 1 to 14 – a PDF font.
-
#horizontal_scale ⇒ Object
The horizontal scale of the text.
-
#justification ⇒ Object
The horizontal alignment.
-
#mode ⇒ Object
The rendering mode.
-
#scale ⇒ Object
The scale of the text.
-
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
-
#vertical_scale ⇒ Object
The vertical scale of the text.
Instance Method Summary collapse
-
#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
attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other
Constructor Details
#initialize ⇒ MarkerStringStyle
Returns a new instance of MarkerStringStyle.
216 217 218 219 220 221 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 216 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
#alignement ⇒ Object
The vertical alignment
200 201 202 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 200 def alignement @alignement end |
#angle ⇒ Object
The angle of the text
188 189 190 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 188 def angle @angle end |
#color ⇒ Object
Colors
206 207 208 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 206 def color @color end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
208 209 210 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 208 def fill_color @fill_color end |
#font ⇒ Object
A number between 1 to 14 – a PDF font
211 212 213 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 211 def font @font end |
#horizontal_scale ⇒ Object
The horizontal scale of the text
194 195 196 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 194 def horizontal_scale @horizontal_scale end |
#justification ⇒ Object
The horizontal alignment
203 204 205 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 203 def justification @justification end |
#mode ⇒ Object
The rendering mode.
214 215 216 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 214 def mode @mode end |
#scale ⇒ Object
The scale of the text
191 192 193 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 191 def scale @scale end |
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
207 208 209 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 207 def stroke_color @stroke_color end |
#vertical_scale ⇒ Object
The vertical scale of the text
197 198 199 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 197 def vertical_scale @vertical_scale end |
Instance Method Details
#draw_string_marker(t, text, x, y) ⇒ Object
Draws the string marker at the given location
225 226 227 228 229 230 231 232 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 225 def draw_string_marker(t, text, x, y) dict = self.to_hash dict['text'] = text dict['at'] = [x, y] # TODO ! dict['mode'] = t.show_marker(dict) end |
#real_vertical_scale ⇒ Object
Returns the true vertical scale of the marker
235 236 237 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 235 def real_vertical_scale return (@vertical_scale || 1.0) * (@scale || 1.0) end |