Class: VORuby::STC::V1_30::CoordinateType

Inherits:
STCBaseType
  • Object
show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Abstract coordinate type; a concrete Coordinate consists of a Value, Error, Resolution, Size, and PixSize.

Instance Attribute Summary collapse

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from STCBaseType

#==, #initialize, stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

This class inherits a constructor from VORuby::STC::V1_30::STCBaseType

Instance Attribute Details

#frame_idObject

Returns the value of attribute frame_id.



1422
1423
1424
# File 'lib/voruby/stc/1.30/stc.rb', line 1422

def frame_id
  @frame_id
end

#nameObject

Returns the value of attribute name.



1422
1423
1424
# File 'lib/voruby/stc/1.30/stc.rb', line 1422

def name
  @name
end

Class Method Details

.coordinate_from_xml(xml) ⇒ Object



1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
# File 'lib/voruby/stc/1.30/stc.rb', line 1446

def self.coordinate_from_xml(xml)
  root = element_from(xml)
  
  options = STCBaseType.stc_base_from_xml(root)
  
  name = REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri})
  options[:name] = name.text if name
  
  frame_id = root.attributes.get_attribute_ns(obj_ns.uri, 'frame_id')
  options[:frame_id] = IdRef.new(frame_id.value) if frame_id
  
  options
end

Instance Method Details

#to_xml(name = nil) ⇒ Object



1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
# File 'lib/voruby/stc/1.30/stc.rb', line 1432

def to_xml(name=nil)
  el = super(name)
  
  if self.name
    name_el = REXML::Element.new("#{obj_ns.prefix}:Name")
    name_el.text = self.name
    el.add_element(name_el)
  end
  
  el.attributes["#{obj_ns.prefix}:frame_id"] = self.frame_id.to_s if self.frame_id
  
  el
end