#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultCompSolid.h>
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_LabelMap.hxx>
+#include <TDF_DeltaOnAddition.hxx>
+#include <TNaming_Builder.hxx>
#include <TNaming_SameShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
#include <TNaming_NamedShape.hxx>
static const int TAG_CURRENT_TRANSACTION = 2; ///< integer, index of the transaction
static const int TAG_SELECTION_FEATURE = 3; ///< integer, tag of the selection feature label
static const int TAG_NODES_STATE = 4; ///< array, tag of the Object Browser nodes states
+///< naming structures constructions selected from other document
+static const int TAG_EXTERNAL_CONSTRUCTIONS = 5;
Model_Document::Model_Document(const int theID, const std::string theKind)
: myID(theID), myKind(theKind), myIsActive(false),
myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
{
-#ifdef DFBROWSER
+#ifdef TINSPECTOR
CDF_Session::CurrentSession()->Directory()->Add(myDoc);
#endif
myObjs = new Model_Objects(myDoc->Main());
if (!isError) {
myDoc = aLoaded;
myDoc->SetUndoLimit(UNDO_LIMIT);
+
// to avoid the problem that feature is created in the current, not this, document
aSession->setActiveDocument(anApp->document(myID), false);
aSession->setCheckTransactions(false);
for(; aPartRes != aPartResults.end(); aPartRes++) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPartRes);
if (aPart.get())
- anApp->setLoadByDemand(aPart->data()->name());
+ anApp->setLoadByDemand(aPart->data()->name(),
+ aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId());
}
} else { // open failed, but new documnet was created to work with it: inform the model
for (; aSubIter != aSubs.end(); aSubIter++)
subDoc(*aSubIter)->abortOperation();
// references may be changed because they are set in attributes on the fly
- myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
}
bool Model_Document::isOperation() const
}
// after undo of all sub-documents to avoid updates on not-modified data (issue 370)
if (theSynchronize) {
- myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
// update the current features status
setCurrentFeature(currentFeature(false), false);
}
subDoc(*aSubIter)->redo();
// after redo of all sub-documents to avoid updates on not-modified data (issue 370)
- myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
// update the current features status
setCurrentFeature(currentFeature(false), false);
}
if (aName->Get() == aSubName)
return aName->Label();
}
+ // If not found child label with the exact sub-name, then try to find compound with
+ // such sub-name without suffix.
+ Standard_Integer aSuffixPos = aSubName.SearchFromEnd('_');
+ if (aSuffixPos != -1) {
+ TCollection_ExtendedString anIndexStr = aSubName.Split(aSuffixPos);
+ aSubName.Remove(aSuffixPos);
+ aNamesIter.Initialize(aFind->second, TDataStd_Name::GetID(), Standard_True);
+ for(; aNamesIter.More(); aNamesIter.Next()) {
+ Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value());
+ if (aName->Get() == aSubName) {
+ return aName->Label();
+ }
+ }
+ }
}
}
return TDF_Label(); // not found
TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), aNewVal);
}
+TDF_Label Model_Document::extConstructionsLabel() const
+{
+ return myDoc->Main().FindChild(TAG_EXTERNAL_CONSTRUCTIONS);
+}
+
bool Model_Document::isOpened()
{
return myObjs && !myDoc.IsNull();