Add all base system changes from the Assembly branch
This commit is contained in:
@@ -143,6 +143,8 @@ struct DocumentP
|
||||
int iUndoMode;
|
||||
unsigned int UndoMemSize;
|
||||
unsigned int UndoMaxStackSize;
|
||||
DependencyList DepList;
|
||||
std::map<DocumentObject*,Vertex> VertexObjectList;
|
||||
|
||||
DocumentP() {
|
||||
activeObject = 0;
|
||||
@@ -530,13 +532,20 @@ Document::Document(void)
|
||||
ADD_PROPERTY_TYPE(LastModifiedDate,("Unknown"),0,Prop_ReadOnly,"Date of last modification");
|
||||
ADD_PROPERTY_TYPE(Company,(""),0,Prop_None,"Additional tag to save the the name of the company");
|
||||
ADD_PROPERTY_TYPE(Comment,(""),0,Prop_None,"Additional tag to save a comment");
|
||||
ADD_PROPERTY_TYPE(Meta,(),0,Prop_None,"Map with additional meta information");
|
||||
ADD_PROPERTY_TYPE(Material,(),0,Prop_None,"Map with material properties");
|
||||
// create the uuid for the document
|
||||
Base::Uuid id;
|
||||
ADD_PROPERTY_TYPE(Id,(id.UuidStr),0,Prop_None,"UUID of the document");
|
||||
ADD_PROPERTY_TYPE(Id,(""),0,Prop_None,"ID of the document");
|
||||
ADD_PROPERTY_TYPE(Uid,(id),0,Prop_None,"UUID of the document");
|
||||
|
||||
// license stuff
|
||||
ADD_PROPERTY_TYPE(License,("CC-BY 3.0"),0,Prop_None,"License string of the Item");
|
||||
ADD_PROPERTY_TYPE(LicenseURL,("http://creativecommons.org/licenses/by/3.0/"),0,Prop_None,"URL to the license text/contract");
|
||||
|
||||
// create transient directory
|
||||
std::string basePath = Base::FileInfo::getTempPath() + GetApplication().getExecutableName();
|
||||
Base::FileInfo TransDir(basePath + "_Doc_" + id.UuidStr);
|
||||
Base::FileInfo TransDir(basePath + "_Doc_" + id.getValue());
|
||||
if (!TransDir.exists())
|
||||
TransDir.createDirectory();
|
||||
ADD_PROPERTY_TYPE(TransientDir,(TransDir.filePath().c_str()),0,Prop_Transient,
|
||||
@@ -629,7 +638,7 @@ void Document::Restore(Base::XMLReader &reader)
|
||||
|
||||
// create new transient directory
|
||||
std::string basePath = Base::FileInfo::getTempPath() + GetApplication().getExecutableName();
|
||||
Base::FileInfo TransDirNew(basePath + "_Doc_" + Id.getValue());
|
||||
Base::FileInfo TransDirNew(basePath + "_Doc_" + Uid.getValueStr());
|
||||
if(!TransDirNew.exists())
|
||||
TransDirNew.createDirectory();
|
||||
TransientDir.setValue(TransDirNew.filePath());
|
||||
@@ -859,7 +868,7 @@ bool Document::save (void)
|
||||
// make a tmp. file where to save the project data first and then rename to
|
||||
// the actual file name. This may be useful if overwriting an existing file
|
||||
// fails so that the data of the work up to now isn't lost.
|
||||
std::string uuid = Base::Uuid::CreateUuid();
|
||||
std::string uuid = Base::Uuid::createUuid();
|
||||
std::string fn = FileName.getValue();
|
||||
fn += "."; fn += uuid;
|
||||
Base::FileInfo tmp(fn);
|
||||
@@ -1081,6 +1090,24 @@ std::vector<App::DocumentObject*> Document::getInList(const DocumentObject* me)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Document::_rebuildDependencyList(void){
|
||||
|
||||
// Filling up the adjacency List
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It)
|
||||
// add the object as Vertex and remember the index
|
||||
d->VertexObjectList[It->second] = add_vertex(d->DepList);
|
||||
// add the edges
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
|
||||
std::vector<DocumentObject*> OutList = It->second->getOutList();
|
||||
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2)
|
||||
if (*It2)
|
||||
add_edge(d->VertexObjectList[It->second],d->VertexObjectList[*It2],d->DepList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Document::recompute()
|
||||
{
|
||||
// delete recompute log
|
||||
@@ -1088,27 +1115,30 @@ void Document::recompute()
|
||||
delete *it;
|
||||
_RecomputeLog.clear();
|
||||
|
||||
DependencyList DepList;
|
||||
std::map<DocumentObject*,Vertex> VertexObjectList;
|
||||
// updates the depency graph
|
||||
_rebuildDependencyList();
|
||||
|
||||
// Filling up the adjacency List
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It)
|
||||
// add the object as Vertex and remember the index
|
||||
VertexObjectList[It->second] = add_vertex(DepList);
|
||||
// add the edges
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
|
||||
std::vector<DocumentObject*> OutList = It->second->getOutList();
|
||||
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2)
|
||||
if (*It2)
|
||||
add_edge(VertexObjectList[It->second],VertexObjectList[*It2],DepList);
|
||||
}
|
||||
//DependencyList DepList;
|
||||
//std::map<DocumentObject*,Vertex> VertexObjectList;
|
||||
|
||||
//// Filling up the adjacency List
|
||||
//for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It)
|
||||
// // add the object as Vertex and remember the index
|
||||
// VertexObjectList[It->second] = add_vertex(DepList);
|
||||
//// add the edges
|
||||
//for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
|
||||
// std::vector<DocumentObject*> OutList = It->second->getOutList();
|
||||
// for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2)
|
||||
// if (*It2)
|
||||
// add_edge(VertexObjectList[It->second],VertexObjectList[*It2],DepList);
|
||||
//}
|
||||
|
||||
std::list<Vertex> make_order;
|
||||
DependencyList::out_edge_iterator j, jend;
|
||||
|
||||
try {
|
||||
// this sort gives the execute
|
||||
boost::topological_sort(DepList, std::front_inserter(make_order));
|
||||
boost::topological_sort(d->DepList, std::front_inserter(make_order));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Document::recompute: " << e.what() << std::endl;
|
||||
@@ -1116,7 +1146,7 @@ void Document::recompute()
|
||||
}
|
||||
|
||||
// caching vertex to DocObject
|
||||
for (std::map<DocumentObject*,Vertex>::const_iterator It1= VertexObjectList.begin();It1 != VertexObjectList.end(); ++It1)
|
||||
for (std::map<DocumentObject*,Vertex>::const_iterator It1= d->VertexObjectList.begin();It1 != d->VertexObjectList.end(); ++It1)
|
||||
d->vertexMap[It1->second] = It1->first;
|
||||
|
||||
#ifdef FC_LOGFEATUREUPDATE
|
||||
@@ -1136,8 +1166,8 @@ void Document::recompute()
|
||||
NeedUpdate = true;
|
||||
else {// if (Cur->mustExecute() == -1)
|
||||
// update if one of the dependencies is touched
|
||||
for (boost::tie(j, jend) = out_edges(*i, DepList); j != jend; ++j) {
|
||||
DocumentObject* Test = d->vertexMap[target(*j, DepList)];
|
||||
for (boost::tie(j, jend) = out_edges(*i, d->DepList); j != jend; ++j) {
|
||||
DocumentObject* Test = d->vertexMap[target(*j, d->DepList)];
|
||||
if (!Test) continue;
|
||||
#ifdef FC_LOGFEATUREUPDATE
|
||||
std::clog << Test->getNameInDocument() << ", " ;
|
||||
|
||||
Reference in New Issue
Block a user