Class: VORuby::STC::V1_10::Region::SmallCircle

Inherits:
Object
  • Object
show all
Includes:
SerializableToXml
Defined in:
lib/voruby/stc/1.10/region.rb

Overview

SmallCircle is used in vertices to indicate that the polygon side associated with the vertex is to be a small circle rather than the default great circle. SmallCircle indicates in polygons that side is along small circle; with optional pole.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ SmallCircle

Returns a new instance of SmallCircle.



290
291
292
# File 'lib/voruby/stc/1.10/region.rb', line 290

def initialize(options={})
  options.is_a?(Hash) ? options.each { |key, value| send("#{key}=", value) } : self.pole = options
end

Instance Attribute Details

#poleObject

Returns the value of attribute pole.



288
289
290
# File 'lib/voruby/stc/1.10/region.rb', line 288

def pole
  @pole
end

Class Method Details

.from_xml(xml) ⇒ Object



314
315
316
317
318
319
320
321
322
# File 'lib/voruby/stc/1.10/region.rb', line 314

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {}
  pole = REXML::XPath.first(root, 'x:Pole', {'x' => obj_ns.uri})
  options[:pole] = Double2.from_xml(pole) if pole
  
  SmallCircle.new(options)
end

Instance Method Details

#==(c) ⇒ Object



300
301
302
# File 'lib/voruby/stc/1.10/region.rb', line 300

def ==(c)
  self.pole == c.pole
end

#to_xml(name = nil) ⇒ Object



304
305
306
307
308
309
310
311
312
# File 'lib/voruby/stc/1.10/region.rb', line 304

def to_xml(name=nil)
  el = element(name)
  
  el.add_element(self.pole.to_xml('Pole', obj_ns)) if pole
  
  collapse_namespaces(el)
  
  el
end