Module Simantics/SceneGraphWebalizer

This module is undocumented. This is a list of its definitions.

addElements :: SceneGraphWebalizer -> [String] -> Double -> Double -> <Proc> ()

addElements sgw ids x y creates a new element on the diagram at the position (x, y) for each identified element type. Ids that do not name a type known to the diagram are skipped.

clearRouteGraph :: SceneGraphWebalizer -> String -> String -> <Proc> ()

Straightens the identified route graph node by merging away all of its route lines. The part id is not used.

configureDefaultTransformations :: SceneGraphWebalizer -> Boolean -> <Proc> ()

Chooses whether the webalizer performs the default element transformations itself. When this is set to False, translateElements, transformElements, rotateElements and flipElements do nothing, which lets the client or the application implement its own transformation behaviour instead.

connect :: SceneGraphWebalizer -> String -> String -> String -> String -> <WriteGraph> ()

connect sgw elementId1 terminalId1 elementId2 terminalId2 creates a connection between the two terminals. Nothing is created if the modelling rules of the diagram reject the connection.

connectFrom :: SceneGraphWebalizer -> String -> String -> <ReadGraph> ()

connectFrom sgw elementId terminalId asks which terminals a connection started from the given terminal may end at. The answer is sent to the listener as a mayConnectTo message listing the element and terminal of every allowed target. Nothing is written to the database.

connectFromFlag :: SceneGraphWebalizer -> Double -> Double -> String -> String -> <WriteGraph> ()

As connectToFlag but the connection runs from the new flag to the given terminal.

connectToFlag :: SceneGraphWebalizer -> Double -> Double -> String -> String -> <Proc> ()

connectToFlag sgw flagX flagY elementId terminalId creates a connection from the given terminal to a new flag placed at (flagX, flagY). Does nothing if the diagram does not use connection flags or if the modelling rules reject the connection.

copyElements :: SceneGraphWebalizer -> [String] -> <Proc> ()

Copies the identified elements to the clipboard.

createSceneGraphWebalizer :: Resource -> (String -> String -> <Proc> Boolean) -> <Proc> SceneGraphWebalizer

createSceneGraphWebalizer diagram listener creates a webalizer for the given diagram resource. The diagram is loaded in the background, so the first init message reaches the listener only once the scene graph is ready.

createSceneGraphWebalizerForExperiment :: Resource -> Maybe Variable -> (String -> String -> <Proc> Boolean) -> <Proc> SceneGraphWebalizer

As createSceneGraphWebalizer but also takes the variable of the experiment run the diagram is shown against. Note that the current implementation ignores that variable.

cutElements :: SceneGraphWebalizer -> [String] -> <Proc> ()

Copies the identified elements to the clipboard and removes them from the diagram.

deleteElements :: SceneGraphWebalizer -> [String] -> <WriteGraph> ()

Removes the identified elements from the diagram.

deleteRouteGraphPart :: SceneGraphWebalizer -> String -> String -> <Proc> ()

Removes the identified part of the identified route graph node: a route line is merged away and a corner is deleted. Terminals cannot be removed this way.

diagramOfSGW :: SceneGraphWebalizer -> Resource

Returns the diagram resource the webalizer was created for.

disposeSceneGraphWebalizer :: SceneGraphWebalizer -> <Proc> ()

Sends a reset message to the listener and releases the canvas context, the scene graph provider and the worker thread of the webalizer. The webalizer cannot be used afterwards.

elementIdToElement :: SceneGraphWebalizer -> String -> <ReadGraph> Maybe Resource

Returns the diagram element resource that the given element id refers to, or Nothing if there is no such resource.

flipElements :: SceneGraphWebalizer -> [String] -> Boolean -> <WriteGraph> ()

Mirrors the identified elements, around the y axis if the flag is True and around the x axis if it is False. Does nothing if default transformations have been switched off with configureDefaultTransformations.

modifyRouteGraph :: SceneGraphWebalizer -> String -> String -> Double -> Double -> <Proc> ()

modifyRouteGraph sgw nodeId partId x y moves the identified route line of the identified route graph node to (x, y). Does nothing if the node is not a route graph node or has no such part.

modifyText :: SceneGraphWebalizer -> String -> String -> <Proc> Maybe (String, Maybe String)

modifyText sgw nodeId text sets the text of the identified text node. Returns the text the node ends up with, paired with the validation error the new text produced or Nothing if it was accepted. Returns Nothing if the identified node is not a text node. No transaction may be open while this is called, because the text validators open their own.

moveElementsDown :: SceneGraphWebalizer -> [String] -> <Proc> ()

Lowers the identified elements by one step in the z order of the diagram.

moveElementsToBottom :: SceneGraphWebalizer -> [String] -> <Proc> ()

Lowers the identified elements below all other elements of the diagram.

moveElementsToTop :: SceneGraphWebalizer -> [String] -> <Proc> ()

Raises the identified elements above all other elements of the diagram.

moveElementsUp :: SceneGraphWebalizer -> [String] -> <Proc> ()

Raises the identified elements by one step in the z order of the diagram.

pasteElements :: SceneGraphWebalizer -> Double -> Double -> <Proc> ()

Pastes the contents of the clipboard onto the diagram at the position (x, y).

resetClientState :: SceneGraphWebalizer -> <Proc> ()

Forgets everything the client is known to have received. The complete scene graph is sent again on the next repaint. Use this when the client has lost its state, for instance after reconnecting.

rotateElements :: SceneGraphWebalizer -> [String] -> Boolean -> <WriteGraph> ()

Rotates the identified elements by 90 degrees around the center of mass of the selection, clockwise if the flag is True and counterclockwise if it is False. Does nothing if default transformations have been switched off with configureDefaultTransformations.

splitRouteGraphPart :: SceneGraphWebalizer -> String -> String -> Double -> <Proc> ()

splitRouteGraphPart sgw nodeId partId position splits the identified route line of the identified route graph node in two at the given position along the line.

transformElements :: SceneGraphWebalizer -> [(String, [Double])] -> <WriteGraph> ()

Replaces the transform of each identified element with the given affine transform, whose six numbers are [m00, m10, m01, m11, m02, m12]. Does nothing if default transformations have been switched off with configureDefaultTransformations.

translateElements :: SceneGraphWebalizer -> [String] -> Double -> Double -> <WriteGraph> ()

translateElements sgw ids dx dy moves the identified elements by dx and dy in diagram coordinates. Route graph connections have their route nodes moved rather than their transform changed. Does nothing if default transformations have been switched off with configureDefaultTransformations.

webalizerContext :: SceneGraphWebalizer -> <Proc> Maybe ICanvasContext

Returns the canvas context the webalizer paints the diagram into, or Nothing if the webalizer has been disposed.

webalizerScenegraphProvider :: SceneGraphWebalizer -> <Proc> Maybe ICanvasSceneGraphProvider

Returns the scene graph provider that loaded the diagram, or Nothing if the diagram has not been loaded yet or the webalizer has been disposed.