hgeometry-ipe-0.11.0.0: Reading and Writing ipe7 files.

Data.Geometry.Ipe.IpeOut

Description

Functions that help drawing geometric values in ipe. An IpeOut is essenitally a function that converts a geometric type g into an IpeObject.

We also proivde a HasDefaultIpeOut typeclass that defines a default conversion function from a geometry type g to an ipe type.

Synopsis

# Documentation

>>> :set -XOverloadedStrings
>>> :{
let myPolygon = fromPoints . map ext $[origin, Point2 10 10, Point2 100 200] :}  # The IpeOut type and the default combinator to use it type IpeOut g i r = g -> IpeObject' i r Source # (!) :: IpeObject' i r -> IpeAttributes i r -> IpeObject' i r Source # Add attributes to an IpeObject' iO :: ToObject i => IpeObject' i r -> IpeObject r Source # Render an ipe object >>> :{  iO$ defIO myPolygon ! attr SFill (IpeColor "blue")
! attr SLayer "alpha"
! attr SLayer "beta"
:}
IpePath (Path {_pathSegments = LSeq (fromList [PolygonPath SimplePolygon CSeq [Point2 [0,0] :+ (),Point2 [10,10] :+ (),Point2 [100,200] :+ ()]])} :+ Attrs {Attr LayerName {_layerName = "beta"}, NoAttr, NoAttr, NoAttr, NoAttr, Attr IpeColor (Named "blue"), NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr})

>>> :{
  iO $ipeGroup [ iO$ ipePolygon myPolygon ! attr SFill (IpeColor "red")
] ! attr SLayer "alpha"
:}
IpeGroup (Group [IpePath (Path {_pathSegments = LSeq (fromList [PolygonPath SimplePolygon CSeq [Point2 [0,0] :+ (),Point2 [10,10] :+ (),Point2 [100,200] :+ ()]])} :+ Attrs {NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, Attr IpeColor (Named "red"), NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr})] :+ Attrs {Attr LayerName {_layerName = "alpha"}, NoAttr, NoAttr, NoAttr, NoAttr})


iO'' :: (HasDefaultIpeOut g, NumType g ~ r, DefaultIpeOut g ~ i, ToObject i) => g -> IpeAttributes i r -> IpeObject r Source #

Render to an ipe object using the defIO IpeOut

>>> :{
  iO'' myPolygon $attr SFill (IpeColor "red") <> attr SLayer "alpha" <> attr SLayer "beta" :} IpePath (Path {_pathSegments = LSeq (fromList [PolygonPath SimplePolygon CSeq [Point2 [0,0] :+ (),Point2 [10,10] :+ (),Point2 [100,200] :+ ()]])} :+ Attrs {Attr LayerName {_layerName = "beta"}, NoAttr, NoAttr, NoAttr, NoAttr, Attr IpeColor (Named "red"), NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr})  >>> iO'' [ myPolygon , myPolygon ]$ attr SLayer "alpha"
IpeGroup (Group [IpePath (Path {_pathSegments = LSeq (fromList [PolygonPath SimplePolygon CSeq [Point2 [0,0] :+ (),Point2 [10,10] :+ (),Point2 [100,200] :+ ()]])} :+ Attrs {NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr}),IpePath (Path {_pathSegments = LSeq (fromList [PolygonPath SimplePolygon CSeq [Point2 [0,0] :+ (),Point2 [10,10] :+ (),Point2 [100,200] :+ ()]])} :+ Attrs {NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr})] :+ Attrs {Attr LayerName {_layerName = "alpha"}, NoAttr, NoAttr, NoAttr, NoAttr})


iO' :: HasDefaultIpeOut g => g -> IpeObject (NumType g) Source #

generate an ipe object without any specific attributes

# Default Conversions

class ToObject (DefaultIpeOut g) => HasDefaultIpeOut g where Source #

Class that specifies a default conversion from a geometry type g into an ipe object.

Associated Types

type DefaultIpeOut g :: * -> * Source #

Instances
 Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut [a] :: Type -> Type Source # MethodsdefIO :: IpeOut [a] (DefaultIpeOut [a]) (NumType [a]) Source # Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Ellipse r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Ellipse r) (DefaultIpeOut (Ellipse r)) (NumType (Ellipse r)) Source # Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (ConvexPolygon p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (ConvexPolygon p r) (DefaultIpeOut (ConvexPolygon p r)) (NumType (ConvexPolygon p r)) Source # Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (SomePolygon p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (SomePolygon p r) (DefaultIpeOut (SomePolygon p r)) (NumType (SomePolygon p r)) Source # Floating r => HasDefaultIpeOut (Disk p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Disk p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Disk p r) (DefaultIpeOut (Disk p r)) (NumType (Disk p r)) Source # Floating r => HasDefaultIpeOut (Circle p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Circle p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Circle p r) (DefaultIpeOut (Circle p r)) (NumType (Circle p r)) Source # Num r => HasDefaultIpeOut (Rectangle p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Rectangle p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Rectangle p r) (DefaultIpeOut (Rectangle p r)) (NumType (Rectangle p r)) Source # (Fractional r, Ord r) => HasDefaultIpeOut (Line 2 r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Line 2 r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Line 2 r) (DefaultIpeOut (Line 2 r)) (NumType (Line 2 r)) Source # Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Point 2 r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Point 2 r) (DefaultIpeOut (Point 2 r)) (NumType (Point 2 r)) Source # (HasDefaultIpeOut g, a ~ IpeAttributes (DefaultIpeOut g) (NumType g)) => HasDefaultIpeOut (g :+ a) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (g :+ a) :: Type -> Type Source # MethodsdefIO :: IpeOut (g :+ a) (DefaultIpeOut (g :+ a)) (NumType (g :+ a)) Source # HasDefaultIpeOut (Polygon t p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (Polygon t p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (Polygon t p r) (DefaultIpeOut (Polygon t p r)) (NumType (Polygon t p r)) Source # HasDefaultIpeOut (PolyLine 2 p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (PolyLine 2 p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (PolyLine 2 p r) (DefaultIpeOut (PolyLine 2 p r)) (NumType (PolyLine 2 p r)) Source # HasDefaultIpeOut (LineSegment 2 p r) Source # Instance detailsDefined in Data.Geometry.Ipe.IpeOut Associated Typestype DefaultIpeOut (LineSegment 2 p r) :: Type -> Type Source # MethodsdefIO :: IpeOut (LineSegment 2 p r) (DefaultIpeOut (LineSegment 2 p r)) (NumType (LineSegment 2 p r)) Source #

# Path Converters

path :: PathSegment r -> Path r Source #

Helper to construct a path from a singleton item

ipePolygon :: IpeOut (Polygon t p r) Path r Source #

Draw a polygon

ipeRectangle :: Num r => IpeOut (Rectangle p r) Path r Source #

Draw a Rectangle

# Text Converters

Creates an text label

Arguments

 :: (Show lbl, NumType g ~ r, ToObject i) => (g -> Point 2 r) where to place the label -> IpeOut g i r how to draw the geometric object -> IpeOut (g :+ lbl) Group r

Annotate an IpeOut with a label