Roassal - idea for compound shapes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal - idea for compound shapes

Ben Coman

I think the following would be the start of a good example of how
Roassal works...

    | view rawView el1 el2 edge line |
    rawView := ROView new.
    el1 := ROElement new.
    el1 extent: 50@50.
    el1 + ROBox red  +  ROCircle yellow  + ROLabel  @  RODraggable.
    rawView add: el1.
    rawView open

...except that it would be nice if the ROLabel could be centred.

In addition, being able to place the ROLabel in various "offset"
locations, I think that would satisfy a lot of my composition
requirements - for example building a transformer compound symbol with
two overlapping circles and two labels for "equipment tag" and "power
size".  To that effect it would be great if ROLabel or similar could
have a callback mechanism to get different attributes from the model.  
Alternatively I guess I could make a new subclass of ROShape that draws
such that directly.

cheers -ben
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal - idea for compound shapes

abergel
>   | view rawView el1 el2 edge line |
>   rawView := ROView new.
>   el1 := ROElement new.
>   el1 extent: 50@50.
>   el1 + ROBox red  +  ROCircle yellow  + ROLabel  @  RODraggable.
>   rawView add: el1.
>   rawView open

neat isn't it?

> ...except that it would be nice if the ROLabel could be centred.

Yes, I will work on this.

> In addition, being able to place the ROLabel in various "offset" locations,

Right, top, center, bottom? Is this what you mean?

> I think that would satisfy a lot of my composition requirements - for example building a transformer compound symbol with two overlapping circles and two labels for "equipment tag" and "power size".  To that effect it would be great if ROLabel or similar could have a callback mechanism to get different attributes from the model.  Alternatively I guess I could make a new subclass of ROShape that draws such that directly.

I do not understand what you mean by these attributes from the model?
You can do things like (using the last version):

-=-=-=-=-=-=-=-=-=-=-=-=
 | view rawView el1 el2 edge line |
  rawView := ROView new.
  el1 := ROElement on: 1.
  el1 extent: 50@50.
  el1 + (ROLabel new color: [ :model | model odd ifTrue: [ Color red ] ifFalse: [ Color blue ]]).
  el1 on: ROMouseLeftClick do: [ :ann | ann element model: (ann element model + 1). el1 shapesDo: #resetCache. rawView signalUpdate ].
  el1 @ RODraggable.

  rawView add: el1.
  rawView open
-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,
Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal - idea for compound shapes

Ben Coman
Alexandre Bergel wrote:
  | view rawView el1 el2 edge line |
  rawView := ROView new.
  el1 := ROElement new.
  el1 extent: 50@50.
  el1 + ROBox red  +  ROCircle yellow  + ROLabel  @  RODraggable.
  rawView add: el1.
  rawView open
    

neat isn't it?

  
...except that it would be nice if the ROLabel could be centred.
    

Yes, I will work on this.

  
In addition, being able to place the ROLabel in various "offset" locations,
    

Right, top, center, bottom? Is this what you mean?

  
I think that would satisfy a lot of my composition requirements - for example building a transformer compound symbol with two overlapping circles and two labels for "equipment tag" and "power size".  To that effect it would be great if ROLabel or similar could have a callback mechanism to get different attributes from the model.  Alternatively I guess I could make a new subclass of ROShape that draws such that directly.
    

I do not understand what you mean by these attributes from the model?
You can do things like (using the last version):

-=-=-=-=-=-=-=-=-=-=-=-=
 | view rawView el1 el2 edge line |
  rawView := ROView new.
  el1 := ROElement on: 1.
  el1 extent: 50@50.
  el1 + (ROLabel new color: [ :model | model odd ifTrue: [ Color red ] ifFalse: [ Color blue ]]). 
  el1 on: ROMouseLeftClick do: [ :ann | ann element model: (ann element model + 1). el1 shapesDo: #resetCache. rawView signalUpdate ].
  el1 @ RODraggable.

  rawView add: el1.
  rawView open
-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,
Alexandre
  

That is truely inspiring - I see a LOT of potential.  By 'attributes' I meant any selector of the model's data.  For example (using a fake model), I was actually thinking along the lines of...

 | view rawView el1 el2 edge line mymodel |
  rawView := ROView new.
 mymodel := Dictionary new.
 mymodel add: (#name -> 'Ben').
 mymodel add: (#country -> '           Australia').
  el1 := ROElement on: mymodel.
  el1 extent: 50@50.
  el1 + ( ROLabel new text: [ :element | element model at: #name ifAbsent: [ ] ]) .
  el1 + ( ROLabel new text: [ :element | element model at: #country ifAbsent: [ ] ]) .

  el1 @ RODraggable.
  rawView add: el1.
  rawView open

The second ROLabel should be able to have an offset to place it on the next line.
Here I faked it with spaces in #country so that the labels don't clash.

-ben

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev