예제 #1
0
int test()
{
	Avoid::ConnEnd end1;
	Avoid::ConnEnd end2;
	Avoid::Polygon poly;
	Avoid::Router * router1 = new Avoid::Router(Avoid::OrthogonalRouting);
	router1->setTransactionUse(true);
	router1->setRoutingPenalty(Avoid::segmentPenalty);
	router1->setRoutingPenalty(Avoid::crossingPenalty);
	router1->setRoutingPenalty(Avoid::fixedSharedPathPenalty);
	router1->setRoutingOption(Avoid::penaliseOrthogonalSharedPathsAtConnEnds, true);
	router1->setRoutingParameter(idealNudgingDistance, 25);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(51410, 50640));
	poly.setPoint(1, Avoid::Point(51410, 50960));
	poly.setPoint(2, Avoid::Point(51050, 50960));
	poly.setPoint(3, Avoid::Point(51050, 50640));
	Avoid::ShapeRef * shape365249936 = new Avoid::ShapeRef(router1, poly, 365249936);
	Avoid::ShapeConnectionPin * pin365249936_2 = new Avoid::ShapeConnectionPin(shape365249936, 3, 0, 0.5, true, 10, 4);
	pin365249936_2->setExclusive(true);
	Avoid::ShapeConnectionPin * pin365249936_4 = new Avoid::ShapeConnectionPin(shape365249936, 5, 0, 0.734375, true, 10, 4);
	pin365249936_4->setExclusive(true);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50760, 50691));
	poly.setPoint(1, Avoid::Point(50760, 50775));
	poly.setPoint(2, Avoid::Point(50640, 50775));
	poly.setPoint(3, Avoid::Point(50640, 50691));
	Avoid::ShapeRef * shape386142480 = new Avoid::ShapeRef(router1, poly, 386142480);
	Avoid::ShapeConnectionPin * pin386142480_1 = new Avoid::ShapeConnectionPin(shape386142480, 2, 0.5, 1, true, 10, 2);
	pin386142480_1->setExclusive(true);
	Avoid::JunctionRef * junction328922310 = new Avoid::JunctionRef(router1, Avoid::Point(50700, 50800), 328922310);
	junction328922310->setPositionFixed(true);
	end1 = Avoid::ConnEnd(shape365249936, 3);
	end2 = Avoid::ConnEnd(junction328922310);
	/*Avoid::ConnRef * conn152169328 = */ new Avoid::ConnRef(router1, end1, end2);
	end1 = Avoid::ConnEnd(junction328922310);
	end2 = Avoid::ConnEnd(shape386142480, 2);
	/*Avoid::ConnRef * conn684888074 = */ new Avoid::ConnRef(router1, end1, end2);
	end1 = Avoid::ConnEnd(shape365249936, 5);
	end2 = Avoid::ConnEnd(junction328922310);
	Avoid::ConnRef * conn18168360 = new Avoid::ConnRef(router1, end1, end2);
	router1->processTransaction();

	router1->outputDiagram("output/2junctions-1");
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50879, 50885));
	poly.setPoint(1, Avoid::Point(50879, 50960));
	poly.setPoint(2, Avoid::Point(50821, 50960));
	poly.setPoint(3, Avoid::Point(50821, 50885));
	Avoid::ShapeRef * shape150429385 = new Avoid::ShapeRef(router1, poly, 150429385);
	Avoid::ShapeConnectionPin * pin150429385_0 = new Avoid::ShapeConnectionPin(shape150429385, 1, 0.5, 0, true, 10, 1);
	pin150429385_0->setExclusive(true);
	Avoid::JunctionRef * junction550292508 = new Avoid::JunctionRef(router1, Avoid::Point(50850, 50875), 550292508);
	router1->deleteConnector(conn18168360);
	conn18168360 = nullptr;
	end1 = Avoid::ConnEnd(shape365249936, 5);
	end2 = Avoid::ConnEnd(junction550292508);
	Avoid::ConnRef * conn795337150 = new Avoid::ConnRef(router1, end1, end2);
	conn795337150->makePathInvalid();
	end1 = Avoid::ConnEnd(junction550292508);
	end2 = Avoid::ConnEnd(junction328922310);
	Avoid::ConnRef * conn151961380 = new Avoid::ConnRef(router1, end1, end2);
	conn151961380->makePathInvalid();
	end1 = Avoid::ConnEnd(shape150429385, 1);
	end2 = Avoid::ConnEnd(junction550292508);
	Avoid::ConnRef * conn149180423 = new Avoid::ConnRef(router1, end1, end2);
	conn149180423->makePathInvalid();
	router1->processTransaction();

	router1->outputDiagram("output/2junctions-2");
	/*
	junction550292508->setPositionFixed(true);
	router1->deleteShape(shape365249936);
	shape365249936 = nullptr;
	router1->deleteShape(shape386142480);
	shape386142480 = nullptr;
	router1->deleteJunction(junction328922310);
	junction328922310 = nullptr;
	router1->deleteConnector(conn152169328);
	conn152169328 = nullptr;
	router1->deleteConnector(conn684888074);
	conn684888074 = nullptr;
	router1->deleteShape(shape150429385);
	shape150429385 = nullptr;
	router1->deleteJunction(junction550292508);
	junction550292508 = nullptr;
	router1->deleteConnector(conn795337150);
	conn795337150 = nullptr;
	router1->deleteConnector(conn151961380);
	conn151961380 = nullptr;
	router1->deleteConnector(conn149180423);
	conn149180423 = nullptr;
	router1->processTransaction();
*/
	bool atEnds = true;
        bool overlap = router1->existsOrthogonalFixedSegmentOverlap(atEnds);
        delete router1;
        return (overlap) ? 1 : 0;
}
int test()
{
	// The contents of this function can be replaced by the automatically generated test code from the debug svg file
	Avoid::ConnEnd end1;
	Avoid::ConnEnd end2;
	Avoid::Polygon poly;
	Avoid::Router * router = new Avoid::Router(Avoid::OrthogonalRouting);
	router->setTransactionUse(true);
	router->setRoutingPenalty(Avoid::segmentPenalty);
	router->setRoutingPenalty(Avoid::crossingPenalty);
	router->setRoutingPenalty(Avoid::fixedSharedPathPenalty);
	router->setRoutingParameter(idealNudgingDistance, 25);
	router->setRoutingOption(Avoid::improveHyperedgeRoutesMovingJunctions, true);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(51160, 50670));
	poly.setPoint(1, Avoid::Point(51160, 50730));
	poly.setPoint(2, Avoid::Point(50950, 50730));
	poly.setPoint(3, Avoid::Point(50950, 50670));
	Avoid::ShapeRef * shape341041314 = new Avoid::ShapeRef(router, poly, 341041314);
	Avoid::ShapeConnectionPin * pin341041314_0 = new Avoid::ShapeConnectionPin(shape341041314, 1, 0.952381, 0.5, 10, 8);
	pin341041314_0->setExclusive(true);
	Avoid::ShapeConnectionPin * pin341041314_1 = new Avoid::ShapeConnectionPin(shape341041314, 2, 0, 0.5, 10, 4);
	pin341041314_1->setExclusive(true);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(51160, 50395));
	poly.setPoint(1, Avoid::Point(51160, 50455));
	poly.setPoint(2, Avoid::Point(50950, 50455));
	poly.setPoint(3, Avoid::Point(50950, 50395));
	Avoid::ShapeRef * shape47540376 = new Avoid::ShapeRef(router, poly, 47540376);
	Avoid::ShapeConnectionPin * pin47540376_0 = new Avoid::ShapeConnectionPin(shape47540376, 1, 0.952381, 0.5, 10, 8);
	pin47540376_0->setExclusive(true);
	Avoid::ShapeConnectionPin * pin47540376_1 = new Avoid::ShapeConnectionPin(shape47540376, 2, 0, 0.5, 10, 4);
	pin47540376_1->setExclusive(true);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50850, 50770));
	poly.setPoint(1, Avoid::Point(50850, 50830));
	poly.setPoint(2, Avoid::Point(50665, 50830));
	poly.setPoint(3, Avoid::Point(50665, 50770));
	Avoid::ShapeRef * shape81920772 = new Avoid::ShapeRef(router, poly, 81920772);
	Avoid::ShapeConnectionPin * pin81920772_0 = new Avoid::ShapeConnectionPin(shape81920772, 1, 0.047619, 0.5, 10, 4);
	pin81920772_0->setExclusive(true);
	Avoid::ShapeConnectionPin * pin81920772_1 = new Avoid::ShapeConnectionPin(shape81920772, 2, 1, 0.5, 10, 8);
	pin81920772_1->setExclusive(true);
	Avoid::JunctionRef * junction878282342 = new Avoid::JunctionRef(router, Avoid::Point(50875, 50700), 878282342);
	junction878282342->setPositionFixed(false);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50850, 50470));
	poly.setPoint(1, Avoid::Point(50850, 50530));
	poly.setPoint(2, Avoid::Point(50665, 50530));
	poly.setPoint(3, Avoid::Point(50665, 50470));
	Avoid::ShapeRef * shape206564314 = new Avoid::ShapeRef(router, poly, 206564314);
	Avoid::ShapeConnectionPin * pin206564314_0 = new Avoid::ShapeConnectionPin(shape206564314, 1, 0.047619, 0.5, 10, 4);
	pin206564314_0->setExclusive(true);
	Avoid::ShapeConnectionPin * pin206564314_1 = new Avoid::ShapeConnectionPin(shape206564314, 2, 1, 0.5, 10, 8);
	pin206564314_1->setExclusive(true);
	Avoid::JunctionRef * junction213455341 = new Avoid::JunctionRef(router, Avoid::Point(50875, 50500), 213455341);
	junction213455341->setPositionFixed(false);
	end1 = Avoid::ConnEnd(junction878282342);
	end2 = Avoid::ConnEnd(shape341041314, 2);
	Avoid::ConnRef * conn290033688 = new Avoid::ConnRef(router, end1, end2);
	conn290033688->makePathInvalid();
	end1 = Avoid::ConnEnd(shape81920772, 2);
	end2 = Avoid::ConnEnd(junction878282342);
	Avoid::ConnRef * conn281807178 = new Avoid::ConnRef(router, end1, end2);
	conn281807178->makePathInvalid();
	end1 = Avoid::ConnEnd(shape47540376, 2);
	end2 = Avoid::ConnEnd(junction213455341);
	Avoid::ConnRef * conn762966660 = new Avoid::ConnRef(router, end1, end2);
	conn762966660->makePathInvalid();
	end1 = Avoid::ConnEnd(junction213455341);
	end2 = Avoid::ConnEnd(junction878282342);
	Avoid::ConnRef * conn46508714 = new Avoid::ConnRef(router, end1, end2);
	conn46508714->makePathInvalid();
	end1 = Avoid::ConnEnd(shape206564314, 2);
	end2 = Avoid::ConnEnd(junction213455341);
	Avoid::ConnRef * conn385831514 = new Avoid::ConnRef(router, end1, end2);
	conn385831514->makePathInvalid();
	router->processTransaction();

	outputInstanceToSVG(router);
	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(51160, 50645));
	poly.setPoint(1, Avoid::Point(51160, 50705));
	poly.setPoint(2, Avoid::Point(50950, 50705));
	poly.setPoint(3, Avoid::Point(50950, 50645));
	router->moveShape(shape341041314, poly);
	conn290033688->makePathInvalid();
	conn281807178->makePathInvalid();
	conn46508714->makePathInvalid();
	conn762966660->makePathInvalid();
	router->processTransaction();

	outputInstanceToSVG(router);
	Avoid::Point junctionPos = junction878282342->recommendedPosition();

	delete router;
	
	// Regression test to check that a junction is correctly moved.
	return (junctionPos.y == 50675) ? 0 : 1; 
}
예제 #3
0
void test()
{
	Avoid::ConnEnd end1;
	Avoid::ConnEnd end2;
	Avoid::Polygon poly;
	Avoid::Router * router1 = new Avoid::Router(Avoid::OrthogonalRouting);
	router1->setTransactionUse(true);
	router1->setRoutingPenalty(Avoid::segmentPenalty);
	router1->setRoutingPenalty(Avoid::crossingPenalty);
	router1->setRoutingPenalty(Avoid::fixedSharedPathPenalty, 9000);
	router1->setRoutingParameter(idealNudgingDistance, 25);

	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50760, 50620));
	poly.setPoint(1, Avoid::Point(50760, 50680));
	poly.setPoint(2, Avoid::Point(50590, 50680));
	poly.setPoint(3, Avoid::Point(50590, 50620));
	Avoid::ShapeRef * shape147006780 = new Avoid::ShapeRef(router1, poly, 147006780);
	Avoid::ShapeConnectionPin * pin147006780_1 = new Avoid::ShapeConnectionPin(shape147006780, 2, 0.941176, 0.5, 10, 8);
	pin147006780_1->setExclusive(true);

	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(50585, 50765));
	poly.setPoint(1, Avoid::Point(50585, 50935));
	poly.setPoint(2, Avoid::Point(50365, 50935));
	poly.setPoint(3, Avoid::Point(50365, 50765));
	Avoid::ShapeRef * shape69758810 = new Avoid::ShapeRef(router1, poly, 69758810);
	Avoid::ShapeConnectionPin * pin69758810_1 = new Avoid::ShapeConnectionPin(shape69758810, 2, 0.954545, 0.5, 10, 8);
	pin69758810_1->setExclusive(true);

	poly = Avoid::Polygon(4);
	poly.setPoint(0, Avoid::Point(51060, 51020));
	poly.setPoint(1, Avoid::Point(51060, 51080));
	poly.setPoint(2, Avoid::Point(50890, 51080));
	poly.setPoint(3, Avoid::Point(50890, 51020));
	Avoid::ShapeRef * shape149922619 = new Avoid::ShapeRef(router1, poly, 149922619);
	Avoid::ShapeConnectionPin * pin149922619_1 = new Avoid::ShapeConnectionPin(shape149922619, 2, 0.941176, 0.5, 10, 8);
	pin149922619_1->setExclusive(true);

	Avoid::JunctionRef * junction228834480 = new Avoid::JunctionRef(router1, Avoid::Point(51050, 51050), 228834480);
	end1 = Avoid::ConnEnd(shape69758810, 2);
	end2 = Avoid::ConnEnd(junction228834480);
	Avoid::ConnRef * conn159270000 = new Avoid::ConnRef(router1, end1, end2);
	conn159270000->makePathInvalid();
	end1 = Avoid::ConnEnd(junction228834480);
	end2 = Avoid::ConnEnd(shape149922619, 2);
	Avoid::ConnRef * conn199495942 = new Avoid::ConnRef(router1, end1, end2);
	router1->processTransaction();

	//outputInstanceToSVG(router1);
	end1 = Avoid::ConnEnd(shape147006780, 2);
	end2 = Avoid::ConnEnd(junction228834480);
	Avoid::ConnRef * conn8326760 = new Avoid::ConnRef(router1, end1, end2);
	conn8326760->makePathInvalid();
	router1->processTransaction(); // infinite

	//outputInstanceToSVG(router1);
	router1->deleteShape(shape147006780);
	shape147006780 = NULL;
	router1->deleteShape(shape69758810);
	shape69758810 = NULL;
	router1->deleteShape(shape149922619);
	shape149922619 = NULL;
	router1->deleteJunction(junction228834480);
	junction228834480 = NULL;
	router1->deleteConnector(conn159270000);
	conn159270000 = NULL;
	router1->deleteConnector(conn199495942);
	conn199495942 = NULL;
	router1->deleteConnector(conn8326760);
	conn8326760 = NULL;
	router1->processTransaction();

	delete router1;
}