Skip to content

Commit

Permalink
Removed how to layout
Browse files Browse the repository at this point in the history
  • Loading branch information
renatav committed Feb 8, 2017
1 parent 19eec66 commit 3f59522
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion GraphLayoutDSL/src/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class App {
public static void main(String[] args) {


String subgraphsExample = "lay out subgraph v1, v2 algorithm Kamada Kawai length factor = 5;subgraph v3, v4 style symmetric; others criteria minimize bands, planar";
String subgraphsExample = "lay out graph criteria minimize edge crossings";
ILayout result = Interpreter.getInstance().execute(subgraphsExample);
System.out.println(result);
}
Expand Down
10 changes: 8 additions & 2 deletions GraphLayoutDSL/src/interpreter/Interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ def execute(self, model_str):

@staticmethod
def execute_one(layout, graph):
layoutType = layout.howToLayout

if layout.__class__.__name__ == "LayoutStyle":
layoutType = "style"
elif layout.__class__.__name__ == "LayoutAlgorithm":
layoutType = "algorithm"
else:
layoutType = "criteria"

if layoutType== 'algorithm':
if layoutType == 'algorithm':
#a map that will contain all information about the algorithm
algorithmProperties = {}
algorithm = layout.algorithm
Expand Down
6 changes: 3 additions & 3 deletions GraphLayoutDSL/src/language/layout.tx
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ LayoutEnum:
;

LayoutStyle:
howToLayout = 'style' style = LayoutStyleEnum
'style' style = LayoutStyleEnum
;

LayoutStyleEnum:
'automatic' | 'circular' | 'tree' | 'hierarchical' | 'symmetric' | 'general'
;

AestheticCriteria:
howToLayout = 'criteria' aestheticCriteria += AestheticCriteion[',']
'criteria' aestheticCriteria += AestheticCriteion[',']
;

LayoutAlgorithm:
howToLayout = 'algorithm' algorithm = LayoutAlgorithmEnum
'algorithm' algorithm = LayoutAlgorithmEnum
;

AestheticCriteion:
Expand Down
10 changes: 8 additions & 2 deletions GraphLayoutDSL/target/classes/interpreter/Interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ def execute(self, model_str):

@staticmethod
def execute_one(layout, graph):
layoutType = layout.howToLayout

if layout.__class__.__name__ == "LayoutStyle":
layoutType = "style"
elif layout.__class__.__name__ == "LayoutAlgorithm":
layoutType = "algorithm"
else:
layoutType = "criteria"

if layoutType== 'algorithm':
if layoutType == 'algorithm':
#a map that will contain all information about the algorithm
algorithmProperties = {}
algorithm = layout.algorithm
Expand Down
6 changes: 3 additions & 3 deletions GraphLayoutDSL/target/classes/language/layout.tx
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ LayoutEnum:
;

LayoutStyle:
howToLayout = 'style' style = LayoutStyleEnum
'style' style = LayoutStyleEnum
;

LayoutStyleEnum:
'automatic' | 'circular' | 'tree' | 'hierarchical' | 'symmetric' | 'general'
;

AestheticCriteria:
howToLayout = 'criteria' aestheticCriteria += AestheticCriteion[',']
'criteria' aestheticCriteria += AestheticCriteion[',']
;

LayoutAlgorithm:
howToLayout = 'algorithm' algorithm = LayoutAlgorithmEnum
'algorithm' algorithm = LayoutAlgorithmEnum
;

AestheticCriteion:
Expand Down

0 comments on commit 3f59522

Please sign in to comment.