Class: VORuby::STC::V1_10::STC::Coord3VecIntervalType

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

Overview

2-D coordinate interval type

Direct Known Subclasses

Coord3VecInterval

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.



1940
1941
1942
# File 'lib/voruby/stc/1.10/stc.rb', line 1940

def hi_limit
  @hi_limit
end

#lo_limitObject

Returns the value of attribute lo_limit.



1940
1941
1942
# File 'lib/voruby/stc/1.10/stc.rb', line 1940

def lo_limit
  @lo_limit
end

Class Method Details

.from_xml(xml) ⇒ Object



1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
# File 'lib/voruby/stc/1.10/stc.rb', line 1981

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

Instance Method Details

#==(i) ⇒ Object



1956
1957
1958
1959
1960
# File 'lib/voruby/stc/1.10/stc.rb', line 1956

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

#to_xml(name = nil) ⇒ Object



1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
# File 'lib/voruby/stc/1.10/stc.rb', line 1962

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