add text and new functionality
authorca
Mon, 09 Feb 1998 12:31:14 +0100
changeset 752 271edd188ab6
parent 751 616686a9b678
child 753 0b6aaced2915
add text and new functionality
GraphColumnView3D.st
--- a/GraphColumnView3D.st	Mon Feb 09 11:47:09 1998 +0100
+++ b/GraphColumnView3D.st	Mon Feb 09 12:31:14 1998 +0100
@@ -13,6 +13,25 @@
 	privateIn:GraphColumnView3D
 !
 
+!GraphColumnView3D class methodsFor:'documentation'!
+
+documentation
+"
+    The class provides all the functionality for showing, scrolling and manipulating graphs
+    described through to a GraphColumn description. Each change in a graph description
+    immediately take affect.
+
+
+    [See also:]
+        GraphColumn
+        GraphColumnView
+        GraphColumnView2D
+
+    [Author:]
+        Claus Atzkern
+"
+
+! !
 
 !GraphColumnView3D class methodsFor:'menu'!
 
@@ -56,124 +75,6 @@
 
 !GraphColumnView3D class methodsFor:'test'!
 
-cos
-"
-self cos
-"
-    |top list view x|
-
-    top  := StandardSystemView extent:800 @ 400.
-    view := GraphColumnView3D origin:0@0 extent:1.0@1.0 in:top.
-    list := OrderedCollection new.
-
-    top label:'2D-View'.
-
-    #(  ( 'foo'         red    )
-        ( 'bar'         green  )
-        ( 'baz'         yellow )
-        ( 'foo 2'       blue   )
-     ) do:[:slice|
-        |col|
-
-        col := GraphColumn name:(slice at:1).
-        col foregroundColor:(Color perform:(slice at:2)).
-
-        col functionYblock:[:start :anArray|
-            x := (start - 1) * 0.2.
-            1 to:(anArray size) do:[:i| anArray at:i put:(x cos). x := x + 0.2 ].
-            anArray
-        ].
-        list add:col
-    ].
-
-    view showGrid:true.
-    view columns:list.
-    top open.
-
-
-
-
-
-!
-
-sin
-"
-self sin
-"
-    |top list view x|
-
-    top  := StandardSystemView extent:800 @ 400.
-    view := GraphColumnView3D origin:0@0 extent:1.0@1.0 in:top.
-    list := OrderedCollection new.
-
-    top label:'2D-View'.
-
-    #(  ( 'foo'         red    )
-        ( 'bar'         green  )
-        ( 'baz'         yellow )
-        ( 'foo 2'       blue   )
-     ) do:[:slice|
-        |col|
-
-        col := GraphColumn name:(slice at:1).
-        col foregroundColor:(Color perform:(slice at:2)).
-
-        col functionYblock:[:start :anArray|
-            x := (start - 1) * 0.2.
-            1 to:(anArray size) do:[:i| anArray at:i put:(x sin). x := x + 0.2 ].
-            anArray
-        ].
-        list add:col
-    ].
-
-    view showGrid:true.
-    view columns:list.
-    top open.
-!
-
-tan
-"
-self tan
-"
-
-    |top list view x step|
-
-    top  := StandardSystemView extent:800 @ 400.
-    view := GraphColumnView3D origin:0@0 extent:1.0@1.0 in:top.
-    list := OrderedCollection new.
-
-    top label:'2D-View'.
-
-    step := 0.04.
-
-    #(  ( 'foo'         red    )
-        ( 'bar'         green  )
-        ( 'baz'         yellow )
-        ( 'foo 2'       blue   )
-     ) do:[:slice|
-        |col|
-
-        col := GraphColumn name:(slice at:1).
-        col foregroundColor:(Color perform:(slice at:2)).
-
-        col functionYblock:[:start :anArray|
-            x := (start - 1) * step.
-            1 to:(anArray size) do:[:i| anArray at:i put:(x tan). x := x + step ].
-            anArray
-        ].
-        list add:col
-    ].
-
-    view showGrid:true.
-    view columns:list.
-    top open.
-
-
-
-
-
-!
-
 test
 "
 self test
@@ -196,9 +97,9 @@
         col functionYblock:[:start :anArray|
             x := (start - 1) * 0.2.
             (idx == 1 or:[idx == 3]) ifTrue:[
-                1 to:(anArray size) do:[:i| anArray at:i put:(x sin). x := x + 0.2 ].
+                1 to:(anArray size) do:[:i| anArray at:i put:20 * (x sin). x := x + 0.2 ].
             ] ifFalse:[
-                1 to:(anArray size) do:[:i| anArray at:i put:(x cos). x := x + 0.2 ].
+                1 to:(anArray size) do:[:i| anArray at:i put:20 * (x cos). x := x + 0.2 ].
             ].
             anArray
         ].
@@ -235,14 +136,14 @@
 !
 
 zoomZ
-    "returns the current z-zoom factor
+    "returns the current zoom Z factor
     "
     ^ zoomZ
 !
 
 zoomZ:aValue
-    "set the current z-zoom factor; if the argument is nil,
-     the z-zoom is set to 1 ( no zoom ).
+    "set the zoom Z factor; if the argument is nil or not valid, the
+     default zoom Z factor is set (1).
     "
     |zZ|
 
@@ -259,14 +160,14 @@
 !GraphColumnView3D methodsFor:'accessing mvc'!
 
 rotateXHolder
-    "returns the valueHolder, which keeps the current rotation X value
+    "returns the valueHolder, which holds the rotation X value
     "
     ^ rotateXHolder
 
 !
 
 rotateXHolder:aHolder
-    "set the valueHolder, which keeps the current rotation X value
+    "set the valueHolder, which holds the rotation X value
     "
     rotateXHolder == aHolder ifFalse:[
         rotateXHolder notNil ifTrue:[
@@ -280,14 +181,14 @@
 !
 
 rotateYHolder
-    "returns the valueHolder, which keeps the current rotation Y value
+    "returns the valueHolder, which holds the rotation Y value
     "
     ^ rotateYHolder
 
 !
 
 rotateYHolder:aHolder
-    "set the valueHolder, which keeps the current rotation Y value
+    "set the valueHolder, which holds the rotation Y value
     "
     rotateYHolder == aHolder ifFalse:[
         rotateYHolder notNil ifTrue:[
@@ -302,14 +203,14 @@
 !
 
 rotateZHolder
-    "returns the valueHolder, which keeps the current rotation Z value
+    "returns the valueHolder, which holds the rotation Z value
     "
     ^ rotateZHolder
 
 !
 
 rotateZHolder:aHolder
-    "set the valueHolder, which keeps the current rotation Z value
+    "set the valueHolder, which holds the rotation Z value
     "
     rotateZHolder == aHolder ifFalse:[
         rotateZHolder notNil ifTrue:[
@@ -324,14 +225,14 @@
 !
 
 zoomZHolder
-    "returns the valueHolder, which keeps the current zoom Z value
+    "returns the valueHolder, which holds the zoom Z factor
     "
     ^ zoomZHolder
 
 !
 
 zoomZHolder:aHolder
-    "set the valueHolder, which keeps the current zoom Z value
+    "set the valueHolder, which holds the zoom Z factor
     "
     zoomZHolder == aHolder ifFalse:[
         zoomZHolder notNil ifTrue:[
@@ -394,28 +295,33 @@
     zoomZ    := 1.
 
     showGraph := true.
-    glxView  := GLXGraph for:self.
+
+    glxView   := GLXGraph extent:(1.0 @ 1.0) in:self.
+    glxView for:self.
 
 ! !
 
 !GraphColumnView3D methodsFor:'protocol'!
 
 colorChanged:what
-    "called if a color changed, #foreground, #background, #grid or #vLines
+    "called if any color changed; the argument to the change notification
+     specifies the color which has changed:
+
+        #foreground     the foreground color 
+        #background     the background color
+        #grid           the color of the grid
+        #vLines         the color of the vertical lines
     "
-    what == #foreground ifTrue:[
-        glxView recomputeGraph
-    ] ifFalse:[
-        what == #grid ifTrue:[
-            glxView recomputeGrid
-        ] ifFalse:[
-            glxView recomputeWholeGraph
-        ]
-    ]
+    what == #foreground ifTrue:[ ^ glxView recomputeGraph ].
+    what == #background ifTrue:[ ^ glxView invalidate ].
+    what == #grid       ifTrue:[ ^ glxView recomputeGrid ].
+
+    Transcript showCR:'VERTICAL LINES NOT YET SUPPORTED'.
 !
 
 columnChanged:what with:oldValue from:aColumn
-    "a column changed
+    "a column has changed one of its attributes; the arguments to the
+     notification are passed by the column.
     "
     (
         #( lineStyle  lineWidth
@@ -424,7 +330,8 @@
            transY
          ) includesIdentical:what
     ) ifTrue:[
-        ^ self
+        Transcript showCR:what printString, ': NOT YET SUPPORTED'.
+      ^ self
     ].
 
     what == #foregroundColor ifTrue:[
@@ -446,6 +353,14 @@
     "
     glxView recomputeWholeGraph
 
+!
+
+vLinesSizeChanged:what atX:aPhysX
+    "called if the list of vertical lines changed; a new lineIndex is inserted (#insert:)
+     or removed (#remove:) from the list
+    "
+    Transcript showCR:'VERTICAL LINES NOT YET SUPPORTED'.
+
 ! !
 
 !GraphColumnView3D methodsFor:'rotation'!
@@ -505,18 +420,6 @@
 
 ! !
 
-!GraphColumnView3D::GLXGraph class methodsFor:'instance creation'!
-
-for:aGraph
-    |graph|
-
-    graph := self extent:(1.0 @ 1.0) in:aGraph.
-    graph for:aGraph.
-  ^ graph
-
-
-! !
-
 !GraphColumnView3D::GLXGraph methodsFor:'drawing'!
 
 redraw
@@ -536,18 +439,20 @@
     "
     |y z x data yVal
 
-     colNr  "{ Class:SmallInteger }"
-     noRows "| Class:SmallInteger }"
-     r      "{ Class:SmallInteger }"
+     colNr   "{ Class:SmallInteger }"
+     noRows  "| Class:SmallInteger }"
+     r       "{ Class:SmallInteger }"
+     firstX  "{ Class:SmallInteger }"
     |
     noRows := graph windowSize.
+    firstX := graph graphOriginX.
     z      := 0.0.
     data   := Array new:noRows.
     maxY   := nil.
 
     graph columns do:[:aCol|
         aCol shown ifTrue:[
-            yVal := aCol yValuesStartAt:1 into:data.
+            yVal := aCol yValuesStartAt:firstX into:data.
             x    := 0.0.
             r    := 1.
 
@@ -578,7 +483,6 @@
      attributes
     "
     |y z x visCols data
-
      noRows "| Class:SmallInteger }"
      r      "{ Class:SmallInteger }"
     |
@@ -589,7 +493,7 @@
     ].
     noRows := graph windowSize.
     x      := 0.0.
-    r      := 1.
+    r      := graph graphOriginX.
     data   := Array new:1.
     maxY   := minY := (visCols at:1) yValueAt:1.
 
@@ -802,5 +706,5 @@
 !GraphColumnView3D class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.1 1998-02-07 15:16:52 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.2 1998-02-09 11:31:14 ca Exp $'
 ! !