class DYI::Shape::ReusedShape
Marker
object represents a symbol at One or more vertices of the lines.
Marker
provides some pre-defined shapes and a custom marker defined freely. @since 1.3.0
Attributes
Public Class Methods
# File lib/dyi/shape/reused_shape.rb, line 38 def initialize(source_element, left_top, options={}) @source_element = source_element.to_reused_source width = Length.new_or_nil(options.delete(:width)) height = Length.new_or_nil(options.delete(:height)) @lt_pt = Coordinate.new(left_top) @lt_pt += Coordinate.new(width, 0) if width && width < Length::ZERO @lt_pt += Coordinate.new(0, height) if height && height < Length::ZERO @width = width && width.abs @height = height && height.abs @attributes = init_attributes(options) source_element.publish_id end
Public Instance Methods
Returns a y-axis coordinate of the bottom of the re-used shape. @return [Length] a y-axis coordinate of the bottom
# File lib/dyi/shape/reused_shape.rb, line 71 def bottom height && (@lt_pt.y + height) end
Returns a coordinate of the center of the re-used shape. @return [Coordinate] a coordinate of the center
# File lib/dyi/shape/reused_shape.rb, line 77 def center width && height && (@lt_pt + Coordinate.new(width.quo(2), height.quo(2))) end
# File lib/dyi/shape/reused_shape.rb, line 81 def child_elements source_element.child_elements end
@return [Boolean] whether the element has a URI reference
# File lib/dyi/shape/reused_shape.rb, line 86 def has_uri_reference? true end
Returns a x-axis coordinate of the left side of the re-used shape. @return [Length] the x-axis coordinate of the left side
# File lib/dyi/shape/reused_shape.rb, line 53 def left @lt_pt.x end
Returns a x-axis coordinate of the right side of the re-used shape. @return [Length] the x-axis coordinate of the right side
# File lib/dyi/shape/reused_shape.rb, line 59 def right width && (@lt_pt.x + width) end
Returns a y-axis coordinate of the top of the re-used shape. @return [Length] a y-axis coordinate of the top
# File lib/dyi/shape/reused_shape.rb, line 65 def top @lt_pt.y end
Writes image on io object. @param [Formatter::Base] formatter an object that defines the image format @param [IO] io an io to be written
# File lib/dyi/shape/reused_shape.rb, line 93 def write_as(formatter, io=$>) formatter.write_reused_shape(self, io) end