EllipticalArc.st
changeset 275 4a9fed506144
parent 112 3e18f2cfe430
child 281 344857a33c20
--- a/EllipticalArc.st	Wed May 08 10:55:27 1996 +0200
+++ b/EllipticalArc.st	Wed May 08 14:44:48 1996 +0200
@@ -10,14 +10,14 @@
  hereby transferred.
 "
 
-Geometric subclass: #EllipticalArc 
-	instanceVariableNames: 'boundingBox  startAngle sweepAngle'
-	classVariableNames: ''
-	poolDictionaries: ''
-	category: 'Graphics-Geometry'
+Geometric subclass:#EllipticalArc
+	instanceVariableNames:'boundingBox startAngle sweepAngle'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Graphics-Geometry'
 !
 
-!EllipticalArc class methodsFor: 'documentation'!
+!EllipticalArc class methodsFor:'documentation'!
 
 copyright
 "
@@ -33,10 +33,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.4 1995-11-11 15:21:09 cg Exp $'
-!
-
 documentation
 "
      This class implements an ellipse which is aligned to x and y axes
@@ -53,6 +49,12 @@
     ^ self new boundingBox:aRectangle
 !
 
+boundingBox:aRectangle startAngle:startAngle endAngle:endAngle
+    "Return a new EllipticalArc."
+
+    ^ self boundingBox:aRectangle startAngle:startAngle sweepAngle:(endAngle - startAngle)
+!
+
 boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
     "Return a new EllipticalArc."
 
@@ -65,67 +67,41 @@
     ^ self new center:centerPoint radius:radius
 ! !
 
-!EllipticalArc methodsFor:'converting'!
-
-asEllipticalArc
-    ^ self 
-! !
-
-!EllipticalArc methodsFor:'queries'!
+!EllipticalArc methodsFor:'accessing'!
 
-canBeFilled
-    ^ true
-! !
-
-!EllipticalArc methodsFor:'displaying'!
+boundingBox:aRectangle
+    "set the center and radius, given a bounding rectangle"
 
-displayStrokedOn:aGC
-    aGC displayArcX:boundingBox left
-		  y:boundingBox top
-	      width:boundingBox width
-	     height:boundingBox height
-	       from:startAngle
-		 to:(startAngle+sweepAngle)
+    boundingBox := aRectangle.
+    startAngle := 0.
+    sweepAngle := 360
 !
 
-displayFilledOn:aGC
-    aGC fillArcX:boundingBox left
-	       y:boundingBox top
-	   width:boundingBox width
-	  height:boundingBox height
-	    from:startAngle
-	      to:(startAngle+sweepAngle)
-! !
-
-!EllipticalArc methodsFor:'accessing'!
-
 boundingBox:aRectangle startAngle:start sweepAngle:sweep
-    "set the center and radius"
+    "set the center, radius, start and endAngle, given a bounding rectangle"
 
     boundingBox := aRectangle.
     startAngle := start.
     sweepAngle := sweep
 !
 
-boundingBox:aRectangle
-    "set the center and radius"
+endAngle
+    "return the endAngle."
 
-    boundingBox := aRectangle.
-    startAngle := 0.
-    sweepAngle := 360
-!
-
-center:centerPoint radius:radiusNumber
-    "set the center and radius"
-
-    ^ self boundingBox:((center-r) asPoint corner:(center+r) asPoint).
+    ^ startAngle + sweepAngle
 !
 
 startAngle
     "return the startAngle."
 
     ^ startAngle
-! 
+!
+
+startAngle:angle
+    "set the startAngle."
+
+    startAngle := angle
+!
 
 sweepAngle
     "return the sweepAngle."
@@ -133,9 +109,67 @@
     ^ sweepAngle
 !
 
+sweepAngle:angle
+    "set the sweepAngle."
+
+    sweepAngle := angle
+! !
+
+!EllipticalArc methodsFor:'converting'!
+
+asEllipticalArc
+    "convert the receiver into an ellipticalArc - thats the receiver itself"
+
+    ^ self 
+! !
+
+!EllipticalArc methodsFor:'displaying'!
+
+displayFilledOn:aGC
+    "draw the receiver as a filled arc in a graphicsContext, aGC"
+
+    aGC fillArcX:boundingBox left
+               y:boundingBox top
+           width:boundingBox width
+          height:boundingBox height
+            from:startAngle
+              to:(startAngle+sweepAngle)
+!
+
+displayStrokedOn:aGC
+    "draw the receiver as a unfilled arc in a graphicsContext, aGC"
+
+    aGC displayArcX:boundingBox left
+                  y:boundingBox top
+              width:boundingBox width
+             height:boundingBox height
+               from:startAngle
+              angle:sweepAngle
+! !
+
+!EllipticalArc methodsFor:'queries'!
+
+bounds
+    "return the smallest enclosing rectangle"
+
+    ^ boundingBox
+!
+
+canBeFilled
+    "return true, if the receiver can be drawn as a filled geometric.
+     Always true here."
+
+    ^ true
+!
+
 center
+    "return the center"
+
     ^ boundingBox center
 ! !
 
+!EllipticalArc class methodsFor:'documentation'!
 
-
+version
+    ^ '$Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.5 1996-05-08 12:44:20 cg Exp $'
+! !