Class: VORuby::STC::V1_10::Coords::DoubleArray

Inherits:
TypedArray show all
Includes:
SerializableToXml
Defined in:
lib/voruby/stc/1.10/coords.rb

Overview

For vector coordinates we need arrays of doubles

Direct Known Subclasses

Double2, Double3, Double4, Double9

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Methods inherited from TypedArray

#<<, #[]=, #clear, #initialize, #insert, maximum_length, #replace, #to_s

Methods inherited from Array

#/, #to_homogeneous

Constructor Details

This class inherits a constructor from TypedArray

Class Method Details

.from_xml(xml) ⇒ Object



384
385
386
# File 'lib/voruby/stc/1.10/coords.rb', line 384

def self.from_xml(xml)
  self.new(element_from(xml).text.split(' ').collect{ |n| Float(n) })
end

.restricted_toObject



382
# File 'lib/voruby/stc/1.10/coords.rb', line 382

def self.restricted_to; [Float] end

Instance Method Details

#to_xml(name = nil, ns = nil) ⇒ Object



388
389
390
391
392
393
# File 'lib/voruby/stc/1.10/coords.rb', line 388

def to_xml(name=nil, ns=nil)
  el = element(name, ns)
  el.text = self.to_s
  collapse_namespaces(el)
  el
end