Class: VORuby::STC::V1_10::STC::PixelSpace

Inherits:
StcDescription show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

Type to specify a pixel space

Instance Attribute Summary

Attributes inherited from StcDescription

#coord_areas, #coord_sys, #coords

Attributes inherited from StcMetadataType

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StcDescription

#==, #to_xml

Methods inherited from StcMetadataType

#==, #to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ PixelSpace

Returns a new instance of PixelSpace.



3134
3135
3136
3137
3138
# File 'lib/voruby/stc/1.10/stc.rb', line 3134

def initialize(options={})
  raise_argument_required_error('pixel coordinate system') if !options.has_key?(:coord_sys)
  raise_argument_required_error('pixel coordinate area') if !options.has_key?(:coord_areas)
  super(options)
end

Class Method Details

.from_xml(xml) ⇒ Object



3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
# File 'lib/voruby/stc/1.10/stc.rb', line 3161

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :coord_sys => xml_to_obj(root, PixelCoordSystem, true),
    :coords => xml_to_obj(root, PixelCoords, false, Coords),
    :coord_areas => xml_to_obj(root, PixelCoordArea, true)
  }
  
  id = root.attributes.get_attribute_ns(obj_ns.uri, 'ID')
  options[:id] = Id.new(id.value) if id
  
  self.new(options)
end

Instance Method Details

#coord_areas=(a) ⇒ Object



3155
3156
3157
3158
3159
# File 'lib/voruby/stc/1.10/stc.rb', line 3155

def coord_areas=(a)
  raise_argument_required_error('pixel coordinate area') if !a
  raise_type_mismatch_error(a, PixelCoordArea)
  @coord_areas = a
end

#coord_sys=(s) ⇒ Object



3140
3141
3142
3143
3144
# File 'lib/voruby/stc/1.10/stc.rb', line 3140

def coord_sys=(s)
  raise_argument_required_error('pixel coordinate system') if !s
  raise_type_mismatch_error(s, PixelCoordSystem)
  @coord_sys = s
end

#coords=(cs) ⇒ Object



3146
3147
3148
3149
3150
3151
3152
3153
# File 'lib/voruby/stc/1.10/stc.rb', line 3146

def coords=(cs)
  if cs
    cs = PixelCoordsList.new(cs) if cs.class == Array
    raise_type_mismatch_error(cs, PixelCoordsList)
  end
  
  @coords = cs
end