Class: VORuby::STC::V1_30::Cart3DRefFrameType

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

Overview

A custom space reference frame type defined through a 3-D Cartesian mapping (rotate and scale).

Direct Known Subclasses

Cart3DRefFrame, Cart3DSpaceRefFrame

Instance Attribute Summary collapse

Attributes inherited from CoordRefFrameType

#name, #ref_frame_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordRefFrameType

coord_ref_frame_from_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(transform, projection, ref_frame_id, options = {}) ⇒ Cart3DRefFrameType

Returns a new instance of Cart3DRefFrameType.



6879
6880
6881
6882
6883
6884
# File 'lib/voruby/stc/1.30/stc.rb', line 6879

def initialize(transform, projection, ref_frame_id, options={})
  super(ref_frame_id, options[:name])
  self.transform = transform
  self.projection = projection || ProjectionType.new('')
  self.id = options[:id]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



6877
6878
6879
# File 'lib/voruby/stc/1.30/stc.rb', line 6877

def id
  @id
end

#projectionObject

Returns the value of attribute projection.



6877
6878
6879
# File 'lib/voruby/stc/1.30/stc.rb', line 6877

def projection
  @projection
end

#transformObject

Returns the value of attribute transform.



6877
6878
6879
# File 'lib/voruby/stc/1.30/stc.rb', line 6877

def transform
  @transform
end

Class Method Details

.from_xml(xml) ⇒ Object



6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
# File 'lib/voruby/stc/1.30/stc.rb', line 6926

def self.from_xml(xml)
  root = element_from(xml)
  
  rfi, name = CoordRefFrameType.coord_ref_frame_from_xml(root)       
   
  id = root.attributes.get_attribute_ns(obj_ns.uri, 'id')
  projection = root.attributes.get_attribute_ns(obj_ns.uri, 'projection')
  
  self.new(
    xml_to_obj(root, CTransform3, true),
    projection ? ProjectionType.new(projection.value) : nil,
    rfi,
    {:name => name, :id => id ? Id.new(id.value) : nil}
  )
end

Instance Method Details

#==(c) ⇒ Object



6908
6909
6910
6911
6912
6913
# File 'lib/voruby/stc/1.30/stc.rb', line 6908

def ==(c)
  super(c) and
  self.transform == c.transform and
  self.projection == c.projection and
  self.id == c.id
end

#to_xml(name = nil) ⇒ Object



6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
# File 'lib/voruby/stc/1.30/stc.rb', line 6915

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.transform.to_xml)
  el.attributes["#{obj_ns.prefix}:id"] = self.id.to_s if self.id
  el.attributes["#{obj_ns.prefix}:projection"] = self.projection.to_s if self.projection
  
  collapse_namespaces(el)
  el
end