Doc: Improve App::Document documentation

This commit is contained in:
Pieter Hijma
2025-10-14 12:26:48 +02:00
parent c093fd484c
commit bd3a7c1368
3 changed files with 1041 additions and 339 deletions

View File

@@ -1251,12 +1251,12 @@ constexpr auto fcAttrDepObjName {"Name"};
constexpr auto fcAttrDepAllowPartial {"AllowPartial"};
constexpr auto fcElementObjectDep {"Dep"};
void Document::writeObjects(const std::vector<DocumentObject*>& obj,
void Document::writeObjects(const std::vector<DocumentObject*>& objs,
Base::Writer& writer) const
{
// writing the features types
writer.incInd(); // indentation for 'Objects count'
writer.Stream() << writer.ind() << "<Objects Count=\"" << obj.size();
writer.Stream() << writer.ind() << "<Objects Count=\"" << objs.size();
if (isExporting(nullptr) == 0U) {
writer.Stream() << "\" " << fcAttrDependencies << "=\"1";
}
@@ -1265,7 +1265,7 @@ void Document::writeObjects(const std::vector<DocumentObject*>& obj,
writer.incInd(); // indentation for 'Object type'
if (isExporting(nullptr) == 0U) {
for (const auto o : obj) {
for (const auto o : objs) {
const auto& outList =
o->getOutList(DocumentObject::OutListNoHidden | DocumentObject::OutListNoXLinked);
writer.Stream() << writer.ind()
@@ -1294,7 +1294,7 @@ void Document::writeObjects(const std::vector<DocumentObject*>& obj,
}
std::vector<DocumentObject*>::const_iterator it;
for (it = obj.begin(); it != obj.end(); ++it) {
for (it = objs.begin(); it != objs.end(); ++it) {
writer.Stream() << writer.ind() << "<Object "
<< "type=\"" << (*it)->getTypeId().getName() << "\" "
<< "name=\"" << (*it)->getExportName() << "\" "
@@ -1324,10 +1324,10 @@ void Document::writeObjects(const std::vector<DocumentObject*>& obj,
writer.Stream() << writer.ind() << "</Objects>" << '\n';
// writing the features itself
writer.Stream() << writer.ind() << "<ObjectData Count=\"" << obj.size() << "\">" << '\n';
writer.Stream() << writer.ind() << "<ObjectData Count=\"" << objs.size() << "\">" << '\n';
writer.incInd(); // indentation for 'Object name'
for (it = obj.begin(); it != obj.end(); ++it) {
for (it = objs.begin(); it != objs.end(); ++it) {
writer.Stream() << writer.ind() << "<Object name=\"" << (*it)->getExportName() << "\"";
if ((*it)->hasExtensions()) {
writer.Stream() << " Extensions=\"True\"";
@@ -2036,11 +2036,11 @@ bool Document::afterRestore(const std::vector<DocumentObject*>& objArray, bool c
return false;
}
// some link type property cannot restore link information until other
// objects has been restored. For example, PropertyExpressionEngine and
// PropertySheet with expression containing label reference. So we add the
// Property::afterRestore() interface to let them sort it out. Note, this
// API is not called in object dedpenency order, because the order
// Some link type properties cannot restore link information until other
// objects have been restored. For example, PropertyExpressionEngine and
// PropertySheet with expressions containing a label reference. So we add
// the Property::afterRestore() interface to let them sort it out. Note,
// this API is not called in object dependency order, because the order
// information is not ready yet.
std::map<DocumentObject*, std::vector<Property*>> propMap;
for (auto obj : objArray) {
@@ -2228,7 +2228,7 @@ vector<DocumentObject*> Document::getTouched() const
return result;
}
void Document::setClosable(const bool c) // NOLINT
void Document::setClosable(bool c) // NOLINT
{
setStatus(Document::Closable, c);
}
@@ -2508,7 +2508,7 @@ std::vector<Document*> Document::getDependentDocuments(const bool sort)
}
std::vector<Document*> Document::getDependentDocuments(std::vector<Document*> docs,
const bool sort)
const bool sort)
{
DependencyList depList;
std::map<Document*, Vertex> docMap;
@@ -2572,11 +2572,6 @@ std::vector<Document*> Document::getDependentDocuments(std::vector<Document*> do
return ret;
}
void Document::_rebuildDependencyList(const std::vector<DocumentObject*>& objs)
{
(void)objs;
}
/**
* @brief Signal that object identifiers, typically a property or document object has been renamed.
*
@@ -3144,15 +3139,15 @@ Document::addObjects(const char* sType, const std::vector<std::string>& objectNa
return objects;
}
void Document::addObject(DocumentObject* pcObject, const char* pObjectName)
void Document::addObject(DocumentObject* obj, const char* name)
{
if (pcObject->getDocument()) {
if (obj->getDocument()) {
throw Base::RuntimeError("Document object is already added to a document");
}
pcObject->setDocument(this);
obj->setDocument(this);
_addObject(pcObject, pObjectName, AddObjectOption::SetNewStatus | AddObjectOption::ActivateObject);
_addObject(obj, name, AddObjectOption::SetNewStatus | AddObjectOption::ActivateObject);
}
void Document::_addObject(DocumentObject* pcObject, const char* pObjectName, AddObjectOptions options, const char* viewType)

File diff suppressed because it is too large Load Diff

View File

@@ -97,7 +97,6 @@ void Document::exportGraphviz(std::ostream& out) const
* This class creates the dependency graph for a document.
*
*/
class GraphCreator
{
public:
@@ -132,7 +131,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @param docObj Document object to get an ID from
* @return A string
*/
std::string getId(const DocumentObject* docObj)
{
std::string id;
@@ -150,7 +148,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @param path
* @return A string
*/
std::string getId(const ObjectIdentifier& path)
{
DocumentObject* docObj = path.getDocumentObject();
@@ -183,7 +180,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @brief setGraphAttributes Set graph attributes on a subgraph for a DocumentObject node.
* @param obj DocumentObject
*/
void setGraphAttributes(const DocumentObject* obj)
{
assert(GraphList.find(obj) != GraphList.end());
@@ -201,7 +197,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @param vertex Property node
* @param name Name of node
*/
void setPropertyVertexAttributes(Graph& g, Vertex vertex, const std::string& name)
{
get(vertex_attribute, g)[vertex]["label"] = name;
@@ -217,7 +212,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @param obj DocumentObject to assess.
* @param CSSubgraphs Boolean if the GeoFeatureGroups are created as subgraphs
*/
void addExpressionSubgraphIfNeeded(DocumentObject* obj, bool CSsubgraphs)
{
@@ -283,7 +277,6 @@ void Document::exportGraphviz(std::ostream& out) const
* @param docObj The document object to add.
* @param name Name of node.
*/
void add(DocumentObject* docObj,
const std::string& name,
const std::string& label,