Class: VORuby::STC::V1_30::PixelVector2CoordinateType

Inherits:
CoordinateType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Direct Known Subclasses

Pixel2D

Instance Attribute Summary collapse

Attributes inherited from CoordinateType

#frame_id, #name

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordinateType

coordinate_from_xml

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

#name1Object

Returns the value of attribute name1.



2007
2008
2009
# File 'lib/voruby/stc/1.30/stc.rb', line 2007

def name1
  @name1
end

#name2Object

Returns the value of attribute name2.



2007
2008
2009
# File 'lib/voruby/stc/1.30/stc.rb', line 2007

def name2
  @name2
end

#valueObject

Returns the value of attribute value.



2007
2008
2009
# File 'lib/voruby/stc/1.30/stc.rb', line 2007

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
# File 'lib/voruby/stc/1.30/stc.rb', line 2049

def self.from_xml(xml)
  root = element_from(xml)
  
  options = CoordinateType.coordinate_from_xml(root)
  
  name1 = REXML::XPath.first(root, 'x:Name1', {'x' => obj_ns.uri})
  options[:name1] = name1.text if name1
  
  name2 = REXML::XPath.first(root, 'x:Name2', {'x' => obj_ns.uri})
  options[:name2] = name2.text if name2
  
  options[:value] = xml_to_obj(root, Value2, true)
  
  self.new(options)
end

Instance Method Details

#==(c) ⇒ Object



2022
2023
2024
2025
2026
# File 'lib/voruby/stc/1.30/stc.rb', line 2022

def ==(c)
  super(c) and
  self.name1 == c.name1 and
  self.name2 == c.name2
end

#to_xml(name = nil) ⇒ Object



2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
# File 'lib/voruby/stc/1.30/stc.rb', line 2028

def to_xml(name=nil)
  el = super(name)
  
  if self.name1
    name1_el = REXML::Element.new("#{obj_ns.prefix}:Name1")
    name1_el.text = self.name1
    el.add_element(name1_el)
  end
  
  if self.name2
    name2_el = REXML::Element.new("#{obj_ns.prefix}:Name2")
    name2_el.text = self.name2
    el.add_element(name2_el)
  end
  
  el.add_element(self.value.to_xml) if self.value
  
  collapse_namespaces(el)
  el
end