}
//=====================================================================
-
//=====================================================================
int SQLiteTreeHandler::AddBranch( const AttributeMapType& attr )
{
tree::Node* parent = DBGetParent(attr);
DBGraftToParent(parent,attr);
- int nChildren = GetNumberOfChildren(parent);
- std::stringstream out;
- out << nChildren;
- if(parent->GetLevel()>0&&parent->GetLevel()<GetTree().GetNumberOfLevels())
- {
- DBSetAttribute(parent,"D1111_0011",out.str());
- }
return (parent->GetLevel()+1);
+
}
//=====================================================================
if (node->GetChildrenLoaded())
{
// Iterate the children
- tree::Node::ChildrenListType::iterator i;
+
+ /*tree::Node::ChildrenListType::iterator i;
for (i = node->GetChildrenList().begin();
i!= node->GetChildrenList().end();
++i)
{
nbloaded += DBLoadChildren(*i,numberoflevels-1);
- }
+ }*/
return nbloaded;
+
}
/// If children not loaded : do it and recurse
while (!q.eof())
{
+ // std::cout<<"Name in q: "<<q.fieldName(3)<<" Value: "<<q.getStringField(3)<<std::endl;
nbloaded++;
Node* n = new Node(node);
for (int fld = 0; fld < q.numFields(); fld++)
if ( numberoflevels != 1 )
{
// msw[2].Pause();
- nbloaded += DBLoadChildren(n, numberoflevels-1);
+ // nbloaded += DBLoadChildren(n, numberoflevels-1);
// msw[2].Resume();
}
// next entry in db
std::vector<std::string>::const_iterator i;
for (i=filenames.begin();i!=filenames.end();++i)
{
+
mProgress.IncNumberScannedFiles();
if (IsHandledFile(*i))
{
mProgressSignal(mProgress);
if (mProgress.GetStop()) break;
}
+ SetNumberOfChildren();
}
//=====================================================================
{
mProgress.Reset();
AddDirectoryRecursor( directory, recurse );
+ SetNumberOfChildren();
GimmickDebugMessage(3,mProgress<<std::endl);
}
- //=====================================================================
+ //=====================================================================
+ void TreeHandlerImageAdder::SetNumberOfChildren()
+ {
+ std::vector<tree::Node*> children = mTreeHandler->GetTree().GetChildrenList();
+ std::vector<tree::Node*>::iterator it;
+ for(it=children.begin();it!=children.end();++it)
+ {
+ SetNumberOfChildrenRecursor(*it);
+ }
+ }
+ //=====================================================================
+ void TreeHandlerImageAdder::SetNumberOfChildrenRecursor(tree::Node* node)
+ {
+ std::stringstream out;
+ out << node->GetChildrenList().size();
+ mTreeHandler->SetAttribute(node,"D1111_0011",out.str());
+ if(node->GetLevel()<mTreeHandler->GetTree().GetNumberOfLevels()-2)
+ {
+ std::vector<tree::Node*> children = node->GetChildrenList();
+ std::vector<tree::Node*>::iterator it;
+ for(it=children.begin();it!=children.end();++it)
+ {
+ SetNumberOfChildrenRecursor(*it);
+ }
+ }
+ }
//=====================================================================
void TreeHandlerImageAdder::AddFile( const std::string& filename )
else
{
mProgress.IncNumberScannedFiles();
- if (IsHandledFile(itr->string()))
+ if (IsHandledFile(itr->string()))
{
mProgress.IncNumberHandledFiles();
AddFile( itr->string() );
if (mProgress.GetStop()) break;
}
}
+
}
/*
/// Recursive method which does the main job for AddDirectory
void AddDirectoryRecursor( const std::string& directory,
bool recurse );
+
+ ///Sets the number of children for the tree
+ void SetNumberOfChildren();
+
+ ///Sets the number of children recursively for the given node
+ void SetNumberOfChildrenRecursor(tree::Node* node);
TreeHandler* mTreeHandler;
Progress mProgress;
ProgressSignalType mProgressSignal;
+
+
};
// EO class TreeHandlerImageAdder
//=======================================================================
GimmickDebugMessage(6,"Default Node constructor (level "<<GetLevel()<<")"
<< std::endl);
// Insert into parent's children list
- parent->GetChildrenList().push_back(this);
- InitializeAttributeMap();
+ //parent->GetChildrenList().push_back(this);
+ //InitializeAttributeMap();
}
else
{
if (i>1) sparent = mLevelList[i-2].wxSplitter;
level.wxSplitter = new wxSplitterWindow( sparent , -1);
+ if(i!=1)
+ {
+ level.wxSplitter->Show(false);
+ }
// level.wxSplitter->SetMinimumPaneSize(100);
wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,