Class: VORuby::STC::V1_30::CoordAreaType

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

Overview

Generalized coordinate area type.

Direct Known Subclasses

AstroCoordAreaType, PixelCoordAreaType

Instance Attribute Summary collapse

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

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(coord_system_id, coord_intervals, options = {}) ⇒ CoordAreaType

Returns a new instance of CoordAreaType.



4935
4936
4937
4938
4939
# File 'lib/voruby/stc/1.30/stc.rb', line 4935

def initialize(coord_system_id, coord_intervals, options={})
  self.coord_system_id = coord_system_id
  self.coord_intervals = coord_intervals
  super(options)
end

Instance Attribute Details

#coord_intervalsObject

Returns the value of attribute coord_intervals.



4933
4934
4935
# File 'lib/voruby/stc/1.30/stc.rb', line 4933

def coord_intervals
  @coord_intervals
end

#coord_system_idObject

Returns the value of attribute coord_system_id.



4933
4934
4935
# File 'lib/voruby/stc/1.30/stc.rb', line 4933

def coord_system_id
  @coord_system_id
end

Class Method Details

.coord_area_from_xml(root) ⇒ Object



4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
# File 'lib/voruby/stc/1.30/stc.rb', line 4974

def self.coord_area_from_xml(root)
  cis = xml_to_obj(root, CoordInterval)
  cis = nil if cis.size == 0
  
  [
    IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id')),
    cis,
    STCBaseType.stc_base_from_xml(root)
  ]
end

.from_xml(xml) ⇒ Object



4985
4986
4987
4988
# File 'lib/voruby/stc/1.30/stc.rb', line 4985

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

Instance Method Details

#==(a) ⇒ Object



4958
4959
4960
4961
4962
# File 'lib/voruby/stc/1.30/stc.rb', line 4958

def ==(a)
  super(a) and
  self.coord_system_id == a.coord_system_id and
  self.coord_intervals == a.coord_intervals
end

#to_xml(name = nil) ⇒ Object



4964
4965
4966
4967
4968
4969
4970
4971
4972
# File 'lib/voruby/stc/1.30/stc.rb', line 4964

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:coord_system_id"] = self.coord_system_id.to_s
  self.coord_intervals.each { |i| el.add_element(i.to_xml) } if self.coord_intervals
  
  collapse_namespaces(el)
  el
end