Class: VORuby::STC::V1_30::Double9Type

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

Overview

A vector of 9 doubles (3x3 matrix).

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(m11, m12, m13, m21, m22, m23, m31, m32, m33, options = {}) ⇒ Double9Type

Returns a new instance of Double9Type.



1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/voruby/stc/1.30/stc.rb', line 1022

def initialize(m11, m12, m13, m21, m22, m23, m31, m32, m33, options={})
  self.m11 = m11
  self.m12 = m12
  self.m13 = m13
  self.m21 = m21
  self.m22 = m22
  self.m23 = m23
  self.m31 = m31
  self.m32 = m32
  self.m33 = m33
  super(options)
end

Instance Attribute Details

#gen_unitObject

Returns the value of attribute gen_unit.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def gen_unit
  @gen_unit
end

#m11Object

Returns the value of attribute m11.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m11
  @m11
end

#m12Object

Returns the value of attribute m12.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m12
  @m12
end

#m13Object

Returns the value of attribute m13.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m13
  @m13
end

#m21Object

Returns the value of attribute m21.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m21
  @m21
end

#m22Object

Returns the value of attribute m22.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m22
  @m22
end

#m23Object

Returns the value of attribute m23.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m23
  @m23
end

#m31Object

Returns the value of attribute m31.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m31
  @m31
end

#m32Object

Returns the value of attribute m32.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m32
  @m32
end

#m33Object

Returns the value of attribute m33.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def m33
  @m33
end

#unitObject

Returns the value of attribute unit.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def unit
  @unit
end

#vel_time_unitObject

Returns the value of attribute vel_time_unit.



1019
1020
1021
# File 'lib/voruby/stc/1.30/stc.rb', line 1019

def vel_time_unit
  @vel_time_unit
end

Class Method Details

.from_xml(xml) ⇒ Object



1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
# File 'lib/voruby/stc/1.30/stc.rb', line 1180

def self.from_xml(xml)
  root = element_from(xml)
  
  m11_el = REXML::XPath.first(root, 'x:M11', {'x' => obj_ns.uri})
  m12_el = REXML::XPath.first(root, 'x:M12', {'x' => obj_ns.uri})
  m13_el = REXML::XPath.first(root, 'x:M13', {'x' => obj_ns.uri})
  m21_el = REXML::XPath.first(root, 'x:M21', {'x' => obj_ns.uri})
  m22_el = REXML::XPath.first(root, 'x:M22', {'x' => obj_ns.uri})
  m23_el = REXML::XPath.first(root, 'x:M23', {'x' => obj_ns.uri})
  m31_el = REXML::XPath.first(root, 'x:M31', {'x' => obj_ns.uri})
  m32_el = REXML::XPath.first(root, 'x:M32', {'x' => obj_ns.uri})
  m33_el = REXML::XPath.first(root, 'x:M33', {'x' => obj_ns.uri})
  
  options = STCBaseType.stc_base_from_xml(root)
  
  unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit')
  options[:unit] = PosUnitType.new(unit.value) if unit
  
  vel_time_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'vel_time_unit')
  options[:vel_time_unit] = VelTimeUnitType.new(vel_time_unit.value) if vel_time_unit
  
  gen_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'gen_unit')
  options[:gen_unit] = UnitType.new(gen_unit.value) if gen_unit
  
  self.new(
    (m11_el and m11_el.text) ? Float(m11_el.text) : nil,
    (m12_el and m12_el.text) ? Float(m12_el.text) : nil,
    (m12_el and m12_el.text) ? Float(m13_el.text) : nil,
    (m21_el and m21_el.text) ? Float(m21_el.text) : nil,
    (m22_el and m22_el.text) ? Float(m22_el.text) : nil,
    (m23_el and m23_el.text) ? Float(m23_el.text) : nil,
    (m31_el and m31_el.text) ? Float(m31_el.text) : nil,
    (m32_el and m32_el.text) ? Float(m32_el.text) : nil,
    (m33_el and m33_el.text) ? Float(m33_el.text) : nil,
    options
  )
end

Instance Method Details

#==(d) ⇒ Object



1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/voruby/stc/1.30/stc.rb', line 1095

def ==(d)
  super(d) and
  self.m11 == d.m11 and
  self.m12 == d.m12 and
  self.m13 == d.m13 and
  self.m21 == d.m21 and
  self.m22 == d.m22 and
  self.m23 == d.m23 and
  self.m31 == d.m31 and
  self.m32 == d.m32 and
  self.m33 == d.m33 and
  self.unit == d.unit and
  self.vel_time_unit == d.vel_time_unit and
  self.gen_unit == d.gen_unit
end

#to_sObject



1176
1177
1178
# File 'lib/voruby/stc/1.30/stc.rb', line 1176

def to_s
  "#{self.m11} #{self.m12} #{self.m13} #{self.m21} #{self.m22} #{self.m23} #{self.m31} #{self.m32} #{self.m33}"
end

#to_xml(name = nil) ⇒ Object



1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
# File 'lib/voruby/stc/1.30/stc.rb', line 1111

def to_xml(name=nil)
  el = super(name)
  
  if self.m11
    m11_el = REXML::Element.new("#{obj_ns.prefix}:M11")
    m11_el.text = self.m11.to_s
    el.add_element(m11_el)
  end
  
  if self.m12
    m12_el = REXML::Element.new("#{obj_ns.prefix}:M12")
    m12_el.text = self.m12.to_s
    el.add_element(m12_el)
  end
  
  if self.m13
    m13_el = REXML::Element.new("#{obj_ns.prefix}:M13")
    m13_el.text = self.m13.to_s
    el.add_element(m13_el)
  end
  
  if self.m21
    m21_el = REXML::Element.new("#{obj_ns.prefix}:M21")
    m21_el.text = self.m21.to_s
    el.add_element(m21_el)
  end
  
  if self.m22
    m22_el = REXML::Element.new("#{obj_ns.prefix}:M22")
    m22_el.text = self.m22.to_s
    el.add_element(m22_el)
  end
  
  if self.m23
    m23_el = REXML::Element.new("#{obj_ns.prefix}:M23")
    m23_el.text = self.m23.to_s
    el.add_element(m23_el)
  end
  
  if self.m31
    m31_el = REXML::Element.new("#{obj_ns.prefix}:M31")
    m31_el.text = self.m31.to_s
    el.add_element(m31_el)
  end
  
  if self.m32
    m32_el = REXML::Element.new("#{obj_ns.prefix}:M32")
    m32_el.text = self.m32.to_s
    el.add_element(m32_el)
  end
  
  if self.m33
    m33_el = REXML::Element.new("#{obj_ns.prefix}:M33")
    m33_el.text = self.m33.to_s
    el.add_element(m33_el)
  end
  
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit
  el.attributes["#{obj_ns.prefix}:vel_time_unit"] = self.vel_time_unit.to_s if self.vel_time_unit
  el.attributes["#{obj_ns.prefix}:gen_unit"] = self.gen_unit.to_s if self.gen_unit
  
  collapse_namespaces(el)
  el
end