Class: Visitor

Inherits:
Object
  • Object
show all
Includes:
LogUtils
Defined in:
lib/kml_maker.rb

Overview

Note:

This class is generic and not used as is

Generic Visitor class for Melissa Converter NG

Author:

  • PRV

Version:

  • 1.0.0

Direct Known Subclasses

KMLMaker

Constant Summary

Constants included from LogUtils

LogUtils::Log

Instance Method Summary collapse

Constructor Details

#initializeVisitor

Returns a new instance of Visitor.



69
70
71
# File 'lib/kml_maker.rb', line 69

def initialize
  @content = ''
end

Instance Method Details

#visit_bullseye(bullseye) ⇒ Object

visit a bullseye

Parameters:

  • bullseye (Bullseye)

    the bullseye to visit



110
111
112
113
114
115
# File 'lib/kml_maker.rb', line 110

def visit_bullseye(bullseye)
  @content += "Bullseye: #{bullseye.name}\n"
  visit_point bullseye.center
  @content += "Rings: #{bullseye.rings}\n"
  @content += "Distance: #{bullseye.distance}\n\n"
end

#visit_corridor(corridor) ⇒ Object

visit a corridor

Parameters:

  • corridor (Corridor)

    the corridor to visit



128
129
130
131
132
133
# File 'lib/kml_maker.rb', line 128

def visit_corridor(corridor)
  @content += "Corridor: #{corridor.name}\n"
  visit_point corridor.start
  visit_point corridor.end
  @content += "Width: #{corridor.width}\n\n"
end

#visit_ellipse(ellipse) ⇒ Object

visit an ellipse

Parameters:

  • ellipse (Ellipse)

    the ellipse to visit



119
120
121
122
123
124
# File 'lib/kml_maker.rb', line 119

def visit_ellipse(ellipse)
  @content += "Ellipse: #{ellipse.name}\n"
  visit_point ellipse.center
  @content += "Horizontal: #{ellipse.horizontal}\n"
  @content += "Vertical: #{ellipse.vertical}\n\n"
end

#visit_line(line) ⇒ Object

visit a line

Parameters:

  • line (Line)

    the line to visit



81
82
83
84
85
86
87
# File 'lib/kml_maker.rb', line 81

def visit_line(line)
  @content += "Line: #{line.name}\n"
  line.points.each do |point|
    visit_point point
  end
  @content += "\n"
end

#visit_point(point) ⇒ Object

visit a point

Parameters:

  • point (Point)

    the point to visit



75
76
77
# File 'lib/kml_maker.rb', line 75

def visit_point(point)
  @content += "Point: #{point.name} (#{point.latitude}, #{point.longitude})\n"
end

#visit_polygon(polygon) ⇒ Object

visit a polygon

Parameters:

  • polygon (Polygon)

    the polygon to visit



91
92
93
94
95
96
97
# File 'lib/kml_maker.rb', line 91

def visit_polygon(polygon)
  @content += "Polygon: #{polygon.name}\n"
  polygon.points.each do |point|
    visit_point point
  end
  @content += "\n"
end

#visit_rectangle(rectangle) ⇒ Object

visit a rectangle

Parameters:

  • rectangle (Rectangle)

    the rectangle to visit



101
102
103
104
105
106
# File 'lib/kml_maker.rb', line 101

def visit_rectangle(rectangle)
  @content += "Rectangle: #{rectangle.name}\n"
  visit_point rectangle.start
  @content += "Horizontal: #{rectangle.horizontal}\n"
  @content += "Vertical: #{rectangle.vertical}\n\n"
end