class OData4::Properties::Geography::Polygon

Private Class Methods

parse_xml(property_xml) click to toggle source
# File lib/odata4/properties/geography/polygon.rb, line 30
def self.parse_xml(property_xml)
  property_xml.xpath('//pos').map do |el|
    el.content.split(' ').map(&:to_f)
  end
end

Public Instance Methods

coords_from_s(str) click to toggle source
# File lib/odata4/properties/geography/polygon.rb, line 13
def coords_from_s(str)
  str.gsub(/[()]/, '')
     .split(',').map { |pos| pos.split(' ').map(&:to_f) }
end
coords_to_s() click to toggle source
# File lib/odata4/properties/geography/polygon.rb, line 9
def coords_to_s
  '(' + value.map { |pos| pos.join(' ') }.join(',') + ')'
end
type() click to toggle source
# File lib/odata4/properties/geography/polygon.rb, line 5
def type
  'Edm.GeographyPolygon'
end
xml_value() click to toggle source
# File lib/odata4/properties/geography/polygon.rb, line 18
def xml_value
  {
    exterior: {
      LinearRing: value.map do |coords|
        { pos: coords.join(' ') }
      end
    }
  }
end