Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / src / energybased / QuadTreeNodeNM.cpp
blob95488b9fc180647a8a08aaf4480a575a7ae8ecee
1 /*
2 * $Revision: 2555 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-06 12:12:10 +0200 (Fr, 06. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Implementation of class QuadTreeNodeNM.
12 * \author Stefan Hachul
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
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
26 * for details.
28 * \par
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.
34 * \par
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 ***************************************************************/
44 #include <ogdf/internal/energybased/QuadTreeNodeNM.h>
47 namespace ogdf {
49 ostream &operator<< (ostream & output, const QuadTreeNodeNM & A)
51 output <<" Sm_level: "<<A.Sm_level<<" Sm_downleftcorner: "<<A.Sm_downleftcorner
52 <<" Sm boxlength: "<<A.Sm_boxlength<<" Sm_center: "<<A.Sm_center
53 <<"spnumber: "<<A.subtreeparticlenumber;
54 if(A.father_ptr == NULL)
55 output <<" is root ";
56 if((A.child_lt_ptr == NULL) ||(A.child_rt_ptr == NULL) || (A.child_lb_ptr == NULL)||
57 (A.child_rb_ptr == NULL))
59 output <<" (no child in ";
60 if(A.child_lt_ptr == NULL)
61 output <<" lt";
62 if(A.child_rt_ptr == NULL)
63 output <<" rt";
64 if(A.child_lb_ptr == NULL)
65 output <<" lb";
66 if(A.child_rb_ptr == NULL)
67 output <<" rb";
68 output<<" quad) ";
71 output<<" L_x: ";
72 if(A.L_x_ptr == NULL)
73 output<<"no list specified";
74 else if(A.L_x_ptr->empty())
75 output <<"is empty";
76 else
78 forall_listiterators(ParticleInfo, it,*A.L_x_ptr)
79 output<<" "<<*it;
82 output<<" L_y: ";
83 if(A.L_y_ptr == NULL)
84 output<<"no list specified";
85 else if(A.L_y_ptr->empty())
86 output <<"is empty";
87 else
89 forall_listiterators(ParticleInfo, it,*A.L_y_ptr)
90 output<<" "<<*it;
93 output<<" I: ";
94 if(A.I.empty())
95 output <<"is empty";
96 else
98 forall_listiterators(QuadTreeNodeNM*, v_ptr,A.I)
99 output<<" ["<<(*v_ptr)->get_Sm_level()<<" , "
100 <<(*v_ptr)->get_Sm_downleftcorner()<<","
101 <<(*v_ptr)->get_Sm_boxlength()<<"]";
104 output<<" D1: ";
105 if(A.D1.empty())
106 output <<"is empty";
107 else
109 forall_listiterators(QuadTreeNodeNM*, v_ptr,A.D1)
110 output<<" ["<<(*v_ptr)->get_Sm_level()<<" , "
111 <<(*v_ptr)->get_Sm_downleftcorner()<<","
112 <<(*v_ptr)->get_Sm_boxlength()<<"]";
115 output<<" D2: ";
116 if(A.D2.empty())
117 output <<"is empty";
118 else
120 forall_listiterators(QuadTreeNodeNM*, v_ptr,A.D2)
121 output<<" ["<<(*v_ptr)->get_Sm_level()<<" , "
122 <<(*v_ptr)->get_Sm_downleftcorner()<<","
123 <<(*v_ptr)->get_Sm_boxlength()<<"]";
126 output<<" M: ";
127 if(A.M.empty())
128 output <<"is empty";
129 else
131 forall_listiterators(QuadTreeNodeNM*, v_ptr,A.M)
132 output<<" ["<<(*v_ptr)->get_Sm_level()<<" , "
133 <<(*v_ptr)->get_Sm_downleftcorner()<<","
134 <<(*v_ptr)->get_Sm_boxlength()<<"]";
136 output<<" contained_nodes ";
137 if(A.contained_nodes.empty())
138 output <<"is empty";
139 else
141 forall_listiterators(node,v_it,A.contained_nodes)
142 output<<(*v_it)->index()<<" ";
144 return output;
148 istream &operator>> (istream & input, QuadTreeNodeNM & A)
150 input >> A.Sm_level;
151 return input;
155 QuadTreeNodeNM::QuadTreeNodeNM()
157 DPoint double_null(0,0);
158 complex<double> comp_null(0,0);
160 L_x_ptr = NULL; ;L_y_ptr = NULL;
161 subtreeparticlenumber = 0;
162 Sm_level = 0;
163 Sm_downleftcorner = double_null;
164 Sm_boxlength = 0;
165 Sm_center = comp_null;
166 ME = NULL;
167 LE = NULL;
168 contained_nodes.clear();
169 I.clear();D1.clear();D2.clear();M.clear();
170 father_ptr = NULL;
171 child_lt_ptr = child_rt_ptr = child_lb_ptr = child_rb_ptr = NULL;
175 QuadTreeNodeNM::~QuadTreeNodeNM()
177 if(L_x_ptr != NULL)
179 delete L_x_ptr;
180 L_x_ptr = NULL;
182 if(L_y_ptr != NULL)
184 delete L_y_ptr;
185 L_y_ptr = NULL;
187 contained_nodes.clear();
188 I.clear();D1.clear();D2.clear();M.clear();
189 delete [] ME;
190 delete [] LE;
193 }//namespace ogdf