Class: VORuby::STC::V1_10::STC::PositionIntervalType

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

Overview

Contains a spatial position CoordInterval

Direct Known Subclasses

PositionInterval, VelocityIntervalType

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ PositionIntervalType

Returns a new instance of PositionIntervalType.



2185
2186
2187
2188
2189
# File 'lib/voruby/stc/1.10/stc.rb', line 2185

def initialize(options={})
  raise_argument_required_error('coordinate interval') if !options.has_key?(:coord_interval)
  raise_argument_required_error('unit') if !options.has_key?(:unit)
  super(options)
end

Instance Attribute Details

#coord_intervalObject

Returns the value of attribute coord_interval.



2183
2184
2185
# File 'lib/voruby/stc/1.10/stc.rb', line 2183

def coord_interval
  @coord_interval
end

#unitObject

Returns the value of attribute unit.



2183
2184
2185
# File 'lib/voruby/stc/1.10/stc.rb', line 2183

def unit
  @unit
end

Class Method Details

.from_xml(xml) ⇒ Object



2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
# File 'lib/voruby/stc/1.10/stc.rb', line 2215

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :unit => PosUnit.new(root.attributes.get_attribute_ns(obj_ns.uri, 'unit').value),
    :coord_interval => xml_to_obj(root, CoordInterval, true)
  }
  
  self.new(options)
end

Instance Method Details

#==(i) ⇒ Object



2203
2204
2205
2206
# File 'lib/voruby/stc/1.10/stc.rb', line 2203

def ==(i)
  self.coord_interval == i.coord_interval and
  self.unit == i.unit
end

#to_xml(name = nil) ⇒ Object



2208
2209
2210
2211
2212
2213
# File 'lib/voruby/stc/1.10/stc.rb', line 2208

def to_xml(name=nil)
  el = element(name)
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s
  el.add_element(self.coord_interval.to_xml)
  el
end