Class: VORuby::STC::V1_10::STC::Coord2VecIntervalType

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

Overview

2-D coordinate interval type

Direct Known Subclasses

Coord2VecInterval

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.



1873
1874
1875
# File 'lib/voruby/stc/1.10/stc.rb', line 1873

def hi_limit
  @hi_limit
end

#lo_limitObject

Returns the value of attribute lo_limit.



1873
1874
1875
# File 'lib/voruby/stc/1.10/stc.rb', line 1873

def lo_limit
  @lo_limit
end

Class Method Details

.from_xml(xml) ⇒ Object



1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
# File 'lib/voruby/stc/1.10/stc.rb', line 1914

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:LoLimit2Vec', {'x' => obj_ns.uri})
  options[:lo_limit] = Double2.from_xml(lo_limit) if lo_limit
  
  hi_limit = REXML::XPath.first(root, 'x:HiLimit2Vec', {'x' => obj_ns.uri})
  options[:hi_limit] = Double2.from_xml(hi_limit) if hi_limit
  
  self.new(options)
end

Instance Method Details

#==(i) ⇒ Object



1889
1890
1891
1892
1893
# File 'lib/voruby/stc/1.10/stc.rb', line 1889

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

#to_xml(name = nil) ⇒ Object



1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
# File 'lib/voruby/stc/1.10/stc.rb', line 1895

def to_xml(name=nil)
  el = super(name)
  
  if self.lo_limit
    lo_limit = REXML::Element.new("#{obj_ns.prefix}:LoLimit2Vec")
    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}:HiLimit2Vec")
    hi_limit.text = self.hi_limit.to_s
    el.add_element(hi_limit)
  end
  
  collapse_namespaces(el)
  el
end