Class: VORuby::STC::V1_30::CoordsType

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

Overview

The generic coordsType.

Direct Known Subclasses

AstroCoordsType, PixelCoordsType

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, coordinates, options = {}) ⇒ CoordsType

Returns a new instance of CoordsType.



3439
3440
3441
3442
3443
# File 'lib/voruby/stc/1.30/stc.rb', line 3439

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

Instance Attribute Details

#coord_system_idObject

Returns the value of attribute coord_system_id.



3437
3438
3439
# File 'lib/voruby/stc/1.30/stc.rb', line 3437

def coord_system_id
  @coord_system_id
end

#coordinatesObject

Returns the value of attribute coordinates.



3437
3438
3439
# File 'lib/voruby/stc/1.30/stc.rb', line 3437

def coordinates
  @coordinates
end

Class Method Details

.coords_from_xml(root) ⇒ Object



3478
3479
3480
3481
3482
3483
3484
3485
# File 'lib/voruby/stc/1.30/stc.rb', line 3478

def self.coords_from_xml(root)
  coords = xml_to_obj(root, GenCoordinate)
  [
    IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id').value),
    coords.size > 0 ? GenCoordinateList.new(coords) : nil,
    STCBaseType.stc_base_from_xml(root)
  ]
end

.from_xml(xml) ⇒ Object



3487
3488
3489
3490
# File 'lib/voruby/stc/1.30/stc.rb', line 3487

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

Instance Method Details

#==(c) ⇒ Object



3462
3463
3464
3465
3466
# File 'lib/voruby/stc/1.30/stc.rb', line 3462

def ==(c)
  super(c) and
  self.coord_system_id == c.coord_system_id and
  self.coordinates == c.coordinates
end

#to_xml(name = nil) ⇒ Object



3468
3469
3470
3471
3472
3473
3474
3475
3476
# File 'lib/voruby/stc/1.30/stc.rb', line 3468

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