Class: VORuby::STC::V1_10::Region::Shape

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

Overview

Shape is the abstract type that is the building block of regions; in real life it needs to be replaced by a concrete shape

Instance Attribute Summary collapse

Attributes inherited from RegionType

#note

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Methods inherited from RegionType

#fill_factor, #fill_factor=, from_xml

Constructor Details

#initialize(options = {}) ⇒ Shape

Returns a new instance of Shape.



74
75
76
77
# File 'lib/voruby/stc/1.10/region.rb', line 74

def initialize(options={})
  raise_argument_required_error('coord system id') if !options.has_key?(:coord_system_id)
  options.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#coord_system_idObject

Returns the value of attribute coord_system_id.



72
73
74
# File 'lib/voruby/stc/1.10/region.rb', line 72

def coord_system_id
  @coord_system_id
end

#unitObject

Returns the value of attribute unit.



72
73
74
# File 'lib/voruby/stc/1.10/region.rb', line 72

def unit
  @unit
end

Instance Method Details

#==(s) ⇒ Object



94
95
96
97
# File 'lib/voruby/stc/1.10/region.rb', line 94

def ==(s)
  self.coord_system_id == s.coord_system_id and
  self.unit == s.unit
end

#to_xml(name = nil) ⇒ Object



99
100
101
102
103
104
105
106
107
108
# File 'lib/voruby/stc/1.10/region.rb', line 99

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:coord_system_id"] = self.coord_system_id.to_s
  el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit
  
  collapse_namespaces(el)
  
  el
end