741
|
1 |
GraphColumnView subclass:#GraphColumnView3D
|
|
2 |
instanceVariableNames:'glxView showGraph rotateX rotateY rotateZ rotateXHolder
|
|
3 |
rotateYHolder rotateZHolder zoomZ zoomZHolder'
|
|
4 |
classVariableNames:''
|
|
5 |
poolDictionaries:''
|
|
6 |
category:'Views-Graphs'
|
|
7 |
!
|
|
8 |
|
|
9 |
GLXView subclass:#GLXGraph
|
|
10 |
instanceVariableNames:'graph colorMap glxObjGraphs glxObjGrid maxY minY'
|
|
11 |
classVariableNames:''
|
|
12 |
poolDictionaries:''
|
|
13 |
privateIn:GraphColumnView3D
|
|
14 |
!
|
|
15 |
|
752
|
16 |
!GraphColumnView3D class methodsFor:'documentation'!
|
|
17 |
|
|
18 |
documentation
|
|
19 |
"
|
|
20 |
The class provides all the functionality for showing, scrolling and manipulating graphs
|
|
21 |
described through to a GraphColumn description. Each change in a graph description
|
|
22 |
immediately take affect.
|
|
23 |
|
|
24 |
|
|
25 |
[See also:]
|
|
26 |
GraphColumn
|
|
27 |
GraphColumnView
|
|
28 |
GraphColumnView2D
|
|
29 |
|
|
30 |
[Author:]
|
|
31 |
Claus Atzkern
|
|
32 |
"
|
|
33 |
|
|
34 |
! !
|
741
|
35 |
|
|
36 |
!GraphColumnView3D class methodsFor:'menu'!
|
|
37 |
|
|
38 |
defaultMenu
|
|
39 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
40 |
|
|
41 |
"do not manually edit this - the builder may not be able to
|
|
42 |
handle the specification if its corrupted."
|
|
43 |
|
|
44 |
"
|
|
45 |
MenuEditor new openOnClass:self andSelector:#defaultMenu
|
|
46 |
(Menu new fromLiteralArrayEncoding:(self defaultMenu)) startUp
|
|
47 |
"
|
|
48 |
|
|
49 |
<resource: #menu>
|
|
50 |
|
|
51 |
^
|
|
52 |
|
|
53 |
#(#Menu
|
|
54 |
|
|
55 |
#(
|
|
56 |
#(#MenuItem
|
|
57 |
#'label:' 'Show Columns'
|
|
58 |
#'indication:' #'showGraph:'
|
|
59 |
)
|
|
60 |
#(#MenuItem
|
|
61 |
#'label:' 'Show Grid'
|
|
62 |
#'indication:' #'showGrid:'
|
|
63 |
)
|
|
64 |
#(#MenuItem
|
|
65 |
#'label:' '-'
|
|
66 |
)
|
|
67 |
#(#MenuItem
|
|
68 |
#'label:' 'Zoom Y'
|
|
69 |
#'submenuChannel:' #subMenuZoomY
|
|
70 |
)
|
|
71 |
) nil
|
|
72 |
nil
|
|
73 |
)
|
|
74 |
! !
|
|
75 |
|
|
76 |
!GraphColumnView3D class methodsFor:'test'!
|
|
77 |
|
|
78 |
test
|
|
79 |
"
|
|
80 |
self test
|
|
81 |
"
|
|
82 |
|top list view x|
|
|
83 |
|
|
84 |
top := StandardSystemView extent:800 @ 400.
|
|
85 |
view := GraphColumnView3D origin:0@0 extent:1.0@1.0 in:top.
|
|
86 |
list := OrderedCollection new.
|
|
87 |
|
|
88 |
top label:'2D-View'.
|
|
89 |
|
|
90 |
#( red green yellow blue
|
|
91 |
) keysAndValuesDo:[:idx :aColor|
|
|
92 |
|col|
|
|
93 |
|
|
94 |
col := GraphColumn name:idx.
|
|
95 |
col foregroundColor:(Color perform:aColor).
|
|
96 |
|
|
97 |
col functionYblock:[:start :anArray|
|
|
98 |
x := (start - 1) * 0.2.
|
|
99 |
(idx == 1 or:[idx == 3]) ifTrue:[
|
752
|
100 |
1 to:(anArray size) do:[:i| anArray at:i put:20 * (x sin). x := x + 0.2 ].
|
741
|
101 |
] ifFalse:[
|
752
|
102 |
1 to:(anArray size) do:[:i| anArray at:i put:20 * (x cos). x := x + 0.2 ].
|
741
|
103 |
].
|
|
104 |
anArray
|
|
105 |
].
|
|
106 |
list add:col
|
|
107 |
].
|
|
108 |
|
|
109 |
view showGrid:true.
|
|
110 |
view columns:list.
|
|
111 |
top open.
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
! !
|
|
118 |
|
|
119 |
!GraphColumnView3D methodsFor:'accessing look'!
|
|
120 |
|
|
121 |
showGraph
|
|
122 |
"show or hide columns; if the grid is enabled, only the grid will be
|
|
123 |
shown
|
|
124 |
"
|
|
125 |
^ showGraph
|
|
126 |
!
|
|
127 |
|
|
128 |
showGraph:aBool
|
|
129 |
"show or hide columns; if the grid is enabled, only the grid will be
|
|
130 |
shown
|
|
131 |
"
|
|
132 |
showGraph ~~ aBool ifTrue:[
|
|
133 |
showGraph := aBool.
|
|
134 |
glxView recomputeGraph.
|
|
135 |
].
|
|
136 |
!
|
|
137 |
|
|
138 |
zoomZ
|
752
|
139 |
"returns the current zoom Z factor
|
741
|
140 |
"
|
|
141 |
^ zoomZ
|
|
142 |
!
|
|
143 |
|
|
144 |
zoomZ:aValue
|
752
|
145 |
"set the zoom Z factor; if the argument is nil or not valid, the
|
|
146 |
default zoom Z factor is set (1).
|
741
|
147 |
"
|
|
148 |
|zZ|
|
|
149 |
|
|
150 |
(zZ := self floatFrom:aValue onError:[1]) <= 0 ifTrue:[
|
|
151 |
zZ := 1
|
|
152 |
].
|
|
153 |
|
|
154 |
zZ = zoomZ ifFalse:[
|
|
155 |
zoomZ := zZ.
|
|
156 |
self invalidateGraph
|
|
157 |
]
|
|
158 |
! !
|
|
159 |
|
|
160 |
!GraphColumnView3D methodsFor:'accessing mvc'!
|
|
161 |
|
|
162 |
rotateXHolder
|
752
|
163 |
"returns the valueHolder, which holds the rotation X value
|
741
|
164 |
"
|
|
165 |
^ rotateXHolder
|
|
166 |
|
|
167 |
!
|
|
168 |
|
|
169 |
rotateXHolder:aHolder
|
752
|
170 |
"set the valueHolder, which holds the rotation X value
|
741
|
171 |
"
|
|
172 |
rotateXHolder == aHolder ifFalse:[
|
|
173 |
rotateXHolder notNil ifTrue:[
|
|
174 |
rotateXHolder removeDependent:self
|
|
175 |
].
|
|
176 |
(rotateXHolder := aHolder) notNil ifTrue:[
|
|
177 |
rotateXHolder addDependent:self
|
|
178 |
]
|
|
179 |
].
|
|
180 |
self rotateX:(rotateXHolder value)
|
|
181 |
!
|
|
182 |
|
|
183 |
rotateYHolder
|
752
|
184 |
"returns the valueHolder, which holds the rotation Y value
|
741
|
185 |
"
|
|
186 |
^ rotateYHolder
|
|
187 |
|
|
188 |
!
|
|
189 |
|
|
190 |
rotateYHolder:aHolder
|
752
|
191 |
"set the valueHolder, which holds the rotation Y value
|
741
|
192 |
"
|
|
193 |
rotateYHolder == aHolder ifFalse:[
|
|
194 |
rotateYHolder notNil ifTrue:[
|
|
195 |
rotateYHolder removeDependent:self
|
|
196 |
].
|
|
197 |
(rotateYHolder := aHolder) notNil ifTrue:[
|
|
198 |
rotateYHolder addDependent:self
|
|
199 |
]
|
|
200 |
].
|
|
201 |
self rotateY:(rotateYHolder value)
|
|
202 |
|
|
203 |
!
|
|
204 |
|
|
205 |
rotateZHolder
|
752
|
206 |
"returns the valueHolder, which holds the rotation Z value
|
741
|
207 |
"
|
|
208 |
^ rotateZHolder
|
|
209 |
|
|
210 |
!
|
|
211 |
|
|
212 |
rotateZHolder:aHolder
|
752
|
213 |
"set the valueHolder, which holds the rotation Z value
|
741
|
214 |
"
|
|
215 |
rotateZHolder == aHolder ifFalse:[
|
|
216 |
rotateZHolder notNil ifTrue:[
|
|
217 |
rotateZHolder removeDependent:self
|
|
218 |
].
|
|
219 |
(rotateZHolder := aHolder) notNil ifTrue:[
|
|
220 |
rotateZHolder addDependent:self
|
|
221 |
]
|
|
222 |
].
|
|
223 |
self rotateZ:(rotateZHolder value)
|
|
224 |
|
|
225 |
!
|
|
226 |
|
|
227 |
zoomZHolder
|
752
|
228 |
"returns the valueHolder, which holds the zoom Z factor
|
741
|
229 |
"
|
|
230 |
^ zoomZHolder
|
|
231 |
|
|
232 |
!
|
|
233 |
|
|
234 |
zoomZHolder:aHolder
|
752
|
235 |
"set the valueHolder, which holds the zoom Z factor
|
741
|
236 |
"
|
|
237 |
zoomZHolder == aHolder ifFalse:[
|
|
238 |
zoomZHolder notNil ifTrue:[
|
|
239 |
zoomZHolder removeDependent:self
|
|
240 |
].
|
|
241 |
(zoomZHolder := aHolder) notNil ifTrue:[
|
|
242 |
zoomZHolder addDependent:self
|
|
243 |
]
|
|
244 |
].
|
|
245 |
self zoomZ:(zoomZHolder value)
|
|
246 |
! !
|
|
247 |
|
|
248 |
!GraphColumnView3D methodsFor:'change & update'!
|
|
249 |
|
|
250 |
update:what with:aPara from:chgObj
|
|
251 |
"catch and handle a change notification of any object
|
|
252 |
"
|
|
253 |
chgObj == rotateXHolder ifTrue:[ ^ self rotateX:(rotateXHolder value) ].
|
|
254 |
chgObj == rotateYHolder ifTrue:[ ^ self rotateY:(rotateYHolder value) ].
|
|
255 |
chgObj == rotateZHolder ifTrue:[ ^ self rotateZ:(rotateZHolder value) ].
|
|
256 |
|
|
257 |
chgObj == zoomZHolder ifTrue:[ ^ self zoomZ:(zoomZHolder value) ].
|
|
258 |
|
|
259 |
super update:what with:aPara from:chgObj
|
|
260 |
! !
|
|
261 |
|
|
262 |
!GraphColumnView3D methodsFor:'converting'!
|
|
263 |
|
|
264 |
rotateValueFrom:aNumber
|
|
265 |
"converts a value to a valid rotation value
|
|
266 |
"
|
|
267 |
|r|
|
|
268 |
|
|
269 |
r := self unsignedIntegerFrom:aNumber onError:[0].
|
|
270 |
^ r < 360 ifTrue:[r] ifFalse:[r \\ 360]
|
|
271 |
! !
|
|
272 |
|
|
273 |
!GraphColumnView3D methodsFor:'initialization'!
|
|
274 |
|
|
275 |
destroy
|
|
276 |
"remove dependencies
|
|
277 |
"
|
|
278 |
super destroy.
|
|
279 |
|
|
280 |
rotateXHolder removeDependent:self.
|
|
281 |
rotateYHolder removeDependent:self.
|
|
282 |
rotateZHolder removeDependent:self.
|
|
283 |
zoomZHolder removeDependent:self.
|
|
284 |
|
|
285 |
!
|
|
286 |
|
|
287 |
initialize
|
|
288 |
"setup default values
|
|
289 |
"
|
|
290 |
super initialize.
|
|
291 |
|
|
292 |
rotateX := 45.
|
|
293 |
rotateY := 45.
|
|
294 |
rotateZ := 0.
|
|
295 |
zoomZ := 1.
|
|
296 |
|
|
297 |
showGraph := true.
|
752
|
298 |
|
|
299 |
glxView := GLXGraph extent:(1.0 @ 1.0) in:self.
|
|
300 |
glxView for:self.
|
741
|
301 |
|
|
302 |
! !
|
|
303 |
|
|
304 |
!GraphColumnView3D methodsFor:'protocol'!
|
|
305 |
|
|
306 |
colorChanged:what
|
752
|
307 |
"called if any color changed; the argument to the change notification
|
|
308 |
specifies the color which has changed:
|
|
309 |
|
|
310 |
#foreground the foreground color
|
|
311 |
#background the background color
|
|
312 |
#grid the color of the grid
|
|
313 |
#vLines the color of the vertical lines
|
741
|
314 |
"
|
752
|
315 |
what == #foreground ifTrue:[ ^ glxView recomputeGraph ].
|
|
316 |
what == #background ifTrue:[ ^ glxView invalidate ].
|
|
317 |
what == #grid ifTrue:[ ^ glxView recomputeGrid ].
|
|
318 |
|
|
319 |
Transcript showCR:'VERTICAL LINES NOT YET SUPPORTED'.
|
741
|
320 |
!
|
|
321 |
|
|
322 |
columnChanged:what with:oldValue from:aColumn
|
752
|
323 |
"a column has changed one of its attributes; the arguments to the
|
|
324 |
notification are passed by the column.
|
741
|
325 |
"
|
|
326 |
(
|
|
327 |
#( lineStyle lineWidth
|
|
328 |
hLineStyle hLineWidth hLineFgColor hLineList
|
|
329 |
scaleY relativeXaxis
|
|
330 |
transY
|
|
331 |
) includesIdentical:what
|
|
332 |
) ifTrue:[
|
752
|
333 |
Transcript showCR:what printString, ': NOT YET SUPPORTED'.
|
|
334 |
^ self
|
741
|
335 |
].
|
|
336 |
|
|
337 |
what == #foregroundColor ifTrue:[
|
|
338 |
^ glxView recomputeGraph
|
|
339 |
].
|
|
340 |
|
|
341 |
glxView recomputeWholeGraph
|
|
342 |
|
|
343 |
!
|
|
344 |
|
|
345 |
invalidateGraph
|
|
346 |
"called to set the glxView to invalidate, to force a redraw
|
|
347 |
"
|
|
348 |
glxView invalidate
|
|
349 |
!
|
|
350 |
|
|
351 |
recomputeWholeGraph
|
|
352 |
"called to force the glxView to recompute all columns and the grid
|
|
353 |
"
|
|
354 |
glxView recomputeWholeGraph
|
|
355 |
|
752
|
356 |
!
|
|
357 |
|
|
358 |
vLinesSizeChanged:what atX:aPhysX
|
|
359 |
"called if the list of vertical lines changed; a new lineIndex is inserted (#insert:)
|
|
360 |
or removed (#remove:) from the list
|
|
361 |
"
|
|
362 |
Transcript showCR:'VERTICAL LINES NOT YET SUPPORTED'.
|
|
363 |
|
741
|
364 |
! !
|
|
365 |
|
|
366 |
!GraphColumnView3D methodsFor:'rotation'!
|
|
367 |
|
|
368 |
rotateX
|
|
369 |
"returns the rotation X value; range: 0 .. 360
|
|
370 |
"
|
|
371 |
^ rotateX
|
|
372 |
!
|
|
373 |
|
|
374 |
rotateX:aValue
|
|
375 |
"set the rotation X value; range: 0 .. 360
|
|
376 |
"
|
|
377 |
|r|
|
|
378 |
|
|
379 |
(r := self rotateValueFrom:aValue) ~~ rotateX ifTrue:[
|
|
380 |
rotateX := r.
|
|
381 |
self invalidateGraph
|
|
382 |
]
|
|
383 |
!
|
|
384 |
|
|
385 |
rotateY
|
|
386 |
"returns the rotation Y value; range: 0 .. 360
|
|
387 |
"
|
|
388 |
^ rotateY
|
|
389 |
|
|
390 |
!
|
|
391 |
|
|
392 |
rotateY:aValue
|
|
393 |
"set the rotation Y value; range: 0 .. 360
|
|
394 |
"
|
|
395 |
|r|
|
|
396 |
|
|
397 |
(r := self rotateValueFrom:aValue) ~~ rotateY ifTrue:[
|
|
398 |
rotateY := r.
|
|
399 |
self invalidateGraph
|
|
400 |
]
|
|
401 |
|
|
402 |
!
|
|
403 |
|
|
404 |
rotateZ
|
|
405 |
"returns the rotation Z value; range: 0 .. 360
|
|
406 |
"
|
|
407 |
^ rotateZ
|
|
408 |
|
|
409 |
!
|
|
410 |
|
|
411 |
rotateZ:aValue
|
|
412 |
"set the rotation Z value; range: 0 .. 360
|
|
413 |
"
|
|
414 |
|r|
|
|
415 |
|
|
416 |
(r := self rotateValueFrom:aValue) ~~ rotateZ ifTrue:[
|
|
417 |
rotateZ := r.
|
|
418 |
self invalidateGraph
|
|
419 |
]
|
|
420 |
|
|
421 |
! !
|
|
422 |
|
|
423 |
!GraphColumnView3D::GLXGraph methodsFor:'drawing'!
|
|
424 |
|
|
425 |
redraw
|
|
426 |
"redraw
|
|
427 |
"
|
|
428 |
shown ifTrue:[
|
|
429 |
self redrawInBackBuffer.
|
|
430 |
self swapBuffers.
|
|
431 |
self sensor flushExposeEventsFor:self.
|
|
432 |
]
|
|
433 |
|
|
434 |
!
|
|
435 |
|
|
436 |
redrawGraph
|
|
437 |
"draw the graph and spawn the grid dependend on the enabled
|
|
438 |
attributes
|
|
439 |
"
|
|
440 |
|y z x data yVal
|
|
441 |
|
752
|
442 |
colNr "{ Class:SmallInteger }"
|
|
443 |
noRows "| Class:SmallInteger }"
|
|
444 |
r "{ Class:SmallInteger }"
|
|
445 |
firstX "{ Class:SmallInteger }"
|
741
|
446 |
|
|
|
447 |
noRows := graph windowSize.
|
752
|
448 |
firstX := graph graphOriginX.
|
741
|
449 |
z := 0.0.
|
|
450 |
data := Array new:noRows.
|
|
451 |
maxY := nil.
|
|
452 |
|
|
453 |
graph columns do:[:aCol|
|
|
454 |
aCol shown ifTrue:[
|
752
|
455 |
yVal := aCol yValuesStartAt:firstX into:data.
|
741
|
456 |
x := 0.0.
|
|
457 |
r := 1.
|
|
458 |
|
|
459 |
maxY isNil ifTrue:[
|
|
460 |
maxY := minY := yVal at:r
|
|
461 |
].
|
|
462 |
self setColor:(aCol foregroundColor).
|
|
463 |
device glxBeginLineIn:drawableId.
|
|
464 |
|
|
465 |
noRows timesRepeat:[
|
|
466 |
y := yVal at:r.
|
|
467 |
maxY := maxY max:y.
|
|
468 |
minY := minY min:y.
|
|
469 |
|
|
470 |
device glxV3fX:x y:y z:z in:drawableId.
|
|
471 |
x := x + 1.0.
|
|
472 |
r := r + 1.
|
|
473 |
].
|
|
474 |
|
|
475 |
device glxEndLineIn:drawableId.
|
|
476 |
z := z + 1.0.
|
|
477 |
]
|
|
478 |
]
|
|
479 |
!
|
|
480 |
|
|
481 |
redrawGrid
|
|
482 |
"draw the graph and spawn the grid dependend on the enabled
|
|
483 |
attributes
|
|
484 |
"
|
|
485 |
|y z x visCols data
|
|
486 |
noRows "| Class:SmallInteger }"
|
|
487 |
r "{ Class:SmallInteger }"
|
|
488 |
|
|
|
489 |
visCols := graph columns select:[:c| c shown ].
|
|
490 |
|
|
491 |
visCols size < 2 ifTrue:[
|
|
492 |
^ self
|
|
493 |
].
|
|
494 |
noRows := graph windowSize.
|
|
495 |
x := 0.0.
|
752
|
496 |
r := graph graphOriginX.
|
741
|
497 |
data := Array new:1.
|
|
498 |
maxY := minY := (visCols at:1) yValueAt:1.
|
|
499 |
|
|
500 |
self setColor:(graph gridColor).
|
|
501 |
|
|
502 |
noRows timesRepeat:[
|
|
503 |
device glxBeginLineIn:drawableId.
|
|
504 |
z := 0.0.
|
|
505 |
|
|
506 |
visCols do:[:aCol|
|
|
507 |
y := aCol yValueAt:r.
|
|
508 |
maxY := maxY max:y.
|
|
509 |
minY := minY min:y.
|
|
510 |
|
|
511 |
device glxV3fX:x y:y z:z in:drawableId.
|
|
512 |
z := z + 1.0.
|
|
513 |
].
|
|
514 |
|
|
515 |
device glxEndLineIn:drawableId.
|
|
516 |
x := x + 1.0.
|
|
517 |
r := r + 1.
|
|
518 |
].
|
|
519 |
|
|
520 |
|
|
521 |
|
|
522 |
|
|
523 |
!
|
|
524 |
|
|
525 |
redrawInBackBuffer
|
|
526 |
"redraw in back
|
|
527 |
"
|
|
528 |
|sY sX noCols dY winSize|
|
|
529 |
|
|
530 |
self setColor:(graph backgroundColor).
|
|
531 |
self clear.
|
|
532 |
|
|
533 |
(noCols := graph numberOfVisibleColumns) == 0 ifTrue:[ "/ no shown columns
|
|
534 |
^ self
|
|
535 |
].
|
|
536 |
|
|
537 |
winSize := graph windowSize.
|
|
538 |
|
|
539 |
(graph showGrid and:[glxObjGrid isNil]) ifTrue:[
|
|
540 |
self makeObject:(glxObjGrid := self newObjectId).
|
|
541 |
self redrawGrid.
|
|
542 |
self closeObject.
|
|
543 |
].
|
|
544 |
|
|
545 |
(graph showGraph and:[glxObjGraphs isNil]) ifTrue:[
|
|
546 |
self makeObject:(glxObjGraphs := self newObjectId).
|
|
547 |
self redrawGraph.
|
|
548 |
self closeObject.
|
|
549 |
].
|
|
550 |
|
|
551 |
dY := (maxY - minY) / 2.
|
|
552 |
sX := 1.9 / winSize.
|
|
553 |
sY := ((0.5 / (dY max:2.0)) min:sX) * graph zoomY.
|
|
554 |
|
|
555 |
|
|
556 |
self pushMatrix.
|
|
557 |
|
|
558 |
self rotateX:(graph rotateX) y:(graph rotateY) z:(graph rotateZ).
|
|
559 |
self scaleX:sX y:sY z:(graph zoomZ * (1.0 / noCols)).
|
|
560 |
|
|
561 |
self translateX:(winSize / -2.0) "/ rotate center line
|
|
562 |
y:(dY - maxY) "/ translate to center
|
|
563 |
z:(noCols / -2.0). "/ rotate center line
|
|
564 |
|
|
565 |
graph showGrid ifTrue:[ self callObject:glxObjGrid ].
|
|
566 |
graph showGraph ifTrue:[ self callObject:glxObjGraphs ].
|
|
567 |
self popMatrix.
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
! !
|
|
574 |
|
|
575 |
!GraphColumnView3D::GLXGraph methodsFor:'event handling'!
|
|
576 |
|
|
577 |
buttonPress:button x:x y:y
|
|
578 |
"delegate button to graph
|
|
579 |
"
|
|
580 |
graph buttonPress:button x:x y:y
|
|
581 |
! !
|
|
582 |
|
|
583 |
!GraphColumnView3D::GLXGraph methodsFor:'initialization'!
|
|
584 |
|
|
585 |
destroy
|
|
586 |
"remove dependencies
|
|
587 |
"
|
|
588 |
super destroy.
|
|
589 |
self deleteAllObjects.
|
|
590 |
|
|
591 |
!
|
|
592 |
|
|
593 |
for:aGraph
|
|
594 |
graph := aGraph
|
|
595 |
!
|
|
596 |
|
|
597 |
initialize
|
|
598 |
"setup default values
|
|
599 |
"
|
|
600 |
super initialize.
|
|
601 |
|
|
602 |
type := #colorIndexDoubleBuffer. "/ works on any device
|
|
603 |
colorMap := Dictionary new.
|
|
604 |
maxY := 1.0.
|
|
605 |
minY := -1.0.
|
|
606 |
!
|
|
607 |
|
|
608 |
realize
|
|
609 |
"define orthogonal projection; switch to back buffer drawing
|
|
610 |
"
|
|
611 |
super realize.
|
|
612 |
device glxOrthoLeft:-1.0 right:1.0 bottom:-1.0 top:1.0 near:10.0 far:-10.0 in:drawableId.
|
|
613 |
self backBuffer.
|
|
614 |
|
|
615 |
!
|
|
616 |
|
|
617 |
unrealize
|
|
618 |
"clear colorMap and objects
|
|
619 |
"
|
|
620 |
super unrealize.
|
|
621 |
self deleteAllObjects.
|
|
622 |
|
|
623 |
colorMap := Dictionary new.
|
|
624 |
|
|
625 |
! !
|
|
626 |
|
|
627 |
!GraphColumnView3D::GLXGraph methodsFor:'private'!
|
|
628 |
|
|
629 |
deleteAllObjects
|
|
630 |
"delete all graphical objects
|
|
631 |
"
|
|
632 |
glxObjGraphs notNil ifTrue:[
|
|
633 |
self deleteObject:glxObjGraphs.
|
|
634 |
glxObjGraphs := nil
|
|
635 |
].
|
|
636 |
|
|
637 |
glxObjGrid notNil ifTrue:[
|
|
638 |
self deleteObject:glxObjGrid.
|
|
639 |
glxObjGrid := nil.
|
|
640 |
].
|
|
641 |
|
|
642 |
colorMap do:[:aColIndex|
|
|
643 |
].
|
|
644 |
|
|
645 |
!
|
|
646 |
|
|
647 |
setColor:aColor
|
|
648 |
|index useCol|
|
|
649 |
|
|
650 |
useCol := aColor ? graph foregroundColor.
|
|
651 |
|
|
652 |
index := colorMap at:useCol ifAbsent:nil.
|
|
653 |
|
|
654 |
index isNil ifTrue:[
|
|
655 |
index := colorMap size + self class numberOfStandardColors.
|
|
656 |
colorMap at:(useCol on:device) put:index.
|
|
657 |
|
|
658 |
self colorRed:(useCol red) green:(useCol green) blue:(useCol blue).
|
|
659 |
|
|
660 |
self mapColor:index
|
|
661 |
red:(useCol redByte)
|
|
662 |
green:(useCol greenByte)
|
|
663 |
blue:(useCol blueByte).
|
|
664 |
].
|
|
665 |
self color:index.
|
|
666 |
|
|
667 |
|
|
668 |
!
|
|
669 |
|
|
670 |
stepZ
|
|
671 |
^ 1.0
|
|
672 |
! !
|
|
673 |
|
|
674 |
!GraphColumnView3D::GLXGraph methodsFor:'recomputation'!
|
|
675 |
|
|
676 |
recomputeGraph
|
|
677 |
"recompute graph and redraw the graph
|
|
678 |
"
|
|
679 |
glxObjGraphs notNil ifTrue:[
|
|
680 |
self deleteObject:glxObjGraphs.
|
|
681 |
glxObjGraphs := nil
|
|
682 |
].
|
|
683 |
self invalidate.
|
|
684 |
!
|
|
685 |
|
|
686 |
recomputeGrid
|
|
687 |
"recompute graph and redraw the graph
|
|
688 |
"
|
|
689 |
glxObjGrid notNil ifTrue:[
|
|
690 |
self deleteObject:glxObjGrid.
|
|
691 |
glxObjGrid := nil
|
|
692 |
].
|
|
693 |
self invalidate.
|
|
694 |
|
|
695 |
!
|
|
696 |
|
|
697 |
recomputeWholeGraph
|
|
698 |
"recompute columns and grid
|
|
699 |
"
|
|
700 |
self deleteAllObjects.
|
|
701 |
self invalidate
|
|
702 |
|
|
703 |
|
|
704 |
! !
|
|
705 |
|
|
706 |
!GraphColumnView3D class methodsFor:'documentation'!
|
|
707 |
|
|
708 |
version
|
752
|
709 |
^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.2 1998-02-09 11:31:14 ca Exp $'
|
741
|
710 |
! !
|