Class: VORuby::STC::V1_30::SectorType

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

Overview

A sector is the counter-clockwise area between two half-lines.

Direct Known Subclasses

Sector, Sector2

Instance Attribute Summary collapse

Attributes inherited from RegionType

#area, #coord_system_id, #note

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 ShapeType

shape_from_xml

Methods inherited from RegionType

region_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(position, pos_angle1, pos_angle2, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ SectorType

Returns a new instance of SectorType.



5647
5648
5649
5650
5651
5652
# File 'lib/voruby/stc/1.30/stc.rb', line 5647

def initialize(position, pos_angle1, pos_angle2, area=nil, lo_include=true, hi_include=true, options={})
  super(area, lo_include, hi_include, options)
  self.position = position
  self.pos_angle1 = pos_angle1
  self.pos_angle2 = pos_angle2
end

Instance Attribute Details

#pos_angle1Object

Returns the value of attribute pos_angle1.



5645
5646
5647
# File 'lib/voruby/stc/1.30/stc.rb', line 5645

def pos_angle1
  @pos_angle1
end

#pos_angle2Object

Returns the value of attribute pos_angle2.



5645
5646
5647
# File 'lib/voruby/stc/1.30/stc.rb', line 5645

def pos_angle2
  @pos_angle2
end

#positionObject

Returns the value of attribute position.



5645
5646
5647
# File 'lib/voruby/stc/1.30/stc.rb', line 5645

def position
  @position
end

Class Method Details

.from_xml(xml) ⇒ Object



5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
# File 'lib/voruby/stc/1.30/stc.rb', line 5697

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    Double2Type.from_xml(REXML::XPath.first(root, 'x:Position', {'x' => obj_ns.uri})),
    PosAngleType.from_xml(REXML::XPath.first(root, 'x:PosAngle1', {'x' => obj_ns.uri})),
    PosAngleType.from_xml(REXML::XPath.first(root, 'x:PosAngle2', {'x' => obj_ns.uri})),
    *ShapeType.shape_from_xml(root)
  )
end

Instance Method Details

#==(s) ⇒ Object



5675
5676
5677
5678
5679
5680
# File 'lib/voruby/stc/1.30/stc.rb', line 5675

def ==(s)
  super(s) and
  self.position == s.position and
  self.pos_angle1 == s.pos_angle1 and
  self.pos_angle2 == s.pos_angle2
end

#to_sObject



5693
5694
5695
# File 'lib/voruby/stc/1.30/stc.rb', line 5693

def to_s
  "SECTOR #{self.coord_system_id || IdRef.new('J2000')} #{self.position} #{self.pos_angle1} #{self.pos_angle2}"
end

#to_xml(name = nil) ⇒ Object



5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
# File 'lib/voruby/stc/1.30/stc.rb', line 5682

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.position.to_xml('Position'))
  el.add_element(self.pos_angle1.to_xml('PosAngle1'))
  el.add_element(self.pos_angle2.to_xml('PosAngle2'))
  
  collapse_namespaces(el)
  el
end