6 * $Date: 2012-07-07 00:03:48 +0200 (Sa, 07. Jul 2012) $
7 ***************************************************************/
10 * \brief Declaration of class ParticleInfo.
12 * \author Stefan Hachul
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 ***************************************************************/
48 #ifndef OGDF_PARTICLE_INFO_H
49 #define OGDF_PARTICLE_INFO_H
51 #include <ogdf/basic/Graph.h>
52 #include <ogdf/basic/List.h>
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
;
68 output
<<" sublist_ptr ";
69 if (A
.subList_ptr
== NULL
)
72 output
<<A
.subList_ptr
;
76 //inputstream for ParticleInfo
77 friend istream
&operator>> (istream
& input
, ParticleInfo
& A
)
85 ParticleInfo() //constructor
89 cross_ref_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
; }
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
132 //Needed for sorting algorithms in ogdf/List and ogdf/Array.
133 class ParticleInfoComparer
{
135 //Returns -1(1) if height of a <(>) height of b. If they are equal 0 is
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;
145 OGDF_AUGMENT_STATICCOMPARER(ParticleInfo
)