Class: VORuby::STC::V1_10::Coords::PixelCoordinate

Inherits:
CoordinateType show all
Includes:
Coordinate
Defined in:
lib/voruby/stc/1.10/coords.rb

Overview

Generic coordinate element for pixels

Instance Attribute Summary collapse

Attributes inherited from CoordinateType

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Methods inherited from CoordinateType

#initialize

Constructor Details

This class inherits a constructor from VORuby::STC::V1_10::Coords::CoordinateType

Instance Attribute Details

#valueObject

Returns the value of attribute value.



1321
1322
1323
# File 'lib/voruby/stc/1.10/coords.rb', line 1321

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
# File 'lib/voruby/stc/1.10/coords.rb', line 1350

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
   :value => REXML::XPath.first(root, 'x:Value', {'x' => obj_ns.uri}).text
  }
  
  name = REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri})
  options[:name] = name.text if name
  
  PixelCoordinate.new(options)
end

Instance Method Details

#==(c) ⇒ Object



1327
1328
1329
1330
# File 'lib/voruby/stc/1.10/coords.rb', line 1327

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

#to_xmlObject



1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
# File 'lib/voruby/stc/1.10/coords.rb', line 1332

def to_xml
  el = element()
  
  if self.name
    name = REXML::Element.new("#{obj_ns.prefix}:Name")
    name.text = self.name
    el.add_element(name)
  end
  
  value = REXML::Element.new("#{obj_ns.prefix}:Value")
  value.text = self.value.to_s
  el.add_element(value)
  
  collapse_namespaces(el)
  
  el
end