Class: VORuby::STC::V1_30::PixelVector3CoordinateType

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

Overview

3-D pixel coordinate type.

Direct Known Subclasses

Pixel3D

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.



2346
2347
2348
# File 'lib/voruby/stc/1.30/stc.rb', line 2346

def name1
  @name1
end

#name2Object

Returns the value of attribute name2.



2346
2347
2348
# File 'lib/voruby/stc/1.30/stc.rb', line 2346

def name2
  @name2
end

#name3Object

Returns the value of attribute name3.



2346
2347
2348
# File 'lib/voruby/stc/1.30/stc.rb', line 2346

def name3
  @name3
end

#valueObject

Returns the value of attribute value.



2346
2347
2348
# File 'lib/voruby/stc/1.30/stc.rb', line 2346

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
# File 'lib/voruby/stc/1.30/stc.rb', line 2400

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
  
  name3 = REXML::XPath.first(root, 'x:Name3', {'x' => obj_ns.uri})
  options[:name3] = name3.text if name3
  
  value = REXML::XPath.first(root, 'x:Value3', {'x' => obj_ns.uri})
  options[:value] = Value3.from_xml(value) if value
  
  self.new(options)
end

Instance Method Details

#==(c) ⇒ Object



2365
2366
2367
2368
2369
2370
2371
# File 'lib/voruby/stc/1.30/stc.rb', line 2365

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

#to_xml(name = nil) ⇒ Object



2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
# File 'lib/voruby/stc/1.30/stc.rb', line 2373

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
  
  if self.name3
    name3_el = REXML::Element.new("#{obj_ns.prefix}:Name3")
    name3_el.text = self.name3
    el.add_element(name3_el)
  end
  
  el.add_element(self.value.to_xml) if self.value
  
  collapse_namespaces(el)
  el
end