Class: VORuby::STC::V1_30::Vector2CoordinateType
- Inherits:
-
CoordinateType
- Object
- STCBaseType
- CoordinateType
- VORuby::STC::V1_30::Vector2CoordinateType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
2-D coordinate type. Single CError2, CResolution2, CSize2, CPixSize2 elements indicate definite values; pairs indicate ranges.
Direct Known Subclasses
Defined Under Namespace
Classes: CError2List, CPixSize2List, CResolution2List, CSize2List
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#name1 ⇒ Object
Returns the value of attribute name1.
-
#name2 ⇒ Object
Returns the value of attribute name2.
-
#pix_size ⇒ Object
Returns the value of attribute pix_size.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#size ⇒ Object
Returns the value of attribute size.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from CoordinateType
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from CoordinateType
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
Constructor Details
This class inherits a constructor from VORuby::STC::V1_30::STCBaseType
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def error @error end |
#name1 ⇒ Object
Returns the value of attribute name1.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def name1 @name1 end |
#name2 ⇒ Object
Returns the value of attribute name2.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def name2 @name2 end |
#pix_size ⇒ Object
Returns the value of attribute pix_size.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def pix_size @pix_size end |
#resolution ⇒ Object
Returns the value of attribute resolution.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def resolution @resolution end |
#size ⇒ Object
Returns the value of attribute size.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def size @size end |
#value ⇒ Object
Returns the value of attribute value.
1891 1892 1893 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1891 def value @value end |
Class Method Details
.from_xml(xml) ⇒ Object
2000 2001 2002 2003 |
# File 'lib/voruby/stc/1.30/stc.rb', line 2000 def self.from_xml(xml) root = element_from(xml) self.new(vector2_coordinate_from_xml(root)) end |
.vector2_coordinate_from_xml(root) ⇒ Object
1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1974 def self.vector2_coordinate_from_xml(root) = CoordinateType.coordinate_from_xml(root) name1 = REXML::XPath.first(root, 'x:Name1', {'x' => obj_ns.uri}) [:name1] = name1.text if name1 name2 = REXML::XPath.first(root, 'x:Name2', {'x' => obj_ns.uri}) [:name2] = name2.text if name2 [:value] = xml_to_obj(root, CValue2, true) [:error] = Vector2CoordinateType::CError2List.new(xml_to_obj(root, CError2)) [:error] = nil if [:error].size == 0 [:resolution] = Vector2CoordinateType::CResolution2List.new(xml_to_obj(root, CResolution2)) [:resolution] = nil if [:resolution].size == 0 [:size] = Vector2CoordinateType::CSize2List.new(xml_to_obj(root, CSize2)) [:size] = nil if [:size].size == 0 [:pix_size] = Vector2CoordinateType::CPixSize2List.new(xml_to_obj(root, CPixSize2)) [:pix_size] = nil if [:pix_size].size == 0 end |
Instance Method Details
#==(c) ⇒ Object
1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1938 def ==(c) super(c) and self.name1 == c.name1 and self.name2 == c.name2 and self.value == c.value and self.error == c.error and self.resolution == c.resolution and self.size == c.size and self.pix_size == c.pix_size end |
#to_xml(name = nil) ⇒ Object
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1949 def to_xml(name=nil) el = super(name) if self.name1 name1_el = REXML::Element.new("#{obj_ns.prefix}:Name1") name1_el.text = self.name1 el.add_element(name1_el) end if self.name2 name2_el = REXML::Element.new("#{obj_ns.prefix}:Name2") name2_el.text = self.name2 el.add_element(name2_el) end el.add_element(self.value.to_xml) if self.value self.error.each{ |e| el.add_element(e.to_xml) } if self.error self.resolution.each{ |r| el.add_element(r.to_xml) } if self.resolution self.size.each{ |s| el.add_element(s.to_xml) } if self.size self.pix_size.each{ |p| el.add_element(p.to_xml) } if self.pix_size collapse_namespaces(el) el end |