本文整理汇总了C++中Router::setRoutingOption方法的典型用法代码示例。如果您正苦于以下问题:C++ Router::setRoutingOption方法的具体用法?C++ Router::setRoutingOption怎么用?C++ Router::setRoutingOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::setRoutingOption方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingParameter((RoutingParameter)0, 10);
router->setRoutingParameter((RoutingParameter)1, 0);
router->setRoutingParameter((RoutingParameter)2, 1000);
router->setRoutingParameter((RoutingParameter)3, 4000);
router->setRoutingParameter((RoutingParameter)4, 0);
router->setRoutingParameter((RoutingParameter)5, 100);
router->setRoutingParameter((RoutingParameter)6, 1);
router->setRoutingParameter((RoutingParameter)7, 10);
router->setRoutingParameter(reverseDirectionPenalty, 500);
router->setRoutingOption((RoutingOption)0, false);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
router->setRoutingOption((RoutingOption)4, true);
router->setRoutingOption((RoutingOption)5, true);
Polygon polygon;
ConnRef *connRef = NULL;
ConnEnd srcPt;
ConnEnd dstPt;
PolyLine newRoute;
// shapeRef1
polygon = Polygon(4);
polygon.ps[0] = Point(0, 0);
polygon.ps[1] = Point(0, 0);
polygon.ps[2] = Point(0, 0);
polygon.ps[3] = Point(0, 0);
new ShapeRef(router, polygon, 1);
// shapeRef2
polygon = Polygon(4);
polygon.ps[0] = Point(0, 0);
polygon.ps[1] = Point(0, 0);
polygon.ps[2] = Point(0, 0);
polygon.ps[3] = Point(0, 0);
new ShapeRef(router, polygon, 2);
// shapeRef3
polygon = Polygon(4);
polygon.ps[0] = Point(0, 0);
polygon.ps[1] = Point(0, 0);
polygon.ps[2] = Point(0, 0);
polygon.ps[3] = Point(0, 0);
new ShapeRef(router, polygon, 3);
// shapeRef4
polygon = Polygon(4);
polygon.ps[0] = Point(0, 0);
polygon.ps[1] = Point(0, 0);
polygon.ps[2] = Point(0, 0);
polygon.ps[3] = Point(0, 0);
new ShapeRef(router, polygon, 4);
// shapeRef5
polygon = Polygon(4);
polygon.ps[0] = Point(501, 345);
polygon.ps[1] = Point(501, 404);
polygon.ps[2] = Point(421, 404);
polygon.ps[3] = Point(421, 345);
ShapeRef *shapeRef5 = new ShapeRef(router, polygon, 5);
new ShapeConnectionPin(shapeRef5, 5, 1, 0.652542, true, 0, (ConnDirFlags) 8);
new ShapeConnectionPin(shapeRef5, 6, 0, 0.79096, true, 0, (ConnDirFlags) 4);
new ShapeConnectionPin(shapeRef5, 7, 0, 0.514124, true, 0, (ConnDirFlags) 4);
// shapeRef6
polygon = Polygon(4);
polygon.ps[0] = Point(94, 251.5);
polygon.ps[1] = Point(94, 315.5);
polygon.ps[2] = Point(12, 315.5);
polygon.ps[3] = Point(12, 251.5);
ShapeRef *shapeRef6 = new ShapeRef(router, polygon, 6);
new ShapeConnectionPin(shapeRef6, 8, 1, 0.640625, true, 0, (ConnDirFlags) 8);
new ShapeConnectionPin(shapeRef6, 9, 0, 0.640625, true, 0, (ConnDirFlags) 4);
// shapeRef7
polygon = Polygon(4);
polygon.ps[0] = Point(634.366, 262);
polygon.ps[1] = Point(634.366, 305);
polygon.ps[2] = Point(416.366, 305);
polygon.ps[3] = Point(416.366, 262);
ShapeRef *shapeRef7 = new ShapeRef(router, polygon, 7);
new ShapeConnectionPin(shapeRef7, 10, 1, 0.709302, true, 0, (ConnDirFlags) 8);
new ShapeConnectionPin(shapeRef7, 11, 0, 0.709302, true, 0, (ConnDirFlags) 4);
// shapeRef8
polygon = Polygon(4);
polygon.ps[0] = Point(324, 147.167);
polygon.ps[1] = Point(324, 206.167);
polygon.ps[2] = Point(236, 206.167);
polygon.ps[3] = Point(236, 147.167);
ShapeRef *shapeRef8 = new ShapeRef(router, polygon, 8);
new ShapeConnectionPin(shapeRef8, 12, 1, 0.652542, true, 0, (ConnDirFlags) 8);
new ShapeConnectionPin(shapeRef8, 13, 0, 0.79096, true, 0, (ConnDirFlags) 4);
new ShapeConnectionPin(shapeRef8, 14, 0, 0.514124, true, 0, (ConnDirFlags) 4);
// shapeRef9
polygon = Polygon(4);
polygon.ps[0] = Point(816, 353.167);
polygon.ps[1] = Point(816, 412.167);
//.........这里部分代码省略.........
示例2: main
int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingParameter((RoutingParameter)0, 50);
router->setRoutingParameter((RoutingParameter)1, 0);
router->setRoutingParameter((RoutingParameter)2, 0);
router->setRoutingParameter((RoutingParameter)3, 4000);
router->setRoutingParameter((RoutingParameter)4, 0);
router->setRoutingParameter((RoutingParameter)5, 100);
router->setRoutingParameter((RoutingParameter)6, 0);
router->setRoutingParameter((RoutingParameter)7, 4);
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
Polygon poly5(4);
poly5.ps[0] = Point(365.3425124847556, 152.0752314071785);
poly5.ps[1] = Point(365.3425124847556, 214.0752314071785);
poly5.ps[2] = Point(303.3425124847556, 214.0752314071785);
poly5.ps[3] = Point(303.3425124847556, 152.0752314071785);
new ShapeRef(router, poly5, 5);
Polygon poly7(4);
poly7.ps[0] = Point(365.3425124847556, 24.07523140617849);
poly7.ps[1] = Point(365.3425124847556, 86.07523140617849);
poly7.ps[2] = Point(303.3425124847556, 86.07523140617849);
poly7.ps[3] = Point(303.3425124847556, 24.07523140617849);
new ShapeRef(router, poly7, 7);
Polygon poly8(4);
poly8.ps[0] = Point(541.6758458190889, 24.07523140617849);
poly8.ps[1] = Point(541.6758458190889, 44.07523140617849);
poly8.ps[2] = Point(509.6758458190889, 44.07523140617849);
poly8.ps[3] = Point(509.6758458190889, 24.07523140617849);
new ShapeRef(router, poly8, 8);
Polygon poly10(4);
poly10.ps[0] = Point(541.6758458190889, 66.07523140617849);
poly10.ps[1] = Point(541.6758458190889, 86.07523140617849);
poly10.ps[2] = Point(509.6758458190889, 86.07523140617849);
poly10.ps[3] = Point(509.6758458190889, 66.07523140617849);
new ShapeRef(router, poly10, 10);
Polygon poly61(4);
poly61.ps[0] = Point(420.3425124847556, 101.0752314061785);
poly61.ps[1] = Point(420.3425124847556, 141.0752314061785);
poly61.ps[2] = Point(344.3425124847556, 141.0752314061785);
poly61.ps[3] = Point(344.3425124847556, 101.0752314061785);
new ShapeRef(router, poly61, 61);
Polygon poly92(4);
poly92.ps[0] = Point(563.5758458190888, 34.07523140617849);
poly92.ps[1] = Point(563.5758458190888, 76.07523140617849);
poly92.ps[2] = Point(487.7758458190889, 76.07523140617849);
poly92.ps[3] = Point(487.7758458190889, 34.07523140617849);
new ShapeRef(router, poly92, 92);
ConnRef *connRef109 = new ConnRef(router, 109);
ConnEnd srcPt109(Point(510.6758458190889, 34.07523140617849), 4);
connRef109->setSourceEndpoint(srcPt109);
ConnEnd dstPt109(Point(334.3425124847556, 183.0752314071785), 15);
connRef109->setDestEndpoint(dstPt109);
connRef109->setRoutingType((ConnType)2);
std::vector<Checkpoint> checkpoints109(1);
checkpoints109[0] = Checkpoint(Point(487.6758458190889, 55.07523140617849), (ConnDirFlags) 15, (ConnDirFlags) 4);
connRef109->setRoutingCheckpoints(checkpoints109);
ConnRef *connRef110 = new ConnRef(router, 110);
ConnEnd srcPt110(Point(510.6758458190889, 76.07523140617849), 4);
connRef110->setSourceEndpoint(srcPt110);
ConnEnd dstPt110(Point(334.3425124847556, 183.0752314071785), 15);
connRef110->setDestEndpoint(dstPt110);
connRef110->setRoutingType((ConnType)2);
std::vector<Checkpoint> checkpoints110(1);
checkpoints110[0] = Checkpoint(Point(487.6758458190889, 55.07523140617849), (ConnDirFlags) 15, (ConnDirFlags) 4);
connRef110->setRoutingCheckpoints(checkpoints110);
router->processTransaction();
router->outputDiagram("output/checkpoints02");
bool succeeded = true;
double checkpointY = 55.07523140617849;
Avoid::PolyLine route109 = connRef109->displayRoute();
if (fabs(route109.ps[route109.size() - 3].y - checkpointY) < 2)
{
succeeded = false;
}
Avoid::PolyLine route110 = connRef110->displayRoute();
if (fabs(route110.ps[route110.size() - 3].y - checkpointY) < 2)
{
succeeded = false;
}
delete router;
return (succeeded) ? 0 : 1;
};
示例3: main
int main(void) {
Router *router = new Router(
PolyLineRouting | OrthogonalRouting);
router->setRoutingPenalty((PenaltyType)0, 50);
router->setRoutingPenalty((PenaltyType)1, 0);
router->setRoutingPenalty((PenaltyType)2, 200);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 9000);
router->setRoutingPenalty((PenaltyType)5, 100);
router->setRoutingOption((RoutingOption)0, false);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, true);
router->setRoutingOption(improveHyperedgeRoutesMovingJunctions, false);
router->setRoutingOption(improveHyperedgeRoutesMovingAddingAndDeletingJunctions, true);
router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly2(4);
poly2.ps[0] = Point(50354, 50975);
poly2.ps[1] = Point(50354, 51060);
poly2.ps[2] = Point(50296, 51060);
poly2.ps[3] = Point(50296, 50975);
ShapeRef *shapeRef2 = new ShapeRef(router, poly2, 2);
new ShapeConnectionPin(shapeRef2, 1, 0.5, 1, true, 10, (ConnDirFlags) 1);
Polygon poly39761567(4);
poly39761567.ps[0] = Point(50754, 50975);
poly39761567.ps[1] = Point(50754, 51060);
poly39761567.ps[2] = Point(50696, 51060);
poly39761567.ps[3] = Point(50696, 50975);
ShapeRef *shapeRef39761567 = new ShapeRef(router, poly39761567, 39761567);
new ShapeConnectionPin(shapeRef39761567, 1, 0.5, 0, true, 10, (ConnDirFlags) 1);
Polygon poly115776716(4);
poly115776716.ps[0] = Point(51504, 50975);
poly115776716.ps[1] = Point(51504, 51060);
poly115776716.ps[2] = Point(51446, 51060);
poly115776716.ps[3] = Point(51446, 50975);
ShapeRef *shapeRef115776716 = new ShapeRef(router, poly115776716, 115776716);
new ShapeConnectionPin(shapeRef115776716, 1, 0.5, 0, true, 10, (ConnDirFlags) 1);
Polygon poly238475293(4);
poly238475293.ps[0] = Point(50554, 50975);
poly238475293.ps[1] = Point(50554, 51060);
poly238475293.ps[2] = Point(50496, 51060);
poly238475293.ps[3] = Point(50496, 50975);
ShapeRef *shapeRef238475293 = new ShapeRef(router, poly238475293, 238475293);
new ShapeConnectionPin(shapeRef238475293, 1, 0.5, 0, true, 10, (ConnDirFlags) 1);
Polygon poly430971008(4);
poly430971008.ps[0] = Point(51004, 50975);
poly430971008.ps[1] = Point(51004, 51060);
poly430971008.ps[2] = Point(50946, 51060);
poly430971008.ps[3] = Point(50946, 50975);
ShapeRef *shapeRef430971008 = new ShapeRef(router, poly430971008, 430971008);
new ShapeConnectionPin(shapeRef430971008, 1, 0.5, 0, true, 10, (ConnDirFlags) 1);
JunctionRef *junctionRef513246008 = new JunctionRef(router, Point(50925, 50700), 513246008);
/*
// This may be useful if junction pins are modified.
new ShapeConnectionPin(junctionRef513246008, 2147483646, (ConnDirFlags) 15);
*/
JunctionRef *junctionRef4 = new JunctionRef(router, Point(50725, 50725), 4);
ConnRef *connRef3 = new ConnRef(router, 3);
ConnEnd srcPt3(shapeRef2, 1);
connRef3->setSourceEndpoint(srcPt3);
ConnEnd dstPt3(junctionRef513246008);
connRef3->setDestEndpoint(dstPt3);
connRef3->setRoutingType((ConnType)2);
ConnRef *connRef5 = new ConnRef(router, 5);
ConnEnd srcPt5(junctionRef4);
connRef5->setSourceEndpoint(srcPt5);
ConnEnd dstPt5(junctionRef513246008);
connRef5->setDestEndpoint(dstPt5);
connRef5->setRoutingType((ConnType)2);
ConnRef *connRef513246009 = new ConnRef(router, 513246009);
ConnEnd srcPt513246009(shapeRef39761567, 1);
connRef513246009->setSourceEndpoint(srcPt513246009);
ConnEnd dstPt513246009(junctionRef4);
connRef513246009->setDestEndpoint(dstPt513246009);
connRef513246009->setRoutingType((ConnType)2);
ConnRef *connRef513246010 = new ConnRef(router, 513246010);
ConnEnd srcPt513246010(junctionRef513246008);
connRef513246010->setSourceEndpoint(srcPt513246010);
ConnEnd dstPt513246010(shapeRef430971008, 1);
connRef513246010->setDestEndpoint(dstPt513246010);
connRef513246010->setRoutingType((ConnType)2);
ConnRef *connRef513246011 = new ConnRef(router, 513246011);
ConnEnd srcPt513246011(junctionRef4);
connRef513246011->setSourceEndpoint(srcPt513246011);
ConnEnd dstPt513246011(shapeRef238475293, 1);
connRef513246011->setDestEndpoint(dstPt513246011);
connRef513246011->setRoutingType((ConnType)2);
ConnRef *connRef513246012 = new ConnRef(router, 513246012);
ConnEnd srcPt513246012(shapeRef115776716, 1);
//.........这里部分代码省略.........
示例4: main
int main(void) {
Router *router = new Router(
PolyLineRouting | OrthogonalRouting);
router->setRoutingPenalty((PenaltyType)0, 50);
router->setRoutingPenalty((PenaltyType)1, 0);
router->setRoutingPenalty((PenaltyType)2, 0);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 0);
router->setRoutingPenalty((PenaltyType)5, 100);
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
/*
Polygon poly1(4);
poly1.ps[0] = Point(541.101, 45);
poly1.ps[1] = Point(541.101, 89);
poly1.ps[2] = Point(274.101, 89);
poly1.ps[3] = Point(274.101, 45);
new ShapeRef(router, poly1, 1);
Polygon poly2(4);
poly2.ps[0] = Point(445.857, 111);
poly2.ps[1] = Point(445.857, 276);
poly2.ps[2] = Point(309.857, 276);
poly2.ps[3] = Point(309.857, 111);
new ShapeRef(router, poly2, 2);
*/
Polygon poly3(4);
poly3.ps[0] = Point(328, 368);
poly3.ps[1] = Point(328, 400);
poly3.ps[2] = Point(308, 400);
poly3.ps[3] = Point(308, 368);
new ShapeRef(router, poly3, 3);
Polygon poly4(4);
poly4.ps[0] = Point(328, 492);
poly4.ps[1] = Point(328, 524);
poly4.ps[2] = Point(308, 524);
poly4.ps[3] = Point(308, 492);
new ShapeRef(router, poly4, 4);
/*
Polygon poly5(4);
poly5.ps[0] = Point(328, 629);
poly5.ps[1] = Point(328, 661);
poly5.ps[2] = Point(308, 661);
poly5.ps[3] = Point(308, 629);
new ShapeRef(router, poly5, 5);
Polygon poly6(4);
poly6.ps[0] = Point(511.857, 308);
poly6.ps[1] = Point(511.857, 328);
poly6.ps[2] = Point(479.857, 328);
poly6.ps[3] = Point(479.857, 308);
new ShapeRef(router, poly6, 6);
Polygon poly7(4);
poly7.ps[0] = Point(518.357, 629);
poly7.ps[1] = Point(518.357, 661);
poly7.ps[2] = Point(498.357, 661);
poly7.ps[3] = Point(498.357, 629);
new ShapeRef(router, poly7, 7);
Polygon poly8(4);
poly8.ps[0] = Point(827.857, 210);
poly8.ps[1] = Point(827.857, 270);
poly8.ps[2] = Point(545.857, 270);
poly8.ps[3] = Point(545.857, 210);
new ShapeRef(router, poly8, 8);
Polygon poly9(4);
poly9.ps[0] = Point(805.357, 409);
poly9.ps[1] = Point(805.357, 469);
poly9.ps[2] = Point(572.357, 469);
poly9.ps[3] = Point(572.357, 409);
new ShapeRef(router, poly9, 9);
Polygon poly10(4);
poly10.ps[0] = Point(157.5, 426);
poly10.ps[1] = Point(157.5, 458);
poly10.ps[2] = Point(137.5, 458);
poly10.ps[3] = Point(137.5, 426);
new ShapeRef(router, poly10, 10);
Polygon poly11(4);
poly11.ps[0] = Point(276, 597.655);
poly11.ps[1] = Point(276, 657.655);
poly11.ps[2] = Point(45, 657.655);
poly11.ps[3] = Point(45, 597.655);
new ShapeRef(router, poly11, 11);
Polygon poly12(4);
poly12.ps[0] = Point(349, 287);
poly12.ps[1] = Point(349, 349);
poly12.ps[2] = Point(287, 349);
poly12.ps[3] = Point(287, 287);
new ShapeRef(router, poly12, 12);
*/
//.........这里部分代码省略.........
示例5: main
int main(void) {
Router *router = new Router(
PolyLineRouting | OrthogonalRouting);
router->setRoutingPenalty((PenaltyType)0, 50);
router->setRoutingPenalty((PenaltyType)1, 0);
router->setRoutingPenalty((PenaltyType)2, 200);
router->setRoutingPenalty((PenaltyType)3, 4000);
router->setRoutingPenalty((PenaltyType)4, 110);
router->setRoutingPenalty((PenaltyType)5, 100);
router->setRoutingOption((RoutingOption)0, false);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingParameter(idealNudgingDistance, 25);
Polygon poly3075375(4);
poly3075375.ps[0] = Point(51925, 52070);
poly3075375.ps[1] = Point(51925, 52130);
poly3075375.ps[2] = Point(51725, 52130);
poly3075375.ps[3] = Point(51725, 52070);
new ShapeRef(router, poly3075375, 3075375);
Polygon poly101599344(4);
poly101599344.ps[0] = Point(50275, 52410);
poly101599344.ps[1] = Point(50275, 52490);
poly101599344.ps[2] = Point(50075, 52490);
poly101599344.ps[3] = Point(50075, 52410);
new ShapeRef(router, poly101599344, 101599344);
Polygon poly127957550(4);
poly127957550.ps[0] = Point(52010, 51617);
poly127957550.ps[1] = Point(52010, 51683);
poly127957550.ps[2] = Point(51890, 51683);
poly127957550.ps[3] = Point(51890, 51617);
ShapeRef *shapeRef127957550 = new ShapeRef(router, poly127957550, 127957550);
new ShapeConnectionPin(shapeRef127957550, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 1);
new ShapeConnectionPin(shapeRef127957550, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 2);
new ShapeConnectionPin(shapeRef127957550, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 4);
new ShapeConnectionPin(shapeRef127957550, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 8);
Polygon poly129612347(4);
poly129612347.ps[0] = Point(51900, 51696);
poly129612347.ps[1] = Point(51900, 51754);
poly129612347.ps[2] = Point(51815, 51754);
poly129612347.ps[3] = Point(51815, 51696);
new ShapeRef(router, poly129612347, 129612347);
Polygon poly203389050(4);
poly203389050.ps[0] = Point(51825, 52260);
poly203389050.ps[1] = Point(51825, 52340);
poly203389050.ps[2] = Point(51625, 52340);
poly203389050.ps[3] = Point(51625, 52260);
new ShapeRef(router, poly203389050, 203389050);
Polygon poly208676910(4);
poly208676910.ps[0] = Point(51950, 51760);
poly208676910.ps[1] = Point(51950, 51840);
poly208676910.ps[2] = Point(51750, 51840);
poly208676910.ps[3] = Point(51750, 51760);
new ShapeRef(router, poly208676910, 208676910);
Polygon poly219117032(4);
poly219117032.ps[0] = Point(50225, 52070);
poly219117032.ps[1] = Point(50225, 52130);
poly219117032.ps[2] = Point(50025, 52130);
poly219117032.ps[3] = Point(50025, 52070);
new ShapeRef(router, poly219117032, 219117032);
Polygon poly258454350(4);
poly258454350.ps[0] = Point(50185, 51617);
poly258454350.ps[1] = Point(50185, 51683);
poly258454350.ps[2] = Point(50065, 51683);
poly258454350.ps[3] = Point(50065, 51617);
ShapeRef *shapeRef258454350 = new ShapeRef(router, poly258454350, 258454350);
new ShapeConnectionPin(shapeRef258454350, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 1);
new ShapeConnectionPin(shapeRef258454350, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 2);
new ShapeConnectionPin(shapeRef258454350, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 4);
new ShapeConnectionPin(shapeRef258454350, 2147483646, 0.5, 0.5, true, 0, (ConnDirFlags) 8);
Polygon poly274504590(4);
poly274504590.ps[0] = Point(51400, 52470);
poly274504590.ps[1] = Point(51400, 52530);
poly274504590.ps[2] = Point(51150, 52530);
poly274504590.ps[3] = Point(51150, 52470);
new ShapeRef(router, poly274504590, 274504590);
Polygon poly320957826(4);
poly320957826.ps[0] = Point(50275, 51910);
poly320957826.ps[1] = Point(50275, 51990);
poly320957826.ps[2] = Point(50075, 51990);
poly320957826.ps[3] = Point(50075, 51910);
new ShapeRef(router, poly320957826, 320957826);
Polygon poly368436384(4);
poly368436384.ps[0] = Point(50325, 51696);
poly368436384.ps[1] = Point(50325, 51754);
poly368436384.ps[2] = Point(50240, 51754);
poly368436384.ps[3] = Point(50240, 51696);
new ShapeRef(router, poly368436384, 368436384);
Polygon poly381499178(4);
poly381499178.ps[0] = Point(51850, 51345);
//.........这里部分代码省略.........
示例6: main
int main(void) {
Router *router = new Router(
PolyLineRouting | OrthogonalRouting);
router->setRoutingParameter((RoutingParameter)0, 50);
router->setRoutingParameter((RoutingParameter)1, 0);
router->setRoutingParameter((RoutingParameter)2, 0);
router->setRoutingParameter((RoutingParameter)3, 4000);
router->setRoutingParameter((RoutingParameter)4, 0);
router->setRoutingParameter((RoutingParameter)5, 100);
router->setRoutingParameter((RoutingParameter)6, 0);
router->setRoutingParameter((RoutingParameter)7, 4);
router->setRoutingOption((RoutingOption)0, true);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
Polygon poly41(4);
poly41.ps[0] = Point(918.6758458220888, 441.0752314081785);
poly41.ps[1] = Point(918.6758458220888, 503.0752314081785);
poly41.ps[2] = Point(856.6758458220888, 503.0752314081785);
poly41.ps[3] = Point(856.6758458220888, 441.0752314081785);
new ShapeRef(router, poly41, 41);
Polygon poly43(4);
poly43.ps[0] = Point(710.6758458200889, 441.0752314081785);
poly43.ps[1] = Point(710.6758458200889, 461.0752314081785);
poly43.ps[2] = Point(678.6758458200889, 461.0752314081785);
poly43.ps[3] = Point(678.6758458200889, 441.0752314081785);
new ShapeRef(router, poly43, 43);
Polygon poly44(4);
poly44.ps[0] = Point(710.6758458200889, 483.0752314081785);
poly44.ps[1] = Point(710.6758458200889, 503.0752314081785);
poly44.ps[2] = Point(678.6758458200889, 503.0752314081785);
poly44.ps[3] = Point(678.6758458200889, 483.0752314081785);
new ShapeRef(router, poly44, 44);
ConnRef *connRef149 = new ConnRef(router, 149);
ConnEnd srcPt149(Point(709.6758458200889, 451.0752314081785), 8);
connRef149->setSourceEndpoint(srcPt149);
ConnEnd dstPt149(Point(887.6758458220888, 472.0752314081786), 15);
connRef149->setDestEndpoint(dstPt149);
connRef149->setRoutingType((ConnType)2);
std::vector<Checkpoint> checkpoints149(1);
checkpoints149[0] = Checkpoint(Point(732.6758458200889, 472.0752314081785), (ConnDirFlags) 15, (ConnDirFlags) 8);
connRef149->setRoutingCheckpoints(checkpoints149);
ConnRef *connRef150 = new ConnRef(router, 150);
ConnEnd srcPt150(Point(709.6758458200889, 493.0752314081785), 8);
connRef150->setSourceEndpoint(srcPt150);
ConnEnd dstPt150(Point(887.6758458220888, 472.0752314081786), 15);
connRef150->setDestEndpoint(dstPt150);
connRef150->setRoutingType((ConnType)2);
std::vector<Checkpoint> checkpoints150(1);
checkpoints150[0] = Checkpoint(Point(732.6758458200889, 472.0752314081785), (ConnDirFlags) 15, (ConnDirFlags) 8);
connRef150->setRoutingCheckpoints(checkpoints150);
router->processTransaction();
router->outputDiagram("output/checkpoints03");
bool succeeded = true;
Avoid::PolyLine route149 = connRef149->displayRoute();
Avoid::PolyLine route150 = connRef150->displayRoute();
if (route149.size() > 4 || route150.size() > 4)
{
// Five segments weren't merged into three. The segments in the shape
// on right weren't shifted to align with the segments going through
// the checkpoint.
succeeded = false;
}
if (succeeded == true)
{
// The segments were merged by were not centred around the
// checkpoint.
double checkpointY = 472.0752314081785;
if (fabs(route149.ps[route149.size() - 1].y - checkpointY) < 2)
{
succeeded = false;
}
if (fabs(route150.ps[route150.size() - 1].y - checkpointY) < 2)
{
succeeded = false;
}
}
delete router;
return (succeeded) ? 0 : 1;
};
示例7: main
int main(void) {
Router *router = new Router(OrthogonalRouting);
router->setRoutingParameter((RoutingParameter)0, 2);
router->setRoutingParameter((RoutingParameter)1, 0);
router->setRoutingParameter((RoutingParameter)2, 0);
router->setRoutingParameter((RoutingParameter)3, 4000);
router->setRoutingParameter((RoutingParameter)4, 9000);
router->setRoutingParameter((RoutingParameter)5, 0);
router->setRoutingParameter((RoutingParameter)6, 0);
router->setRoutingParameter((RoutingParameter)7, 16);
router->setRoutingParameter((RoutingParameter)8, 0);
router->setRoutingOption((RoutingOption)0, false);
router->setRoutingOption((RoutingOption)1, true);
router->setRoutingOption((RoutingOption)2, false);
router->setRoutingOption((RoutingOption)3, false);
router->setRoutingOption((RoutingOption)4, true);
router->setRoutingOption((RoutingOption)5, false);
router->setRoutingOption((RoutingOption)6, true);
Polygon polygon;
ConnEnd srcPt;
ConnEnd dstPt;
ConnEnd heConnPt;
PolyLine newRoute;
ShapeConnectionPin *connPin = NULL;
// shapeRef1
polygon = Polygon(4);
polygon.ps[0] = Point(450, 330);
polygon.ps[1] = Point(490, 330);
polygon.ps[2] = Point(490, 450);
polygon.ps[3] = Point(450, 450);
ShapeRef *shapeRef1 = new ShapeRef(router, polygon, 1);
connPin = new ShapeConnectionPin(shapeRef1, 1, 0, 0.333333, true, 10, (ConnDirFlags) 0);
connPin->setExclusive(false);
connPin = new ShapeConnectionPin(shapeRef1, 2, 0, 0.666667, true, 10, (ConnDirFlags) 0);
connPin->setExclusive(false);
connPin = new ShapeConnectionPin(shapeRef1, 3, 1, 0.5, true, 10, (ConnDirFlags) 0);
connPin->setExclusive(false);
connPin = new ShapeConnectionPin(shapeRef1, 4, 0.5, 0, true, 10, (ConnDirFlags) 0);
connPin->setExclusive(false);
// shapeRef8
polygon = Polygon(4);
polygon.ps[0] = Point(502, 237.5);
polygon.ps[1] = Point(502, 262.5);
polygon.ps[2] = Point(438, 262.5);
polygon.ps[3] = Point(438, 237.5);
ShapeRef *shapeRef8 = new ShapeRef(router, polygon, 8);
connPin = new ShapeConnectionPin(shapeRef8, 1, 0, 0.5, true, 1, (ConnDirFlags) 0);
connPin = new ShapeConnectionPin(shapeRef8, 2, 1, 0.5, true, 1, (ConnDirFlags) 0);
connPin = new ShapeConnectionPin(shapeRef8, 3, 0.5, 1, true, 1, (ConnDirFlags) 0);
connPin = new ShapeConnectionPin(shapeRef8, 4, 0.5, 0, true, 1, (ConnDirFlags) 0);
JunctionRef *junctionRef6 = new JunctionRef(router, Point(470, 300), 6);
/*
// This may be useful if junction pins are modified.
connPin = new ShapeConnectionPin(junctionRef6, 2147483646, (ConnDirFlags) 15);
*/
// connRef9
ConnRef *connRef9 = new ConnRef(router, 9);
srcPt = ConnEnd(junctionRef6);
connRef9->setSourceEndpoint(srcPt);
dstPt = ConnEnd(shapeRef8, 3);
connRef9->setDestEndpoint(dstPt);
connRef9->setRoutingType((ConnType)2);
#if 1
// connRef10 - WITH BUG
ConnRef *connRef10 = new ConnRef(router, 10);
srcPt = ConnEnd(junctionRef6);
connRef10->setSourceEndpoint(srcPt);
dstPt = ConnEnd(shapeRef1, 4);
connRef10->setDestEndpoint(dstPt);
connRef10->setRoutingType((ConnType)2);
#else
// connRef10 - WITHOUT BUG
ConnRef *connRef10 = new ConnRef(router, 10);
srcPt = ConnEnd(shapeRef1, 4);
connRef10->setSourceEndpoint(srcPt);
dstPt = ConnEnd(junctionRef6);
connRef10->setDestEndpoint(dstPt);
connRef10->setRoutingType((ConnType)2);
#endif
// router->deleteConnector(connRef5);
router->processTransaction();
ConnRef *mergedConn = junctionRef6->removeJunctionAndMergeConnectors();
router->processTransaction();
router->outputDiagram("output/removeJunctions01");
std::pair<ConnEnd, ConnEnd> ends = mergedConn->endpointConnEnds();
// Expected result: output images should be virtually identical.
// Result: An endpoint seems to be disconnected from shapeRef8.
bool isConnected = (ends.first.shape() == shapeRef8) || (ends.second.shape() == shapeRef8);
delete router;
return isConnected ? 0 : 1;
//.........这里部分代码省略.........