Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Adding inscriptions to edges and using .svg for Node images
Adding inscriptions to edges and using .svg for Node images [message #1272614] Tue, 18 March 2014 06:35 Go to next message
Julian Koch is currently offline Julian Koch
Messages: 5
Registered: March 2014
Junior Member
Hi,
I'm new to sirius (and modeling with eclipse). I just did the basicfamily tutorial and built a small model with EMFtext. The idea is having 2 different types of elements (nodes) and different kinds of flows between them (5 different edge types).
Now I have two Problems.

Example with WIP workbench:

index.php/fa/17766/0/


Adding inscription to edges
The arrows alone aren't very useful so the end user should get the option to add an inscription to the arrows. For example for a material flow edge between gas station and car -> 'gasoline'. How can I do this with sirius?

Using .svg images for nodes
I want to use hexagons instead of squares or ellipses. I added them as a .png image but is there a way to use .svg images for a better scalability?

Regards

Julian
  • Attachment: editor.PNG
    (Size: 37.56KB, Downloaded 43 times)

[Updated on: Tue, 18 March 2014 09:06]

Report message to a moderator

Re: Adding inscriptions to edges and using .svg for Node images [message #1272676 is a reply to message #1272614] Tue, 18 March 2014 09:29 Go to previous messageGo to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Hello,

Quote:
Adding inscription to edges
The arrows alone aren't very useful so the end user should get the option to add an inscription to the arrows. For example for a material flow edge between gas station and car -> 'gasoline'. How can I do this with sirius?

If you need specific information for an edge, I think that your metamodel need a new metaclass(let's call it Travel) linking your source("Gas Station") and target("Car") and a field(Let's say a String named "purpose") holding your information("Gasoline"). Then you will have to change the Edge Mapping in your VSM from Relation Based to Element Based and the label to display will present the field("purpose").

Quote:
Using .vsd images for nodes
I want to use hexagons instead of squares or ellipses. I added them as a .png image but is there a way to use .svg images for a better scalability?

For the style of a node mapping, you can choose a Workspace Image style. PNG and SVG images are accepted. However, note that even if your SVG is displayed as hexagon-shaped, the selection of these nodes will still be a rectangle.

Regards,
Steve
Re: Adding inscriptions to edges and using .svg for Node images [message #1272696 is a reply to message #1272676] Tue, 18 March 2014 10:26 Go to previous messageGo to next message
Julian Koch is currently offline Julian Koch
Messages: 5
Registered: March 2014
Junior Member
Thanks for the quick answer, I will modify my model. Smile

I tried to use a svg image from my workspace but I only get an empty diagram, a null pointer exception, an unhandled event loop exception and ...a blank one until I change it back to the png file and reload the diagram. (Screenshot and log attached)

Regards

Julian
Re: Adding inscriptions to edges and using .svg for Node images [message #1272732 is a reply to message #1272696] Tue, 18 March 2014 12:17 Go to previous messageGo to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Le 18/03/2014 15:26, Julian Koch a écrit :
> Thanks for the quick answer, I will modify my model. :)
>
> I tried to use a svg image from my workspace but I only get an empty diagram, a null pointer exception, an unhandled event loop exception and ...a blank one until I change it back to the png file and reload the diagram. (Screenshot and log attached)
>
> Regards
>
> Julian
>

Is it possible that you attach your SVG so I can test? We already had
issues with some tags in SVG files, but it seems different with your sample.

I has just tested to have a workspace Image style with to SVG in
attachement and it is working fine. Can you try to replace your SVG by
this one in your VSM?

Regards,
Steve
  • Attachment: triangle.svg
    (Size: 8.91KB, Downloaded 13 times)
Re: Adding inscriptions to edges and using .svg for Node images [message #1272743 is a reply to message #1272732] Tue, 18 March 2014 12:58 Go to previous messageGo to next message
Julian Koch is currently offline Julian Koch
Messages: 5
Registered: March 2014
Junior Member
Your triangle works great. After rechecking the file I realised that I just messed up the file. My lessons for today:
1. Don't trust converters
2. If checking a converted file be sure that you don't check the input file instead... Embarrassed

I will build a new one instead of converting a png. Thanks for your help.

Regards,
Julian
Re: Adding inscriptions to edges and using .svg for Node images [message #1273104 is a reply to message #1272743] Wed, 19 March 2014 10:20 Go to previous messageGo to next message
Julian Koch is currently offline Julian Koch
Messages: 5
Registered: March 2014
Junior Member
Hello again,

I modified (completely rewrote) my metamodel and added the new meta class for relations.
index.php/fa/17779/0/

It seems to work: (relation was build in the car.se, not with a tool)
index.php/fa/17782/0/

How is it different to build an Element based edge tool instead of a Relation based edge tool? Do I have to create a new instance of the metaclass 'Relation'? My attempt isn't really working.
index.php/fa/17781/0/

Regards,

Julian
  • Attachment: ecore.PNG
    (Size: 14.51KB, Downloaded 19 times)
  • Attachment: edge_tool.PNG
    (Size: 29.83KB, Downloaded 21 times)
  • Attachment: car_diagram.PNG
    (Size: 19.77KB, Downloaded 20 times)

[Updated on: Wed, 19 March 2014 10:21]

Report message to a moderator

Re: Adding inscriptions to edges and using .svg for Node images [message #1273123 is a reply to message #1273104] Wed, 19 March 2014 10:50 Go to previous messageGo to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Le 19/03/2014 15:20, Julian Koch a écrit :
> Hello again,
>
> I modified (completely rewrote) my metamodel and added the new meta class for relations.
>
>
> It seems to work: (relation was build in the car.se, not with a tool)
>
>
> How is it different to build an Element based edge tool instead of a Relation based edge tool? Do I have to create a new instance of the metaclass 'Relation'? My attempt isn't really working.
>
>
> Regards,
>
> Julian
>

Hello,

In your creation tool, you have a "Set" task for your field
"inscription" after the Create Instance. However, I think that you
forgot to set the reference "from" and "to". By the way, are you sure
that you need a multi-valued reference for "from" and "to"? A
single-valued reference may be enough.

Regards,
Steve
Re: Adding inscriptions to edges and using .svg for Node images [message #1273786 is a reply to message #1273123] Thu, 20 March 2014 10:37 Go to previous messageGo to next message
Julian Koch is currently offline Julian Koch
Messages: 5
Registered: March 2014
Junior Member
Quote:
In your creation tool, you have a "Set" task for your field
"inscription" after the Create Instance.

Is that wrong?

Quote:
However, I think that you
forgot to set the reference "from" and "to".

Where do I set the reference?

In the creation of the Design I have the Source Finder Expression and Target Finder Expression.
Screenshot of the working setting:index.php/fa/17798/0/

But where do I set it when creating the edge tool? With additional set values? index.php/fa/17799/0/

To be honest I'm not even sure if I have to create a new Instance...

What are the additional operations that I need for a creating the element based tool?
For the Relation based tool in the old model I only added change context (var:source), set value (feature= [name of the relation in the metamodel] and value expression= var:target)

Quote:
By the way, are you sure
that you need a multi-valued reference for "from" and "to"? A
single-valued reference may be enough.

I tried it with a single one but if I remove one the edge doesn't show up.

Newer Diagram example: (I only added additional type of edges)
index.php/fa/17800/0/
Re: Adding inscriptions to edges and using .svg for Node images [message #1273812 is a reply to message #1273786] Thu, 20 March 2014 11:22 Go to previous message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Le 20/03/2014 15:37, Julian Koch a écrit :
> Quote:
>> In your creation tool, you have a "Set" task for your field
>> "inscription" after the Create Instance.
>
> Is that wrong?

No it is ok.

>
> Quote:
>> However, I think that you
>> forgot to set the reference "from" and "to".
>
> Where do I set the reference?
>
> In the creation of the Design I have the Source Finder Expression and Target Finder Expression.
> Screenshot of the working setting:index.php/fa/17798/0/
>
> But where do I set it when creating the edge tool? With additional set values? index.php/fa/17799/0/

Yes as additional set values.

>
> To be honest I'm not even sure if I have to create a new Instance...

As your edge displays a semantic element now (se.Relation in the domain
class of your sample), the edge creation tool needs to create an
instance. However, if your relation is contained by the source element
in your semantic model (Just guessing here, I don't know your
metamodel), the change context expression should be var:source instead
of var:container. In that case the "from" field of the location would
not be needed after all.

>
> What are the additional operations that I need for a creating the element based tool?
> For the Relation based tool in the old model I only added change context (var:source), set value (feature= [name of the relation in the metamodel] and value expression= var:target)

This should be enough for an element based tool. You can find further
information in the documentation : Help/ Help Contents -> Sirius /
Sirius Specifier Manual / Diagrams / Layer and Graphical Elements /
Edges and irius / Sirius Specifier Manual / Diagrams / Tools / Edge Tools.
You can also import with source the sample
"org.eclipse.sirius.sample.ecore.design" a VSM for Ecore models. In the
diagram description Entities, take a look to the EC_EReference edge
mapping and its creation tool(in Section Relation).

>
> Quote:
>> By the way, are you sure
>> that you need a multi-valued reference for "from" and "to"? A
>> single-valued reference may be enough.
>
> I tried it with a single one but if I remove one the edge doesn't show up.
>
> Newer Diagram example: (I only added additional type of edges)
> index.php/fa/17800/0/
>
Previous Topic:Force refresh not working for me
Next Topic:Connecting to CDO repository
Goto Forum:
  


Current Time: Fri Jul 25 13:44:05 EDT 2014

Powered by FUDForum. Page generated in 0.03197 seconds