understanding edges in Roassal

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

understanding edges in Roassal

Usman Bhatti
Hello,
I have this script. The problem is that when there are duplicate entities on my canvas, edges are constructed for only one of them.

|myView entity otherEntities |
myView := ROMondrianViewBuilder new.
entity := 1.
otherEntities := #(2 2 3 3 4 4).
myView shape rectangle withoutBorder.
myView node: #entity forIt: [
myView nodes: otherEntities  forEach: [:each | 
myView shape label.
myView node: each name].
].
myView shape rectangle withoutBorder.
myView node: #otherEntities forIt: [
myView shape rectangle.
myView node: entity 
].
myView shape line color: Color red; width: 1.
myView edges: otherEntities  from: #yourself  to: entity.
myView verticalLineLayout center.
myView open.
Inline image 2
The edges to all the entities can be drawn using this script which is a bit inelegant. 

((myView raw elementsSuchThat: [:each | each model name includesSubString: 'other']) first elements)
do: [:each | myView raw  add: (myView buildEdgeFrom: each to: (myView lookup: entity))].


Inline image 3

Question: how to deal with duplicate entities in Roassal? May be this occurs seldom in reality?

regards,
Usman

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

Re: understanding edges in Roassal

abergel
> I have this script. The problem is that when there are duplicate entities on my canvas, edges are constructed for only one of them.
>
> |myView entity otherEntities |
> myView := ROMondrianViewBuilder new.
> entity := 1.
> otherEntities := #(2 2 3 3 4 4).
> myView shape rectangle withoutBorder.
> myView node: #entity forIt: [
> myView nodes: otherEntities  forEach: [:each |
> myView shape label.
> myView node: each name].
> ].
> myView shape rectangle withoutBorder.
> myView node: #otherEntities forIt: [
> myView shape rectangle.
> myView node: entity
> ].
> myView shape line color: Color red; width: 1.
> myView edges: otherEntities  from: #yourself  to: entity.
>
> myView verticalLineLayout center.
> myView open.

Well.. This is a limitation of the Mondrian DLS. We had this issue before with Mondrian.
Since nodes are looked up with edges:from:to:, then you should not have more than one candidate, else how the engine can guess which one to use?

> The edges to all the entities can be drawn using this script which is a bit inelegant.
>
> ((myView raw elementsSuchThat: [:each | each model name includesSubString: 'other']) first elements)
> do: [:each | myView raw  add: (myView buildEdgeFrom: each to: (myView lookup: entity))].

You could do:
-=-=-=-=-=-=-=-=-=-=-=-=
|myView entity otherEntities nodes endNode lineShape |
myView := ROMondrianViewBuilder new.
entity := 1.
otherEntities := #(2 2 3 3 4 4).
myView shape rectangle withoutBorder.
myView node: #entity forIt: [
        nodes := myView nodes: otherEntities  forEach: [:each |
                myView shape label.
                myView node: each name ].
].

myView shape rectangle withoutBorder.
myView node: #otherEntities forIt: [
        myView shape rectangle.
        endNode := myView node: entity
].

myView raw addAll: (ROEdge linesFor: (nodes collect: [ :n | n -> endNode ])).

myView verticalLineLayout center.
myView open.
-=-=-=-=-=-=-=-=-=-=-=-=

> Question: how to deal with duplicate entities in Roassal?

I think I've answered to your question. Let me know if not.

> May be this occurs seldom in reality?

It does not happen very often in practice. I think Jannik had such a problem.

Cheers,
Alexandre

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

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
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: understanding edges in Roassal

Usman Bhatti
Hello,

On Sat, Jun 30, 2012 at 1:36 AM, Alexandre Bergel <[hidden email]> wrote:
> I have this script. The problem is that when there are duplicate entities on my canvas, edges are constructed for only one of them.
>
> |myView entity otherEntities |
> myView := ROMondrianViewBuilder new.
> entity := 1.
> otherEntities := #(2 2 3 3 4 4).
>       myView shape rectangle withoutBorder.
>       myView node: #entity forIt: [
>                               myView nodes: otherEntities  forEach: [:each |
>                                       myView shape label.
>                                       myView node: each name].
>                       ].
>                       myView shape rectangle withoutBorder.
>                       myView node: #otherEntities forIt: [
>                               myView shape rectangle.
>                               myView node: entity
>                       ].
>                       myView shape line color: Color red; width: 1.
>                       myView edges: otherEntities  from: #yourself  to: entity.
>
>                       myView verticalLineLayout center.
>                       myView open.

Well.. This is a limitation of the Mondrian DLS. We had this issue before with Mondrian.
Since nodes are looked up with edges:from:to:, then you should not have more than one candidate, else how the engine can guess which one to use?

> The edges to all the entities can be drawn using this script which is a bit inelegant.
>
> ((myView raw elementsSuchThat: [:each | each model name includesSubString: 'other']) first elements)
>                               do: [:each | myView raw  add: (myView buildEdgeFrom: each to: (myView lookup: entity))].

You could do:
-=-=-=-=-=-=-=-=-=-=-=-=
|myView entity otherEntities nodes endNode lineShape |
myView := ROMondrianViewBuilder new.
entity := 1.
otherEntities := #(2 2 3 3 4 4).
myView shape rectangle withoutBorder.
myView node: #entity forIt: [
       nodes := myView nodes: otherEntities  forEach: [:each |
               myView shape label.
               myView node: each name ].
].

myView shape rectangle withoutBorder.
myView node: #otherEntities forIt: [
       myView shape rectangle.
       endNode := myView node: entity
].

myView raw addAll: (ROEdge linesFor: (nodes collect: [ :n | n -> endNode ])).

myView verticalLineLayout center.
myView open.
-=-=-=-=-=-=-=-=-=-=-=-=

> Question: how to deal with duplicate entities in Roassal?

I think I've answered to your question. Let me know if not.

Yes it does. I was just looking for an elegant solution to achieve the task of making all edges appear so I know a better answer now. The purpose of my mail was also to provide a feedback, look for superior solution than mine and that others can benefit from it. That's done.

tx
Usman
 

> May be this occurs seldom in reality?

It does not happen very often in practice. I think Jannik had such a problem.

Cheers,
Alexandre

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

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



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


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

Re: understanding edges in Roassal

abergel
> Yes it does. I was just looking for an elegant solution to achieve the task of making all edges appear so I know a better answer now. The purpose of my mail was also to provide a feedback, look for superior solution than mine and that others can benefit from it. That's done.

Thanks for your feedback. It is very precious!

Alexandre

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



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