2 import "Simantics/Diagram"
3 import "Simantics/Rename"
5 importJava "org.simantics.g2d.canvas.ICanvasContext" where
8 importJava "org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider" where
9 data ICanvasSceneGraphProvider
11 getCanvasContext :: ICanvasSceneGraphProvider -> ICanvasContext
13 importJava "org.simantics.modeling.SCLScenegraph" where
14 sceneGraphTest :: ICanvasContext -> String -> String -> <Proc> String
16 getAllNodes :: ICanvasContext -> String
18 getBoundsNodes :: ICanvasContext -> String
20 getBackgroundNodes :: ICanvasContext -> String
22 getDataNodes :: ICanvasContext -> String
24 getNavigationNodes :: ICanvasContext -> String
26 getParentNodes :: ICanvasContext -> String
28 getDecorationNodes :: ICanvasContext -> String
30 getSingleElementNodes :: ICanvasContext -> String
32 getConnectionNodes :: ICanvasContext -> String
34 getTextNodes :: ICanvasContext -> String
36 getItemNodes :: ICanvasContext -> String
39 getText :: ICanvasContext -> String -> String
41 @JavaName getNodeCount
42 getCount :: ICanvasContext -> String
44 @JavaName getNodeTransform
45 getTransform :: ICanvasContext -> String -> String
47 getICanvasSceneGraphProvider :: Model -> Resource -> String -> ICanvasSceneGraphProvider
49 disposeSceneGraphProvider :: ICanvasSceneGraphProvider -> ()
51 editNodeText :: ICanvasContext -> String -> String -> String -> <Proc> String
53 copyPaste :: ICanvasContext -> ICanvasContext -> [Resource] -> <Proc> Boolean
55 renderSVG :: ICanvasContext -> <Proc> String
57 getSceneGraphProvider :: Diagram -> <Proc> ICanvasSceneGraphProvider
58 getSceneGraphProvider diagram = do
59 diagramName = syncRead(\() -> getSafeName diagram)
60 diagramRVI = "/" + diagramName
61 model = syncRead(\() -> fromJust $ possibleIndexRoot diagram)
62 composite = syncRead(\() -> compositeToDiagram' diagram)
63 getICanvasSceneGraphProvider model composite diagramRVI
65 getDiagramContext :: ICanvasSceneGraphProvider -> ICanvasContext
66 getDiagramContext provider = do
67 getCanvasContext provider
69 getNodeTransform :: Diagram -> String -> <Proc> String
70 getNodeTransform diagram nodeName = do
71 diagramName = syncRead(\() -> getSafeName diagram)
72 diagramRVI = "/" + diagramName
73 model = syncRead(\() -> getPossibleModel diagram)
74 composite = syncRead(\() -> compositeToDiagram' diagram)
75 provider = getICanvasSceneGraphProvider model composite diagramRVI
76 context = getCanvasContext provider
77 getTransform context nodeName
79 getNodeText :: Diagram -> String -> <Proc> String
80 getNodeText diagram nodeName = do
81 diagramName = syncRead(\() -> getSafeName diagram)
82 diagramRVI = "/" + diagramName
83 model = syncRead(\() -> getPossibleModel diagram)
84 composite = syncRead(\() -> compositeToDiagram' diagram)
85 provider = getICanvasSceneGraphProvider model composite diagramRVI
86 context = getCanvasContext provider
87 getText context nodeName
89 getNodeCount :: Diagram -> <Proc> String
90 getNodeCount diagram = do
91 diagramName = syncRead(\() -> getSafeName diagram)
92 diagramRVI = "/" + diagramName
93 model = syncRead(\() -> getPossibleModel diagram)
94 composite = syncRead(\() -> compositeToDiagram' diagram)
95 provider = getICanvasSceneGraphProvider model composite diagramRVI
96 context = getCanvasContext provider
99 importJava "org.simantics.scenegraph.g2d.G2DNodeModification" where
100 data G2DNodeModification
102 createG2DNodeModification :: [SVGNodeAssignment] -> [TransformationAssignment] -> G2DNodeModification
104 createG2DNodeModification3 :: [SVGNodeAssignment] -> [TargetedSVGNodeAssignment] -> [TransformationAssignment] -> G2DNodeModification
106 importJava "org.simantics.scenegraph.g2d.nodes.SVGNodeAssignment" where
107 data SVGNodeAssignment
109 createSVGNodeAssignment :: String -> String -> String -> SVGNodeAssignment
111 importJava "org.simantics.scenegraph.g2d.nodes.TargetedSVGNodeAssignment" where
112 data TargetedSVGNodeAssignment
114 createTargetedSVGNodeAssignment :: a -> String -> String -> String -> TargetedSVGNodeAssignment
116 importJava "org.simantics.scenegraph.g2d.nodes.TransformationAssignment" where
117 data TransformationAssignment
119 createTransformationAssignment :: a -> AffineTransform -> TransformationAssignment
121 importJava "java.awt.geom.AffineTransform" where
124 createAffineTransform :: Double -> Double -> Double -> Double -> Double -> Double -> AffineTransform
126 importJava "org.simantics.scenegraph.g2d.AffineTransformFunctions" where
127 transform :: AffineTransform -> (Double,Double) -> (Double,Double)
128 inverseTransform :: AffineTransform -> (Double,Double) -> (Double,Double)