Class: VORuby::STC::V1_30::RegionAreaType

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

Overview

Element to hold the area of a Region, once calculated; the element holds the actual area, linearAreaUnit the linear units of the of the area (i.e., it should be squared to get the proper units of the area), and validArea indicates whether the area has been calculated properly.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(value, linear_area_unit, valid_area) ⇒ RegionAreaType

Returns a new instance of RegionAreaType.



5154
5155
5156
5157
5158
# File 'lib/voruby/stc/1.30/stc.rb', line 5154

def initialize(value, linear_area_unit, valid_area)
  self.value = value
  self.linear_area_unit = linear_area_unit
  self.valid_area = valid_area
end

Instance Attribute Details

#linear_area_unitObject

Returns the value of attribute linear_area_unit.



5152
5153
5154
# File 'lib/voruby/stc/1.30/stc.rb', line 5152

def linear_area_unit
  @linear_area_unit
end

#valid_areaObject

Returns the value of attribute valid_area.



5152
5153
5154
# File 'lib/voruby/stc/1.30/stc.rb', line 5152

def valid_area
  @valid_area
end

#valueObject

Returns the value of attribute value.



5152
5153
5154
# File 'lib/voruby/stc/1.30/stc.rb', line 5152

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



5197
5198
5199
5200
5201
5202
5203
5204
5205
# File 'lib/voruby/stc/1.30/stc.rb', line 5197

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    Float(root.text),
    PosUnitType.new(root.attributes.get_attribute_ns(obj_ns.uri, 'linearAreaUnit').value),
    root.attributes.get_attribute_ns(obj_ns.uri, 'validArea').value == 'true' ? true : false
  )
end

Instance Method Details

#==(a) ⇒ Object



5181
5182
5183
5184
5185
# File 'lib/voruby/stc/1.30/stc.rb', line 5181

def ==(a)
  self.value == a.value and
  self.linear_area_unit == a.linear_area_unit and
  self.valid_area == a.valid_area
end

#to_xml(name = nil) ⇒ Object



5187
5188
5189
5190
5191
5192
5193
5194
5195
# File 'lib/voruby/stc/1.30/stc.rb', line 5187

def to_xml(name=nil)
  el = element(name)
  
  el.text = self.value.to_s
  el.attributes["#{obj_ns.prefix}:linearAreaUnit"] = self.linear_area_unit.to_s
  el.attributes["#{obj_ns.prefix}:validArea"] = self.valid_area.to_s
  
  el
end

#valid_area?Boolean

Returns:

  • (Boolean)


5179
# File 'lib/voruby/stc/1.30/stc.rb', line 5179

def valid_area?; self.valid_area end