Class: Polygon

Inherits:
Path show all
Defined in:
app/models/polygon.rb

Overview

Very similar to a Path, except the first operation is assumed to be a Moveto and all subsequent operations are assumed to be Lineto's. No operation tokens are supported in the path string. It is not necessary (but allowed) to close a polygon; when drawn the last point will be connected to the first.

Direct Known Subclasses

Polyline

Instance Method Summary (collapse)

Methods inherited from Path

#to_legacy_json, #to_legacy_xml

Methods inherited from GraphicObject

#get_all_descendants, #get_display_attributes_svg, #get_display_attributes_xml

Instance Method Details

- (Object) to_svg(_options = {})



9
10
11
12
# File 'app/models/polygon.rb', line 9

def to_svg(_options = {})
  svg = "<polygon id=\"#{id}\" parent_id=\"#{parent_id}\" order=\"#{order}\" structure_id=\"#{structure_id}\" points=\"#{path}\""
  svg << get_display_attributes_svg << "/>"
end