lp-diagrams-1.0: An EDSL for diagrams based based on linear constraints

Safe HaskellNone
LanguageHaskell2010

Graphics.Diagrams.Object

Synopsis

Documentation

data Anchor Source

Constructors

Center 
N 
NW 
W 
SW 
S 
SE 
E 
NE 
BaseW 
Base 
BaseE 

Instances

type Box = Object Source

Box-shaped object. (a subtype)

newtype Anchorage Source

Constructors

Anchorage 

Fields

fromAnchorage :: Anchor -> Point
 

(#) :: Anchored a => a -> Anchor -> Point infix 8 Source

hdist :: Anchored a => a -> a -> Expr Source

Horizontal distance between objects

vdist :: Anchored a => a -> a -> Expr Source

Vertical distance between objects

extend :: Expr -> Anchorage -> Anchorage Source

Extend the box boundaries by the given delta

shiftInDir :: Anchor -> Expr -> Point Source

Makes a shift of size d in the given direction.

mkLabel :: Monad m => lab -> Diagram lab m Anchorage Source

Make a label object. This is just some text surrounded by 4 points of blank.

labelObj :: Monad m => lab -> Diagram lab m Box Source

labelPt :: Monad m => lab -> Anchor -> Point -> Diagram lab m Box Source

Label a point by a given TeX expression, at the given anchor.

point :: Monad m => Diagram lab m Point Source

A free point

pointBox :: Monad m => Diagram lab m Anchorage Source

A point anchorage (similar to a box of zero width and height)

box :: Monad m => Diagram lab m Anchorage Source

A box. Anchors are aligned along a grid.

vrule :: Monad m => Diagram lab m Anchorage Source

A box of zero width

hrule :: Monad m => Diagram lab m Anchorage Source

A box of zero height

height :: Anchored a => a -> Expr Source

width :: Anchored a => a -> Expr Source

ascent :: Anchored a => a -> Expr Source

fitsIn :: (Monad m, Anchored a, Anchored b) => a -> b -> Diagram lab m () Source

Make one object fit (snugly) in the other.

fitsHorizontallyIn :: (Monad m, Anchored a, Anchored b) => a -> b -> Diagram lab m () Source

Make one object fit (snugly) in the other.

fitsVerticallyIn :: (Monad m, Anchored a, Anchored b) => a -> b -> Diagram lab m () Source

Make one object fit (snugly) in the other.

circleShape :: Monad m => Diagram lab m Object Source

A circle

traceAnchorage :: (Anchored a, Monad m) => Color -> a -> Diagram lab m () Source

labelBox :: Monad m => lab -> Diagram lab m Anchorage Source

Typeset a piece of text and return its bounding box.

data OVector Source

A vector with an origin

Constructors

OVector 

turn180 :: OVector -> OVector Source

Turn the orientation by 180 degrees

data FList xs a where Source

Constructors

NIL :: FList `[]` a 
(:%>) :: Functor t => t a -> FList fs a -> FList ((:) t fs) a infixr 9 

Instances

edge :: Monad m => Object -> Object -> Diagram lab m OVector Source

Traces a straight edge between two objects. A vector originated at the midpoint and pointing perpendicular to the edge is returned.

(.<.) :: Monad m => Point -> Point -> Diagram lab m () Source

insideBox :: Monad m => Anchored a => Point -> a -> Diagram lab m () Source

Forces the point to be inside the (bounding box) of the object.

autoLabelObj :: Monad m => Box -> OVector -> Diagram lab m () Source

autoLabel o i Layouts the label object o at the given incidence vector.

autoLabel :: Monad m => lab -> OVector -> Diagram lab m () Source

autoLabel o i Layouts the label object o at the given incidence vector.

labeledEdge :: Monad m => Object -> Object -> Box -> Diagram lab m () Source

labeledEdge label source target

leftOf :: Monad m => Object -> Object -> Diagram lab m () Source

topOf :: Monad m => Object -> Object -> Diagram lab m () Source

spread :: Monad m => (t -> t -> Expr) -> Expr -> [t] -> Diagram lab m () Source

Spread a number of objects by *minimum* a given distance. example: spread hdist 30 ps

node :: Monad m => lab -> Diagram lab m Object Source

A node: a labeled circle

arrow :: Monad m => Object -> Object -> Diagram lab m OVector Source

Draw an arrow between two objects

boundingBox :: (Monad m, Anchored a) => [a] -> Diagram lab m Object Source

Bounding box of a number of anchored values