Class: DYI::Shape::ShapeGroup

Inherits:
Base show all
Defined in:
lib/dyi/shape/base.rb

Overview

Since:

  • 0.0.0

Constant Summary

Constants inherited from GraphicalElement

GraphicalElement::CLASS_REGEXP

Constants inherited from Element

Element::ID_REGEXP

Instance Attribute Summary collapse

Attributes inherited from Base

#anchor_href, #anchor_target, #attributes, #clipping, #parent

Attributes inherited from GraphicalElement

#css_class

Attributes inherited from Element

#description, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_animation, #add_painting_animation, #add_transform_animation, #animate?, #animations, #clear_clipping, #draw_on, #has_marker?, #has_uri_reference?, #root_element?, #root_node?, #rotate, #scale, #set_clipping, #set_clipping_shapes, #set_event, #skew_x, #skew_y, #transform, #translate

Methods inherited from GraphicalElement

#add_css_class, #add_event_listener, #css_classes, #event_listeners, #event_target?, #remove_css_class, #remove_event_listener, #set_event, #to_reused_source

Methods inherited from Element

#canvas, #has_uri_reference?, #id, #id=, #include_external_file?, #inner_id

Constructor Details

#initialize(options = {}) ⇒ ShapeGroup

Returns a new instance of ShapeGroup.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :description (String)

    the description of this group

  • :title (String)

    the title of this group

Since:

  • 0.0.0



838
839
840
841
# File 'lib/dyi/shape/base.rb', line 838

def initialize(options={})
  @attributes = init_attributes(options)
  @child_elements = []
end

Instance Attribute Details

#child_elementsObject (readonly)

Since:

  • 0.0.0



834
835
836
# File 'lib/dyi/shape/base.rb', line 834

def child_elements
  @child_elements
end

Class Method Details

.draw_on(canvas, options = {}) ⇒ Object

Since:

  • 0.0.0



858
859
860
# File 'lib/dyi/shape/base.rb', line 858

def draw_on(canvas, options = {})
  new(options).draw_on(canvas)
end

Instance Method Details

#heightObject

Since:

  • 0.0.0



847
848
849
# File 'lib/dyi/shape/base.rb', line 847

def height
  Length.new_or_nil(@attributes[:height])
end

#widthObject

Since:

  • 0.0.0



843
844
845
# File 'lib/dyi/shape/base.rb', line 843

def width
  Length.new_or_nil(@attributes[:width])
end

#write_as(formatter, io = $>) ⇒ Object

Since:

  • 0.0.0



851
852
853
# File 'lib/dyi/shape/base.rb', line 851

def write_as(formatter, io=$>)
  formatter.write_group(self, io, &(block_given? ? Proc.new : nil))
end