Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / internal / energybased / ParticleInfo.h
blobc4963b5664b00058518725e01297e4b3d2d10e14
1 /*
2 * $Revision: 2564 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-07 00:03:48 +0200 (Sa, 07. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of class ParticleInfo.
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 #ifdef _MSC_VER
45 #pragma once
46 #endif
48 #ifndef OGDF_PARTICLE_INFO_H
49 #define OGDF_PARTICLE_INFO_H
51 #include <ogdf/basic/Graph.h>
52 #include <ogdf/basic/List.h>
54 namespace ogdf {
56 class OGDF_EXPORT ParticleInfo
58 //Helping data structure for building up the reduced quad tree by NMM.
60 //Outputstream for ParticleInfo.
61 friend ostream &operator<< (ostream & output, const ParticleInfo & A)
63 output <<" node_index "<<A.vertex->index()<<" x_y_coord "<<A.x_y_coord;
64 if(A.marked == true)
65 output<<" marked ";
66 else
67 output<<" unmarked ";
68 output<<" sublist_ptr ";
69 if (A.subList_ptr == NULL)
70 output<<"NULL";
71 else
72 output<<A.subList_ptr;
73 return output;
76 //inputstream for ParticleInfo
77 friend istream &operator>> (istream & input, ParticleInfo & A)
79 input >> A;
80 return input;
83 public:
85 ParticleInfo() //constructor
87 vertex = NULL;
88 x_y_coord = 0;
89 cross_ref_item = NULL;
90 copy_item = NULL;
91 subList_ptr = NULL;
92 marked = false;
93 tmp_item = NULL;
96 ~ParticleInfo() { } //destructor
98 void set_vertex(node v) { vertex = v; }
99 void set_x_y_coord(double c) { x_y_coord = c; }
100 void set_cross_ref_item (ListIterator<ParticleInfo> it) { cross_ref_item = it; }
101 void set_subList_ptr(List<ParticleInfo>* ptr) { subList_ptr = ptr; }
102 void set_copy_item (ListIterator<ParticleInfo> it) { copy_item = it; }
103 void mark() { marked = true; }
104 void unmark() { marked = false; }
105 void set_tmp_cross_ref_item(ListIterator<ParticleInfo> it) { tmp_item = it; }
107 node get_vertex() const { return vertex; }
108 double get_x_y_coord() const { return x_y_coord; }
109 ListIterator<ParticleInfo> get_cross_ref_item() const { return cross_ref_item; }
110 List<ParticleInfo>* get_subList_ptr() const { return subList_ptr; }
111 ListIterator<ParticleInfo> get_copy_item() const{return copy_item;}
112 bool is_marked() const { return marked; }
113 ListIterator<ParticleInfo> get_tmp_cross_ref_item() const { return tmp_item; }
115 private:
116 node vertex; //the vertex of G that is associated with this attributes
117 double x_y_coord; //the x (resp. y) coordinate of the actual position of the vertex
118 ListIterator<ParticleInfo> cross_ref_item; //the Listiterator of the
119 //ParticleInfo-Element that
120 //containes the vertex in the List storing the other
121 //coordinates (a cross reference)
122 List<ParticleInfo>* subList_ptr; //points to the subList of L_x(L_y) where the
123 //actual entry of ParticleInfo has to be stored
124 ListIterator<ParticleInfo> copy_item; //the item of this entry in the copy List
125 bool marked; //indicates if this ParticleInfo object is marked or not
126 ListIterator<ParticleInfo> tmp_item; //a temporily item that is used to construct
127 //the cross references for the copy_Lists
128 //and the subLists
132 //Needed for sorting algorithms in ogdf/List and ogdf/Array.
133 class ParticleInfoComparer {
134 public:
135 //Returns -1(1) if height of a <(>) height of b. If they are equal 0 is
136 //returned.
137 static int compare(const ParticleInfo& a,const ParticleInfo & b)
139 double p = a.get_x_y_coord();
140 double q = b.get_x_y_coord();
141 if(p < q ) return -1;
142 else if(p > q ) return 1;
143 else return 0;
145 OGDF_AUGMENT_STATICCOMPARER(ParticleInfo)
148 }//namespace ogdf
150 #endif