Class: CTioga2::Graphics::Styles::MarkerStyle

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

Overview

This class represents all the stylistic information to draw a Marker.

TODO: many things are still missing hereā€¦

Constant Summary

Constants inherited from BasicStyle

BasicStyle::OldAttrAccessor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicStyle

attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other

Instance Attribute Details

#colorObject

The color



54
55
56
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 54

def color
  @color
end

#markerObject

The marker



57
58
59
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 57

def marker
  @marker
end

#scaleObject

The marker scale



60
61
62
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 60

def scale
  @scale
end

Instance Method Details

#draw_markers_at(t, x, y) ⇒ Object

Shows the marker at a given location/set of locations.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 63

def draw_markers_at(t, x, y)
  if x.is_a? Numeric
    x = Dvector[x]
    y = Dvector[y]
  end
  t.context do
    # Always with line style solid (though that could change ?)
    t.line_type = LineStyles::Solid
    dict = { 
      'Xs' => x, 'Ys' => y,
      'marker' => @marker, 
      'color' => @color
    }
    if @scale
      dict['scale'] = @scale
    end
    t.show_marker(dict)
  end
end