+ restore external constraints after project load

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5352 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer 2011-12-28 13:19:26 +00:00
parent 5aebda6e2c
commit 93665fa95a
5 changed files with 17 additions and 3 deletions

View File

@ -987,8 +987,10 @@ void Document::restore (void)
reader.readFiles(zipstream);
// reset all touched
for (std::map<std::string,DocumentObject*>::iterator It= d->objectMap.begin();It!=d->objectMap.end();++It)
for (std::map<std::string,DocumentObject*>::iterator It= d->objectMap.begin();It!=d->objectMap.end();++It) {
It->second->onDocumentRestored();
It->second->purgeTouched();
}
GetApplication().signalRestoreDocument(*this);
}

View File

@ -179,6 +179,8 @@ protected:
virtual void onBeforeChange(const Property* prop);
/// get called by the container when a property was changed
virtual void onChanged(const Property* prop);
/// get called after a document has been fully restored
virtual void onDocumentRestored() {}
/// python object of this class and all descendend
protected: // attributes

View File

@ -1300,7 +1300,6 @@ void SketchObject::Restore(XMLReader &reader)
{
// read the father classes
Part::Part2DObject::Restore(reader);
rebuildExternalGeometry();
Constraints.acceptGeometry(getCompleteGeometry());
rebuildVertexIndex();
}
@ -1312,6 +1311,16 @@ void SketchObject::onChanged(const App::Property* prop)
Part::Part2DObject::onChanged(prop);
}
void SketchObject::onDocumentRestored()
{
try {
rebuildExternalGeometry();
Constraints.acceptGeometry(getCompleteGeometry());
}
catch (...) {
}
}
void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId)
{
if (VertexId < 0 || VertexId >= (int)VertexId2GeoId.size()) {

View File

@ -148,6 +148,7 @@ public:
protected:
/// get called by the container when a property has changed
virtual void onChanged(const App::Property* /*prop*/);
virtual void onDocumentRestored();
private:
std::vector<Part::Geometry *> ExternalGeo;

View File

@ -52,7 +52,7 @@ short SketchObjectSF::mustExecute() const
App::DocumentObjectExecReturn *SketchObjectSF::execute(void)
{
Base::Console().Warning("%s: This feature is deprecated and will not longer supported in future version of FreeCAD \n",this->getNameInDocument());
Base::Console().Warning("%s: This feature is deprecated and won't be longer supported in future FreeCAD versions\n",this->getNameInDocument());
// do nothing
return App::DocumentObject::StdReturn;
}