185# include <tclap/CmdLine.h>
189# define TERMINATE(n) (save_parameters(), exit(n))
274 <<
"Horizontal radius -x = " <<
hr <<
endl
275 <<
"Vertical radius -y = " <<
vr <<
endl
276 <<
"Horizontal diameter = " <<
hd <<
endl
277 <<
"Vertical diameter = " <<
vd <<
endl
281 <<
"Horizontal offset for key -X = " <<
x_offset <<
endl
349# define X(p) ((p)->get_info().x)
350# define Y(p) ((p)->get_info().y)
351# define HR(p) ((p)->get_info().hr)
352# define VR(p) ((p)->get_info().vr)
353# define SHADOW(p) ((p)->get_info().shadow)
354# define WITHOUT(p) ((p)->get_info().without)
355# define NUMBER(p) ((p)->get_info().number)
356# define STRING(p) ((p)->get_info().name)
357# define XOFFSET(p) ((p)->get_info().xoffset)
358# define YOFFSET(p) ((p)->get_info().yoffset)
359# define TAGS(p) ((p)->get_info().tag_list)
361# define DYNARRAY_APPEND(array, item) (array[array.size()] = item)
384# define STRING_ARC(a) ((a)->get_info().data)
385# define XOFFSET_ARC(a) ((a)->get_info().xoffset)
386# define YOFFSET_ARC(a) ((a)->get_info().yoffset)
387# define SHADOW_ARC(a) ((a)->get_info().shadow)
388# define DASHED_ARC(a) ((a)->get_info().dashed)
389# define CURVE_ARC(a) ((a)->get_info().curve)
390# define CURVE_LEFT(a) ((a)->get_info().left)
391# define CURVE_MID(a) ((a)->get_info().curve_mid)
426 catch (
const std::out_of_range &)
441 while (c !=
'\n' and c !=
EOF);
494 if (
strcasecmp(buffer,
"SHADOW-CURVE-ARC") == 0)
497 if (
strcasecmp(buffer,
"DASHED-CURVE-ARC") == 0)
554 if (
strcasecmp(buffer,
"CROSS-NET-DIGRAPH") == 0)
557 if (
strcasecmp(buffer,
"CROSS-NET-GRAPH") == 0)
581 X(p) =
pt.get_x().get_d();
582 Y(p) =
pt.get_y().get_d();
586 catch (
const std::domain_error &)
588 AH_ERROR(
"Expecting for side-size or an arc");
629 catch (
const std::domain_error &)
631 AH_ERROR(
"Expecting for num-of-levels or a distance");
654 double x =
xdist / 2;
683 catch (
const std::domain_error &)
685 AH_ERROR(
"Expecting for num-of-levels or a distance");
722 AH_ERROR(
"Expecting for number of nodes");
730 p->get_info().name = n;
731 NUMBER(p) =
static_cast<int>(i);
911 AH_ERROR(
"Invalid sense in curved-arc definition");
1056 catch (exception & e)
1071 <<
"% This LaTeX picture is a graph automatically" <<
endl
1072 <<
"% generated by graphpic program" <<
endl
1074 <<
"% Copyright (C) 2007" <<
endl
1075 <<
"% UNIVERSITY of LOS ANDES (ULA)" <<
endl
1076 <<
"% Merida - REPUBLICA BOLIVARIANA DE VENEZUELA" <<
endl
1077 <<
"% Center of Studies in Microelectronics & Distributed Systems"
1078 <<
" (CEMISID)" <<
endl
1079 <<
"% ULA Computer Science Department" <<
endl
1081 <<
"% Leandro Leon - lrleon@ula.ve" <<
endl
1083 <<
"% You must use curves, epic and eepic latex packages" <<
endl
1084 <<
"% in your LaTeX application" <<
endl
1086 <<
"% curves Copyright by I.L. Maclaine-cross" <<
endl
1087 <<
"% epic Copyright by Sunil Podar" <<
endl
1088 <<
"% eepic Copyright by Conrad Kwok" <<
endl
1089 <<
"% LaTeX is a collection of TeX macros created by Leslie Lamport"
1091 <<
"% TeX was created by Donald Knuth" <<
endl
1093 <<
"% command line: " <<
endl
1099 <<
"% Creation date: " <<
ctime(&t) <<
endl
1103 output <<
"%%%%%%%%%%%%%%%% LATEX Header generated with -a option" <<
endl
1104 <<
"\\documentclass[11pt]{article}" <<
endl
1106 <<
"\\usepackage{curves}" <<
endl
1107 <<
"\\usepackage{epic}" <<
endl
1108 <<
"\\usepackage{eepic}" <<
endl
1110 <<
"\\begin{document}" <<
endl
1111 <<
"\\begin{center}" <<
endl;
1149 const double & dist,
1202 const double &
xp =
X(p);
1203 const double &
yp =
Y(p);
1339 const double ydiff = 0.6 *
vr;
1372 default:
AH_ERROR(
"(Internal) invalid sense option");
1496 for (Graph::Node_Iterator it(*g); it.has_curr(); it.next())
1499 for (
size_t i = 0; i <
::arcs.size(); ++i)
1512 <<
"\\end{center}" <<
endl
1513 <<
"\\end{document}" <<
endl;
1532 "graphpic - Aleph-w graph visualization tool.\n"
1533 "Generates LaTeX/eepic pictures from graph DSL specifications.\n"
1534 "Copyright (C) 2007-2024 University of Los Andes (ULA)",
1540 "f",
"file",
"Input graph specification file (required unless -R)",
false,
"",
"file",
cmd
1543 "o",
"output",
"Output eepic file (default: input.eepic)",
false,
"",
"file",
cmd
1548 "r",
"radius",
"Fit radius for circles (sets both hr and vr)",
false, 8,
"radius",
cmd
1551 "x",
"h-radius",
"Horizontal radius of node ellipse",
false, 8,
"radius",
cmd
1554 "y",
"v-radius",
"Vertical radius of node ellipse",
false, 8,
"radius",
cmd
1559 "W",
"width",
"Picture width",
false, 3000,
"size",
cmd
1562 "H",
"height",
"Picture height",
false, 3000,
"size",
cmd
1564 TCLAP::ValueArg<double>
zoomArg(
1565 "Z",
"zoom",
"Zoom factor",
false, 1.0,
"factor",
cmd
1568 "l",
"resolution",
"Resolution in mm",
false,
resolution,
"mm",
cmd
1573 "X",
"key-x-offset",
"Horizontal key offset",
false, 0,
"offset",
cmd
1576 "Y",
"key-y-offset",
"Vertical key offset",
false, 0,
"offset",
cmd
1579 "O",
"x-pic-offset",
"X picture offset",
false, 0,
"offset",
cmd
1582 "P",
"y-pic-offset",
"Y picture offset",
false, 0,
"offset",
cmd
1587 "a",
"latex",
"Add LaTeX document header",
cmd,
false
1590 "N",
"no-nodes",
"Do not draw node ellipses",
cmd,
false
1593 "S",
"no-squarize",
"Do not auto-fit picture scale",
cmd,
false
1596 "t",
"tiny-keys",
"Use tiny keys",
cmd,
false
1599 "R",
"print-params",
"Print current parameters and exit",
cmd,
false
1620 AH_ERROR(
"Input file (-f) is required");
1648 cout <<
"Warning: resolution too big" <<
endl;
1672 if (pos == string::npos)
1683 cout <<
"graphpic - Aleph-w graph visualization tool\n";
1702 catch (TCLAP::ArgException & e)
1704 cerr <<
"Error: " << e.error() <<
" for argument " << e.argId() <<
endl;
1707 catch (exception & e)
1709 cerr <<
"Error: " << e.what() <<
endl;
#define AH_ERROR(format, args...)
Print an error message (always enabled).
Generic directed graph (digraph) wrapper template.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic doubly linked list with O(1) size and bidirectional access.
Graph implemented with double-linked adjacency lists.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
_Graph_Arc Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
2D canvas for generating EEPIC/LaTeX picture environments.
void zoom(const double &factor)
Scale the EEPIC plane in real points (zoom in/out).
void draw(std::ostream &output, const bool &squarize=true)
Emits a complete LaTeX picture environment containing the geometric objects.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
bool is_digraph() const noexcept
Return true if the graph this is directed.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Rectangular point in the plane.
Polar representation of a 2D point.
A general (irregular) 2D polygon defined by a sequence of vertices.
void add_vertex(const Point &point)
Add a vertex to the polygon.
A regular polygon defined by center, side length, and vertex count.
const Point get_vertex(const size_t &i) const
Get the i-th vertex of the polygon.
Fundamental segment defined by two points.
A vertex in a polygon's doubly-linked vertex list.
void put_in_plane(Eepic_Plane &plane, const Point &geom_obj)
EEPIC/LaTeX geometric drawing utilities.
void process_node(Eepic_Plane &plane, Graph::Node *p)
Graph::Arc * parse_arc_text_definition(ifstream &input_stream, Graph *g)
const char * parameters_file_name
void parse_hradio_definition(ifstream &input_stream)
void generate_graph(Graph *g, ofstream &output)
Graph::Arc * parse_shadow_curve_arc_definition(ifstream &input_stream, Graph *g)
Token_Type get_token(ifstream &input_stream)
void parse_shadow_node_definition(ifstream &input_stream)
void generate_picture(ofstream &output, Graph *g)
Graph::Node * parse_node_text_definition(ifstream &input_stream)
Segment arc_segment(Graph::Node *src, Graph::Node *tgt)
Graph::Arc * parse_shadow_arc_definition(ifstream &input_stream, Graph *g)
void process_tag_node(Eepic_Plane &plane, Graph::Node *p)
Graph * build_poly_graph(ifstream &input_stream, Graph *g)
void generate_epilogue(ofstream &output)
bool tiny_keys
Global flag to enable tiny font size for keys/labels.
Graph * parse_graph_definition(ifstream &input_stream)
Graph * read_input_and_build_graph(ifstream &input_stream)
Graph * build_cross_net_graph(ifstream &input_stream, Graph *g)
void process_arc(Eepic_Plane &plane, Graph *g, Graph::Arc *a)
Graph::Arc * parse_dashed_arc_definition(ifstream &input_stream, Graph *g)
void parse_tag_definition(ifstream &input_stream)
Polygon arc_trigon(Graph::Node *src, Graph::Node *tgt, const double &dist, const bool &left)
Graph::Arc * parse_dashed_curve_arc_definition(ifstream &input_stream, Graph *g)
DynArray< Graph::Node * > nodes
Graph_Node< Node_Data > Node
void load_nodes(ifstream &input_stream, Graph::Node *&src_node, Graph::Node *&tgt_node)
#define DYNARRAY_APPEND(array, item)
void parse_vradio_definition(ifstream &input_stream)
Graph::Arc * parse_curve_arc_definition(ifstream &input_stream, Graph *g)
void process_text_arc(Eepic_Plane &plane, Graph::Arc *a, const Segment &arc_sg)
Graph::Arc * parse_arc_definition(ifstream &input_stream, Graph *g)
void generate_prologue(ofstream &output)
DynTreapTree< string, Graph::Node * > node_table
void parse_without_node_definition(ifstream &input_stream)
Graph * build_net_graph(ifstream &input_stream, Graph *g)
Graph_Arc< Arc_Data > Arc
void parse_node_definition(ifstream &input_stream)
List_Graph< Node, Arc > Graph
DynArray< Graph::Arc * > arcs
Graph::Node * load_node(ifstream &input_stream)
GT::Arc * search_arc(const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Arc filtered searching given two nodes.
const long double offset[]
Offset values indexed by symbol string length (bounded by MAX_OFFSET_INDEX)
void init_token_scanning()
Initialize token scanning by recording current position.
void close_token_scanning(const char *buffer, char *&start_addr, const char *end_addr)
Finalize token scanning by null-terminating and saving the token.
int read_char_from_stream(std::ifstream &input_stream)
Read a single character from an input stream with position tracking.
void print_parse_error_and_exit(const std::string &str)
Print a parse error message and terminate the program.
void put_char_in_buffer(char *&start_addr, const char *end_addr, int c)
Append a character to a buffer with bounds checking.
std::string to_string(const time_t t, const std::string &format)
Format a time_t value into a string using format.
std::string command_line_to_string(int argc, char *argv[])
Convert command line arguments to a single string.
void skip_white_spaces(std::ifstream &input_stream)
Skip whitespace characters in the input stream.
constexpr size_t Buffer_Size
Default buffer size for token parsing.
std::string load_string(std::ifstream &input_stream)
Load a string from the input stream.
DynList< T > maps(const C &c, Op op)
Classic map operation.
long load_number(std::ifstream &input_stream)
Load an integer number from the input stream.
Comprehensive parsing utilities for text processing and compiler construction.
Geom_Number pitag(const Geom_Number &x, const Geom_Number &y)
Return the Euclidean distance.
Dynamic mapping implemented with treap trees.
Arc of graph implemented with double-linked adjacency lists.
Node belonging to a graph implemented with a double linked adjacency list.
Segment-drawing variants (types).
DynDlist< Tag_Data > tag_list
Lazy and scalable dynamic array implementation.
Generic graph and digraph implementations.
Comprehensive sorting algorithms and search utilities for Aleph-w.
Tree picture generation utilities.