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…

  • in particular, angles could be handled here, and they could be handled directly in the marker specification…

Constant Summary

Constants inherited from BasicStyle

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

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

Instance Method Details

#draw_markers_at(t, x, y, override = nil) ⇒ Object

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

p override is a hash that can override part of the dictionnary specification.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 84

def draw_markers_at(t, x, y, override = nil)
  t.context do
    ## \todo allow custom line types for markers ?
    t.line_type = LineStyles::Solid
    dict = { 
      'marker' => @marker, 
      'color' => @color
    }
    if x.is_a? Numeric
      dict['x'] = x
      dict['y'] = y
    else
      dict['Xs'] = x
      dict['Ys'] = y
    end

    if @scale
      dict['scale'] = @scale
    end
    if override
      dict.merge!(override)
    end
    t.show_marker(dict)
  end
end