Class: VORuby::STC::V1_30::VelocitySphereType

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

Overview

Defines a velocity sphere. A special kind of area is a circle or sphere (in two or three dimensions), defined by a center position and a radius; the radius requires a unit.

Direct Known Subclasses

VelocitySphere

Instance Attribute Summary collapse

Attributes inherited from VelocityIntervalType

#vel_time_unit

Attributes inherited from SpatialIntervalType

#epoch, #unit

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 VelocityIntervalType

velocity_interval_from_xml

Methods inherited from SpatialIntervalType

spatial_interval_from_xml

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(radius, center, radius_unit, vel_time_unit, lo_include = true, hi_include = true, options = {}) ⇒ VelocitySphereType

Returns a new instance of VelocitySphereType.



4718
4719
4720
4721
4722
4723
# File 'lib/voruby/stc/1.30/stc.rb', line 4718

def initialize(radius, center, radius_unit, vel_time_unit, lo_include=true, hi_include=true, options={})
  self.radius = radius
  self.center = center
  self.radius_unit = radius_unit || PosUnitType.new('deg')
  super(vel_time_unit, lo_include, hi_include, options)
end

Instance Attribute Details

#centerObject

Returns the value of attribute center.



4716
4717
4718
# File 'lib/voruby/stc/1.30/stc.rb', line 4716

def center
  @center
end

#radiusObject

Returns the value of attribute radius.



4716
4717
4718
# File 'lib/voruby/stc/1.30/stc.rb', line 4716

def radius
  @radius
end

#radius_unitObject

Returns the value of attribute radius_unit.



4716
4717
4718
# File 'lib/voruby/stc/1.30/stc.rb', line 4716

def radius_unit
  @radius_unit
end

Class Method Details

.from_xml(xml) ⇒ Object



4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
# File 'lib/voruby/stc/1.30/stc.rb', line 4766

def self.from_xml(xml)
  root = element_from(xml)
  
  radius_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'radius_unit')
  self.new(
    Double1Type.from_xml(REXML::XPath.first(root, 'x:Radius', {'x' => obj_ns.uri})),
    Double3Type.from_xml(REXML::XPath.first(root, 'x:Center', {'x' => obj_ns.uri})),
    radius_unit ? PosUnitType.new(radius_unit.value) : nil,
    *VelocityIntervalType.velocity_interval_from_xml(root)
  )
end

Instance Method Details

#==(s) ⇒ Object



4748
4749
4750
4751
4752
4753
# File 'lib/voruby/stc/1.30/stc.rb', line 4748

def ==(s)
  super(s) and
  self.radius == s.radius and
  self.center == s.center and
  self.radius_unit == s.radius_unit
end

#to_xml(name = nil) ⇒ Object



4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
# File 'lib/voruby/stc/1.30/stc.rb', line 4755

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:radius_unit"] = self.radius_unit.to_s if self.radius_unit
  el.add_element(self.radius.to_xml('Radius')) if self.radius
  el.add_element(self.center.to_xml('Center')) if self.center
  
  collapse_namespaces(el)
  el
end