Class: Path

Inherits:
Shape show all
Defined in:
app/models/path.rb

Overview

In addition to being a supported shape in its own right, Path is the base class for polygon, polyline & line.

Direct Known Subclasses

Polygon

Instance Method Summary (collapse)

Methods inherited from GraphicObject

#get_all_descendants, #get_display_attributes_svg, #get_display_attributes_xml

Instance Method Details

- (Object) to_legacy_json(_options = {})



17
18
19
# File 'app/models/path.rb', line 17

def to_legacy_json(_options = {})
  "{\"type\":\"#{type}\", \"id\":#{id}, \"parent_id\":#{parent_id.nil? ? :null : parent_id}, \"order\":#{order.nil? ? :null : order}, \"structure_id\":#{structure_id.nil? ? :null : structure_id}, \"d\":\"#{path}\"}"
end

- (Object) to_legacy_xml(_options = {})



10
11
12
13
14
15
# File 'app/models/path.rb', line 10

def to_legacy_xml(_options = {})
  xml = "<#{type} id='#{id}' parent_id='#{parent_id}' order='#{order}' structure_id='#{structure_id}' d='#{path}'"
  xml << get_display_attributes_xml << ">"
  xml << "</#{type}>"
  xml
end

- (Object) to_svg



5
6
7
8
# File 'app/models/path.rb', line 5

def to_svg
  svg = "<path id=\"#{id}\" parent_id=\"#{parent_id}\" order=\"#{order}\" structure_id=\"#{structure_id}\" d=\"#{path}\""
  svg << get_display_attributes_svg << "/>"
end