home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
BURKS
/
LANGUAGE
/
SMALTALK
/
TEXTBOOK
/
AP30.ST
(
.txt
)
< prev
next >
Wrap
Text File
|
1997-04-22
|
3KB
|
124 lines
'Smalltalk Textbook Appendix 30'!
EngiVertex subclass: #EngiClassVertex
instanceVariableNames: 'className classIcon '
classVariableNames: ''
poolDictionaries: ''
category: 'Engi-Inheritance'!
EngiClassVertex comment:
'
Engi 0.07 (24 March 1994)
Copyright (C) 1994 by Atsushi Aoki
'!
!EngiClassVertex methodsFor: 'accessing'!
className
^className!
className: aSymbol
className := aSymbol.
classIcon := (' ' , aSymbol asString , ' ') asComposedText.
classIcon gridWithLead: 0.
self vertexExtent: classIcon bounds extent! !
!EngiClassVertex methodsFor: 'bounds accessing'!
computeBounds
| bounds |
bounds := classIcon bounds.
bounds := bounds align: bounds origin with: self vertexPoint.
^bounds! !
!EngiClassVertex methodsFor: 'displaying'!
displayFilledOn: graphicsContext at: aPoint
| aRectangle |
self fillColor isNil ifFalse: [((self bounds translatedBy: aPoint)
intersects: graphicsContext clippingBounds)
ifTrue:
[aRectangle := self vertexPoint extent: self vertexExtent.
aRectangle := (aRectangle translatedBy: aPoint) rounded.
graphicsContext paint: self fillColor.
graphicsContext lineWidth: self lineWidth.
graphicsContext displayRectangle: aRectangle]]!
displayStrokedOn: graphicsContext at: aPoint
| aRectangle |
self strokeColor isNil ifFalse: [((self bounds translatedBy: aPoint)
intersects: graphicsContext clippingBounds)
ifTrue:
[aRectangle := self vertexPoint extent: self vertexExtent.
aRectangle := (aRectangle translatedBy: aPoint) rounded.
graphicsContext paint: self strokeColor.
graphicsContext lineWidth: self lineWidth.
classIcon displayOn: graphicsContext at: aRectangle origin]]! !
!EngiClassVertex methodsFor: 'printing'!
printOn: aStream
aStream nextPutAll: 'vertex('.
aStream nextPutAll: self className asString.
aStream nextPutAll: ')'! !
EngiBranch subclass: #EngiClassBranch
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Engi-Inheritance'!
EngiClassBranch comment:
'
Engi 0.07 (24 March 1994)
Copyright (C) 1994 by Atsushi Aoki
'!
!EngiClassBranch methodsFor: 'point accessing'!
endPoint
endVertex isNil ifTrue: [^Point zero].
^endVertex bounds leftCenter!
startPoint
startVertex isNil ifTrue: [^Point zero].
^startVertex bounds rightCenter! !
!EngiClassBranch methodsFor: 'displaying'!
displayStrokedOn: graphicsContext at: aPoint
| startPoint endPoint centerPoint |
self strokeColor isNil ifFalse: [((self bounds translatedBy: aPoint)
intersects: graphicsContext clippingBounds)
ifTrue:
[startPoint := (self startPoint + aPoint) rounded.
endPoint := (self endPoint + aPoint) rounded.
graphicsContext paint: self strokeColor.
graphicsContext lineWidth: self lineWidth.
centerPoint := (startPoint + (endPoint - startPoint / 2)) rounded.
graphicsContext displayLineFrom: startPoint to: centerPoint x @ startPoint y.
graphicsContext displayLineFrom: centerPoint x @ startPoint y to: centerPoint x @ endPoint y.
graphicsContext displayLineFrom: centerPoint x @ endPoint y to: endPoint]]! !
!EngiClassBranch methodsFor: 'printing'!
printOn: aStream
aStream nextPutAll: 'branch('.
aStream nextPutAll: self startVertex className asString.
aStream nextPutAll: ','.
aStream nextPutAll: self endVertex className asString.
aStream nextPutAll: ')'! !