|
Module Simantics/DiagramAffine Transformsdata Position
is a 2D affine transform with a rotation/scale/shear part,
i.e.
Position :: Double -> Double -> Double -> Double -> Double -> Double -> Position location :: Double -> Double -> Position
Returns an affine transform with identity rotation and move :: (Double, Double) -> Position -> Position
Returns a function that adds rotate :: Integer -> Position -> Position
Returns a function that rotates the specified affine transform by scale :: Double -> Position -> Position
Multiplies the rotation part of the specified affine
withScale :: Double -> Position -> Position
Sets the rotation part so that the base vectors defined by
flipX :: Position -> Position
Performs a mirror operation for the specified flipY :: Position -> Position
Performs a mirror operation for the specified positionToDoubleArray :: Position -> Vector Double Converts a Position into a positionToVector :: Position -> Vector Double Converts a Position into a Diagram Browsingdiagram :: Resource -> [String] -> <ReadGraph> Resource Returns a diagram in the given model with the given model relative path. The first Note that this function returns the diagram configuration composite resource. If you need to get the actual diagram resource, use compositeToDiagram on the configuration composite resource. So for example if you have the following hierarchy
the function would be used to fetch the
possibleDiagram :: Resource -> [String] -> <ReadGraph> Maybe Resource Same as diagram but returns Note that this function returns the diagram configuration composite resource. If you need to get the actual diagram resource, use compositeToDiagram on the configuration composite resource. diagramsOf :: Resource -> <ReadGraph> [Resource]
Returns all configuration diagrams of the given model. Note that this function returns the diagram configuration composite resource. If you need to get the actual diagram resource, use compositeToDiagram on the configuration composite resources. diagramsUnder :: Resource -> <ReadGraph> [Resource] Returns all diagrams under the specified diagram folder. The parameter can also be the configuration root Note that this function returns diagram configuration composite resources. If you need to get the actual diagram resources, use map compositeToDiagram on the configuration composite resources. Consider for example if you have the following hierarchy
the function would be used to fetch the
Undocumented entitiesBaseline :: Alignment Center :: Alignment Component :: a -> String -> Position -> [Property a] -> DiagramElement a Connection :: [ConnectionNode a] -> [Edge] -> Maybe String -> DiagramElement a DiagramInfo :: Resource -> Resource -> MMap.T String Resource -> DiagramInfo Edge :: Integer -> Integer -> Edge ExistingDiagram :: Resource -> DiagramSpec Flag :: a -> String -> String -> Boolean -> Boolean -> Maybe String -> Maybe Integer -> Position -> [Dynamic] -> DiagramElement a Font :: String -> Integer -> Integer -> Font Leading :: Alignment Monitor :: String -> Maybe MonitorReference -> MonitorVisuals -> Position -> DiagramElement a MonitorReference :: String -> String -> MonitorReference MonitorVisuals :: Maybe Font -> Double -> Alignment -> Alignment -> MonitorVisuals NewDiagram :: Resource -> [String] -> Resource -> Resource -> DiagramSpec Property :: a -> Dynamic -> Property a RouteLine :: Boolean -> Double -> ConnectionNode a SVG :: String -> Position -> DiagramElement a SimpleConnection :: String -> a -> String -> a -> Maybe String -> DiagramElement a Terminal :: String -> a -> ConnectionNode a Text :: Resource -> String -> TextVisuals -> Position -> DiagramElement a TextVisuals :: Maybe Font -> Alignment -> Alignment -> TextVisuals Trailing :: Alignment alignmentToResource :: Alignment -> Resource applyConnectionType :: Resource -> <Proc,WriteGraph,ReadGraph> () Determines the connection type of the given diagram connection element and
claims it as the applyDiagramMapping :: Resource -> <Proc,WriteGraph> () Runs the mapping of the given diagram resource once, which updates the configuration composite of the diagram to match the current contents of the diagram. syncActivateDiagram does the same starting from the configuration composite. claimFolder :: Resource -> [String] -> Resource -> <Proc,WriteGraph> Resource
Returns the folder at the given configuration relative claimModelFolder :: Resource -> [String] -> Resource -> <Proc,WriteGraph> Resource
Same as claimFolder but the componentToElement :: Resource -> <ReadGraph> Resource Returns the diagram element that the given configuration component is mapped to. Fails if the component has no element. compositeToDiagram :: Resource -> <ReadGraph> Resource Returns the diagram resource of the given diagram configuration composite. Fails if the composite has no diagram. The functions that read or write the elements of a diagram expect this resource rather than the composite. compositeToDiagram' :: Resource -> <ReadGraph> Resource createComposite :: Resource -> String -> Resource -> <WriteGraph> Resource
Creates a new diagram composite of createComposite_ :: Resource -> String -> Resource -> <WriteGraph> Resource
Creates a new component of createComposite__ :: Resource -> String -> Resource -> <WriteGraph> Resource
Creates a new diagram composite of createDiagramR :: DiagramSpec -> (Dynamic -> <WriteGraph> Resource) -> [DiagramElement Resource] -> <WriteGraph> (Resource, [Resource]) Creates or modifies an existing diagram to contain the given diagram elements. createJoinMap :: () -> <Proc> Dynamic -> <WriteGraph> Resource
Creates a function that maps a key to a connection join. The first call for
a key creates a new createSVGElement :: Resource -> String -> Vector Byte -> Double -> Double -> <WriteGraph> ()
Creates a new image element on the specified
Any other The created element is given a fresh element name within the diagram and is added first in the diagram's element ordered set. It is not put on any of the diagram's layers. Placing the element on the currently visible layers requires the created element, i.e. createSVGElementR. createSVGElementR :: Resource -> String -> Vector Byte -> Double -> Double -> <WriteGraph> Resource
Creates an image element into the given diagram resource at defaultSymbolDropHandler :: [WorkbenchSelectionElement] -> <WriteGraph> () The default handler for symbols dropped onto a diagram. The present implementation only prints the dropped selection and changes nothing. determineConnectionType :: Resource -> <ReadGraph> Maybe Resource Takes one connection element and returns possible connection type. diagramResourceOf :: Resource -> <ReadGraph> Resource Returns the diagram resource of the given diagram configuration composite, the same as compositeToDiagram. Fails if the composite has no diagram. elementToComponent :: Resource -> <ReadGraph> Resource Returns the configuration component that the given diagram element is mapped to. Fails if the element has no component, which is the case for elements such as flags and text elements. elementsOfR :: Resource -> <ReadGraph> [(DiagramElement Resource, Resource)] Returns the elements of the given diagram. flipConnection :: Resource -> Boolean -> Double -> <WriteGraph> ()
Mirrors the interior route lines of the given connection. When genericFlagType :: () -> <ReadGraph> Resource Returns the diagram flag type resource used for all generic diagram flags. getConnection :: Resource -> String -> <ReadGraph> [Resource]
Returns the connection elements of the given diagram configuration composite
whose element name is getConnections :: Resource -> <ReadGraph> [Resource] Returns the route graph connection elements of the diagram of the given configuration composite. getOrCreateFolder :: Resource -> Resource -> String -> <Proc,WriteGraph> Resource
Returns the child of importSVGElement :: Resource -> File -> Double -> Double -> <WriteGraph> ()
Reads the given image file and creates an element for it into the given
diagram resource at importSVGElementR :: Resource -> File -> Double -> Double -> <WriteGraph> Resource Same as importSVGElement but returns the created element. joinFlagsLocal :: [Resource] -> <WriteGraph> () Joins each of the given flags with its counterpart flags on the same diagram: the two connections that end at a flag pair are merged into one connection. A flag is removed in the process unless it has more than one counterpart, i.e. is a merged flag. Flags that are not connected to anything are skipped. mapDiagramElement :: (a -> <c> b) -> (a -> <c> b) -> (a -> <c> Maybe b) -> (a -> <c> b) -> DiagramElement a -> <c> DiagramElement b Constructs a transformation for a diagram element. moveConnection :: Resource -> Double -> Double -> <WriteGraph> ()
Translates the interior route lines of the given connection by newTypicalDiagram :: Resource -> Resource Creates a new master typical diagram into the given library and returns its configuration composite. The containing model or shared library must define the typical composite and diagram base types; nothing is created if it does not. Performs its own write transaction. pathNameOf :: Resource -> <ReadGraph> String Returns the model configuration relative path of the given diagram as a single
string with the names separated by pathOf :: Resource -> <ReadGraph> [String] Returns a model configuration relative path of the given diagram. removeElement :: Resource -> Resource -> <WriteGraph> ()
Removes the given element from the given diagram resource. A connection is removed together with its connectors and route lines. Fails if something prevents the element from being removed. resourceToAlignment :: Show a => Browsable a => a -> <ReadGraph> Alignment rotateConnection :: Resource -> Double -> Double -> Boolean -> <WriteGraph> ()
Rotates the interior route lines of the given connection by 90 degrees
around the point rotateDegrees :: Double -> Position -> Position
Returns a function that rotates the specified affine transform by setElements :: DiagramInfo -> (Dynamic -> <WriteGraph> Resource) -> [DiagramElement Resource] -> <Proc,WriteGraph> [Resource] Sets the elements of the diagram. Diagram is assumed to be empty, but the configuration may contain existing components that can be found from the given existing components map. setProfileMonitorsDirectionUp :: Resource -> Boolean -> <WriteGraph> ()
Sets whether the profile monitors of the given diagram element are stacked upwards from the element instead of downwards. setStraightConnectionLines :: Resource -> Boolean -> <WriteGraph> ()
Sets whether the connections attached to the given diagram element are routed with straight lines between the terminals, route points and branch points instead of orthogonal lines. The setting is written to every connector of the element. setTransform :: Resource -> Vector Double -> <WriteGraph> ()
Replaces the affine transform of the given diagram element. showProfileMonitors :: Resource -> Boolean -> <WriteGraph> ()
Sets whether the profile monitors of the given diagram element are shown. splitConnection :: Resource -> Double -> Double -> <WriteGraph> ()
Splits the given route graph connection in two at the diagram coordinates
syncActivateDiagram :: Resource -> <WriteGraph,Proc> Boolean Runs the mapping of the diagram of the given configuration composite once, so
that the composite matches the contents of the diagram. Always returns syncTypicalInstance :: Resource -> <WriteGraph> () Synchronizes one typical instance diagram with the master typical diagram it was instantiated from, so that the changes made to the master are applied to the instance. transformElement :: (Position -> Position) -> Resource -> <WriteGraph> () transformElements :: (Position -> Position) -> [Resource] -> <WriteGraph> ()
Runs transformElement using the specified transformer for
all the specified Use this function together with e.g. scale and withScale or similar functions. Examples:
translateRouteNodes :: Resource -> Double -> Double -> <WriteGraph> ()
Translates the interior route lines of the given connection by |