Class: VORuby::STC::V1_10::STC::PixelCoordSystemType

Inherits:
CoordSysType
  • Object
show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

The pixel coordinate system definition

Direct Known Subclasses

PixelCoordSystem

Instance Attribute Summary collapse

Attributes inherited from CoordSysType

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ PixelCoordSystemType

Returns a new instance of PixelCoordSystemType.



1644
1645
1646
1647
1648
# File 'lib/voruby/stc/1.10/stc.rb', line 1644

def initialize(options={})
  raise_argument_required_error('list of pixel coordinate systems') if !options.has_key?(:pixel_coord_frames)
  options[:coord_frames] = options[:pixel_coord_frames]
  super(options)
end

Instance Attribute Details

#pixel_coord_framesObject

Returns the value of attribute pixel_coord_frames.



1642
1643
1644
# File 'lib/voruby/stc/1.10/stc.rb', line 1642

def pixel_coord_frames
  @pixel_coord_frames
end

Class Method Details

.from_xml(xml) ⇒ Object



1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
# File 'lib/voruby/stc/1.10/stc.rb', line 1682

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :id => Id.new(root.attributes.get_attribute_ns(obj_ns.uri, 'ID').value),
    :pixel_coord_frames => PixelCoordFrameList.new(
      REXML::XPath.match(root, 'x:PixelCoordFrame', {'x' => obj_ns.uri}).collect { |p| PixelCoordFrame.from_xml(p) }
    )
  }

  self.new(options)
end

Instance Method Details

#==(f) ⇒ Object



1667
1668
1669
1670
# File 'lib/voruby/stc/1.10/stc.rb', line 1667

def ==(f)
  self.id == f.id and
  self.pixel_coord_frames == f.pixel_coord_frames
end

#coord_framesObject



1659
1660
1661
# File 'lib/voruby/stc/1.10/stc.rb', line 1659

def coord_frames
  self.pixel_coord_frames
end

#coord_frames=(cs) ⇒ Object



1663
1664
1665
# File 'lib/voruby/stc/1.10/stc.rb', line 1663

def coord_frames=(cs)
  self.pixel_coord_frames = cs
end

#to_xml(name = nil) ⇒ Object



1672
1673
1674
1675
1676
1677
1678
1679
1680
# File 'lib/voruby/stc/1.10/stc.rb', line 1672

def to_xml(name=nil)
  el = element(name)
  el.attributes["#{obj_ns.prefix}:ID"] = self.id.to_s
  
  self.pixel_coord_frames.each { |f| el.add_element(f.to_xml) }
  
  collapse_namespaces(el)
  el
end