add method restoreFinished and reimplement it in SketchObject
This commit is contained in:
@@ -129,4 +129,5 @@ void Persistence::restoreFromStream(std::istream& stream)
|
||||
reader.readElement("Content");
|
||||
Restore(reader);
|
||||
reader.readFiles(zipstream);
|
||||
restoreFinished();
|
||||
}
|
||||
|
||||
@@ -154,6 +154,14 @@ public:
|
||||
|
||||
//restore the binary persistence data from a stream. Must have the format used by dumpToStream
|
||||
void restoreFromStream(std::istream& stream);
|
||||
|
||||
private:
|
||||
/** This method is used at the end of restoreFromStream()
|
||||
* after all data files have been read in.
|
||||
* A subclass can set up some internals. The default
|
||||
* implementation does nothing.
|
||||
*/
|
||||
virtual void restoreFinished() {}
|
||||
};
|
||||
|
||||
} //namespace Base
|
||||
|
||||
@@ -6614,6 +6614,21 @@ void SketchObject::onDocumentRestored()
|
||||
}
|
||||
}
|
||||
|
||||
void SketchObject::restoreFinished()
|
||||
{
|
||||
try {
|
||||
Constraints.acceptGeometry(getCompleteGeometry());
|
||||
// this may happen when saving a sketch directly in edit mode
|
||||
// but never performed a recompute before
|
||||
if (Shape.getValue().IsNull() && hasConflicts() == 0) {
|
||||
if (this->solve(true) == 0)
|
||||
Shape.setValue(solvedSketch.toShape());
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) const
|
||||
{
|
||||
if (VertexId < 0 || VertexId >= int(VertexId2GeoId.size())) {
|
||||
|
||||
@@ -403,6 +403,7 @@ protected:
|
||||
/// get called by the container when a property has changed
|
||||
virtual void onChanged(const App::Property* /*prop*/);
|
||||
virtual void onDocumentRestored();
|
||||
virtual void restoreFinished();
|
||||
|
||||
virtual void setExpression(const App::ObjectIdentifier &path, boost::shared_ptr<App::Expression> expr, const char * comment = 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user