Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
2junctions.cpp
Go to the documentation of this file.
1#include "libavoid/libavoid.h"
2#include <sstream>
3using namespace Avoid;
4
5int test()
6{
11 router1->setTransactionUse(true);
17 poly = Avoid::Polygon(4);
18 poly.setPoint(0, Avoid::Point(51410, 50640));
19 poly.setPoint(1, Avoid::Point(51410, 50960));
20 poly.setPoint(2, Avoid::Point(51050, 50960));
21 poly.setPoint(3, Avoid::Point(51050, 50640));
22 Avoid::ShapeRef * shape365249936 = new Avoid::ShapeRef(router1, poly, 365249936);
23 Avoid::ShapeConnectionPin * pin365249936_2 = new Avoid::ShapeConnectionPin(shape365249936, 3, 0, 0.5, true, 10, 4);
24 pin365249936_2->setExclusive(true);
25 Avoid::ShapeConnectionPin * pin365249936_4 = new Avoid::ShapeConnectionPin(shape365249936, 5, 0, 0.734375, true, 10, 4);
26 pin365249936_4->setExclusive(true);
27 poly = Avoid::Polygon(4);
28 poly.setPoint(0, Avoid::Point(50760, 50691));
29 poly.setPoint(1, Avoid::Point(50760, 50775));
30 poly.setPoint(2, Avoid::Point(50640, 50775));
31 poly.setPoint(3, Avoid::Point(50640, 50691));
32 Avoid::ShapeRef * shape386142480 = new Avoid::ShapeRef(router1, poly, 386142480);
33 Avoid::ShapeConnectionPin * pin386142480_1 = new Avoid::ShapeConnectionPin(shape386142480, 2, 0.5, 1, true, 10, 2);
34 pin386142480_1->setExclusive(true);
35 Avoid::JunctionRef * junction328922310 = new Avoid::JunctionRef(router1, Avoid::Point(50700, 50800), 328922310);
36 junction328922310->setPositionFixed(true);
37 end1 = Avoid::ConnEnd(shape365249936, 3);
38 end2 = Avoid::ConnEnd(junction328922310);
39 /*Avoid::ConnRef * conn152169328 = */ new Avoid::ConnRef(router1, end1, end2);
40 end1 = Avoid::ConnEnd(junction328922310);
41 end2 = Avoid::ConnEnd(shape386142480, 2);
42 /*Avoid::ConnRef * conn684888074 = */ new Avoid::ConnRef(router1, end1, end2);
43 end1 = Avoid::ConnEnd(shape365249936, 5);
44 end2 = Avoid::ConnEnd(junction328922310);
45 Avoid::ConnRef * conn18168360 = new Avoid::ConnRef(router1, end1, end2);
46 router1->processTransaction();
47
48 router1->outputDiagram("output/2junctions-1");
49 poly = Avoid::Polygon(4);
50 poly.setPoint(0, Avoid::Point(50879, 50885));
51 poly.setPoint(1, Avoid::Point(50879, 50960));
52 poly.setPoint(2, Avoid::Point(50821, 50960));
53 poly.setPoint(3, Avoid::Point(50821, 50885));
54 Avoid::ShapeRef * shape150429385 = new Avoid::ShapeRef(router1, poly, 150429385);
55 Avoid::ShapeConnectionPin * pin150429385_0 = new Avoid::ShapeConnectionPin(shape150429385, 1, 0.5, 0, true, 10, 1);
56 pin150429385_0->setExclusive(true);
57 Avoid::JunctionRef * junction550292508 = new Avoid::JunctionRef(router1, Avoid::Point(50850, 50875), 550292508);
58 router1->deleteConnector(conn18168360);
59 conn18168360 = nullptr;
60 end1 = Avoid::ConnEnd(shape365249936, 5);
61 end2 = Avoid::ConnEnd(junction550292508);
62 Avoid::ConnRef * conn795337150 = new Avoid::ConnRef(router1, end1, end2);
63 conn795337150->makePathInvalid();
64 end1 = Avoid::ConnEnd(junction550292508);
65 end2 = Avoid::ConnEnd(junction328922310);
66 Avoid::ConnRef * conn151961380 = new Avoid::ConnRef(router1, end1, end2);
67 conn151961380->makePathInvalid();
68 end1 = Avoid::ConnEnd(shape150429385, 1);
69 end2 = Avoid::ConnEnd(junction550292508);
70 Avoid::ConnRef * conn149180423 = new Avoid::ConnRef(router1, end1, end2);
71 conn149180423->makePathInvalid();
72 router1->processTransaction();
73
74 router1->outputDiagram("output/2junctions-2");
75 /*
76 junction550292508->setPositionFixed(true);
77 router1->deleteShape(shape365249936);
78 shape365249936 = nullptr;
79 router1->deleteShape(shape386142480);
80 shape386142480 = nullptr;
81 router1->deleteJunction(junction328922310);
82 junction328922310 = nullptr;
83 router1->deleteConnector(conn152169328);
84 conn152169328 = nullptr;
85 router1->deleteConnector(conn684888074);
86 conn684888074 = nullptr;
87 router1->deleteShape(shape150429385);
88 shape150429385 = nullptr;
89 router1->deleteJunction(junction550292508);
90 junction550292508 = nullptr;
91 router1->deleteConnector(conn795337150);
92 conn795337150 = nullptr;
93 router1->deleteConnector(conn151961380);
94 conn151961380 = nullptr;
95 router1->deleteConnector(conn149180423);
96 conn149180423 = nullptr;
97 router1->processTransaction();
98*/
99 bool atEnds = true;
100 bool overlap = router1->existsOrthogonalFixedSegmentOverlap(atEnds);
101 delete router1;
102 return (overlap) ? 1 : 0;
103}
104
105extern "C" int main(void)
106{
107 return test();
108}
int main(void)
int test()
Definition 2junctions.cpp:5
The ConnEnd class represents different possible endpoints for connectors.
Definition connend.h:111
The ConnRef class represents a connector object.
Definition connector.h:132
void makePathInvalid(void)
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to.
Definition junction.h:58
void setPositionFixed(bool fixed)
Sets whether the junction has a fixed position and therefore can't be moved by the Router during rout...
Definition junction.cpp:83
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 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 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
bool existsOrthogonalFixedSegmentOverlap(const bool atEnds=false)
Definition router.cpp:2207
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
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
@ penaliseOrthogonalSharedPathsAtConnEnds
This option penalises and attempts to reroute orthogonal shared connector paths terminating at a comm...
Definition router.h:228