Class: VORuby::STC::V1_30::VertexType
- Inherits:
-
Object
- Object
- VORuby::STC::V1_30::VertexType
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Vertex is a position with optional SmallCircle element; the SmallCircle element indicates that the polygon side formed by that vertex and its predecessor vertex is a small circle, rather than a great circle; SmallCircle has no meaning in Cartesian coordinates.
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(position, small_circle = nil) ⇒ VertexType
constructor
A new instance of VertexType.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(position, small_circle = nil) ⇒ VertexType
Returns a new instance of VertexType.
5480 5481 5482 5483 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5480 def initialize(position, small_circle=nil) self.position = position self.small_circle = small_circle end |
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
5478 5479 5480 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5478 def position @position end |
#small_circle ⇒ Object
Returns the value of attribute small_circle.
5478 5479 5480 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5478 def small_circle @small_circle end |
Class Method Details
.from_xml(xml) ⇒ Object
5515 5516 5517 5518 5519 5520 5521 5522 5523 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5515 def self.from_xml(xml) root = element_from(xml) small_circle = REXML::XPath.first(root, 'x:SmallCircle', {'x' => obj_ns.uri}) self.new( Double2Type.from_xml(REXML::XPath.first(root, 'x:Position', {'x' => obj_ns.uri})), small_circle ? SmallCircleType.from_xml(small_circle) : nil ) end |
Instance Method Details
#==(v) ⇒ Object
5496 5497 5498 5499 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5496 def ==(v) self.position == v.position and self.small_circle == v.small_circle end |
#to_s ⇒ Object
5511 5512 5513 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5511 def to_s self.position.to_s end |
#to_xml(name = nil) ⇒ Object
5501 5502 5503 5504 5505 5506 5507 5508 5509 |
# File 'lib/voruby/stc/1.30/stc.rb', line 5501 def to_xml(name=nil) el = element(name) el.add_element(self.position.to_xml('Position')) el.add_element(self.small_circle.to_xml('SmallCircle')) if self.small_circle collapse_namespaces(el) el end |