Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
graph.h
Go to the documentation of this file.
1/*
2 * vim: ts=4 sw=4 et tw=0 wm=0
3 *
4 * libavoid - Fast, Incremental, Object-avoiding Line Router
5 *
6 * Copyright (C) 2004-2011 Monash University
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 * See the file LICENSE.LGPL distributed with the library.
13 *
14 * Licensees holding a valid commercial license may use this file in
15 * accordance with the commercial license agreement provided with the
16 * library.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * Author(s): Michael Wybrow
23*/
24
25
26#ifndef AVOID_GRAPH_H
27#define AVOID_GRAPH_H
28
29
30#include <cassert>
31#include <list>
32#include <utility>
33#include "libavoid/vertices.h"
34
35namespace Avoid {
36
37
38class ConnRef;
39class Router;
40
41
42typedef std::list<int> ShapeList;
43typedef std::list<bool *> FlagList;
44
45
47{
48 public:
49 EdgeInf(VertInf *v1, VertInf *v2, const bool orthogonal = false);
50 ~EdgeInf();
51 inline double getDist(void)
52 {
53 return m_dist;
54 }
55 void setDist(double dist);
56 void alertConns(void);
57 void addConn(bool *flag);
58 void addCycleBlocker(void);
59 void addBlocker(int b);
60 bool added(void);
61 bool isOrthogonal(void) const;
62 bool isDummyConnection(void) const;
63 bool isDisabled(void) const;
64 void setDisabled(const bool disabled);
65 bool rotationLessThan(const VertInf* last, const EdgeInf *rhs) const;
66 std::pair<VertID, VertID> ids(void) const;
67 std::pair<Point, Point> points(void) const;
68 void db_print(void);
69 void checkVis(void);
70 VertInf *otherVert(const VertInf *vert) const;
72 bool knownNew = false);
73 static EdgeInf *existingEdge(VertInf *i, VertInf *j);
74 int blocker(void) const;
75
76 bool isHyperedgeSegment(void) const;
77 void setHyperedgeSegment(const bool hyperedge);
78 double mtstDist(void) const;
79 void setMtstDist(const double joinCost);
80
83 private:
85 friend class VertInf;
86
87 void makeActive(void);
88 void makeInactive(void);
89 int firstBlocker(void);
90 bool isBetween(VertInf *i, VertInf *j);
91
94 bool m_added;
101 EdgeInfList::iterator m_pos1;
102 EdgeInfList::iterator m_pos2;
104 double m_dist;
106};
107
108
110{
111 public:
112 friend class EdgeInf;
113 EdgeList(bool orthogonal = false);
114 ~EdgeList();
115 void clear(void);
116 EdgeInf *begin(void);
117 EdgeInf *end(void);
118 int size(void) const;
119 private:
120 void addEdge(EdgeInf *edge);
121 void removeEdge(EdgeInf *edge);
122
126 unsigned int m_count;
127};
128
129
130}
131
132
133#endif
134
135
bool m_added
Definition graph.h:94
Router * m_router
Definition graph.h:92
bool isDummyConnection(void) const
Definition graph.cpp:569
bool isBetween(VertInf *i, VertInf *j)
Definition graph.cpp:550
double m_dist
Definition graph.h:104
int firstBlocker(void)
Definition graph.cpp:486
double m_mtst_dist
Definition graph.h:105
std::pair< Point, Point > points(void) const
Definition graph.cpp:367
EdgeInfList::iterator m_pos1
Definition graph.h:101
int m_blocker
Definition graph.h:93
void addConn(bool *flag)
Definition graph.cpp:329
bool isHyperedgeSegment(void) const
Definition graph.cpp:288
static EdgeInf * checkEdgeVisibility(VertInf *i, VertInf *j, bool knownNew=false)
Definition graph.cpp:586
FlagList m_conns
Definition graph.h:103
void db_print(void)
Definition graph.cpp:373
bool isOrthogonal(void) const
Definition graph.cpp:562
bool m_isHyperedgeSegment
Definition graph.h:97
std::pair< VertID, VertID > ids(void) const
Definition graph.cpp:361
EdgeInf * lstPrev
Definition graph.h:81
bool m_orthogonal
Definition graph.h:96
double mtstDist(void) const
Definition graph.cpp:283
void setDist(double dist)
Definition graph.cpp:259
void checkVis(void)
Definition graph.cpp:383
bool m_disabled
Definition graph.h:98
EdgeInf * lstNext
Definition graph.h:82
static EdgeInf * existingEdge(VertInf *i, VertInf *j)
Definition graph.cpp:622
void makeActive(void)
Definition graph.cpp:185
bool m_visible
Definition graph.h:95
void setMtstDist(const double joinCost)
Definition graph.cpp:278
bool added(void)
Definition graph.cpp:308
void addBlocker(int b)
Definition graph.cpp:342
bool rotationLessThan(const VertInf *last, const EdgeInf *rhs) const
Definition graph.cpp:135
double getDist(void)
Definition graph.h:51
VertInf * otherVert(const VertInf *vert) const
Definition graph.cpp:578
bool isDisabled(void) const
Definition graph.cpp:293
void makeInactive(void)
Definition graph.cpp:221
int blocker(void) const
Definition graph.cpp:313
void alertConns(void)
Definition graph.cpp:318
void setDisabled(const bool disabled)
Definition graph.cpp:298
void setHyperedgeSegment(const bool hyperedge)
Definition graph.cpp:303
EdgeInfList::iterator m_pos2
Definition graph.h:102
VertInf * m_vert1
Definition graph.h:99
VertInf * m_vert2
Definition graph.h:100
void addCycleBlocker(void)
Definition graph.cpp:335
unsigned int m_count
Definition graph.h:126
void clear(void)
Definition graph.cpp:687
EdgeInf * m_first_edge
Definition graph.h:124
int size(void) const
Definition graph.cpp:701
EdgeInf * end(void)
Definition graph.cpp:777
bool m_orthogonal
Definition graph.h:123
void removeEdge(EdgeInf *edge)
Definition graph.cpp:740
EdgeInf * begin(void)
Definition graph.cpp:771
void addEdge(EdgeInf *edge)
Definition graph.cpp:707
EdgeInf * m_last_edge
Definition graph.h:125
The Router class represents a libavoid router instance.
Definition router.h:386
libavoid: Object-avoiding orthogonal and polyline connector routing library.
std::list< int > ShapeList
Definition graph.h:42
std::list< bool * > FlagList
Definition graph.h:43
double dist(const Point &a, const Point &b)
Definition geometry.cpp:310