Class: GraphicObject
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- GraphicObject
- Includes:
- CoreBase
- Defined in:
- app/models/graphic_object.rb
Overview
Direct Known Subclasses
Instance Method Summary (collapse)
- - (Object) get_all_descendants
- - (Object) get_display_attributes_svg
- - (Object) get_display_attributes_xml
Instance Method Details
- (Object) get_all_descendants
35 36 37 |
# File 'app/models/graphic_object.rb', line 35 def get_all_descendants GraphicObject.all(:conditions => "address like '#{address}%' and id != #{id}", :order => "parent_id, \"order\"") end |
- (Object) get_display_attributes_svg
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'app/models/graphic_object.rb', line 55 def get_display_attributes_svg da = "" if !display_attributes.nil? && display_attributes.length > 0 da = " style=\"" display_attributes.each do |key,value| if key == "stroke" da << "stroke:black;" elsif key == "color" da << "stroke:black;fill:##{'%06x' % value}" else da << " #{key}: #{value}; " end end da += "\"" end transforms = graphic_transformations if transforms.size > 0 da << " transform=\"" transforms.each do |t| da << " #{t.type.downcase}(#{t.sx}, #{t.sy})" end da += "\"" end da end |
- (Object) get_display_attributes_xml
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/graphic_object.rb', line 39 def get_display_attributes_xml da = "" begin if display_attributes.present? display_attributes.each{|key,value| da << " #{key}='#{value}'" } unless display_attributes.nil? end rescue da = "" end da end |