Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Petri Net: how to model transition
Petri Net: how to model transition [message #667519] Fri, 29 April 2011 10:24 Go to next message
chiara  is currently offline chiara Friend
Messages: 10
Registered: March 2011
Junior Member

Hi,

As i did not find anything prepared to model petri net, i tried to visualize it by supposing that transitions are similars to connections between states.

However, in my diagram, only states are represented in Petri net. I don't succeed to visulaize transitions.

Can you help me?



**/ code to represent transitions in Petri Net:

for (State begin : cd.getSources()) {
iteratorEnd=0;
Anchor[] anchor_end = new Anchor[cd.getDestinations().size()];
anchor_start[iteratorStart] = FeatureProvider.unique.pictMap.get(begin.getName());

for (State end : cd.getDestinations()) {
anchor_end[iteratorEnd] = FeatureProvider.unique.pictMap.get(end.getName());

AddConnectionContext contextConn = new AddConnectionContext(anchor_start[iteratorStart], anchor_end[iteratorEnd]);
contextConn.setNewObject(cd);
contextConn.setTargetContainer(containerShape);
I
Transition trans = (Transition) ContextConn.getNewObject();


connection[i] = createConnection();
connection[i].setStart(anchor_start[iteratorStart]);
connection[i].setEnd(anchor_end[iteratorEnd]);
Polyline polyline = gaService.createPolyline(connection[i]);
Color color = manageColor(new ColorConstant(255,255,255));
polyline.setForeground(color);
polyline.setLineWidth(2);
link(connection[i], trans);

ConnectionDecorator cdec = peCreateService.createConnectionDecorator(connection[i], false, 1.0, true);
createArrow(cdec, color);

link(connection[i], trans);
iteratorEnd++;
i++;
}
iteratorStart++;
}
}

//create connection create a Manhattan connection
Re: Petri Net: how to model transition [message #667543 is a reply to message #667519] Fri, 29 April 2011 12:42 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1923
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Without having a closer look at the rest of the coding, I see you are using
ColorConstant(255,255,255) for the line foreground. So you end up with a
white line on a white diagram...

Michael


"chiara" wrote in message news:ipe35t$snm$1@news.eclipse.org...


Hi,

As i did not find anything prepared to model petri net, i tried to visualize
it by supposing that transitions are similars to connections between states.

However, in my diagram, only states are represented in Petri net. I don't
succeed to visulaize transitions.

Can you help me?



**/ code to represent transitions in Petri Net:

for (State begin : cd.getSources()) {
iteratorEnd=0;
Anchor[] anchor_end = new Anchor[cd.getDestinations().size()];
anchor_start[iteratorStart] =
FeatureProvider.unique.pictMap.get(begin.getName());

for (State end : cd.getDestinations()) {
anchor_end[iteratorEnd] = FeatureProvider.unique.pictMap.get(end.getName());

AddConnectionContext contextConn = new
AddConnectionContext(anchor_start[iteratorStart], anchor_end[iteratorEnd]);
contextConn.setNewObject(cd);
contextConn.setTargetContainer(containerShape);
I
Transition trans = (Transition) ContextConn.getNewObject();


connection[i] = createConnection();
connection[i].setStart(anchor_start[iteratorStart]);
connection[i].setEnd(anchor_end[iteratorEnd]);
Polyline polyline = gaService.createPolyline(connection[i]);
Color color = manageColor(new ColorConstant(255,255,255));
polyline.setForeground(color);
polyline.setLineWidth(2);
link(connection[i], trans);

ConnectionDecorator cdec =
peCreateService.createConnectionDecorator(connection[i], false, 1.0, true);
createArrow(cdec, color);

link(connection[i], trans);
iteratorEnd++;
i++;
}
iteratorStart++;
}
}

//create connection create a Manhattan connection
Re: Petri Net: how to model transition [message #667552 is a reply to message #667543] Fri, 29 April 2011 13:53 Go to previous messageGo to next message
chiara  is currently offline chiara Friend
Messages: 10
Registered: March 2011
Junior Member

But the container Shape in which i will represent the transition is not withe. I suppose it does not matter.


However, i tried it with black color (0 , 0, 0) . And it did not work also. Confused Sad
Re: Petri Net: how to model transition [message #667814 is a reply to message #667552] Mon, 02 May 2011 09:38 Go to previous message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

does it work if you use a FreeFormConnection instead of a
ManhattanConnection?
Did you have a look at the error log?

Best, Tim
Previous Topic:How to embed Graphiti in another application
Next Topic:Inactive PE disappears
Goto Forum:
  


Current Time: Thu Dec 03 07:27:47 GMT 2020

Powered by FUDForum. Page generated in 0.01273 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top