Class: Gdsii::Strans

Inherits:
Group
  • Object
show all
Defined in:
lib/gdsii/strans.rb

Overview

Represents a GDSII structure translation object (Strans).

Instance Attribute Summary

Attributes inherited from Group

#records

Instance Method Summary collapse

Methods inherited from Group

bnf_key, bnf_key=, bnf_spec, bnf_spec=, #configure, #validate, #write

Methods included from Read

#read

Constructor Details

#initialize(mag = nil, angle = nil, reflect_x = false, abs_mag = false, abs_angle = false) {|_self| ... } ⇒ Strans

Constructor

Yields:

  • (_self)

Yield Parameters:

  • _self (Gdsii::Strans)

    the object that the method was called on



22
23
24
25
26
27
28
29
30
31
# File 'lib/gdsii/strans.rb', line 22

def initialize(mag=nil, angle=nil, reflect_x=false, abs_mag=false, abs_angle=false)
  super()
  @records[GRT_STRANS] = Record.new(GRT_STRANS, 0)
  self.reflect_x = true if reflect_x
  self.abs_mag = true if abs_mag
  self.abs_angle = true if abs_angle
  self.mag = mag unless mag.nil?
  self.angle = angle unless angle.nil?
  yield self if block_given?
end

Instance Method Details

#abs_angle=(flag) ⇒ Object

Set the strans absAngle bit



128
129
130
# File 'lib/gdsii/strans.rb', line 128

def abs_angle=(flag)
  self.value = flag ? value | 0x0002 : value & 0xfffd
end

#abs_angle?Boolean

Return true if the absolute angle bit is set; false if not

Returns:

  • (Boolean)


121
122
123
# File 'lib/gdsii/strans.rb', line 121

def abs_angle?()
  (value & 0x0002) == 0x0002
end

#abs_mag=(flag) ⇒ Object

Set or clear the absolute magnification bit (true = set; false = clear)



114
115
116
# File 'lib/gdsii/strans.rb', line 114

def abs_mag=(flag)
  self.value = flag ? value | 0x0004 : value & 0xfffb
end

#abs_mag?Boolean

Return true if an absolute magnification is set; false if not

Returns:

  • (Boolean)


107
108
109
# File 'lib/gdsii/strans.rb', line 107

def abs_mag?()
  (value & 0x0004) == 0x0004
end

#angleObject

Get the strans angle value (returns Fixnum)



67
# File 'lib/gdsii/strans.rb', line 67

def angle() @records.get_data(GRT_ANGLE); end

#angle=(val) ⇒ Object

Set the strans angle record



72
# File 'lib/gdsii/strans.rb', line 72

def angle=(val) @records.set(GRT_ANGLE,val); end

#angle_recordObject

Get the strans angle (returns Record)



62
# File 'lib/gdsii/strans.rb', line 62

def angle_record() @records.get_data(GRT_ANGLE); end

#magObject

Get the strans magnification value (returns Fixnum)



82
# File 'lib/gdsii/strans.rb', line 82

def mag() @records.get_data(GRT_MAG); end

#mag=(val) ⇒ Object

Set the strans magnification record



87
# File 'lib/gdsii/strans.rb', line 87

def mag=(val) @records.set(GRT_MAG,val); end

#mag_recordObject

Get the strans magnification (returns Record)



77
# File 'lib/gdsii/strans.rb', line 77

def mag_record() @records.get_data(GRT_MAG); end

#recordObject

Get the strans bitarray (returns Record)



36
# File 'lib/gdsii/strans.rb', line 36

def record() @records.get(GRT_STRANS); end

#reflect_x=(flag) ⇒ Object

Set or clear the strans x-reflect bit (true = set; false = clear)



100
101
102
# File 'lib/gdsii/strans.rb', line 100

def reflect_x=(flag)
  self.value = flag ? value | 0x8000 : value & 0x7fff
end

#reflect_x?Boolean

Return true if the translation bitarray indicates that a reflection about the x-axis is set.

Returns:

  • (Boolean)


93
94
95
# File 'lib/gdsii/strans.rb', line 93

def reflect_x?()
  (value & 0x8000) == 0x8000
end

#valueObject

Get the strans bitarray data (returns Fixnum). The recommendation is to not access this directly but rather use the various bitwise query methods instead: #reflect_x?, #abs_angle?, #abs_mag?.



43
# File 'lib/gdsii/strans.rb', line 43

def value() @records.get_data(GRT_STRANS); end

#value=(val) ⇒ Object

Set the strans bitarray record. The recommendation is to not access this directly but rather use the various bitwise manipulation methods instead: #reflect_x=, #abs_angle=, #abs_mag=.

  • 15 = reflect_x

  • 2 = abs_mag

  • 1 = abs_angle

  • All others reserved for future use.



55
56
57
# File 'lib/gdsii/strans.rb', line 55

def value=(val)
  @records.set(GRT_STRANS,val);
end