Class: VORuby::STC::V1_30::PixelSpaceType

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

Overview

Type to specify a pixel space.

Defined Under Namespace

Classes: PixelCoordsList

Instance Attribute Summary

Attributes inherited from STCDescriptionType

#coord_areas, #coord_sys, #coords

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from STCDescriptionType

#==, #initialize, stc_description_from_xml

Methods inherited from STCMetadataType

stc_metadata_from_xml

Methods inherited from STCBaseType

#==, #initialize, 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

This class inherits a constructor from VORuby::STC::V1_30::STCDescriptionType

Class Method Details

.from_xml(xml) ⇒ Object



8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
# File 'lib/voruby/stc/1.30/stc.rb', line 8344

def self.from_xml(xml)
  root = element_from(xml)
  
  css, cs, cas, options = STCDescriptionType.stc_description_from_xml(root)
  
  coords = xml_to_obj(root, PixelCoords)
  coords = nil if coords.size == 0
  
  self.new(
    xml_to_obj(root, PixelCoordSystem, true),
    coords ? PixelCoordsList.new(coords) : nil,
    xml_to_obj(root, PixelCoordArea, true),
    options || {}
  )
end

Instance Method Details

#coord_areaObject



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

def coord_area; self.coord_areas end

#coord_area=(ca) ⇒ Object



8329
8330
8331
# File 'lib/voruby/stc/1.30/stc.rb', line 8329

def coord_area=(ca)
  self.coord_areas = ca
end

#coord_areas=(ca) ⇒ Object



8322
8323
8324
8325
8326
# File 'lib/voruby/stc/1.30/stc.rb', line 8322

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

#coord_sys=(cs) ⇒ Object



8308
8309
8310
8311
8312
# File 'lib/voruby/stc/1.30/stc.rb', line 8308

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

#coords=(cs) ⇒ Object



8314
8315
8316
8317
8318
8319
8320
# File 'lib/voruby/stc/1.30/stc.rb', line 8314

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

#to_xml(name = nil) ⇒ Object



8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
# File 'lib/voruby/stc/1.30/stc.rb', line 8333

def to_xml(name=nil)
  el = super(name, true)
  
  el.add_element(self.coord_sys.to_xml) if self.coord_sys
  self.coords.each{ |c| el.add_element(c.to_xml) } if self.coords
  el.add_element(self.coord_areas.to_xml) if self.coord_areas
  
  collapse_namespaces(el)
  el
end