equal
deleted
inserted
replaced
5 poolDictionaries:'' |
5 poolDictionaries:'' |
6 category:'Views-Graphs' |
6 category:'Views-Graphs' |
7 ! |
7 ! |
8 |
8 |
9 GLXView subclass:#GLXGraph |
9 GLXView subclass:#GLXGraph |
10 instanceVariableNames:'graph colorMap glxObjGraphs glxObjRefs glxObjGrid glxObjAxis maxY |
10 instanceVariableNames:'graph colorMap glxObjGraphs glxObjFcts glxObjRefs glxObjGrid |
11 minY' |
11 glxObjAxis maxY minY removeGraphs removeFcts removeRefs |
|
12 removeGrid removeAxis redrawLock' |
12 classVariableNames:'' |
13 classVariableNames:'' |
13 poolDictionaries:'' |
14 poolDictionaries:'' |
14 privateIn:GraphColumnView3D |
15 privateIn:GraphColumnView3D |
15 ! |
16 ! |
16 |
17 |
122 |
123 |
123 |
124 |
124 |
125 |
125 |
126 |
126 |
127 |
|
128 ! |
|
129 |
|
130 test1 |
|
131 " |
|
132 self test1 |
|
133 " |
|
134 |top list view x| |
|
135 |
|
136 top := StandardSystemView extent:800 @ 400. |
|
137 view := GraphColumnView3D origin:0@0 extent:1.0@1.0 in:top. |
|
138 list := OrderedCollection new. |
|
139 |
|
140 top label:'3D-View'. |
|
141 |
|
142 #( red green yellow blue |
|
143 ) keysAndValuesDo:[:idx :aColor| |
|
144 |col| |
|
145 |
|
146 col := GraphColumn name:idx. |
|
147 col foregroundColor:(Color perform:aColor). |
|
148 |
|
149 col functionYblock:[:start :anArray| |
|
150 x := (start - 1) * 0.2. |
|
151 (idx == 1 or:[idx == 3]) ifTrue:[ |
|
152 1 to:(anArray size) do:[:i| anArray at:i put:20 * (x sin). x := x + 0.2 ]. |
|
153 ] ifFalse:[ |
|
154 1 to:(anArray size) do:[:i| anArray at:i put:20 * (x cos). x := x + 0.2 ]. |
|
155 ]. |
|
156 anArray |
|
157 ]. |
|
158 list add:col |
|
159 ]. |
|
160 view showGrid:true. |
|
161 view columns:list. |
|
162 view showDefaultMenu:true. |
|
163 top openAndWait. |
|
164 |
|
165 [ |o i| |
|
166 |
|
167 i := 0. |
|
168 |
|
169 [top shown] whileTrue:[ |
|
170 view rotateX:i. |
|
171 i := i + 10. |
|
172 o := view removeFirst. |
|
173 view add:o. |
|
174 Delay waitForSeconds:0.2. |
|
175 ] |
|
176 |
|
177 ] forkAt:7. |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
127 ! ! |
183 ! ! |
128 |
184 |
129 !GraphColumnView3D methodsFor:'accessing look'! |
185 !GraphColumnView3D methodsFor:'accessing look'! |
130 |
186 |
131 showAxis |
187 showAxis |
404 |
460 |
405 rotateX:aValue |
461 rotateX:aValue |
406 "set the rotation X value; range: 0 .. 360 |
462 "set the rotation X value; range: 0 .. 360 |
407 " |
463 " |
408 |r| |
464 |r| |
|
465 "/ Transcript showCR:aValue. |
409 |
466 |
410 (r := self rotateValueFrom:aValue) ~~ rotateX ifTrue:[ |
467 (r := self rotateValueFrom:aValue) ~~ rotateX ifTrue:[ |
411 rotateX := r. |
468 rotateX := r. |
412 self doInvalidateGraph |
469 self doInvalidateGraph |
413 ] |
470 ] |
455 |
512 |
456 redraw |
513 redraw |
457 "redraw |
514 "redraw |
458 " |
515 " |
459 shown ifTrue:[ |
516 shown ifTrue:[ |
460 self redrawInBackBuffer. |
517 self freeObjectsDo:[ |
461 self swapBuffers. |
518 self redrawInBackBuffer. |
462 self sensor flushExposeEventsFor:self. |
519 self swapBuffers. |
|
520 ] |
463 ] |
521 ] |
464 |
522 |
465 ! |
523 ! |
466 |
524 |
467 redrawAxisFor:aListOfVisibleCols |
525 redrawAxisFor:aListOfVisibleCols |
600 self makeObject:(glxObjGrid := self newObjectId). |
658 self makeObject:(glxObjGrid := self newObjectId). |
601 self redrawGridFor:loCols. |
659 self redrawGridFor:loCols. |
602 self closeObject. |
660 self closeObject. |
603 ]. |
661 ]. |
604 |
662 |
605 (graph showGraph and:[glxObjGraphs isNil]) ifTrue:[ |
663 (graph showGraph and:[glxObjFcts isNil]) ifTrue:[ |
606 self makeObject:(glxObjGraphs := self newObjectId). |
664 self makeObject:(glxObjFcts := self newObjectId). |
607 self redrawGraphFor:loCols. |
665 self redrawGraphFor:loCols. |
608 self closeObject. |
666 self closeObject. |
609 ]. |
667 ]. |
610 |
668 |
611 (graph showAxis and:[glxObjAxis isNil]) ifTrue:[ |
669 (graph showAxis and:[glxObjAxis isNil]) ifTrue:[ |
647 self translateX:(winSize / -2.0) "/ rotate center line |
705 self translateX:(winSize / -2.0) "/ rotate center line |
648 y:(dY - maxY) "/ translate to center |
706 y:(dY - maxY) "/ translate to center |
649 z:(noCols - 1 / -2.0). "/ rotate center line |
707 z:(noCols - 1 / -2.0). "/ rotate center line |
650 |
708 |
651 graph showGrid ifTrue:[ self callObject:glxObjGrid ]. |
709 graph showGrid ifTrue:[ self callObject:glxObjGrid ]. |
652 graph showGraph ifTrue:[ self callObject:glxObjGraphs ]. |
710 graph showGraph ifTrue:[ self callObject:glxObjFcts ]. |
653 graph showAxis ifTrue:[ self callObject:glxObjAxis ]. |
711 graph showAxis ifTrue:[ self callObject:glxObjAxis ]. |
654 graph showReferences ifTrue:[ self callObject:glxObjRefs ]. |
712 graph showReferences ifTrue:[ self callObject:glxObjRefs ]. |
655 |
713 |
656 self popMatrix. |
714 self popMatrix. |
657 ! |
715 ! |
705 |
763 |
706 destroy |
764 destroy |
707 "remove dependencies |
765 "remove dependencies |
708 " |
766 " |
709 super destroy. |
767 super destroy. |
710 self deleteAllObjects. |
768 self deleteAllObjects. |
|
769 self freeObjectsDo:nil. |
711 ! |
770 ! |
712 |
771 |
713 for:aGraph |
772 for:aGraph |
714 graph := aGraph |
773 graph := aGraph |
715 ! |
774 ! |
721 |
780 |
722 type := #colorIndexDoubleBuffer. "/ works on any device |
781 type := #colorIndexDoubleBuffer. "/ works on any device |
723 colorMap := Dictionary new. |
782 colorMap := Dictionary new. |
724 maxY := 1.0. |
783 maxY := 1.0. |
725 minY := -1.0. |
784 minY := -1.0. |
|
785 removeFcts := false. |
|
786 removeRefs := false. |
|
787 removeGrid := false. |
|
788 removeAxis := false. |
|
789 |
|
790 redrawLock := Semaphore forMutualExclusion. |
726 ! |
791 ! |
727 |
792 |
728 realize |
793 realize |
729 "define orthogonal projection; switch to back buffer drawing |
794 "define orthogonal projection; switch to back buffer drawing |
730 " |
795 " |
736 |
801 |
737 unrealize |
802 unrealize |
738 "clear colorMap and objects |
803 "clear colorMap and objects |
739 " |
804 " |
740 super unrealize. |
805 super unrealize. |
|
806 |
741 self deleteAllObjects. |
807 self deleteAllObjects. |
742 |
808 self freeObjectsDo:[ |
743 colorMap := Dictionary new. |
809 colorMap := Dictionary new. |
|
810 ]. |
744 |
811 |
745 ! ! |
812 ! ! |
746 |
813 |
747 !GraphColumnView3D::GLXGraph methodsFor:'private'! |
814 !GraphColumnView3D::GLXGraph methodsFor:'private'! |
|
815 |
|
816 freeObjectsDo:aBlock |
|
817 |id| |
|
818 |
|
819 redrawLock critical:[ |
|
820 id := glxObjFcts printString. |
|
821 |
|
822 (removeFcts and:[glxObjFcts notNil]) ifTrue:[ |
|
823 self deleteObject:glxObjFcts. |
|
824 glxObjFcts := nil. |
|
825 ]. |
|
826 |
|
827 (removeRefs and:[glxObjRefs notNil]) ifTrue:[ |
|
828 self deleteObject:glxObjRefs. |
|
829 glxObjRefs := nil. |
|
830 ]. |
|
831 |
|
832 (removeGrid and:[glxObjGrid notNil]) ifTrue:[ |
|
833 self deleteObject:glxObjGrid. |
|
834 glxObjGrid := nil. |
|
835 ]. |
|
836 |
|
837 (removeAxis and:[glxObjAxis notNil]) ifTrue:[ |
|
838 self deleteObject:glxObjAxis. |
|
839 glxObjAxis := nil. |
|
840 ]. |
|
841 |
|
842 removeAxis := removeGrid := removeRefs := removeFcts := false. |
|
843 aBlock value. |
|
844 ] |
|
845 |
|
846 ! |
748 |
847 |
749 setColor:aColor |
848 setColor:aColor |
750 |index useCol| |
849 |index useCol| |
751 |
850 |
752 useCol := aColor ? graph foregroundColor. |
851 useCol := aColor ? graph foregroundColor. |
776 !GraphColumnView3D::GLXGraph methodsFor:'removing'! |
875 !GraphColumnView3D::GLXGraph methodsFor:'removing'! |
777 |
876 |
778 deleteAllObjects |
877 deleteAllObjects |
779 "delete all graphical objects |
878 "delete all graphical objects |
780 " |
879 " |
781 self deleteGrid. |
880 removeGrid := removeAxis := removeFcts := removeRefs := true. |
782 self deleteAxis. |
881 |
783 self deleteColumns. |
|
784 self deleteReferences. |
|
785 ! |
882 ! |
786 |
883 |
787 deleteAxis |
884 deleteAxis |
788 |
885 removeAxis := true. |
789 glxObjAxis notNil ifTrue:[ |
|
790 self deleteObject:glxObjAxis. |
|
791 glxObjAxis := nil. |
|
792 ]. |
|
793 |
|
794 ! |
886 ! |
795 |
887 |
796 deleteColumns |
888 deleteColumns |
797 "delete the columns |
889 "delete the columns |
798 " |
890 " |
799 glxObjGraphs notNil ifTrue:[ |
891 removeFcts := true. |
800 self deleteObject:glxObjGraphs. |
|
801 glxObjGraphs := nil |
|
802 ]. |
|
803 |
|
804 ! |
892 ! |
805 |
893 |
806 deleteGrid |
894 deleteGrid |
807 "delete the grid |
895 "delete the grid |
808 " |
896 " |
809 glxObjGrid notNil ifTrue:[ |
897 removeGrid := true. |
810 self deleteObject:glxObjGrid. |
|
811 glxObjGrid := nil |
|
812 ]. |
|
813 |
|
814 ! |
898 ! |
815 |
899 |
816 deleteReferences |
900 deleteReferences |
817 "delete the references |
901 "delete the references |
818 " |
902 " |
819 glxObjRefs notNil ifTrue:[ |
903 removeRefs := true. |
820 self deleteObject:glxObjRefs. |
|
821 glxObjRefs := nil. |
|
822 ]. |
|
823 ! ! |
904 ! ! |
824 |
905 |
825 !GraphColumnView3D class methodsFor:'documentation'! |
906 !GraphColumnView3D class methodsFor:'documentation'! |
826 |
907 |
827 version |
908 version |
828 ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.3 1998-02-13 13:50:50 ca Exp $' |
909 ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.4 1998-03-05 19:43:24 ca Exp $' |
829 ! ! |
910 ! ! |