Class: VORuby::STC::V1_10::STC::SpaceFrameType
- Inherits:
-
CoordFrameType
- Object
- CoordFrameType
- VORuby::STC::V1_10::STC::SpaceFrameType
- Defined in:
- lib/voruby/stc/1.10/stc.rb
Overview
A spatial coordinate frame consists of a coordinate frame and a reference position
Direct Known Subclasses
Instance Attribute Summary collapse
-
#coord_flavor ⇒ Object
Returns the value of attribute coord_flavor.
-
#offset_center ⇒ Object
Returns the value of attribute offset_center.
-
#reference_position ⇒ Object
Returns the value of attribute reference_position.
-
#space_ref_frame ⇒ Object
Returns the value of attribute space_ref_frame.
Attributes inherited from CoordFrameType
Class Method Summary collapse
Instance Method Summary collapse
- #==(f) ⇒ Object
-
#initialize(options = {}) ⇒ SpaceFrameType
constructor
A new instance of SpaceFrameType.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ SpaceFrameType
Returns a new instance of SpaceFrameType.
1088 1089 1090 1091 1092 1093 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1088 def initialize(={}) raise_argument_required_error('space reference frame') if !.has_key?(:space_ref_frame) raise_argument_required_error('reference position') if !.has_key?(:reference_position) raise_argument_required_error('coordinate flavor') if !.has_key?(:coord_flavor) super() end |
Instance Attribute Details
#coord_flavor ⇒ Object
Returns the value of attribute coord_flavor.
1086 1087 1088 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1086 def coord_flavor @coord_flavor end |
#offset_center ⇒ Object
Returns the value of attribute offset_center.
1086 1087 1088 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1086 def offset_center @offset_center end |
#reference_position ⇒ Object
Returns the value of attribute reference_position.
1086 1087 1088 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1086 def reference_position @reference_position end |
#space_ref_frame ⇒ Object
Returns the value of attribute space_ref_frame.
1086 1087 1088 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1086 def space_ref_frame @space_ref_frame end |
Class Method Details
.from_xml(xml) ⇒ Object
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1156 def self.from_xml(xml) root = element_from(xml) = { :space_ref_frame => xml_to_obj(root, SpaceRefFrame, true), :reference_position => xml_to_obj(root, ReferencePosition, true), :coord_flavor => xml_to_obj(root, CoordFlavor, true) } name = REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri}) [:name] = name.text if name offset_center = REXML::XPath.first(root, 'x:OffsetCenter', {'x' => obj_ns.uri}) [:offset_center] = xml_to_obj(offset_center, CoordValue, true, Coords) if offset_center self.new() end |
Instance Method Details
#==(f) ⇒ Object
1125 1126 1127 1128 1129 1130 1131 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1125 def ==(f) super(f) and self.space_ref_frame == f.space_ref_frame and self.reference_position == f.reference_position and self.offset_center == f.offset_center and self.coord_flavor == f.coord_flavor end |
#to_xml(name = nil) ⇒ Object
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/voruby/stc/1.10/stc.rb', line 1133 def to_xml(name=nil) el = super(name) if self.offset_center coords_ns = NAMESPACES['VORuby::STC::V1_10::Coords'] el.add_namespace(coords_ns.prefix, coords_ns.uri) end el.add_element(self.space_ref_frame.to_xml) el.add_element(self.reference_position.to_xml) if self.offset_center offset_center = REXML::Element.new("#{obj_ns.prefix}:OffsetCenter") offset_center.add_element(self.offset_center.to_xml) el.add_element(offset_center) end el.add_element(self.coord_flavor.to_xml) collapse_namespaces(el) el end |