X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graphviz%2Fscl%2FVisualization%2FGraphviz%2FNode.scl;fp=bundles%2Forg.simantics.graphviz%2Fscl%2FVisualization%2FGraphviz%2FNode.scl;h=0cbe57b6d04ae5d6e1b0175f3a6f101bdd9e6d8f;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graphviz/scl/Visualization/Graphviz/Node.scl b/bundles/org.simantics.graphviz/scl/Visualization/Graphviz/Node.scl new file mode 100644 index 000000000..0cbe57b6d --- /dev/null +++ b/bundles/org.simantics.graphviz/scl/Visualization/Graphviz/Node.scl @@ -0,0 +1,26 @@ +import "Visualization/Graphviz/AbstractTypes" +import "Visualization/Graphviz/Property" +import "JavaBuiltin" as Java + +importJava "org.simantics.graphviz.Node" where + data Node + @JavaName "" + newPrimitiveNode :: IGraph -> Node + setLabel :: Node -> String -> () + setShape :: Node -> String -> () + @JavaName set + setGenericProperty :: Node -> String -> String -> () + +instance Identifiable Node where + identifiable = Java.unsafeCoerce + +applyNodeProperty :: Node -> Property -> () +applyNodeProperty graph (Label str) = setLabel graph str +applyNodeProperty graph (Shape str) = setShape graph str +applyNodeProperty graph (GenericProperty property str) = setGenericProperty graph property str + +newNode :: IGraph a => a -> [Property] -> Node +newNode graph properties = node + where + node = newPrimitiveNode (iGraph graph) + for properties (applyNodeProperty node) \ No newline at end of file