Class: VORuby::STC::V1_10::Region::Vertex
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::Region::Vertex
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/region.rb
Overview
Vertex is a position with optional SmallCircle element
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
-
#small_circle ⇒ Object
Returns the value of attribute small_circle.
Class Method Summary collapse
Instance Method Summary collapse
- #==(v) ⇒ Object
-
#initialize(options = {}) ⇒ Vertex
constructor
A new instance of Vertex.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ Vertex
Returns a new instance of Vertex.
331 332 333 334 |
# File 'lib/voruby/stc/1.10/region.rb', line 331 def initialize(={}) raise_argument_required_error('position') if !.has_key?(:position) .each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
329 330 331 |
# File 'lib/voruby/stc/1.10/region.rb', line 329 def position @position end |
#small_circle ⇒ Object
Returns the value of attribute small_circle.
329 330 331 |
# File 'lib/voruby/stc/1.10/region.rb', line 329 def small_circle @small_circle end |
Class Method Details
.from_xml(xml) ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/voruby/stc/1.10/region.rb', line 368 def self.from_xml(xml) root = element_from(xml) = { :position => Double2.from_xml(REXML::XPath.first(root, 'x:Position', {'x' => obj_ns.uri})) } small_circle = REXML::XPath.first(root, 'x:SmallCircle', {'x' => obj_ns.uri}) [:small_circle] = SmallCircle.from_xml(small_circle) if small_circle Vertex.new() end |
Instance Method Details
#==(v) ⇒ Object
348 349 350 351 |
# File 'lib/voruby/stc/1.10/region.rb', line 348 def ==(v) self.position == v.position and self.small_circle == v.small_circle end |
#to_s ⇒ Object
364 365 366 |
# File 'lib/voruby/stc/1.10/region.rb', line 364 def to_s self.position.to_s end |
#to_xml(name = nil) ⇒ Object
353 354 355 356 357 358 359 360 361 362 |
# File 'lib/voruby/stc/1.10/region.rb', line 353 def to_xml(name=nil) el = element(name) el.add_element(self.position.to_xml('Position', obj_ns)) el.add_element(self.small_circle.to_xml('SmallCircle')) if self.small_circle collapse_namespaces(el) el end |