256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
# File 'lib/voruby/stc/1.10/region.rb', line 256
def self.from_xml(xml)
root = element_from(xml)
fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
note = root.attributes.get_attribute_ns(obj_ns.uri, 'note')
unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit')
options = {
:fill_factor => fill_factor ? Float(fill_factor.value) : nil,
:note => note ? note.value : nil,
:coord_system_id => IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id').value),
:pos_angle_unit => AngleUnit.new(root.attributes.get_attribute_ns(obj_ns.uri, 'pos_angle_unit').value),
:unit => unit ? PosUnit.new(unit.value) : nil,
:center => Double2.from_xml(REXML::XPath.first(root, 'x:Center', {'x' => obj_ns.uri})),
:radius => Float(REXML::XPath.first(root, 'x:Radius', {'x' => obj_ns.uri}).text),
:minor_radius => Float(REXML::XPath.first(root, 'x:MinorRadius', {'x' => obj_ns.uri}).text),
:pos_angle => Float(REXML::XPath.first(root, 'x:PosAngle', {'x' => obj_ns.uri}).text)
}
self.new(options)
end
|