[ENH] Mods to display aLinearFit out of aGraphicSymbolInstance

John-Reed Maffeo (rlpa80) rlpa80 at email.sps.mot.com
Mon Mar 6 03:47:46 UTC 2000


This set of changes affects GraphicSymbol, GraphicSymbolInstnace, LinearFit, and
Path. It was developed to display aLinearFit out of aGraphicSymbolInstance.


John-Reed Maffeo
Mesa, AZ







--- snip here ----
'From Squeak2.7 of 5 January 2000 [latest update: #1782] on 4 March 2000 at
12:02:05 pm'!

!GraphicSymbol methodsFor: 'accessing' stamp: 'jrm 2/6/2000 11:01'!
computeBoundingBox
	"Compute a boundingBox that encloses all of the Paths in this symbol"

	^Rectangle merging: (self collect: [:each | each computeBoundingBox])
! !


!GraphicSymbolInstance methodsFor: 'displaying' stamp: 'jrm 2/13/2000 10:02'!
displayOn: aDisplayMedium transformation: aTransformation clippingBox:
clipRect rule: anInteger fillColor: aForm 
	"Display the graphic symbol on the Display according to the arguments 
	of this message."

	graphicSymbol
		displayOn: aDisplayMedium
		transformation: aTransformation 
		clippingBox: clipRect
		rule: anInteger
		fillColor: aForm! !


!Path methodsFor: 'transforming' stamp: 'jrm 9/1/1999 21:26'!
scaleBy: aPoint 
	"Answers a new Path scaled by aPoint. Does not affect the current data in 
	this Path."

	| newPath | 
	newPath _ self species new: self size. 
	newPath form: self form.
	collectionOfPoints do: [:element | newPath add: (element scaleBy: aPoint)].
	^newPath! !

!Path methodsFor: 'transforming' stamp: 'jrm 9/1/1999 21:28'!
translateBy: aPoint 
	"Answers a new Path whose elements are translated by aPoint. Does not
	affect the elements of this Path."

	| newPath |
	newPath _ self species new: self size.
	newPath form: self form.
	collectionOfPoints do: [:element | newPath add: (element translateBy: aPoint)].
	^newPath! !


!LinearFit methodsFor: 'displaying' stamp: 'jrm 9/7/1999 22:16'!
displayOn: aDisplayMedium at: aPoint clippingBox: clipRect rule: anInteger
fillColor: aForm
 
	| line |
	line _ Line new.
	line form: self form.
	1 to: self size - 1 do: 
		[:i | 
		line beginPoint: (self at: i).
		line endPoint: (self at: i + 1).
		line displayOn: aDisplayMedium
			at: aPoint
			clippingBox: clipRect
			rule: anInteger
			fillColor: aForm]! !

!LinearFit methodsFor: 'displaying' stamp: 'jrm 9/7/1999 23:00'!
displayOn: aDisplayMedium transformation: aTransformation clippingBox:
clipRect rule: anInteger fillColor: aForm 

	| transformedPath |
	"get the scaled and translated Path."
	transformedPath _ aTransformation applyTo: self.
	transformedPath
		displayOn: aDisplayMedium
		at: 0 @ 0
		clippingBox: clipRect
		rule: anInteger
		fillColor: aForm! !





More information about the Squeak-dev mailing list