Class: VORuby::STC::V1_30::GenVector2CoordinateType

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

Overview

Generic 2-D coordinate type. Single CError2, CResolution2, CSize2, CPixSize2 elements indicate definite values; pairs indicate ranges.

Direct Known Subclasses

Vector2DCoordinate

Instance Attribute Summary collapse

Attributes inherited from Vector2CoordinateType

#error, #name1, #name2, #pix_size, #resolution, #size, #value

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 Vector2CoordinateType

vector2_coordinate_from_xml

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

#unitObject

Returns the value of attribute unit.



2510
2511
2512
# File 'lib/voruby/stc/1.30/stc.rb', line 2510

def unit
  @unit
end

Class Method Details

.from_xml(xml) ⇒ Object



2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
# File 'lib/voruby/stc/1.30/stc.rb', line 2530

def self.from_xml(xml)
  root = element_from(xml)

  options = Vector2CoordinateType.vector2_coordinate_from_xml(root)

  unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit')
  options[:unit] = UnitType.new(unit.value) if unit

  self.new(options)
end

Instance Method Details

#==(c) ⇒ Object



2520
2521
2522
# File 'lib/voruby/stc/1.30/stc.rb', line 2520

def ==(c)
  super(c) and self.unit == c.unit
end

#to_xml(name = nil) ⇒ Object



2524
2525
2526
2527
2528
# File 'lib/voruby/stc/1.30/stc.rb', line 2524

def to_xml(name=nil)
  el = super(name)
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit
  el
end