Class: VORuby::STC::V1_30::SpatialIntervalType

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

Overview

Abstract spatial interval type.

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?, #initialize, #lo_include?

Methods inherited from STCBaseType

#initialize, 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

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

Instance Attribute Details

#epochObject

Returns the value of attribute epoch.



4149
4150
4151
# File 'lib/voruby/stc/1.30/stc.rb', line 4149

def epoch
  @epoch
end

#unitObject

Returns the value of attribute unit.



4149
4150
4151
# File 'lib/voruby/stc/1.30/stc.rb', line 4149

def unit
  @unit
end

Class Method Details

.from_xml(xml) ⇒ Object



4190
4191
4192
4193
# File 'lib/voruby/stc/1.30/stc.rb', line 4190

def self.from_xml(xml)
  root = element_from(xml)
  self.new(*spatial_interval_from_xml(root))
end

.spatial_interval_from_xml(root) ⇒ Object



4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
# File 'lib/voruby/stc/1.30/stc.rb', line 4178

def self.spatial_interval_from_xml(root)
  lo_include, hi_include, options = CoordIntervalType.coord_interval_from_xml(root)
  
  epoch_el = root.attributes.get_attribute_ns(obj_ns.uri, 'epoch')
  options[:epoch] = Float(epoch_el.value) if epoch_el
  
  unit_el = root.attributes.get_attribute_ns(obj_ns.uri, 'unit')
  options[:unit] = PosUnitType.new(unit_el.value) if unit_el
  
  [lo_include, hi_include, options]
end

Instance Method Details

#==(i) ⇒ Object



4163
4164
4165
4166
4167
# File 'lib/voruby/stc/1.30/stc.rb', line 4163

def ==(i)
  super(i) and
  self.epoch == i.epoch and
  self.unit == i.unit
end

#to_xml(name = nil) ⇒ Object



4169
4170
4171
4172
4173
4174
4175
4176
# File 'lib/voruby/stc/1.30/stc.rb', line 4169

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:epoch"] = self.epoch.to_s if self.epoch
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit
  
  el
end