#include <creaImageIOMultiThreadImageReader.h>
#include <creaImageIOImageReader.h>
#include <wx/utils.h>
+#include <creaImageIOSystem.h>
namespace creaImageIO
{
: //mDoNotSignal(false),
mReader(0),
mTotalMem(0),
- mTotalMemMax(10000)
+ mTotalMemMax(100000)
{
// std::cout << "#### MultiThreadImageReader::MultiThreadImageReader("
// << " #threads= " << number_of_threads <<" )"<<std::endl;
void MultiThreadImageReader::SignalImageRead(ImageToLoadPtr p,
bool purge)
{
- // std::cout << "MultiThreadImageReader::SignalImageRead" <<std::endl;
+
+// std::cout << "MultiThreadImageReader::SignalImageRead" <<std::endl;
// std::cout << "this="<<this <<std::endl;
// std::cout << "user="<<p->GetUser() <<std::endl;
BUGGY : TO FIX
*/
if (!purge) return;
+ GimmickMessage(5,"Image '"<<p->GetFilename()<<"' read"<<std::endl);
// wxMutexLocker lock(GetMultiThreadImageReaderUserMutex());
p->GetImage()->PropagateUpdateExtent();
long ImMem = p->GetImage()->GetEstimatedMemorySize();
mTotalMem += ImMem;
- // std::cout << " ==> Total mem = "<<mTotalMem<<" Ko"<<std::endl;
+
+ GimmickMessage(5,"==> Image in memory = "<<mUnloadQueue.size()<<std::endl);
+ GimmickMessage(5,"==> Total mem = "<<mTotalMem<<" Ko"<<std::endl);
+
+ // return;
+
while (mTotalMem > mTotalMemMax)
{
- // std::cout
- // <<" ! Exceeded max of "
- // << mTotalMemMax << " : unloading oldest image ... "
- // << std::endl;
+ GimmickMessage(5,
+ " ! Exceeded max of "
+ << mTotalMemMax << " Ko : unloading oldest image ... "
+ << std::endl);
if ( mUnloadQueue.size() <= 1 )
{
- // std::cout << "Only one image : cannot load AND unload it !!"
- // <<std::endl;
+ GimmickMessage(5,
+ " Only one image : cannot load AND unload it !!"
+ <<std::endl);
break;
-
+
}
ImageToLoadPtr unload = mUnloadQueue.remove_top();
MultiThreadImageReaderUser* user = unload->GetUser();
}
- // std::cout << "'" << unload->GetFilename() << "'" << std::endl;
+ GimmickMessage(5,"'" << unload->GetFilename() << "'" << std::endl);
mTotalMem -= unload->GetImage()->GetEstimatedMemorySize();
- // std::cout << " ==> Total mem = "<<mTotalMem<<" Ko "<<std::endl;
+
+ GimmickMessage(5," ==> Total mem = "<<mTotalMem<<" Ko "<<std::endl);
std::string filename = unload->GetFilename();
if (unload->Index()>=0)
{
- // std::cout << "still in queue"<<std::endl;
+ // GimmickMessage(5,"still in queue"<<std::endl);
}
unload->Index() = -1;
level.wxCtrl = ctrl;
level.wxSplitter->Initialize(ctrl);
+ // Create the first column : number of children
+
+ std::string title = "#";
+ if (i<handler->GetTree().GetNumberOfLevels()-1)
+ {
+ title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
+ if (title[title.size()-1]!='s')
+ title += "s";
+ }
+ ctrl->InsertColumn(0,crea::std2wx(title),col_style);
+
+
// Create the columns : one for each attribute of the level
- int col = 0;
+ int col = 1;
tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
for (a = handler->GetTree().GetAttributeDescriptorList(i).begin();
a != handler->GetTree().GetAttributeDescriptorList(i).end();
++a)
{
- if(col==0)
- {
- wxListItem it;
- it.SetTextColour(*wxRED);
- it.SetText(_T("#C"));
-
- ctrl->InsertColumn(col,it);
- col++;
- }
-
+
GimmickDebugMessage(5,"Creating column "<<col<<" : "
<<a->GetName()
<<std::endl);