Class: VORuby::STC::V1_30::UCoord3VecIntervalType

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

Overview

3-D coordinate interval type with units and frame_id.

Direct Known Subclasses

Coord3VecInterval

Instance Attribute Summary collapse

Attributes inherited from CoordIntervalType

#fill_factor, #frame_id, #hi_include, #lo_include

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordIntervalType

coord_interval_from_xml, #hi_include?, #lo_include?

Methods inherited from STCBaseType

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

#initialize(lo_limit, hi_limit, lo_include = true, hi_include = true, options = {}) ⇒ UCoord3VecIntervalType

Returns a new instance of UCoord3VecIntervalType.



4086
4087
4088
4089
4090
# File 'lib/voruby/stc/1.30/stc.rb', line 4086

def initialize(lo_limit, hi_limit, lo_include=true, hi_include=true, options={})
  self.lo_limit = lo_limit
  self.hi_limit = hi_limit
  super(lo_include, hi_include, options)
end

Instance Attribute Details

#hi_limitObject

Returns the value of attribute hi_limit.



4084
4085
4086
# File 'lib/voruby/stc/1.30/stc.rb', line 4084

def hi_limit
  @hi_limit
end

#lo_limitObject

Returns the value of attribute lo_limit.



4084
4085
4086
# File 'lib/voruby/stc/1.30/stc.rb', line 4084

def lo_limit
  @lo_limit
end

#unitObject

Returns the value of attribute unit.



4084
4085
4086
# File 'lib/voruby/stc/1.30/stc.rb', line 4084

def unit
  @unit
end

Class Method Details

.from_xml(xml) ⇒ Object



4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
# File 'lib/voruby/stc/1.30/stc.rb', line 4128

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

  lo_include, hi_include, options = CoordIntervalType.coord_interval_from_xml(root)

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

  lo_limit = REXML::XPath.first(root, 'x:LoLimit3Vec', {'x' => obj_ns.uri})
  hi_limit = REXML::XPath.first(root, 'x:HiLimit3Vec', {'x' => obj_ns.uri})

  self.new(
    lo_limit ? Double3Type.from_xml(lo_limit) : nil,
    hi_limit ? Double3Type.from_xml(hi_limit) : nil,
    lo_include, hi_include, options
  )
end

Instance Method Details

#==(i) ⇒ Object



4110
4111
4112
4113
4114
4115
# File 'lib/voruby/stc/1.30/stc.rb', line 4110

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

#to_xml(name = nil) ⇒ Object



4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
# File 'lib/voruby/stc/1.30/stc.rb', line 4117

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit
  el.add_element(self.lo_limit.to_xml('LoLimit3Vec')) if self.lo_limit
  el.add_element(self.hi_limit.to_xml('HiLimit3Vec')) if self.hi_limit
  
  collapse_namespaces(el)
  el
end