6 * $Date: 2012-07-10 17:25:20 +0200 (Di, 10. Jul 2012) $
7 ***************************************************************/
10 * \brief Implementation of class NodeInfo.
12 * \author Karsten Klein
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
43 #include <ogdf/internal/orthogonal/NodeInfo.h>
48 void NodeInfo::get_data(
52 RoutingChannel
<int>& rc
,
55 //initializes basic node data
56 //nodeboxsize, numsedges, mgenpos
57 //ACHTUNG: odNorth ist 0, soll aber links sein
60 //first, initialize the node and cage size
61 box_x_size
= nw
[v
]; //nw[P.original(v)];//P.widthOrig(P.original(v));
62 box_y_size
= nh
[v
]; //nh[P.original(v)];//P.heightOrig(P.original(v));
63 //{ fright, fleft, ftop, fbottom}
65 //get the generalization edge position on all four sides if existant
66 OrthoDir od
= odNorth
;
69 OrthoRep::SideInfoUML sinfo
= O
.cageInfo(v
)->m_side
[od
];
72 if ((od
== odNorth
) || (od
== odEast
)) set_gen_pos(od
, sinfo
.m_nAttached
[0]);
73 else set_gen_pos(od
, sinfo
.m_nAttached
[1]);
74 set_num_edges(od
, sinfo
.m_nAttached
[0] + 1 + sinfo
.m_nAttached
[1]);
75 m_vdegree
+= num_s_edges
[od
];
80 set_num_edges(od
, sinfo
.m_nAttached
[0]);
81 m_vdegree
+= num_s_edges
[od
];
83 m_rc
[od
] = rc(v
, od
);//sinfo.m_routingChannel;
85 od
= OrthoRep::nextDir(od
);
86 } while (od
!= odNorth
);
88 //cout<<"input nodedeg: "<<m_vdegree<<"\n"<<flush;
90 //compute cage coordinates, use cage corners vertexinfoUML::m_corner
91 const OrthoRep::VertexInfoUML
* vinfo
= O
.cageInfo(v
);
92 adjEntry ae
= vinfo
->m_corner
[0]; e
= *ae
; //pointing towards north, on left side
93 m_ccoord
[0] = L
.x(e
->source()); //already odDir
94 ae
= vinfo
->m_corner
[1]; e
= *ae
;
95 m_ccoord
[1] = L
.y(e
->source()); //already odDir
96 ae
= vinfo
->m_corner
[2]; e
= *ae
;
97 m_ccoord
[2] = L
.x(e
->source()); //already odDir
98 ae
= vinfo
->m_corner
[3]; e
= *ae
;
99 m_ccoord
[3] = L
.y(e
->source()); //already odDir
101 //fill the in_edges lists for all box_sides
105 int NodeInfo::free_coord(OrthoDir s_main
, OrthoDir s_to
)
107 int result
= coord(s_main
);
111 case odNorth
: offset
= flips(odNorth
, s_to
)*delta(s_to
, odNorth
);
112 case odSouth
: offset
= flips(odSouth
, s_to
)*delta(s_to
, odSouth
);
113 case odWest
: offset
= flips(odWest
, s_to
)*delta(s_to
, odWest
);
114 case odEast
: offset
= -flips(odEast
, s_to
)*delta(s_to
, odEast
);
118 result
= result
+ offset
;
123 ostream
& operator<<(ostream
& O
, const NodeInfo
& inf
)
125 O
.precision(5);//O.setf(ios::fixed);???????
127 << "\n********************************************\nnodeinfo: \n********************************************\n"
128 << "box left/top/right/bottom: " << inf
.coord(OrthoDir(0)) << "/" << inf
.coord(OrthoDir(1)) << "/"
129 << inf
.coord(OrthoDir(2)) << "/" << inf
.coord(OrthoDir(3)) << "\n"
130 << "boxsize: " << inf
.box_x_size
<< ":" << inf
.box_y_size
<< "\n"
131 << "cage l/t/r/b: " << inf
.cage_coord(OrthoDir(0)) << "/" << inf
.cage_coord(OrthoDir(1)) << "/"
132 << inf
.cage_coord(OrthoDir(2)) << "/" << inf
.cage_coord(OrthoDir(3)) << "\n"
133 << "gen. pos.: " << inf
.gen_pos(OrthoDir(0)) << "/"
134 << inf
.gen_pos(OrthoDir(1)) << "/"
135 << inf
.gen_pos(OrthoDir(2)) << "/" << inf
.gen_pos(OrthoDir(3)) << "\n"
136 << "delta l/t/r/b (left/right):" << inf
.delta(odNorth
, odWest
) << ":" << inf
.delta(odNorth
, odEast
) << " / \n"
137 << " " << inf
.delta(odEast
, odNorth
) << ":" << inf
.delta(odEast
, odSouth
) << " / \n"
138 << " " << inf
.delta(odSouth
, odEast
) << ":" << inf
.delta(odSouth
, odWest
) << " / "
139 << inf
.delta(odWest
, odSouth
) << ":" << inf
.delta(odWest
, odNorth
) << "\n"
140 << "eps l/t/r/b (left/right): " << inf
.eps(odNorth
, odWest
) << ":" << inf
.eps(odNorth
, odEast
) << " / \n"
141 << " " << inf
.eps(odEast
, odNorth
) << ":" << inf
.eps(odEast
, odSouth
) << " / \n"
142 << " " << inf
.eps(odSouth
, odEast
) << ":" << inf
.eps(odSouth
, odWest
) << " / "
143 << inf
.eps(odWest
, odSouth
) << ":" << inf
.eps(odWest
, odNorth
) << "\n"
144 << "rc: " << inf
.rc(OrthoDir(0)) << "/" << inf
.rc(OrthoDir(1)) << "/" << inf
.rc(OrthoDir(2)) << "/" << inf
.rc(OrthoDir(3)) << "\n"
145 << "num edges: " << inf
.num_edges(OrthoDir(0)) << "/" << inf
.num_edges(OrthoDir(1)) << "/" << inf
.num_edges(OrthoDir(2))
146 << "/" << inf
.num_edges(OrthoDir(3)) << "\n"
147 << "num bendfree edges: " << inf
.num_bend_free(OrthoDir(0)) << "/" << inf
.num_bend_free(OrthoDir(1)) << "/" << inf
.num_bend_free(OrthoDir(2))
148 << "/" << inf
.num_bend_free(OrthoDir(3)) << endl
;