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 meth =~ /^[A-Z]/
    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



20
21
22
# File 'lib/microstation/text.rb', line 20

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

#boundsObject



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

def bounds
  binding.pry
  rotation = ole_obj.Rotation
  inverse_rotation = app_ole_obj.Matrix3dInverse(rotation) rescue pry
  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



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

def read_ole(ole)
  ole_obj.Text
end

#to_regexpObject



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

def to_regexp
  Regexp.new(read_ole.to_s)
end

#to_sObject

def text_node?

false

end



36
37
38
# File 'lib/microstation/text.rb', line 36

def to_s
  original.to_s
end

#write_ole(text) ⇒ Object



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

def write_ole(text)
  ole_obj.Text = text
end