Class: VORuby::STC::V1_30::UnionType

Inherits:
RegionType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

The union of two or more regions is a region.

Direct Known Subclasses

Union, Union2

Instance Attribute Summary collapse

Attributes inherited from RegionType

#area, #coord_system_id, #note

Attributes inherited from SpatialIntervalType

#epoch, #unit

Attributes inherited from CoordIntervalType

#fill_factor, #frame_id, #hi_include, #lo_include

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RegionType

region_from_xml

Methods inherited from SpatialIntervalType

spatial_interval_from_xml

Methods inherited from CoordIntervalType

coord_interval_from_xml, #hi_include?, #lo_include?

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(regions, area = nil, lo_include = true, hi_include = true, options = {}) ⇒ UnionType

Returns a new instance of UnionType.



5925
5926
5927
5928
# File 'lib/voruby/stc/1.30/stc.rb', line 5925

def initialize(regions, area=nil, lo_include=true, hi_include=true, options={})
  super(area, lo_include, hi_include, options)
  self.regions = regions
end

Instance Attribute Details

#regionsObject

Returns the value of attribute regions.



5923
5924
5925
# File 'lib/voruby/stc/1.30/stc.rb', line 5923

def regions
  @regions
end

Class Method Details

.from_xml(xml) ⇒ Object



5957
5958
5959
5960
5961
5962
5963
5964
# File 'lib/voruby/stc/1.30/stc.rb', line 5957

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    RegionList.new(xml_to_obj(root, Region)),
    *RegionType.region_from_xml(root)
  )
end

Instance Method Details

#==(u) ⇒ Object



5939
5940
5941
5942
# File 'lib/voruby/stc/1.30/stc.rb', line 5939

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

#to_sObject



5953
5954
5955
# File 'lib/voruby/stc/1.30/stc.rb', line 5953

def to_s
  "UNION(#{self.regions})"
end

#to_xml(name = nil) ⇒ Object



5944
5945
5946
5947
5948
5949
5950
5951
# File 'lib/voruby/stc/1.30/stc.rb', line 5944

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