本文整理汇总了C++中GridLayout::bends方法的典型用法代码示例。如果您正苦于以下问题:C++ GridLayout::bends方法的具体用法?C++ GridLayout::bends怎么用?C++ GridLayout::bends使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridLayout
的用法示例。
在下文中一共展示了GridLayout::bends方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doCall
void GridLayoutPlanRepModule::doCall(
const Graph &G,
adjEntry adjExternal,
GridLayout &gridLayout,
IPoint &boundingBox,
bool fixEmbedding)
{
// create temporary graph copy and grid layout
PlanRep PG(G);
PG.initCC(0); // currently only for a single component!
GridLayout glPG(PG);
// determine adjacency entry on external face of PG (if required)
if(adjExternal != nullptr) {
edge eG = adjExternal->theEdge();
edge ePG = PG.copy(eG);
adjExternal = (adjExternal == eG->adjSource()) ? ePG->adjSource() : ePG->adjTarget();
}
// call algorithm for copy
doCall(PG,adjExternal,glPG,boundingBox,fixEmbedding);
// extract layout for original graph
for(node v : G.nodes) {
node vPG = PG.copy(v);
gridLayout.x(v) = glPG.x(vPG);
gridLayout.y(v) = glPG.y(vPG);
}
for(edge e : G.edges) {
IPolyline &ipl = gridLayout.bends(e);
ipl.clear();
for(edge ec : PG.chain(e))
ipl.conc(glPG.bends(ec));
}
}
示例2: doCall
void PlanarizationGridLayout::doCall(
const Graph &G,
GridLayout &gridLayout,
IPoint &bb)
{
m_nCrossings = 0;
if(G.empty()) return;
PlanRep pr(G);
const int numCC = pr.numberOfCCs();
// (width,height) of the layout of each connected component
Array<IPoint> boundingBox(numCC);
for(int cc = 0; cc < numCC; ++cc)
{
//--------------------------------------
// 1. crossing minimization
//--------------------------------------
int cr;
m_crossMin.get().call(pr, cc, cr);
m_nCrossings += cr;
OGDF_ASSERT(isPlanar(pr));
GridLayout gridLayoutPG(pr);
m_planarLayouter.get().callGrid(pr,gridLayoutPG);
// copy grid layout of PG into grid layout of G
for(int j = pr.startNode(); j < pr.stopNode(); ++j)
{
node vG = pr.v(j);
gridLayout.x(vG) = gridLayoutPG.x(pr.copy(vG));
gridLayout.y(vG) = gridLayoutPG.y(pr.copy(vG));
adjEntry adj;
forall_adj(adj,vG) {
if ((adj->index() & 1) == 0) continue;
edge eG = adj->theEdge();
IPolyline &ipl = gridLayout.bends(eG);
ipl.clear();
bool firstTime = true;
ListConstIterator<edge> itE;
for(itE = pr.chain(eG).begin(); itE.valid(); ++itE) {
if(!firstTime) {
node v = (*itE)->source();
ipl.pushBack(IPoint(gridLayoutPG.x(v),gridLayoutPG.y(v)));
} else
firstTime = false;
ipl.conc(gridLayoutPG.bends(*itE));
}
}
}
boundingBox[cc] = m_planarLayouter.get().gridBoundingBox();
boundingBox[cc].m_x += 1; // one row/column space between components
boundingBox[cc].m_y += 1;
}
Array<IPoint> offset(numCC);
m_packer.get().call(boundingBox,offset,m_pageRatio);
bb.m_x = bb.m_y = 0;
for(int cc = 0; cc < numCC; ++cc)
{
const int dx = offset[cc].m_x;
const int dy = offset[cc].m_y;
if(boundingBox[cc].m_x + dx > bb.m_x)
bb.m_x = boundingBox[cc].m_x + dx;
if(boundingBox[cc].m_y + dy > bb.m_y)
bb.m_y = boundingBox[cc].m_y + dy;
// iterate over all nodes in i-th cc
for(int j = pr.startNode(cc); j < pr.stopNode(cc); ++j)
{
node vG = pr.v(j);
gridLayout.x(vG) += dx;
gridLayout.y(vG) += dy;
adjEntry adj;
forall_adj(adj,vG) {
if ((adj->index() & 1) == 0) continue;
edge eG = adj->theEdge();
ListIterator<IPoint> it;
for(it = gridLayout.bends(eG).begin(); it.valid(); ++it) {
(*it).m_x += dx;
(*it).m_y += dy;
}
}
}
}
bb.m_x -= 1; // remove margin of topmost/rightmost box
bb.m_y -= 1;
}
示例3: doCall
void PlanarizationGridLayout::doCall(
const Graph &G,
GridLayout &gridLayout,
IPoint &bb)
{
m_nCrossings = 0;
if(G.empty()) return;
PlanRep PG(G);
const int numCC = PG.numberOfCCs();
// (width,height) of the layout of each connected component
Array<IPoint> boundingBox(numCC);
int i;
for(i = 0; i < numCC; ++i)
{
PG.initCC(i);
const int nOrigVerticesPG = PG.numberOfNodes();
List<edge> deletedEdges;
m_subgraph.get().callAndDelete(PG, deletedEdges);
m_inserter.get().call(PG,deletedEdges);
m_nCrossings += PG.numberOfNodes() - nOrigVerticesPG;
GridLayout gridLayoutPG(PG);
m_planarLayouter.get().callGrid(PG,gridLayoutPG);
// copy grid layout of PG into grid layout of G
ListConstIterator<node> itV;
for(itV = PG.nodesInCC(i).begin(); itV.valid(); ++itV)
{
node vG = *itV;
gridLayout.x(vG) = gridLayoutPG.x(PG.copy(vG));
gridLayout.y(vG) = gridLayoutPG.y(PG.copy(vG));
adjEntry adj;
forall_adj(adj,vG) {
if ((adj->index() & 1) == 0) continue;
edge eG = adj->theEdge();
IPolyline &ipl = gridLayout.bends(eG);
ipl.clear();
bool firstTime = true;
ListConstIterator<edge> itE;
for(itE = PG.chain(eG).begin(); itE.valid(); ++itE) {
if(!firstTime) {
node v = (*itE)->source();
ipl.pushBack(IPoint(gridLayoutPG.x(v),gridLayoutPG.y(v)));
} else
firstTime = false;
ipl.conc(gridLayoutPG.bends(*itE));
}
}
}
boundingBox[i] = m_planarLayouter.get().gridBoundingBox();
boundingBox[i].m_x += 1; // one row/column space between components
boundingBox[i].m_y += 1;
}
Array<IPoint> offset(numCC);
m_packer.get().call(boundingBox,offset,m_pageRatio);
bb.m_x = bb.m_y = 0;
for(i = 0; i < numCC; ++i)
{
const List<node> &nodes = PG.nodesInCC(i);
const int dx = offset[i].m_x;
const int dy = offset[i].m_y;
if(boundingBox[i].m_x + dx > bb.m_x)
bb.m_x = boundingBox[i].m_x + dx;
if(boundingBox[i].m_y + dy > bb.m_y)
bb.m_y = boundingBox[i].m_y + dy;
// iterate over all nodes in i-th cc
ListConstIterator<node> it;
for(it = nodes.begin(); it.valid(); ++it)
{
node vG = *it;
gridLayout.x(vG) += dx;
gridLayout.y(vG) += dy;
adjEntry adj;
forall_adj(adj,vG) {
if ((adj->index() & 1) == 0) continue;
edge eG = adj->theEdge();
ListIterator<IPoint> it;
for(it = gridLayout.bends(eG).begin(); it.valid(); ++it) {
(*it).m_x += dx;
(*it).m_y += dy;
}
}
//.........这里部分代码省略.........