/[eiffelstudio]/branches/eth/eve/Src/library/memory_analyzer/ma_draw_statistic.e
ViewVC logotype

Contents of /branches/eth/eve/Src/library/memory_analyzer/ma_draw_statistic.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83441 - (show annotations)
Sat Jun 5 13:52:53 2010 UTC (9 years, 7 months ago) by jasonw
File size: 4822 byte(s)
Renamed branch eve3 to eve. The eve branch serves as the new branch for the EVE project.
1 note
2 description: "Objects that used for draw graphics whihch are the datas about memory useage."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date: "$Date$"
6 revision: "$Revision$"
7
8 deferred class
9 MA_DRAW_STATISTIC
10
11 feature -- Command
12
13 draw_graph (a_used_percent, a_overhead_percent:DOUBLE)
14 -- Draw the graph of the statistics.
15 require
16 used_percent_not_too_large_not_too_small : a_used_percent >= 0 and a_used_percent <= 1
17 overhead_percent_not_too_large_not_too_small : a_overhead_percent >= 0 and a_overhead_percent <= 1
18 deferred
19 end
20
21 draw_text (a_info: STRING)
22 -- Draw some infomation on the graph.
23 do
24
25 end
26
27 pixmap: EV_PIXMAP
28 -- Return the drawed graph.
29 do
30 Result := internal_pixmap
31 ensure
32 result_not_void: Result /= Void
33 end
34
35 set_height (a_height: INTEGER)
36 -- Set the height of graph.
37 require
38 a_height_valid: a_height >= 0 and a_height <= 800
39 do
40 graph_height := a_height
41 internal_pixmap.set_size (graph_width, a_height)
42 ensure
43 a_height_set: graph_height = a_height
44 end
45
46 set_width (a_width: INTEGER)
47 -- Set the width of graph.
48 require
49 a_width_valid: a_width >= 0 and a_width <= 3000
50 do
51 graph_width := a_width
52 internal_pixmap.set_size (a_width, graph_height)
53 ensure
54 a_width_set: graph_width = a_width
55 end
56
57 feature -- Query
58
59 inner_graph_width: INTEGER
60 -- The inner graph's width.
61 do
62 Result := graph_width - left_top_x - right_interval
63 ensure
64 result_greater_than_zero: Result > 0
65 end
66
67 inner_graph_height: INTEGER
68 -- The inner graph's height.
69 do
70 Result := graph_height - left_top_y - bottom_interval
71 ensure
72 result_greater_than_zero: Result > 0
73 end
74
75 inner_graph_draw_height (a_percent: DOUBLE): INTEGER
76 -- The inner graph's used/overhead height.
77 do
78 Result := (inner_graph_height * a_percent).ceiling
79 ensure
80 result_positive: Result >= 0
81 end
82
83 inner_graph_draw_height_y (a_percent: DOUBLE): INTEGER
84 -- The inner used graph's y position which can be used by EV_DRAWABLE.draw_sth.(x,y...).
85 do
86 Result := inner_graph_height - inner_graph_draw_height (a_percent) + left_top_y
87 ensure
88 result_positive: Result >= 0
89 end
90
91 feature {NONE} -- Implemention
92
93 internal_pixmap: EV_PIXMAP
94 -- The drawable diagram for draw histogram diagram.
95
96 left_top_x: INTEGER = 30
97 -- The statistic graph left_top x point.
98
99 left_top_y: INTEGER = 10
100 -- The statistic graph left_top y point.
101
102 bottom_interval: INTEGER
103 -- The interval between the graph and the EV_DRAWABLE bottom which is used for draw texts.
104
105 right_interval: INTEGER
106 -- The interval between the inner graph and the EV_DRAWABLE right side.
107
108 graph_height: INTEGER
109 -- The max height of the graph.
110
111 graph_width: INTEGER
112 --The max width of the graph.
113
114 graph_used_color: EV_COLOR
115 -- The used section's color of the graph.
116 once
117 Result := (create {EV_STOCK_COLORS}).red
118 end
119
120 graph_overhead_color: EV_COLOR
121 -- The overhead section's color of the graph.
122 once
123 Result := (create {EV_STOCK_COLORS}).yellow
124 ensure
125 reuslt_not_void: Result /= Void
126 end
127
128 graph_grid_color: EV_COLOR
129 -- The grid color of the graphs.
130 once
131 Result := (create {EV_STOCK_COLORS}).white
132 ensure
133 result_not_void: Result /= Void
134 end
135
136 graph_inner_background_color: EV_COLOR
137 -- The background color of the inner graphs.
138 once
139 Result := (create {EV_STOCK_COLORS}).white
140 ensure
141 result_not_void: Result /= Void
142 end
143
144 graph_background_color: EV_COLOR
145 -- The background color of the inner graphs.
146 once
147 Result := (create {EV_STOCK_COLORS}).black
148 ensure
149 result_not_void: Result /= Void
150 end
151
152 graph_pixmap_background_color: EV_COLOR
153 -- The background color of the whole graph.
154 once
155 Result := (create {EV_STOCK_COLORS}).black
156 ensure
157 result_not_void: Result /= Void
158 end
159
160 graph_text_color: EV_COLOR
161 -- The color of the text in the graph.
162 once
163 Result := (create {EV_STOCK_COLORS}).white
164 ensure
165 result_not_void: Result /= Void
166 end
167
168 grid_size: INTEGER = 20
169 -- The grid size of the graph.
170
171 invariant
172 pixmap_not_void: internal_pixmap /= Void
173 bottom_interval_not_zero: bottom_interval /= 0
174 inner_graph_width_valid: inner_graph_width >= 0 and inner_graph_width <= graph_width
175 inner_graph_height_valid: inner_graph_height >= 0 and inner_graph_height <= graph_height
176 graph_width_valid: graph_width >= 0
177 graph_height_valid: graph_height >= 0 and graph_height <= 200
178 note
179 copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
180 license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
181 source: "[
182 Eiffel Software
183 356 Storke Road, Goleta, CA 93117 USA
184 Telephone 805-685-1006, Fax 805-685-6869
185 Website http://www.eiffel.com
186 Customer support http://support.eiffel.com
187 ]"
188
189
190
191
192 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23