Class: VORuby::STC::V1_30::CoordFrameType

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

Overview

A CoordFrame has to have at least an Id.

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(name, options = {}) ⇒ CoordFrameType

Returns a new instance of CoordFrameType.



6272
6273
6274
6275
# File 'lib/voruby/stc/1.30/stc.rb', line 6272

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6270
6271
6272
# File 'lib/voruby/stc/1.30/stc.rb', line 6270

def name
  @name
end

Class Method Details

.coord_frame_from_xml(root) ⇒ Object



6298
6299
6300
6301
6302
6303
6304
6305
# File 'lib/voruby/stc/1.30/stc.rb', line 6298

def self.coord_frame_from_xml(root)
  name = REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri})
  
  [
    name ? name.text : nil,
    STCBaseType.stc_base_from_xml(root)
  ]
end

.from_xml(xml) ⇒ Object



6307
6308
6309
6310
# File 'lib/voruby/stc/1.30/stc.rb', line 6307

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

Instance Method Details

#==(f) ⇒ Object



6281
6282
6283
6284
# File 'lib/voruby/stc/1.30/stc.rb', line 6281

def ==(f)
  super(f) and
  self.name == f.name
end

#to_xml(el_name = nil) ⇒ Object



6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
# File 'lib/voruby/stc/1.30/stc.rb', line 6286

def to_xml(el_name=nil)
  el = super(el_name)
  
  if self.name
    name_el = REXML::Element.new("#{obj_ns.prefix}:Name")
    name_el.text = self.name
    el.add_element(name_el)
  end
  
  el
end