00001 #include "VLCClusterliste.h"
00002 using namespace std;
00003
00004 VLCClusterliste::VLCClusterliste(){
00005 }
00006
00007
00008
00009
00010
00011
00012
00013
00014 void VLCClusterliste::addCluster(VLCCluster c, list<list<VLCCluster>::iterator>::iterator i, bool v)
00015 {
00016
00017
00018
00019
00020 if(clist.empty())
00021 {
00022
00023
00024 clist.push_front(c);
00025 vNavi.push_front(clist.begin());
00026 hNavi.push_front(clist.begin());
00027
00028
00029 clist.begin()->setVPointer(vNavi.begin());
00030 clist.begin()->setHPointer(hNavi.begin());
00031 }
00032 else
00033 {
00034 clist.push_front(c);
00035 vhIter = NULL;
00036
00037 if(v)
00038 {
00039
00040
00041
00042
00043 vNavi.insert(i,clist.begin());
00044
00045 --i;
00046 clist.begin()->setVPointer(i);
00047
00048
00049
00050 vhIter = hNavi.begin();
00051 posGefunden = false;
00052 while((posGefunden == false) && (vhIter != hNavi.end()))
00053 {
00054 cIter = *vhIter;
00055 if(clist.begin()->getYMin() <= cIter->getYMin())
00056 {
00057 posGefunden = true;
00058 }
00059 ++vhIter;
00060 }
00061
00062
00063
00064
00065 if(posGefunden)
00066 {
00067
00068
00069 --vhIter;
00070 hNavi.insert(vhIter, clist.begin());
00071
00072 --vhIter;
00073 clist.begin()->setHPointer(vhIter);
00074 }
00075
00076
00077 else if((posGefunden == false) && (vhIter == hNavi.end()))
00078 {
00079 hNavi.push_back(clist.begin());
00080
00081
00082 --vhIter;
00083 clist.begin()->setHPointer(vhIter);
00084 }
00085
00086 }
00087
00088
00089
00090 else
00091 {
00092
00093
00094
00095
00096
00097
00098 hNavi.insert(i,clist.begin());
00099
00100 --i;
00101 clist.begin()->setHPointer(i);
00102
00103
00104
00105 vhIter = vNavi.begin();
00106 posGefunden = false;
00107 while((posGefunden == false) && (vhIter != vNavi.end()))
00108 {
00109 cIter = *vhIter;
00110 if(clist.begin()->getXMin() <= cIter->getXMin())
00111 {
00112 posGefunden = true;
00113 }
00114 ++vhIter;
00115 }
00116
00117
00118
00119
00120 if(posGefunden)
00121 {
00122
00123
00124 --vhIter;
00125 vNavi.insert(vhIter, clist.begin());
00126 --vhIter;
00127 clist.begin()->setVPointer(vhIter);
00128 }
00129
00130 else if((posGefunden == false) && (vhIter == vNavi.end()))
00131 {
00132 vNavi.push_back(clist.begin());
00133 --vhIter;
00134 clist.begin()->setVPointer(vhIter);
00135 }
00136
00137
00138 }
00139
00140
00141 }
00142
00143 }
00144
00145
00146
00147
00148 void VLCClusterliste::deleteAll()
00149 {
00150 clist.clear();
00151 vNavi.clear();
00152 hNavi.clear();
00153 midlist.clear();
00154 }
00155
00156
00157
00158
00159
00160 void VLCClusterliste::removeCluster(list<VLCCluster>::iterator rc)
00161 {
00162
00163
00164
00165 vhIter = rc->getVPointer();
00166 vNavi.erase(vhIter);
00167
00168
00169 vhIter = rc->getHPointer();
00170 hNavi.erase(vhIter);
00171
00172
00173 cIter = clist.erase(rc);
00174
00175 }
00176
00177
00178
00179 list<Vector2<double> > VLCClusterliste::getMidpoints()
00180 {
00181 midlist.clear();
00182 for(cIter = clist.begin(); cIter != clist.end(); ++cIter )
00183 {
00184 midlist.push_back(cIter->getMidpoint());
00185 }
00186 return(midlist);
00187 }
00188
00189
00190 list<VLCCluster>::iterator VLCClusterliste::getCListBegin()
00191 {
00192 return(clist.begin());
00193 }
00194
00195
00196 list<VLCCluster>::iterator VLCClusterliste::getCListEnd()
00197 {
00198 return(clist.end());
00199 }
00200
00201
00202
00203 list<list<VLCCluster>::iterator>::iterator VLCClusterliste::getVNaviBegin()
00204 {
00205 return(vNavi.begin());
00206 }
00207
00208 list<list<VLCCluster>::iterator>::iterator VLCClusterliste::getVNaviEnd()
00209 {
00210 return(vNavi.end());
00211 }
00212
00213
00214 list<list<VLCCluster>::iterator>::iterator VLCClusterliste::getHNaviBegin()
00215 {
00216 return(hNavi.begin());
00217 }
00218
00219
00220
00221 list<list<VLCCluster>::iterator>::iterator VLCClusterliste::getHNaviEnd()
00222 {
00223 return(hNavi.end());
00224 }
00225
00226
00227 bool VLCClusterliste::getEmpty()
00228 {
00229 return(clist.empty());
00230 }
00231
00232
00233
00234