本文整理汇总了C++中Obstacle::polygon方法的典型用法代码示例。如果您正苦于以下问题:C++ Obstacle::polygon方法的具体用法?C++ Obstacle::polygon怎么用?C++ Obstacle::polygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obstacle
的用法示例。
在下文中一共展示了Obstacle::polygon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: performRerouting
void HyperedgeRerouter::performRerouting(void)
{
COLA_ASSERT(m_router != NULL);
m_new_junctions_vector.clear();
m_new_junctions_vector.resize(count());
m_new_connectors_vector.clear();
m_new_connectors_vector.resize(count());
#ifdef HYPEREDGE_DEBUG
double minX = LIMIT;
double minY = LIMIT;
double maxX = -LIMIT;
double maxY = -LIMIT;
VertInf *curr = m_router->vertices.connsBegin();
while (curr)
{
Point p = curr->point;
reduceRange(p.x);
reduceRange(p.y);
if (p.x > -LIMIT)
{
minX = std::min(minX, p.x);
}
if (p.x < LIMIT)
{
maxX = std::max(maxX, p.x);
}
if (p.y > -LIMIT)
{
minY = std::min(minY, p.y);
}
if (p.y < LIMIT)
{
maxY = std::max(maxY, p.y);
}
curr = curr->lstNext;
}
minX -= 8;
minY -= 8;
maxX += 8;
maxY += 8;
FILE *fp = fopen("hyperedge-debug.svg", "w");
fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
// width=\"100%%\" height=\"100%%\"
fprintf(fp, "<svg xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"%g %g %g %g\">\n", minX, minY, maxX - minX, maxY - minY);
fprintf(fp, "<defs>\n");
fprintf(fp, "<style type=\"text/css\" ><![CDATA[\n");
fprintf(fp, ".shape { stroke-width: 1px; stroke: black; fill: blue; stroke-opacity: 0.50; fill-opacity: 0.50; }\n");
fprintf(fp, ".graph { opacity: 0; fill: none; stroke: red; stroke-width: 1px; }\n");
fprintf(fp, ".forest { fill: none; stroke: purple; stroke-width: 1px; }\n");
fprintf(fp, ".hyperedge { fill: none; stroke-width: 1px; }\n");
fprintf(fp, "]]></style>\n");
fprintf(fp, "</defs>\n");
fprintf(fp, "<g inkscape:groupmode=\"layer\" "
"inkscape:label=\"ShapesRect\">\n");
ObstacleList::iterator obstacleIt = m_router->m_obstacles.begin();
double shapePad = 5;
while (obstacleIt != m_router->m_obstacles.end())
{
Obstacle *obstacle = *obstacleIt;
bool isShape = (NULL != dynamic_cast<ShapeRef *> (obstacle));
if ( ! isShape )
{
// Don't output obstacles here, for now.
++obstacleIt;
continue;
}
double minX, minY, maxX, maxY;
obstacle->polygon().getBoundingRect(&minX, &minY, &maxX, &maxY);
fprintf(fp, "<rect id=\"rect-%u\" x=\"%g\" y=\"%g\" width=\"%g\" "
"height=\"%g\" class=\"shape\" />\n",
obstacle->id(), minX + shapePad, minY + shapePad,
maxX - minX - (shapePad * 2),
maxY - minY - (shapePad * 2));
// shapeContainsEndpointVertex(obstacle) ? "style=\"fill: green;\"" : "");
++obstacleIt;
}
fprintf(fp, "</g>\n");
fprintf(fp, "<g inkscape:groupmode=\"layer\" "
"id=\"graph\" style=\"display: none;\" "
"inkscape:label=\"OrthogVisGraph\">\n");
EdgeInf *finish = m_router->visOrthogGraph.end();
for (EdgeInf *t = m_router->visOrthogGraph.begin(); t != finish; t = t->lstNext)
{
std::pair<Point, Point> ptpair = t->points();
Point p1 = ptpair.first;
Point p2 = ptpair.second;
reduceRange(p1.x);
reduceRange(p1.y);
//.........这里部分代码省略.........