Class: VORuby::STC::V1_10::Region::BooleanOperatorType

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

Direct Known Subclasses

IntersectionType, UnionType

Instance Attribute Summary collapse

Attributes inherited from RegionType

#note

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Methods inherited from RegionType

#fill_factor, #fill_factor=

Constructor Details

#initialize(options = {}) ⇒ BooleanOperatorType

Returns a new instance of BooleanOperatorType.



766
767
768
769
# File 'lib/voruby/stc/1.10/region.rb', line 766

def initialize(options={})
  raise_argument_required_error('list of regions') if !options.has_key?(:regions)
  super(options)
end

Instance Attribute Details

#regionsObject

Returns the value of attribute regions.



764
765
766
# File 'lib/voruby/stc/1.10/region.rb', line 764

def regions
  @regions
end

Class Method Details

.from_xml(xml) ⇒ Object



796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/voruby/stc/1.10/region.rb', line 796

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :regions => xml_to_obj(root, Region)
  }
  fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
  options[:fill_factor] = Float(fill_factor.value) if fill_factor
  note = root.attributes.get_attribute_ns(obj_ns.uri, 'note')
  options[:note] = note.value if note
  
  self.new(options)
end

Instance Method Details

#==(u) ⇒ Object



780
781
782
783
# File 'lib/voruby/stc/1.10/region.rb', line 780

def ==(u)
  super(u) and
  self.regions == u.regions
end

#to_s(name) ⇒ Object



792
793
794
# File 'lib/voruby/stc/1.10/region.rb', line 792

def to_s(name)
  "#{name}(#{self.regions.collect{ |r| r.to_s }.join(' ')})"
end

#to_xml(name = nil) ⇒ Object



785
786
787
788
789
790
# File 'lib/voruby/stc/1.10/region.rb', line 785

def to_xml(name=nil)
  el = super(name)
  self.regions.each { |r| el.add_element(r.to_xml) }
  collapse_namespaces(el)
  el
end