'From Pharo1.4 of 18 April 2012 [Latest update: #14457] on 16 September 2012 at
9:08:32 pm'!
ROShape subclass: #ROCircle
instanceVariableNames: 'borderColor borderWidth'
classVariableNames: ''
poolDictionaries: ''
category: 'Roassal-Core'!
!ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012
21:06'!
usecase7
"
self new usecase7
"
"
Need to have elements that represent electrical symbols: eg
http://www.red-bag.com/imageslib/BN-DS-E2_02.pdf
Here we implement a transformer as an example - see page 11.
"
| view circle circleLabel transformer transformerLabel |
view := ROView new.
transformer := (ROElement on: 'N080111' ) @ RODraggable. "N080111 is an
example equipment tag for a particular transformer"
transformer attributes at: #rating put: '7MVA'. "Properly these attributes
would be ivars of the transformer model, but fake it for demo purposes"
transformer attributes at: #impedance put: '15%'.
transformerLabel := ROLabel new text:
[ :element |
(element attributes at: #rating ifAbsent: '??MVA') asString,
String crlf,
(element attributes at: #impedance ifAbsent: '??%') asString.
].
transformer + (ROCircle new borderOnly extent: 50@50 ) + (ROTranslatingShape new offset:
25@0) + (ROCircle new borderOnly extent: 50@50).
transformer + (ROTranslatingShape new offset: [ (transformer width / 8) negated @
(transformer height) ] ) + transformerLabel.
view add: transformer .
view open.! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:08'!
borderColor
^ borderColor ! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:07'!
borderColor: aColor
borderColor := aColor.! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 20:38'!
borderOnly
self borderWidth: 1.
self borderColor: Color black.
self color: Color transparent.
! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:08'!
borderWidth
^borderWidth
! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:06'!
borderWidth: anInteger
borderWidth := anInteger.
! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:06'!
drawOn: aCanvas for: aROElement
aCanvas
fillOval: aROElement bounds
color: color
borderWidth: borderWidth
borderColor: borderColor! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 15:45'!
extent: anExtentPoint
| max |
max := anExtentPoint x max: anExtentPoint y.
extent := max @ max.
next extent: anExtentPoint! !
!ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:05'!
initialize
super initialize.
borderWidth := 0.
borderColor := Color black.! !
ROCircle removeSelector: #borederOnly!