Class: VORuby::STC::V1_10::STC::CoordScalarIntervalType

Inherits:
CoordIntervalType show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

Scalar coordinate interval type

Instance Attribute Summary collapse

Attributes inherited from CoordIntervalType

#hi_include, #lo_include

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordIntervalType

#fill_factor, #fill_factor=, #initialize

Methods included from SerializableToXml

#element

Constructor Details

This class inherits a constructor from VORuby::STC::V1_10::STC::CoordIntervalType

Instance Attribute Details

#hi_limitObject

Returns the value of attribute hi_limit.



1808
1809
1810
# File 'lib/voruby/stc/1.10/stc.rb', line 1808

def hi_limit
  @hi_limit
end

#lo_limitObject

Returns the value of attribute lo_limit.



1808
1809
1810
# File 'lib/voruby/stc/1.10/stc.rb', line 1808

def lo_limit
  @lo_limit
end

Class Method Details

.from_xml(xml) ⇒ Object



1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
# File 'lib/voruby/stc/1.10/stc.rb', line 1847

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {}
  
  lo_include = root.attributes.get_attribute_ns(obj_ns.uri, 'lo_include')
  options[:lo_include] = (lo_include.value == 'true' ? true : false) if lo_include
  
  hi_include = root.attributes.get_attribute_ns(obj_ns.uri, 'hi_include')
  options[:hi_include] = (hi_include.value == 'true' ? true : false) if hi_include
  
  fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
  options[:fill_factor] = Float(fill_factor.value) if fill_factor
  
  lo_limit = REXML::XPath.first(root, 'x:LoLimit', {'x' => obj_ns.uri})
  options[:lo_limit] = Float(lo_limit.text) if lo_limit
  
  hi_limit = REXML::XPath.first(root, 'x:HiLimit', {'x' => obj_ns.uri})
  options[:hi_limit] = Float(hi_limit.text) if hi_limit
  
  self.new(options)
end

Instance Method Details

#==(i) ⇒ Object



1822
1823
1824
1825
1826
# File 'lib/voruby/stc/1.10/stc.rb', line 1822

def ==(i)
  super(i) and
  self.lo_limit == i.lo_limit and
  self.hi_limit == i.hi_limit
end

#to_xml(name = nil) ⇒ Object



1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
# File 'lib/voruby/stc/1.10/stc.rb', line 1828

def to_xml(name=nil)
  el = super(name)
  
  if self.lo_limit
    lo_limit = REXML::Element.new("#{obj_ns.prefix}:LoLimit")
    lo_limit.text = self.lo_limit.to_s
    el.add_element(lo_limit)
  end
  
  if self.hi_limit
    hi_limit = REXML::Element.new("#{obj_ns.prefix}:HiLimit")
    hi_limit.text = self.hi_limit.to_s
    el.add_element(hi_limit)
  end
  
  collapse_namespaces(el)
  el
end