Class: VORuby::STC::V1_10::Coords::ScalarCoordinateType

Inherits:
CoordinateType
  • Object
show all
Defined in:
lib/voruby/stc/1.10/coords.rb

Overview

Generic scalar coordinate type. Single CError, CResolution, CSize, CPixSize elements indicate definite values; pairs indicate ranges.

Instance Attribute Summary collapse

Attributes inherited from CoordinateType

#name

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ ScalarCoordinateType

Returns a new instance of ScalarCoordinateType.



674
675
676
# File 'lib/voruby/stc/1.10/coords.rb', line 674

def initialize(options={})
  options.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



672
673
674
# File 'lib/voruby/stc/1.10/coords.rb', line 672

def error
  @error
end

#pix_sizeObject

Returns the value of attribute pix_size.



672
673
674
# File 'lib/voruby/stc/1.10/coords.rb', line 672

def pix_size
  @pix_size
end

#resolutionObject

Returns the value of attribute resolution.



672
673
674
# File 'lib/voruby/stc/1.10/coords.rb', line 672

def resolution
  @resolution
end

#sizeObject

Returns the value of attribute size.



672
673
674
# File 'lib/voruby/stc/1.10/coords.rb', line 672

def size
  @size
end

#valueObject

Returns the value of attribute value.



672
673
674
# File 'lib/voruby/stc/1.10/coords.rb', line 672

def value
  @value
end

Instance Method Details

#==(sc) ⇒ Object



757
758
759
760
761
762
763
764
# File 'lib/voruby/stc/1.10/coords.rb', line 757

def ==(sc)
  super(sc) and
  self.value == sc.value and
  self.error == sc.error and
  self.resolution == sc.resolution and
  self.size == sc.size and
  self.pix_size == sc.pix_size
end

#to_xml(name = nil) ⇒ Object



738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/voruby/stc/1.10/coords.rb', line 738

def to_xml(name=nil)
  el = element(name)

  name = REXML::Element.new("#{obj_ns.prefix}:Name")
  name.text = self.name

  el.add_element(name)
  el.add_element(self.value.to_xml) if self.value
  self.error.each { |e| el.add_element(e.to_xml) } if self.error
  self.resolution.each { |r| el.add_element(r.to_xml) } if self.resolution
  self.size.each { |s| el.add_element(s.to_xml) } if self.size
  self.pix_size.each { |p| el.add_element(p.to_xml) } if self.pix_size
  
  collapse_namespaces(el)

  el
end