Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[520919] Ensure that Dot Files with fixedsize="" are properly rendered.
- Modify the DotAttributes validateAttributeRawValue method to consider
an empty fixedsize dot attribute value as valid.
- Add philo.dot example file to demonstrate the corresponding use case.
- Implement corresponding DotParserTests test case.
  • Loading branch information
miklossy committed Aug 19, 2017
1 parent d68f9d3 commit 517e8ad
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 1 deletion.
143 changes: 143 additions & 0 deletions org.eclipse.gef.dot.tests/resources/philo.dot
@@ -0,0 +1,143 @@
/*******************************************************************************
* Copyright (c) 2017 itemis AG and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tamas Miklossy (itemis AG) - Initial text (bug #521149)
*******************************************************************************/

// Sample graph from
// http://www.graphviz.org/content/philo
// http://www.graphviz.org/Gallery/undirected/philo.gv.txt

## "It encodes the so-called philosophers dilemma. Neato pretty much approximates the way how humans would layout the graph." Contributed by Manfred Jeusfield.
## Command to generate the layout: "neato -Tpng thisfile > thisfile.png"

digraph PhiloDilemma {
graph [bb="-441.78,419.3,344.16,-417.55",
fontsize=12,
label="PetriNet Model PhiloDilemma\nExtracted from ConceptBase and layed out by Graphviz ",
layout=neato,
lheight=0.36,
lp="-48.809,402.3",
lwidth=3.57,
overlap=false
];
node [fixedsize=true,
label="\N",
shape=circle,
width=0.9
];
bec3 [fixedsize="",
height=0.5,
pos="-391.82,145.52",
shape=box,
width=0.75];
hu3 [height=0.90278,
pos="-248.49,188.55",
width=0.90278];
bec3 -> hu3 [pos="e,-279.68,179.19 -364.53,153.72 -343.25,160.1 -313.38,169.07 -289.27,176.31"];
rel3 [fixedsize="",
height=0.5,
pos="-280.86,-72.386",
shape=box,
width=0.75];
th3 [height=0.90278,
pos="-409.28,-4.8008",
width=0.90278];
rel3 -> th3 [pos="e,-380.3,-20.052 -308.09,-58.053 -326.48,-48.375 -351.01,-35.468 -371.3,-24.785"];
ri3 [height=0.90278,
pos="-134.28,-61.648",
width=0.90278];
rel3 -> ri3 [pos="e,-166.73,-64.025 -253.63,-70.391 -232.12,-68.815 -201.69,-66.586 -176.95,-64.774"];
bec2 [fixedsize="",
height=0.5,
pos="241.14,-317.9",
shape=box,
width=0.75];
hu2 [height=0.90278,
pos="137.62,-209.9",
width=0.90278];
bec2 -> hu2 [pos="e,160.35,-233.61 223.58,-299.58 208.2,-283.53 185.53,-259.88 167.33,-240.9"];
rel2 [fixedsize="",
height=0.5,
pos="79.431,-268.41",
shape=box,
width=0.75];
th2 [height=0.90278,
pos="160.6,-385.05",
width=0.90278];
rel2 -> th2 [pos="e,141.98,-358.29 92.114,-286.63 103.87,-303.53 121.68,-329.12 136.2,-349.98"];
ri2 [height=0.90278,
pos="108.18,-87.89",
width=0.90278];
rel2 -> ri2 [pos="e,103.04,-120.19 82.346,-250.11 86.782,-222.25 95.351,-168.44 101.4,-130.45"];
acq2 [fixedsize="",
height=0.5,
pos="-15.038,-148.14",
shape=box,
width=0.75];
ea2 [height=0.90278,
pos="-43.003,-283.95",
width=0.90278];
acq2 -> ea2 [pos="e,-36.43,-252.02 -18.751,-166.17 -22.726,-185.47 -29.167,-216.75 -34.412,-242.23"];
acq3 [fixedsize="",
height=0.5,
pos="-126.35,96.552",
shape=box,
width=0.75];
ea3 [height=0.90278,
pos="-243.6,54.073",
width=0.90278];
acq3 -> ea3 [pos="e,-212.83,65.22 -153.54,86.7 -168.22,81.382 -186.63,74.712 -202.97,68.791"];
bec1 [fixedsize="",
height=0.5,
pos="317.16,257.73",
shape=box,
width=0.75];
hu1 [height=0.90278,
pos="276.22,113.7",
width=0.90278];
bec1 -> hu1 [pos="e,285.17,145.2 311.97,239.49 305.98,218.39 295.91,182.98 287.98,155.09"];
rel1 [fixedsize="",
height=0.5,
pos="74.448,280.23",
shape=box,
width=0.75];
th1 [height=0.90278,
pos="199.98,352.8",
width=0.90278];
rel1 -> th1 [pos="e,171.49,336.33 101.69,295.98 119.57,306.32 143.19,319.97 162.8,331.31"];
ri1 [height=0.90278,
pos="5.483,151.22",
width=0.90278];
rel1 -> ri1 [pos="e,21.015,180.27 64.713,262.02 54.639,243.18 38.607,213.18 25.762,189.15"];
acq1 [fixedsize="",
height=0.5,
pos="133.12,57.065",
shape=box,
width=0.75];
ea1 [height=0.90278,
pos="159.37,179.45",
width=0.90278];
acq1 -> ea1 [pos="e,152.52,147.53 136.99,75.123 140.51,91.54 145.84,116.38 150.42,137.71"];
hu3 -> acq3 [pos="e,-150.43,114.69 -222.29,168.82 -203.64,154.77 -178.48,135.82 -158.59,120.84"];
th3 -> bec3 [pos="e,-393.96,127.13 -405.49,27.817 -402.4,54.413 -398.08,91.605 -395.13,117.02"];
ri3 -> acq2 [pos="e,-40.203,-129.89 -107.82,-80.843 -90.323,-93.532 -67.246,-110.27 -48.484,-123.88"];
ri3 -> acq3 [pos="e,-127.27,78.131 -132.64,-28.869 -131.2,-0.26528 -129.14,40.815 -127.77,68.07"];
ea3 -> rel3 [pos="e,-275.55,-54.364 -252.81,22.814 -258.9,2.1353 -266.82,-24.734 -272.69,-44.651"];
hu2 -> acq2 [pos="e,11.991,-159.08 107.46,-197.7 82.806,-187.73 47.854,-173.58 21.592,-162.96"];
th2 -> bec2 [pos="e,219.38,-336.04 185.65,-364.17 193.83,-357.34 203.01,-349.69 211.5,-342.61"];
ri2 -> acq2 [pos="e,12.265,-134.79 78.979,-102.17 61.768,-110.58 39.839,-121.31 21.49,-130.28"];
ri2 -> acq1 [pos="e,129.96,38.697 113.71,-55.72 118.06,-30.436 124.06,4.4452 128.24,28.695"];
ea2 -> rel2 [pos="e,52.181,-271.87 -10.515,-279.82 5.6776,-277.77 25.338,-275.27 42.143,-273.14"];
hu1 -> acq1 [pos="e,160.52,67.91 245.87,101.69 223.66,92.901 193.42,80.931 169.84,71.601"];
th1 -> bec1 [pos="e,294.94,275.76 225.41,332.17 243.55,317.46 268.01,297.61 287.12,282.11"];
ri1 -> acq3 [pos="e,-98.935,107.92 -24.761,138.67 -44.055,130.67 -69.182,120.26 -89.619,111.78"];
ri1 -> acq1 [pos="e,108.44,75.271 31.929,131.71 51.783,117.06 79.088,96.921 100.33,81.251"];
ea1 -> rel1 [pos="e,89.868,261.93 138.38,204.36 125.7,219.41 109.55,238.58 96.654,253.88"];
}
Expand Up @@ -241,6 +241,11 @@ public void testNodeShapesPolygonBased() {
testFile("nodeshapes_polygon_based.dot");
}

@Test
public void testPhilo() {
testFile("philo.dot");
}

@Test
public void testSimpleDigraph() {
testFile("simple_digraph.dot");
Expand Down
Expand Up @@ -434,7 +434,11 @@ class DotAttributes {
validateAttributeRawValue(COLOR_PARSER, COLOR_VALIDATOR, attributeContext, attributeName, attributeValue)
else
Collections.emptyList
case FIXEDSIZE__N: validateAttributeRawValue(BOOL_PARSER, null, attributeContext, FIXEDSIZE__N, attributeValue)
case FIXEDSIZE__N:
if(attributeValue!==null && !attributeValue.toValue.isEmpty){
validateAttributeRawValue(BOOL_PARSER, null, attributeContext, FIXEDSIZE__N, attributeValue)
}else
Collections.emptyList
case FONTCOLOR__GCNE: validateAttributeRawValue(COLOR_PARSER, COLOR_VALIDATOR, attributeContext, attributeName, attributeValue)
case FORCELABELS__G: validateAttributeRawValue(BOOL_PARSER, null, attributeContext, FORCELABELS__G, attributeValue)
case HEAD_LP__E: validateAttributeRawValue(POINT_PARSER, POINT_VALIDATOR, attributeContext, attributeName, attributeValue)
Expand Down

0 comments on commit 517e8ad

Please sign in to comment.