Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
endlessLoop01.cpp
Go to the documentation of this file.
1#include "libavoid/libavoid.h"
2#include <sstream>
3using namespace Avoid;
4
6{
7 static int counter = 0;
8 std::ostringstream os;
9 os << (++counter);
10 router->outputDiagram(os.str());
11}
12
13void test()
14{
15 // The contents of this function can be replaced by the automatically generated test code from the debug svg file
16 Avoid::ConnEnd end1_0;
17 Avoid::ConnEnd end2_0;
18 Avoid::Polygon poly0;
19 std::vector<Avoid::Checkpoint> checkpoints_0;
21 Avoid::HyperedgeNewAndDeletedObjectLists newanddeletedobjects_0;
22 Avoid::ConnRefList::const_iterator connit_0;
23 Avoid::JunctionRefList::const_iterator junctionit_0;
24 router0->setTransactionUse(true);
31
32 poly0 = Avoid::Polygon(4);
33 poly0.setPoint(0, Avoid::Point(50700, 50615));
34 poly0.setPoint(1, Avoid::Point(50700, 51185));
35 poly0.setPoint(2, Avoid::Point(50365, 51185));
36 poly0.setPoint(3, Avoid::Point(50365, 50615));
37 Avoid::ShapeRef * shape0_355243155 = new Avoid::ShapeRef(router0, poly0, 355243155);
38 Avoid::ShapeConnectionPin * pin0_355243155_0 = new Avoid::ShapeConnectionPin(shape0_355243155, 1, 1, 0.149122807018, true, 10, 8);
39 pin0_355243155_0->setExclusive(true);
40 Avoid::ShapeConnectionPin * pin0_355243155_1 = new Avoid::ShapeConnectionPin(shape0_355243155, 2, 1, 0.675438596491, true, 10, 8);
41 pin0_355243155_1->setExclusive(true);
42 Avoid::ShapeConnectionPin * pin0_355243155_2 = new Avoid::ShapeConnectionPin(shape0_355243155, 3, 1, 0.80701754386, true, 10, 8);
43 pin0_355243155_2->setExclusive(true);
44 Avoid::ShapeConnectionPin * pin0_355243155_3 = new Avoid::ShapeConnectionPin(shape0_355243155, 4, 1, 0.543859649123, true, 10, 8);
45 pin0_355243155_3->setExclusive(true);
46 Avoid::ShapeConnectionPin * pin0_355243155_4 = new Avoid::ShapeConnectionPin(shape0_355243155, 5, 1, 0.280701754386, true, 10, 8);
47 pin0_355243155_4->setExclusive(true);
48 Avoid::ShapeConnectionPin * pin0_355243155_5 = new Avoid::ShapeConnectionPin(shape0_355243155, 6, 1, 0.412280701754, true, 10, 8);
49 pin0_355243155_5->setExclusive(true);
50 Avoid::ShapeConnectionPin * pin0_355243155_6 = new Avoid::ShapeConnectionPin(shape0_355243155, 7, 0.477611940299, 0.982456140351, true, 10, 2);
51 pin0_355243155_6->setExclusive(true);
52 Avoid::ShapeConnectionPin * pin0_355243155_7 = new Avoid::ShapeConnectionPin(shape0_355243155, 8, 0.253731343284, 0.982456140351, true, 10, 2);
53 pin0_355243155_7->setExclusive(true);
54 poly0 = Avoid::Polygon(4);
55 poly0.setPoint(0, Avoid::Point(51060, 50816));
56 poly0.setPoint(1, Avoid::Point(51060, 50884));
57 poly0.setPoint(2, Avoid::Point(50940, 50884));
58 poly0.setPoint(3, Avoid::Point(50940, 50816));
59 Avoid::ShapeRef * shape0_35177560 = new Avoid::ShapeRef(router0, poly0, 35177560);
60 Avoid::ShapeConnectionPin * pin0_35177560_0 = new Avoid::ShapeConnectionPin(shape0_35177560, 1, 0.5, 0.5, true, 0, 15);
61 pin0_35177560_0->setExclusive(true);
62 poly0 = Avoid::Polygon(4);
63 poly0.setPoint(0, Avoid::Point(51060, 50966));
64 poly0.setPoint(1, Avoid::Point(51060, 51034));
65 poly0.setPoint(2, Avoid::Point(50940, 51034));
66 poly0.setPoint(3, Avoid::Point(50940, 50966));
67 Avoid::ShapeRef * shape0_214253640 = new Avoid::ShapeRef(router0, poly0, 214253640);
68 Avoid::ShapeConnectionPin * pin0_214253640_0 = new Avoid::ShapeConnectionPin(shape0_214253640, 1, 0.5, 0.5, true, 0, 15);
69 pin0_214253640_0->setExclusive(true);
70 Avoid::JunctionRef * junction0_636368600 = new Avoid::JunctionRef(router0, Avoid::Point(50875, 50850), 636368600);
71 Avoid::JunctionRef * junction0_503331836 = new Avoid::JunctionRef(router0, Avoid::Point(50875, 51000), 503331836);
72 Avoid::JunctionRef * junction0_46074711 = new Avoid::JunctionRef(router0, Avoid::Point(50775, 51000), 46074711);
73 Avoid::JunctionRef * junction0_390996481 = new Avoid::JunctionRef(router0, Avoid::Point(50775, 50850), 390996481);
74 end1_0 = Avoid::ConnEnd(junction0_636368600);
75 end2_0 = Avoid::ConnEnd(shape0_35177560, 1);
76 Avoid::ConnRef * conn0_929108568 = new Avoid::ConnRef(router0, end1_0, end2_0, 929108568);
77 end1_0 = Avoid::ConnEnd(junction0_503331836);
78 end2_0 = Avoid::ConnEnd(shape0_214253640, 1);
79 Avoid::ConnRef * conn0_627671070 = new Avoid::ConnRef(router0, end1_0, end2_0, 627671070);
80 end1_0 = Avoid::ConnEnd(junction0_636368600);
81 end2_0 = Avoid::ConnEnd(junction0_503331836);
82 Avoid::ConnRef * conn0_510680660 = new Avoid::ConnRef(router0, end1_0, end2_0, 510680660);
83 end1_0 = Avoid::ConnEnd(shape0_355243155, 2);
84 end2_0 = Avoid::ConnEnd(junction0_46074711);
85 Avoid::ConnRef * conn0_175131537 = new Avoid::ConnRef(router0, end1_0, end2_0, 175131537);
86 end1_0 = Avoid::ConnEnd(junction0_46074711);
87 end2_0 = Avoid::ConnEnd(junction0_503331836);
88 Avoid::ConnRef * conn0_545568780 = new Avoid::ConnRef(router0, end1_0, end2_0, 545568780);
89 end1_0 = Avoid::ConnEnd(shape0_355243155, 6);
90 end2_0 = Avoid::ConnEnd(junction0_390996481);
91 Avoid::ConnRef * conn0_17788857 = new Avoid::ConnRef(router0, end1_0, end2_0, 17788857);
92 end1_0 = Avoid::ConnEnd(junction0_390996481);
93 end2_0 = Avoid::ConnEnd(junction0_636368600);
94 Avoid::ConnRef * conn0_160581511 = new Avoid::ConnRef(router0, end1_0, end2_0, 160581511);
95 end1_0 = Avoid::ConnEnd(junction0_46074711);
96 end2_0 = Avoid::ConnEnd(junction0_390996481);
97 Avoid::ConnRef * conn0_92116728 = new Avoid::ConnRef(router0, end1_0, end2_0, 92116728);
98 router0->processTransaction();
99
100 newanddeletedobjects_0 = router0->newAndDeletedObjectListsFromHyperedgeImprovement();
101 outputDiagram(router0);
102 router0->deleteConnector(conn0_92116728);
103 conn0_92116728 = nullptr;
104 router0->deleteConnector(conn0_160581511);
105 conn0_160581511 = nullptr;
106 router0->deleteConnector(conn0_17788857);
107 conn0_17788857 = nullptr;
108 router0->deleteJunction(junction0_390996481);
109 junction0_390996481 = nullptr;
110 router0->deleteConnector(conn0_545568780);
111 conn0_545568780 = nullptr;
112 router0->deleteConnector(conn0_175131537);
113 conn0_175131537 = nullptr;
114 router0->deleteJunction(junction0_46074711);
115 junction0_46074711 = nullptr;
116 router0->deleteConnector(conn0_510680660);
117 conn0_510680660 = nullptr;
118 router0->deleteConnector(conn0_627671070);
119 conn0_627671070 = nullptr;
120 router0->deleteJunction(junction0_503331836);
121 junction0_503331836 = nullptr;
122 router0->deleteConnector(conn0_929108568);
123 conn0_929108568 = nullptr;
124 router0->deleteJunction(junction0_636368600);
125 junction0_636368600 = nullptr;
126 router0->deleteShape(shape0_214253640);
127 shape0_214253640 = nullptr;
128 router0->deleteShape(shape0_35177560);
129 shape0_35177560 = nullptr;
130 router0->deleteShape(shape0_355243155);
131 shape0_355243155 = nullptr;
132
133 router0->processTransaction();
134
135 delete router0;
136}
137
138extern "C" int main(void)
139{
140 test();
141 return 0;
142}
The ConnEnd class represents different possible endpoints for connectors.
Definition connend.h:111
The ConnRef class represents a connector object.
Definition connector.h:132
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to.
Definition junction.h:58
The Point class defines a point in the plane.
Definition geomtypes.h:53
A dynamic Polygon, to which points can be easily added and removed.
Definition geomtypes.h:208
void setPoint(size_t index, const Point &point)
Sets a position for a particular point in the polygon.
The Router class represents a libavoid router instance.
Definition router.h:386
void setRoutingOption(const RoutingOption option, const bool value)
Turn specific routing options on or off.
Definition router.cpp:2045
void deleteShape(ShapeRef *shape)
Delete a shape from the router scene.
Definition router.cpp:281
HyperedgeNewAndDeletedObjectLists newAndDeletedObjectListsFromHyperedgeImprovement(void) const
Returns a HyperedgeNewAndDeletedObjectLists detailing the lists of junctions and connectors created a...
Definition router.cpp:3083
void deleteConnector(ConnRef *connector)
Remove a connector from the router scene.
Definition router.cpp:312
void setRoutingParameter(const RoutingParameter parameter, const double value=chooseSensibleParamValue)
Sets values for routing parameters, including routing penalties.
Definition router.cpp:1995
void deleteJunction(JunctionRef *junction)
Remove a junction from the router scene.
Definition router.cpp:685
void setTransactionUse(const bool transactions)
Allows setting of the behaviour of the router in regard to transactions.
Definition router.cpp:457
void outputDiagram(std::string instanceName=std::string())
Definition router.cpp:3003
bool processTransaction(void)
Finishes the current transaction and processes all the queued object changes efficiently.
Definition router.cpp:640
void setRoutingPenalty(const RoutingParameter penType, const double penVal=chooseSensibleParamValue)
Sets or removes penalty values that are applied during connector routing.
Definition router.cpp:2060
The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to.
void setExclusive(const bool exclusive)
Sets whether the pin is exclusive, i.e., only one connector can attach to it.
The ShapeRef class represents a shape object.
Definition shape.h:82
int main(void)
void outputDiagram(Avoid::Router *router)
void test()
Standard libavoid include file which includes all libavoid header files.
libavoid: Object-avoiding orthogonal and polyline connector routing library.
@ crossingPenalty
This penalty is applied whenever a connector path crosses another connector path.
Definition router.h:114
@ fixedSharedPathPenalty
This penalty is applied whenever a connector path shares some segments with an immovable portion of a...
Definition router.h:131
@ segmentPenalty
This penalty is applied for each segment in the connector path beyond the first.
Definition router.h:97
@ idealNudgingDistance
This parameter defines the spacing distance that will be used for nudging apart overlapping corners a...
Definition router.h:154
@ OrthogonalRouting
This option specifies that the router should maintain the structures necessary to allow orthogonal co...
Definition router.h:77
@ improveHyperedgeRoutesMovingAddingAndDeletingJunctions
This option causes hyperedge routes to be locally improved fixing obviously bad paths.
Definition router.h:275
@ penaliseOrthogonalSharedPathsAtConnEnds
This option penalises and attempts to reroute orthogonal shared connector paths terminating at a comm...
Definition router.h:228
static gint counter
Definition box3d.cpp:39
The HyperedgeNewAndDeletedObjectLists class stores lists of objects created and deleted during hypere...
Definition hyperedge.h:80