def fixed_text( str, x, y, options={} )
vertical_justification = false
horizontal_justification = false
color = false
options.each{ |key, val|
case key
when 'vertical_justification'
vertical_justification = val
when 'horizontal_justification'
horizontal_justification = val
when 'color'
unless Array === val
raise "value of option['color'] must be Array"
end
color = val
else
raise "option (#{key}) is invalid"
end
}
text = Vtk::TextMapper.new
text.SetInput( str )
prop = text.GetTextProperty
if vertical_justification
case vertical_justification
when 'bottom'
prop.SetVerticalJustificationToBottom
when 'top'
prop.SetVerticalJustificationToTop
when 'center'
prop.SetVerticalJustificationToCentered
else
raise "value of option['vertical_justification'] (=#{val}) is invalid"
end
end
if horizontal_justification
case horizontal_justification
when 'left'
prop.SetJustificationToLeft
when 'right'
prop.SetJustificationToRight
when 'center'
prop.SetJustificationToCentered
else
raise "value of option['horizontal_justification'] (=#{val}) is invalid"
end
end
prop.SetColor( color ) if color
actor = Vtk::Actor2D.new
actor.SetMapper( text )
actor.GetPositionCoordinate.SetCoordinateSystemToNormalizedDisplay
actor.GetPositionCoordinate.SetValue( x, y )
@ren.AddActor( actor )
return nil
end