1 package org.simantics.sysdyn.modelImport.model.element;
\r
3 import org.simantics.databoard.Bindings;
\r
4 import org.simantics.db.Resource;
\r
5 import org.simantics.db.WriteGraph;
\r
6 import org.simantics.db.exception.DatabaseException;
\r
7 import org.simantics.layer0.Layer0;
\r
8 import org.simantics.sysdyn.SysdynResource;
\r
9 import org.simantics.sysdyn.modelImport.model.WriteContext;
\r
11 public class Dependency2 extends Connection2 {
\r
13 private boolean showArrow;
\r
14 private boolean showDelay;
\r
15 private double angle;
\r
17 public Dependency2(Element2 head, Element2 tail, boolean showArrow, boolean showDelay, double angle) {
\r
19 this.showArrow = showArrow;
\r
20 this.showDelay = showDelay;
\r
25 public void write(WriteGraph graph, Resource parent, WriteContext context) throws DatabaseException {
\r
26 if (head == null || tail == null) {
\r
27 System.err.println("dependency missing head or tail");
\r
31 Layer0 l0 = Layer0.getInstance(graph);
\r
33 SysdynResource sr = SysdynResource.getInstance(graph);
\r
35 Resource dependency = createConnection(graph, sr.Dependency, parent, context);
\r
36 graph.claimLiteral(dependency, l0.HasName, context.getNextDependency(), Bindings.STRING);
\r
37 Resource symbol = createSymbol(graph, sr.DependencyConnection, dependency, parent, context);
\r
39 graph.claimLiteral(symbol, sr.Dependency_angle, angle, Bindings.DOUBLE);
\r