Class: Microstation::Text

Inherits:
Element
  • Object
show all
Defined in:
lib/microstation/text.rb

Instance Attribute Summary

Attributes inherited from Element

#app, #ole_obj, #original

Instance Method Summary collapse

Methods inherited from Element

#[], #app_ole_obj, convert_item, #do_update, #each, #each_cell, #each_complex, #get_property_handler, #in_cell?, #initialize, #ole_cell, ole_object?, #property_handler, #redraw, #update, #updated?

Methods included from ElementTrait

#cell?, #complex?, #graphical?, #has_tags?, #id_from_record, #line?, #microstation_id, #microstation_type, #model, #parent, #select, #text?, #text_node?, #textual?, #to_ole

Constructor Details

This class inherits a constructor from Microstation::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/microstation/text.rb', line 57

def method_missing(meth, *args, &block)
  if /^[A-Z]/.match?(meth)
    ole_obj.send(meth, *args)
  else
    dup = @original.dup
    result = dup.send(meth, *args, &block)
    update(result)
    result
  end
end

Instance Method Details

#=~(reg) ⇒ Object



17
18
19
# File 'lib/microstation/text.rb', line 17

def =~(reg)
  @original =~ reg
end

#boundsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/microstation/text.rb', line 36

def bounds
  binding.pry
  rotation = ole_obj.Rotation
  inverse_rotation = begin
    app_ole_obj.Matrix3dInverse(rotation)
  rescue
    pry
  end
  transform = app_ole_obj.Transform3dFromMatrix3dandFixedPoint3d(app_ole_obj.Matrix3dInverse(rotation),
    ole_obj.origin)
  ole_obj.transform transform
  pts = []

  0.upto(4) do |i|
    points[i] = ole_obj.Boundary.Low
  end
  points[2] = self.Boundary.High
  points[1].X = points[2].x
  points[3].y = points[2].Y
end

#read_ole(_ole) ⇒ Object



5
6
7
# File 'lib/microstation/text.rb', line 5

def read_ole(_ole)
  ole_obj.Text
end

#to_regexpObject



13
14
15
# File 'lib/microstation/text.rb', line 13

def to_regexp
  Regexp.new(read_ole.to_s)
end

#to_sObject

def text_node?

false

end



32
33
34
# File 'lib/microstation/text.rb', line 32

def to_s
  original.to_s
end

#write_ole(text) ⇒ Object



9
10
11
# File 'lib/microstation/text.rb', line 9

def write_ole(text)
  ole_obj.Text = text
end