Class: VORuby::STC::V1_30::SpaceFrameType

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

Overview

A spatial coordinate frame consists of a coordinate frame, a reference position, a flavor, and, optionally, an offset center.

Direct Known Subclasses

SpaceFrame

Instance Attribute Summary collapse

Attributes inherited from CoordFrameType

#name

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordFrameType

coord_frame_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(space_ref_frame, reference_position, coord_flavor, offset_center = nil, name = nil, options = {}) ⇒ SpaceFrameType

Returns a new instance of SpaceFrameType.



7654
7655
7656
7657
7658
7659
7660
# File 'lib/voruby/stc/1.30/stc.rb', line 7654

def initialize(space_ref_frame, reference_position, coord_flavor, offset_center=nil, name=nil, options={})
  super(name, options)
  self.space_ref_frame = space_ref_frame
  self.reference_position = reference_position
  self.coord_flavor = coord_flavor
  self.offset_center = offset_center
end

Instance Attribute Details

#coord_flavorObject

Returns the value of attribute coord_flavor.



7652
7653
7654
# File 'lib/voruby/stc/1.30/stc.rb', line 7652

def coord_flavor
  @coord_flavor
end

#offset_centerObject

Returns the value of attribute offset_center.



7652
7653
7654
# File 'lib/voruby/stc/1.30/stc.rb', line 7652

def offset_center
  @offset_center
end

#reference_positionObject

Returns the value of attribute reference_position.



7652
7653
7654
# File 'lib/voruby/stc/1.30/stc.rb', line 7652

def reference_position
  @reference_position
end

#space_ref_frameObject

Returns the value of attribute space_ref_frame.



7652
7653
7654
# File 'lib/voruby/stc/1.30/stc.rb', line 7652

def space_ref_frame
  @space_ref_frame
end

Class Method Details

.from_xml(xml) ⇒ Object



7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
# File 'lib/voruby/stc/1.30/stc.rb', line 7712

def self.from_xml(xml)
  root = element_from(xml)
  
  offset_center = REXML::XPath.first(root, 'x:OffsetCenter', {'x' => obj_ns.uri})
  self.new(
    xml_to_obj(root, SpaceRefFrame, true),
    xml_to_obj(root, ReferencePosition, true),
    xml_to_obj(root, CoordFlavor, true),
    offset_center ? CoordValueType.from_xml(offset_center) : nil,
    *CoordFrameType.coord_frame_from_xml(root)
  )
end

Instance Method Details

#==(f) ⇒ Object



7692
7693
7694
7695
7696
7697
7698
# File 'lib/voruby/stc/1.30/stc.rb', line 7692

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



7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
# File 'lib/voruby/stc/1.30/stc.rb', line 7700

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.space_ref_frame.to_xml)
  el.add_element(self.reference_position.to_xml)
  el.add_element(self.offset_center.to_xml('OffsetCenter')) if self.offset_center
  el.add_element(self.coord_flavor.to_xml)
  
  collapse_namespaces(el)
  el
end