Class: VORuby::STC::V1_10::Region::RegionType
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::Region::RegionType
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/region.rb
Overview
Region is the base type for everything.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#note ⇒ Object
Returns the value of attribute note.
Class Method Summary collapse
Instance Method Summary collapse
- #==(r) ⇒ Object
-
#fill_factor ⇒ Object
The fill_factor (value between 0 and 1) indicates the fraction of the region that is actually included; possible application: large scale resource coverage areas.
- #fill_factor=(f) ⇒ Object
-
#initialize(options = {}) ⇒ RegionType
constructor
A new instance of RegionType.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ RegionType
Returns a new instance of RegionType.
17 18 19 |
# File 'lib/voruby/stc/1.10/region.rb', line 17 def initialize(={}) .each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#note ⇒ Object
Returns the value of attribute note.
15 16 17 |
# File 'lib/voruby/stc/1.10/region.rb', line 15 def note @note end |
Class Method Details
.from_xml(xml) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/voruby/stc/1.10/region.rb', line 51 def self.from_xml(xml) root = element_from(xml) = {} fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor') [:fill_factor] = Float(fill_factor.value) if fill_factor note = root.attributes.get_attribute_ns(obj_ns.uri, 'note') [:note] = note.value if note self.new() end |
Instance Method Details
#==(r) ⇒ Object
36 37 38 39 |
# File 'lib/voruby/stc/1.10/region.rb', line 36 def ==(r) self.fill_factor == r.fill_factor and self.note == r.note end |
#fill_factor ⇒ Object
The fill_factor (value between 0 and 1) indicates the fraction of the region that is actually included; possible application: large scale resource coverage areas
23 24 25 |
# File 'lib/voruby/stc/1.10/region.rb', line 23 def fill_factor @fill_factor || 1.0 end |
#fill_factor=(f) ⇒ Object
27 28 29 30 |
# File 'lib/voruby/stc/1.10/region.rb', line 27 def fill_factor=(f) raise ArgumentError, "fill factor must be between 0.0 and 1.0" if f and (Float(f) < 0.0 or Float(f) > 1.0) @fill_factor = f ? Float(f) : nil end |
#to_xml(name = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/voruby/stc/1.10/region.rb', line 41 def to_xml(name=nil) el = element(name) el.attributes["#{obj_ns.prefix}:fill_factor"] = self.fill_factor.to_s if self.fill_factor el.attributes["#{obj_ns.prefix}:note"] = self.note if self.note collapse_namespaces(el) el end |