Class: TaskJuggler::GanttMilestone

Inherits:
Object
  • Object
show all
Includes:
HTMLGraphics
Defined in:
lib/taskjuggler/reports/GanttMilestone.rb

Overview

The GanttMilestone represents a milestone task.

Constant Summary collapse

@@size =

The size of the milestone symbol measured from the center to the tips.

6

Instance Method Summary collapse

Methods included from HTMLGraphics

#arrowHeadToHTML, #diamondToHTML, #jagToHTML, #lineToHTML, #rectToHTML

Constructor Details

#initialize(lineHeight, x, y) ⇒ GanttMilestone

Create a GanttMilestone object based on the following information: task is a reference to the Task to be displayed. lineHeight is the height of the line this milestone is shown in. x and y are the coordinates of the center of the milestone in the GanttChart.



30
31
32
33
34
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 30

def initialize(lineHeight, x, y)
  @lineHeight = lineHeight
  @x = x
  @y = y
end

Instance Method Details

#addBlockedZones(router) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 58

def addBlockedZones(router)
  router.addZone(@x - @@size - 2, @y + (@lineHeight / 2) - @@size - 2,
                 2 * @@size + 5, 2 * @@size + 5, true, true)
  # Block for arrowhead.
  router.addZone(@x - @@size - 9, @y + (@lineHeight / 2) - 7, 10, 15,
                 true, true)
end

#endDepLineEndObject

Return the point [ x, y ] where task end dependency lines should end at.



54
55
56
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 54

def endDepLineEnd
  [ @x + @@size, @y + @lineHeight / 2 ]
end

#endDepLineStartObject

Return the point [ x, y ] where task end dependency lines should start from.



49
50
51
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 49

def endDepLineStart
  [ @x + @@size , @y + @lineHeight / 2 ]
end

#startDepLineEndObject

Return the point [ x, y ] where task start dependency lines should end at.



43
44
45
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 43

def startDepLineEnd
  [ @x - @@size, @y + @lineHeight / 2 ]
end

#startDepLineStartObject

Return the point [ x, y ] where task start dependency lines should start from.



38
39
40
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 38

def startDepLineStart
  [ @x + @@size, @y + @lineHeight / 2 ]
end

#to_htmlObject

Convert the abstact representation of the GanttMilestone into HTML elements.



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/taskjuggler/reports/GanttMilestone.rb', line 68

def to_html
  html = []

  # Invisible trigger frame for tooltips.
  html << rectToHTML(@x - (@lineHeight / 2), 0, @lineHeight, @lineHeight,
                     'tj_gantt_frame')

  # Draw a diamond shape.
  html += diamondToHTML(@x, @lineHeight / 2)
  html
end