Class: VORuby::STC::V1_30::PixelCoordsType

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

Overview

The pixel coordinates type.

Direct Known Subclasses

PixelCoords

Instance Attribute Summary collapse

Attributes inherited from CoordsType

#coord_system_id, #coordinates

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordsType

coords_from_xml

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(pixels, coord_system_id, coordinates, options = {}) ⇒ PixelCoordsType

Returns a new instance of PixelCoordsType.



3501
3502
3503
3504
# File 'lib/voruby/stc/1.30/stc.rb', line 3501

def initialize(pixels, coord_system_id, coordinates, options={})
  self.pixels = pixels
  super(coord_system_id, coordinates, options)
end

Instance Attribute Details

#pixelsObject

Returns the value of attribute pixels.



3499
3500
3501
# File 'lib/voruby/stc/1.30/stc.rb', line 3499

def pixels
  @pixels
end

Class Method Details

.from_xml(xml) ⇒ Object



3528
3529
3530
3531
3532
3533
3534
3535
3536
# File 'lib/voruby/stc/1.30/stc.rb', line 3528

def self.from_xml(xml)
  root = element_from(xml)
  
  pixels = xml_to_obj(root, Pixel)
  self.new(
    pixels.size > 0 ? PixelList.new(pixels) : nil,
    *CoordsType.coords_from_xml(root)
  )
end

Instance Method Details

#==(c) ⇒ Object



3514
3515
3516
3517
# File 'lib/voruby/stc/1.30/stc.rb', line 3514

def ==(c)
  super(c) and
  self.pixels == c.pixels
end

#to_xml(name = nil) ⇒ Object



3519
3520
3521
3522
3523
3524
3525
3526
# File 'lib/voruby/stc/1.30/stc.rb', line 3519

def to_xml(name=nil)
  el = super(name)
  
  self.pixels.each{ |p| el.add_element(p.to_xml) } if self.pixels
  
  collapse_namespaces(el)
  el
end