Class: VORuby::STC::V1_10::Coords::PixelCoords

Inherits:
PixelCoordsType show all
Includes:
Coords
Defined in:
lib/voruby/stc/1.10/coords.rb

Overview

Contains pixel coordinates

Instance Attribute Summary

Attributes inherited from PixelCoordsType

#coordinates

Attributes inherited from CoordsType

#coord_system_id, #coordinates

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Methods inherited from CoordsType

#==, #initialize

Constructor Details

This class inherits a constructor from VORuby::STC::V1_10::Coords::CoordsType

Class Method Details

.from_xml(xml) ⇒ Object



2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
# File 'lib/voruby/stc/1.10/coords.rb', line 2257

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :coord_system_id => IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id').value)
   }
   options[:coordinates] = xml_to_obj(root, PixelCoordinate)
   
   PixelCoords.new(options)
end

Instance Method Details

#to_xmlObject



2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
# File 'lib/voruby/stc/1.10/coords.rb', line 2246

def to_xml
  el = element()
  el.attributes["#{obj_ns.prefix}:coord_system_id"] = self.coord_system_id.to_s
   
  self.coordinates.each { |c| el.add_element(c.to_xml) } if self.coordinates
  
  collapse_namespaces(el)
  
  el
end