Class: VORuby::STC::V1_30::STCDescriptionType

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

Overview

Generalized single stcMetadata type.

Defined Under Namespace

Classes: CoordAreaList, CoordSysList, CoordsList

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 STCMetadataType

stc_metadata_from_xml

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_sys, coords, coord_areas, options = {}) ⇒ STCDescriptionType

Returns a new instance of STCDescriptionType.



8122
8123
8124
8125
8126
8127
# File 'lib/voruby/stc/1.30/stc.rb', line 8122

def initialize(coord_sys, coords, coord_areas, options={})
  super(options)
  self.coord_sys = coord_sys
  self.coords = coords
  self.coord_areas = coord_areas
end

Instance Attribute Details

#coord_areasObject

Returns the value of attribute coord_areas.



8108
8109
8110
# File 'lib/voruby/stc/1.30/stc.rb', line 8108

def coord_areas
  @coord_areas
end

#coord_sysObject

Returns the value of attribute coord_sys.



8108
8109
8110
# File 'lib/voruby/stc/1.30/stc.rb', line 8108

def coord_sys
  @coord_sys
end

#coordsObject

Returns the value of attribute coords.



8108
8109
8110
# File 'lib/voruby/stc/1.30/stc.rb', line 8108

def coords
  @coords
end

Class Method Details

.from_xml(xml) ⇒ Object



8191
8192
8193
8194
# File 'lib/voruby/stc/1.30/stc.rb', line 8191

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

.stc_description_from_xml(root) ⇒ Object



8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
# File 'lib/voruby/stc/1.30/stc.rb', line 8173

def self.stc_description_from_xml(root)
  coord_sys = xml_to_obj(root, CoordSys)
  coord_sys = nil if coord_sys.size == 0
  
  coords = xml_to_obj(root, Coords)
  coords = nil if coords.size == 0
  
  coord_areas = xml_to_obj(root, CoordArea)
  coord_areas = nil if coord_areas.size == 0
  
  [
    coord_sys ? CoordSysList.new(coord_sys) : nil,
    coords ? CoordsList.new(coords) : nil,
    coord_areas ? CoordAreaList.new(coord_areas) : nil,
    STCMetadataType.(root)
  ]
end

Instance Method Details

#==(d) ⇒ Object



8153
8154
8155
8156
8157
8158
# File 'lib/voruby/stc/1.30/stc.rb', line 8153

def ==(d)
  super(d) and
  self.coord_sys == d.coord_sys and
  self.coords == d.coords and
  self.coord_areas == d.coord_areas
end

#to_xml(name = nil, suppress_content = false) ⇒ Object



8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
# File 'lib/voruby/stc/1.30/stc.rb', line 8160

def to_xml(name=nil, suppress_content=false)
  el = super(name)
  
  if !suppress_content
    self.coord_sys.each{ |cs| el.add_element(cs.to_xml) } if self.coord_sys
    self.coords.each{ |c| el.add_element(c.to_xml) } if self.coords
    self.coord_areas.each{ |ca| el.add_element(ca.to_xml) } if self.coord_areas
  end
  
  collapse_namespaces(el)
  el
end