当前位置: 首页>>代码示例>>C++>>正文


C++ Router::outputDiagram方法代码示例

本文整理汇总了C++中Router::outputDiagram方法的典型用法代码示例。如果您正苦于以下问题:C++ Router::outputDiagram方法的具体用法?C++ Router::outputDiagram怎么用?C++ Router::outputDiagram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Router的用法示例。


在下文中一共展示了Router::outputDiagram方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void) {
    Router *router = new Router(
            PolyLineRouting | OrthogonalRouting);
    router->setRoutingPenalty((PenaltyType)0, 50);
    router->setRoutingPenalty((PenaltyType)1, 0);
    router->setRoutingPenalty((PenaltyType)2, 50);
    router->setRoutingPenalty((PenaltyType)3, 4000);
    router->setRoutingPenalty((PenaltyType)4, 110);
    router->setRoutingParameter(idealNudgingDistance, 25);

    Polygon poly143407352(4);
    poly143407352.ps[0] = Point(6035, 4390);
    poly143407352.ps[1] = Point(6035, 5085);
    poly143407352.ps[2] = Point(5675, 5085);
    poly143407352.ps[3] = Point(5675, 4390);
    new ShapeRef(router, poly143407352, 143407352);
    
    Polygon poly124950386(4);
    poly124950386.ps[0] = Point(4900, 4090);
    poly124950386.ps[1] = Point(4900, 4785);
    poly124950386.ps[2] = Point(4540, 4785);
    poly124950386.ps[3] = Point(4540, 4090);
    new ShapeRef(router, poly124950386, 124950386);
    
    ConnRef *connRef373967044 = new ConnRef(router, 373967044);
    ConnEnd srcPt373967044(Point(4890, 4250), 8);
    connRef373967044->setSourceEndpoint(srcPt373967044);
    ConnEnd dstPt373967044(Point(5685, 4550), 4);
    connRef373967044->setDestEndpoint(dstPt373967044);
    connRef373967044->setRoutingType((ConnType)2);

    ConnRef *connRef681881486 = new ConnRef(router, 681881486);
    ConnEnd srcPt681881486(Point(4890, 4325), 8);
    connRef681881486->setSourceEndpoint(srcPt681881486);
    ConnEnd dstPt681881486(Point(5685, 4625), 4);
    connRef681881486->setDestEndpoint(dstPt681881486);
    connRef681881486->setRoutingType((ConnType)2);

    ConnRef *connRef829752 = new ConnRef(router, 829752);
    ConnEnd srcPt829752(Point(4890, 4400), 8);
    connRef829752->setSourceEndpoint(srcPt829752);
    ConnEnd dstPt829752(Point(5685, 4700), 4);
    connRef829752->setDestEndpoint(dstPt829752);
    connRef829752->setRoutingType((ConnType)2);

    ConnRef *connRef17625739 = new ConnRef(router, 17625739);
    ConnEnd srcPt17625739(Point(4890, 4475), 8);
    connRef17625739->setSourceEndpoint(srcPt17625739);
    ConnEnd dstPt17625739(Point(5685, 4775), 4);
    connRef17625739->setDestEndpoint(dstPt17625739);
    connRef17625739->setRoutingType((ConnType)2);

    ConnRef *connRef223864175 = new ConnRef(router, 223864175);
    ConnEnd srcPt223864175(Point(4890, 4550), 8);
    connRef223864175->setSourceEndpoint(srcPt223864175);
    ConnEnd dstPt223864175(Point(5685, 4850), 4);
    connRef223864175->setDestEndpoint(dstPt223864175);
    connRef223864175->setRoutingType((ConnType)2);

    ConnRef *connRef98144280 = new ConnRef(router, 98144280);
    ConnEnd srcPt98144280(Point(4890, 4625), 8);
    connRef98144280->setSourceEndpoint(srcPt98144280);
    ConnEnd dstPt98144280(Point(5685, 4925), 4);
    connRef98144280->setDestEndpoint(dstPt98144280);
    connRef98144280->setRoutingType((ConnType)2);

    ConnRef *connRef283100856 = new ConnRef(router, 283100856);
    ConnEnd srcPt283100856(Point(4890, 4700), 8);
    connRef283100856->setSourceEndpoint(srcPt283100856);
    ConnEnd dstPt283100856(Point(5685, 5000), 4);
    connRef283100856->setDestEndpoint(dstPt283100856);
    connRef283100856->setRoutingType((ConnType)2);

    ConnRef *connRef387080925 = new ConnRef(router, 387080925);
    ConnEnd srcPt387080925(Point(5685, 4475), 4);
    connRef387080925->setSourceEndpoint(srcPt387080925);
    ConnEnd dstPt387080925(Point(4890, 4175), 8);
    connRef387080925->setDestEndpoint(dstPt387080925);
    connRef387080925->setRoutingType((ConnType)2);

    router->processTransaction();
    router->outputDiagram("output/orthordering-02");
    
    int crossings = router->existsCrossings();

    delete router;
    return (crossings > 0) ? 1 : 0;
};
开发者ID:P-N-L,项目名称:adaptagrams,代码行数:88,代码来源:orthordering02.cpp

示例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;
};
开发者ID:P-N-L,项目名称:adaptagrams,代码行数:97,代码来源:checkpoints02.cpp

示例3: main


//.........这里部分代码省略.........
    ConnEnd dstPt39(Point(318, 384), 8);
    connRef39->setDestEndpoint(dstPt39);
    connRef39->setRoutingType((ConnType)2);

    ConnRef *connRef40 = new ConnRef(router, 40);
    ConnEnd srcPt40(Point(376, 508), 4);
    connRef40->setSourceEndpoint(srcPt40);
    ConnEnd dstPt40(Point(318, 508), 8);
    connRef40->setDestEndpoint(dstPt40);
    connRef40->setRoutingType((ConnType)2);

    ConnRef *connRef41 = new ConnRef(router, 41);
    ConnEnd srcPt41(Point(376, 645), 4);
    connRef41->setSourceEndpoint(srcPt41);
    ConnEnd dstPt41(Point(318, 645), 8);
    connRef41->setDestEndpoint(dstPt41);
    connRef41->setRoutingType((ConnType)2);

    ConnRef *connRef42 = new ConnRef(router, 42);
    ConnEnd srcPt42(Point(495.857, 268), 2);
    connRef42->setSourceEndpoint(srcPt42);
    ConnEnd dstPt42(Point(495.857, 318), 1);
    connRef42->setDestEndpoint(dstPt42);
    connRef42->setRoutingType((ConnType)2);

    ConnRef *connRef43 = new ConnRef(router, 43);
    ConnEnd srcPt43(Point(566.357, 645), 4);
    connRef43->setSourceEndpoint(srcPt43);
    ConnEnd dstPt43(Point(508.357, 645), 8);
    connRef43->setDestEndpoint(dstPt43);
    connRef43->setRoutingType((ConnType)2);

    ConnRef *connRef44 = new ConnRef(router, 44);
    ConnEnd srcPt44(Point(89.5, 442), 8);
    connRef44->setSourceEndpoint(srcPt44);
    ConnEnd dstPt44(Point(147.5, 442), 4);
    connRef44->setDestEndpoint(dstPt44);
    connRef44->setRoutingType((ConnType)2);

    ConnRef *connRef45 = new ConnRef(router, 45);
    ConnEnd srcPt45(Point(318, 318), 15);
    connRef45->setSourceEndpoint(srcPt45);
    ConnEnd dstPt45(Point(318, 369), 1);
    connRef45->setDestEndpoint(dstPt45);
    connRef45->setRoutingType((ConnType)2);
    */

    ConnRef *connRef46 = new ConnRef(router, 46);
    ConnEnd srcPt46(Point(609.857, 367), 15);
    connRef46->setSourceEndpoint(srcPt46);
    ConnEnd dstPt46(Point(318, 369), 1);
    connRef46->setDestEndpoint(dstPt46);
    connRef46->setRoutingType((ConnType)2);

    /*
    ConnRef *connRef47 = new ConnRef(router, 47);
    ConnEnd srcPt47(Point(318, 583), 15);
    connRef47->setSourceEndpoint(srcPt47);
    ConnEnd dstPt47(Point(318, 630), 1);
    connRef47->setDestEndpoint(dstPt47);
    connRef47->setRoutingType((ConnType)2);

    ConnRef *connRef48 = new ConnRef(router, 48);
    ConnEnd srcPt48(Point(318, 318), 15);
    connRef48->setSourceEndpoint(srcPt48);
    ConnEnd dstPt48(Point(378.357, 271.5), 2);
    connRef48->setDestEndpoint(dstPt48);
    connRef48->setRoutingType((ConnType)2);

    ConnRef *connRef49 = new ConnRef(router, 49);
    ConnEnd srcPt49(Point(318, 318), 15);
    connRef49->setSourceEndpoint(srcPt49);
    ConnEnd dstPt49(Point(551.357, 240.5), 4);
    connRef49->setDestEndpoint(dstPt49);
    connRef49->setRoutingType((ConnType)2);
    */

    ConnRef *connRef50 = new ConnRef(router, 50);
    ConnEnd srcPt50(Point(609.857, 367), 15);
    connRef50->setSourceEndpoint(srcPt50);
    ConnEnd dstPt50(Point(577.857, 439.5), 4);
    connRef50->setDestEndpoint(dstPt50);
    connRef50->setRoutingType((ConnType)2);

    /*
    ConnRef *connRef51 = new ConnRef(router, 51);
    ConnEnd srcPt51(Point(318, 583), 15);
    connRef51->setSourceEndpoint(srcPt51);
    ConnEnd dstPt51(Point(271.5, 628.155), 8);
    connRef51->setDestEndpoint(dstPt51);
    connRef51->setRoutingType((ConnType)2);
    */

    router->processTransaction();
    router->outputDiagram("output/finalSegmentNudging2");
    bool atEnds = true;
    bool overlap = router->existsOrthogonalFixedSegmentOverlap(atEnds);
    delete router;
    return (overlap) ? 1 : 0;
};
开发者ID:P-N-L,项目名称:adaptagrams,代码行数:101,代码来源:finalSegmentNudging2.cpp

示例4: main


//.........这里部分代码省略.........
    connRef413766381->setDestEndpoint(dstPt413766381);
    connRef413766381->setRoutingType((ConnType)2);

    ConnRef *connRef422359365 = new ConnRef(router, 422359365);
    ConnEnd srcPt422359365(Point(50535, 51825), 4);
    connRef422359365->setSourceEndpoint(srcPt422359365);
    ConnEnd dstPt422359365(Point(50085, 51800), 4);
    connRef422359365->setDestEndpoint(dstPt422359365);
    connRef422359365->setRoutingType((ConnType)2);

    ConnRef *connRef427415850 = new ConnRef(router, 427415850);
    ConnEnd srcPt427415850(Point(50775, 52215), 2);
    connRef427415850->setSourceEndpoint(srcPt427415850);
    ConnEnd dstPt427415850(Point(50265, 52450), 8);
    connRef427415850->setDestEndpoint(dstPt427415850);
    connRef427415850->setRoutingType((ConnType)2);

    ConnRef *connRef444649182 = new ConnRef(router, 444649182);
    ConnEnd srcPt444649182(Point(51540, 51750), 8);
    connRef444649182->setSourceEndpoint(srcPt444649182);
    ConnEnd dstPt444649182(Point(51760, 51800), 4);
    connRef444649182->setDestEndpoint(dstPt444649182);
    connRef444649182->setRoutingType((ConnType)2);

    ConnRef *connRef505297694 = new ConnRef(router, 505297694);
    ConnEnd srcPt505297694(Point(50700, 51510), 1);
    connRef505297694->setSourceEndpoint(srcPt505297694);
    ConnEnd dstPt505297694(Point(50235, 51550), 4);
    connRef505297694->setDestEndpoint(dstPt505297694);
    connRef505297694->setRoutingType((ConnType)2);

    ConnRef *connRef528809632 = new ConnRef(router, 528809632);
    ConnEnd srcPt528809632(Point(51540, 51900), 8);
    connRef528809632->setSourceEndpoint(srcPt528809632);
    ConnEnd dstPt528809632(Point(51735, 51950), 4);
    connRef528809632->setDestEndpoint(dstPt528809632);
    connRef528809632->setRoutingType((ConnType)2);

    ConnRef *connRef548127810 = new ConnRef(router, 548127810);
    ConnEnd srcPt548127810(Point(50535, 51975), 4);
    connRef548127810->setSourceEndpoint(srcPt548127810);
    ConnEnd dstPt548127810(Point(50085, 51950), 4);
    connRef548127810->setDestEndpoint(dstPt548127810);
    connRef548127810->setRoutingType((ConnType)2);

    ConnRef *connRef648819584 = new ConnRef(router, 648819584);
    ConnEnd srcPt648819584(Point(51540, 51825), 8);
    connRef648819584->setSourceEndpoint(srcPt648819584);
    ConnEnd dstPt648819584(Point(51940, 51800), 8);
    connRef648819584->setDestEndpoint(dstPt648819584);
    connRef648819584->setRoutingType((ConnType)2);

    ConnRef *connRef651183694 = new ConnRef(router, 651183694);
    ConnEnd srcPt651183694(Point(51635, 51550), 4);
    connRef651183694->setSourceEndpoint(srcPt651183694);
    ConnEnd dstPt651183694(Point(51450, 51510), 1);
    connRef651183694->setDestEndpoint(dstPt651183694);
    connRef651183694->setRoutingType((ConnType)2);

    ConnRef *connRef655025700 = new ConnRef(router, 655025700);
    ConnEnd srcPt655025700(Point(51150, 52215), 2);
    connRef655025700->setSourceEndpoint(srcPt655025700);
    ConnEnd dstPt655025700(Point(51100, 52510), 1);
    connRef655025700->setDestEndpoint(dstPt655025700);
    connRef655025700->setRoutingType((ConnType)2);

    ConnRef *connRef662151765 = new ConnRef(router, 662151765);
    ConnEnd srcPt662151765(Point(50535, 51600), 4);
    connRef662151765->setSourceEndpoint(srcPt662151765);
    ConnEnd dstPt662151765(shapeRef258454350, 2147483646);
    connRef662151765->setDestEndpoint(dstPt662151765);
    connRef662151765->setRoutingType((ConnType)2);

    ConnRef *connRef678159455 = new ConnRef(router, 678159455);
    ConnEnd srcPt678159455(Point(51815, 51550), 8);
    connRef678159455->setSourceEndpoint(srcPt678159455);
    ConnEnd dstPt678159455(Point(51375, 51510), 1);
    connRef678159455->setDestEndpoint(dstPt678159455);
    connRef678159455->setRoutingType((ConnType)2);

    ConnRef *connRef803304040 = new ConnRef(router, 803304040);
    ConnEnd srcPt803304040(Point(50850, 52215), 2);
    connRef803304040->setSourceEndpoint(srcPt803304040);
    ConnEnd dstPt803304040(Point(50085, 52450), 4);
    connRef803304040->setDestEndpoint(dstPt803304040);
    connRef803304040->setRoutingType((ConnType)2);

    ConnRef *connRef960638799 = new ConnRef(router, 960638799);
    ConnEnd srcPt960638799(Point(50535, 52125), 4);
    connRef960638799->setSourceEndpoint(srcPt960638799);
    ConnEnd dstPt960638799(Point(50035, 52100), 4);
    connRef960638799->setDestEndpoint(dstPt960638799);
    connRef960638799->setRoutingType((ConnType)2);

    router->processTransaction();
    router->outputDiagram("output/validPaths01");
    int result = router->existsInvalidOrthogonalPaths();
    delete router;
    return result;
};
开发者ID:P-N-L,项目名称:adaptagrams,代码行数:101,代码来源:validPaths01.cpp

示例5: 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;
};
开发者ID:P-N-L,项目名称:adaptagrams,代码行数:89,代码来源:checkpoints03.cpp

示例6: 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;
//.........这里部分代码省略.........
开发者ID:jtiai,项目名称:adaptagrams,代码行数:101,代码来源:removeJunctions01.cpp

示例7: 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->setRoutingParameter(idealNudgingDistance, 25);

    Polygon poly282634758(4);
    poly282634758.ps[0] = Point(51360, 50215);
    poly282634758.ps[1] = Point(51360, 50460);
    poly282634758.ps[2] = Point(51075, 50460);
    poly282634758.ps[3] = Point(51075, 50215);
    new ShapeRef(router, poly282634758, 282634758);

    Polygon poly69386928(4);
    poly69386928.ps[0] = Point(51050, 50415);
    poly69386928.ps[1] = Point(51050, 50735);
    poly69386928.ps[2] = Point(50690, 50735);
    poly69386928.ps[3] = Point(50690, 50415);
    new ShapeRef(router, poly69386928, 69386928);

    Polygon poly11958280(4);
    poly11958280.ps[0] = Point(50460, 50490);
    poly11958280.ps[1] = Point(50460, 50660);
    poly11958280.ps[2] = Point(50290, 50660);
    poly11958280.ps[3] = Point(50290, 50490);
    new ShapeRef(router, poly11958280, 11958280);

    Polygon poly50591298(4);
    poly50591298.ps[0] = Point(51260, 50015);
    poly50591298.ps[1] = Point(51260, 50185);
    poly50591298.ps[2] = Point(51075, 50185);
    poly50591298.ps[3] = Point(51075, 50015);
    new ShapeRef(router, poly50591298, 50591298);

    ConnRef *connRef355676284 = new ConnRef(router, 355676284);
    ConnEnd srcPt355676284(Point(51040, 50575), 8);
    connRef355676284->setSourceEndpoint(srcPt355676284);
    ConnEnd dstPt355676284(Point(51085, 50300), 4);
    connRef355676284->setDestEndpoint(dstPt355676284);
    connRef355676284->setRoutingType((ConnType)2);

    ConnRef *connRef33653259 = new ConnRef(router, 33653259);
    ConnEnd srcPt33653259(Point(51040, 50650), 8);
    connRef33653259->setSourceEndpoint(srcPt33653259);
    ConnEnd dstPt33653259(Point(51085, 50375), 4);
    connRef33653259->setDestEndpoint(dstPt33653259);
    connRef33653259->setRoutingType((ConnType)2);

    ConnRef *connRef421608980 = new ConnRef(router, 421608980);
    ConnEnd srcPt421608980(Point(51040, 50500), 8);
    connRef421608980->setSourceEndpoint(srcPt421608980);
    ConnEnd dstPt421608980(Point(51085, 50100), 4);
    connRef421608980->setDestEndpoint(dstPt421608980);
    connRef421608980->setRoutingType((ConnType)2);

    router->processTransaction();
    router->outputDiagram("output/restrictedNudging");

    bool overlap = router->existsOrthogonalTouchingPaths();
    delete router;
    return (overlap) ? 1 : 0;
};
开发者ID:jtiai,项目名称:adaptagrams,代码行数:66,代码来源:restrictedNudging.cpp


注:本文中的Router::outputDiagram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。