Loading...
Searching...
No Matches
GraphToEps< T > Class Template Reference

## Detailed Description

template<class T>
class lemon::GraphToEps< T >

Auxiliary class to implement the named parameters of graphToEps().

For detailed examples see the graph_to_eps_demo.cc demo file.

`#include <lemon/graph_to_eps.h>`

## Public Types

enum | NodeShapes { CIRCLE =0 , SQUARE =1 , DIAMOND =2 , MALE =3 , FEMALE =4 }
| Node shapes. More...

## Public Member Functions

template<class X>
GraphToEps< CoordsTraits< X > > | coords (const X &x)
| Sets the map of the node coordinates.
template<class X>
GraphToEps< NodeSizesTraits< X > > | nodeSizes (const X &x)
| Sets the map of the node sizes.
template<class X>
GraphToEps< NodeShapesTraits< X > > | nodeShapes (const X &x)
| Sets the map of the node shapes.
template<class X>
GraphToEps< NodeTextsTraits< X > > | nodeTexts (const X &x)
| Sets the text printed on the nodes.
template<class X>
GraphToEps< NodePsTextsTraits< X > > | nodePsTexts (const X &x)
| Inserts a PostScript block to the nodes.
template<class X>
GraphToEps< ArcWidthsTraits< X > > | arcWidths (const X &x)
| Sets the map of the arc widths.
template<class X>
GraphToEps< NodeColorsTraits< X > > | nodeColors (const X &x)
| Sets the map of the node colors.
template<class X>
GraphToEps< NodeTextColorsTraits< X > > | nodeTextColors (const X &x)
| Sets the map of the node text colors.
template<class X>
GraphToEps< ArcColorsTraits< X > > | arcColors (const X &x)
| Sets the map of the arc colors.
GraphToEps< T > & | nodeScale (double d=.01)
| Sets a global scale factor for node sizes.
GraphToEps< T > & | autoNodeScale (bool b=true)
| Turns on/off the automatic node size scaling.
GraphToEps< T > & | absoluteNodeSizes (bool b=true)
| Turns on/off the absolutematic node size scaling.
GraphToEps< T > & | negateY (bool b=true)
| Negates the Y coordinates.
GraphToEps< T > & | preScale (bool b=true)
| Turn on/off pre-scaling.
GraphToEps< T > & | arcWidthScale (double d=.003)
| Sets a global scale factor for arc widths.
GraphToEps< T > & | autoArcWidthScale (bool b=true)
| Turns on/off the automatic arc width scaling.
GraphToEps< T > & | absoluteArcWidths (bool b=true)
| Turns on/off the absolutematic arc width scaling.
GraphToEps< T > & | scale (double d)
| Sets a global scale factor for the whole picture.
GraphToEps< T > & | border (double b=10)
| Sets the width of the border around the picture.
GraphToEps< T > & | border (double x, double y)
| Sets the width of the border around the picture.
GraphToEps< T > & | drawArrows (bool b=true)
| Sets whether to draw arrows.
GraphToEps< T > & | arrowLength (double d=1.0)
| Sets the length of the arrowheads.
GraphToEps< T > & | arrowWidth (double d=.3)
| Sets the width of the arrowheads.
GraphToEps< T > & | scaleToA4 ()
| Scales the drawing to fit to A4 page.
GraphToEps< T > & | enableParallel (bool b=true)
| Enables parallel arcs.
GraphToEps< T > & | parArcDist (double d)
| Sets the distance between parallel arcs.
GraphToEps< T > & | hideArcs (bool b=true)
| Hides the arcs.
GraphToEps< T > & | hideNodes (bool b=true)
| Hides the nodes.
GraphToEps< T > & | nodeTextSize (double d)
| Sets the size of the node texts.
GraphToEps< T > & | distantColorNodeTexts ()
| Sets the color of the node texts to be different from the node color.
GraphToEps< T > & | distantBWNodeTexts ()
| Sets the color of the node texts to be black or white and always visible.
GraphToEps< T > & | nodePsTextsPreamble (const char *str)
| Gives a preamble block for node Postscript block.
GraphToEps< T > & | undirected (bool b=true)
| Sets whether the graph is undirected.
GraphToEps< T > & | directed (bool b=true)
| Sets whether the graph is directed.
GraphToEps< T > & | title (const std::string &t)
| Sets the title.
GraphToEps< T > & | copyright (const std::string &t)
| Sets the copyright statement.
void | run ()
| Draws the graph.
Aliases
These are just some aliases to other parameter setting functions.
template<class X>
GraphToEps< ArcWidthsTraits< X > > | edgeWidths (const X &x)
| An alias for arcWidths().
template<class X>
GraphToEps< ArcColorsTraits< X > > | edgeColors (const X &x)
| An alias for arcColors().
GraphToEps< T > & | edgeWidthScale (double d)
| An alias for arcWidthScale().
GraphToEps< T > & | autoEdgeWidthScale (bool b=true)
| An alias for autoArcWidthScale().
GraphToEps< T > & | absoluteEdgeWidths (bool b=true)
| An alias for absoluteArcWidths().
GraphToEps< T > & | parEdgeDist (double d)
| An alias for parArcDist().
GraphToEps< T > & | hideEdges (bool b=true)
| An alias for hideArcs().

## Member Enumeration Documentation

## NodeShapes

template<class T>

enum NodeShapes

Node shapes.

Enumerator
CIRCLE | = 0 latex nodeshape_0.eps "CIRCLE shape (0)"
SQUARE | = 1 latex nodeshape_1.eps "SQUARE shape (1)"
DIAMOND | = 2 latex nodeshape_2.eps "DIAMOND shape (2)"
MALE | = 3 latex nodeshape_3.eps "MALE shape (3)"
FEMALE | = 4 latex nodeshape_4.eps "FEMALE shape (4)"

## Member Function Documentation

## coords()

template<class T>
template<class X>

GraphToEps< CoordsTraits< X > > coords | ( | const X & | x | ) |

inline

Sets the map of the node coordinates.

Parameters

  x | must be a node map with dim2::Point<double> or dim2::Point<int> values.

## nodeSizes()

template<class T>
template<class X>

GraphToEps< NodeSizesTraits< X > > nodeSizes | ( | const X & | x | ) |

inline

Sets the map of the node sizes.

Parameters

  x | must be a node map with `double` (or convertible) values.

## nodeShapes()

template<class T>
template<class X>

GraphToEps< NodeShapesTraits< X > > nodeShapes | ( | const X & | x | ) |

inline

Sets the map of the node shapes. The available shape values can be found in enum NodeShapes.

Parameters

  x | must be a node map with `int` (or convertible) values.

See also
  NodeShapes

## nodeTexts()

template<class T>
template<class X>

GraphToEps< NodeTextsTraits< X > > nodeTexts | ( | const X & | x | ) |

inline

Sets the text printed on the nodes.

Parameters

  x | must be a node map with type that can be pushed to a standard `ostream`.

## nodePsTexts()

template<class T>
template<class X>

GraphToEps< NodePsTextsTraits< X > > nodePsTexts | ( | const X & | x | ) |

inline

With this command it is possible to insert a verbatim PostScript block to the nodes. The PS current point will be moved to the center of the node before the PostScript block inserted.

Before and after the block a newline character is inserted so you don't have to bother with the separators.

Parameters

  x | must be a node map with type that can be pushed to a standard `ostream`.

See also
  nodePsTextsPreamble()

## arcWidths()

template<class T>
template<class X>

GraphToEps< ArcWidthsTraits< X > > arcWidths | ( | const X & | x | ) |

inline

Sets the map of the arc widths.

Parameters

  x | must be an arc map with `double` (or convertible) values.

## nodeColors()

template<class T>
template<class X>

GraphToEps< NodeColorsTraits< X > > nodeColors | ( | const X & | x | ) |

inline

Sets the map of the node colors.

Parameters

  x | must be a node map with Color values.

See also
  Palette

## nodeTextColors()

template<class T>
template<class X>

GraphToEps< NodeTextColorsTraits< X > > nodeTextColors | ( | const X & | x | ) |

inline

Sets the map of the node text colors.

Parameters

  x | must be a node map with Color values.

See also
  Palette

## arcColors()

template<class T>
template<class X>

GraphToEps< ArcColorsTraits< X > > arcColors | ( | const X & | x | ) |

inline

Sets the map of the arc colors.

Parameters

  x | must be an arc map with Color values.

See also
  Palette

## nodeScale()

template<class T>

GraphToEps< T > & nodeScale | ( | double | d = .01 | ) |

inline

Sets a global scale factor for node sizes.

If nodeSizes() is not given, this function simply sets the node sizes to `d`. If nodeSizes() is given, but autoNodeScale() is not, then the node size given by nodeSizes() will be multiplied by the value `d`. If both nodeSizes() and autoNodeScale() are used, then the node sizes will be scaled in such a way that the greatest size will be equal to `d`.

See also
  nodeSizes()
  autoNodeScale()

## autoNodeScale()

template<class T>

GraphToEps< T > & autoNodeScale | ( | bool | b = true | ) |

inline

Turns on/off the automatic node size scaling.

See also
  nodeScale()

## absoluteNodeSizes()

template<class T>

GraphToEps< T > & absoluteNodeSizes | ( | bool | b = true | ) |

inline

Turns on/off the absolutematic node size scaling.

See also
  nodeScale()

## preScale()

template<class T>

GraphToEps< T > & preScale | ( | bool | b = true | ) |

inline

By default, graphToEps() rescales the whole image in order to avoid very big or very small bounding boxes.

This (p)rescaling can be turned off with this function.

## arcWidthScale()

template<class T>

GraphToEps< T > & arcWidthScale | ( | double | d = .003 | ) |

inline

Sets a global scale factor for arc widths.

If arcWidths() is not given, this function simply sets the arc widths to `d`. If arcWidths() is given, but autoArcWidthScale() is not, then the arc withs given by arcWidths() will be multiplied by the value `d`. If both arcWidths() and autoArcWidthScale() are used, then the arc withs will be scaled in such a way that the greatest width will be equal to `d`.

## autoArcWidthScale()

template<class T>

GraphToEps< T > & autoArcWidthScale | ( | bool | b = true | ) |

inline

Turns on/off the automatic arc width scaling.

See also
  arcWidthScale()

## absoluteArcWidths()

template<class T>

GraphToEps< T > & absoluteArcWidths | ( | bool | b = true | ) |

inline

Turns on/off the absolutematic arc width scaling.

See also
  arcWidthScale()

## distantColorNodeTexts()

template<class T>

GraphToEps< T > & distantColorNodeTexts | ( |  | ) |

inline

Sets the color of the node texts to be as different from the node color as it is possible.

## distantBWNodeTexts()

template<class T>

GraphToEps< T > & distantBWNodeTexts | ( |  | ) |

inline

Sets the color of the node texts to be black or white according to which is more different from the node color.

## nodePsTextsPreamble()

template<class T>

GraphToEps< T > & nodePsTextsPreamble | ( | const char * | str | ) |

inline

Gives a preamble block for node Postscript block.

See also
  nodePsTexts()

## undirected()

template<class T>

GraphToEps< T > & undirected | ( | bool | b = true | ) |

inline

Sets whether the graph is undirected.

This setting is the default for undirected graphs.

See also
  directed()

## directed()

template<class T>

GraphToEps< T > & directed | ( | bool | b = true | ) |

inline

Sets whether the graph is directed. Use it to show the edges as a pair of directed ones.

This setting is the default for digraphs.

See also
  undirected()

## title()

template<class T>

GraphToEps< T > & title | ( | const std::string & | t | ) |

inline

Sets the title of the generated image, namely it inserts a %Title: DSC field to the header of the EPS file.

## copyright()

template<class T>

GraphToEps< T > & copyright | ( | const std::string & | t | ) |

inline

Sets the copyright statement of the generated image, namely it inserts a %Copyright: DSC field to the header of the EPS file.

## run()

template<class T>

void run | ( |  | ) |

inline

Like other functions using named template parameters, this function calls the algorithm itself, i.e. in this case it draws the graph.