boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
- if (aDoc) aDoc->objectIsNotReferenced(aDoc->object(myRef->Get()));
myRef->Set(aData->label().Father()); // references to the feature label
- boost::shared_dynamic_cast<Model_Document>(owner()->document())->objectIsReferenced(theObject);
owner()->data()->sendAttributeUpdated(this);
}
if (owner()) {
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
- if (aDoc) aDoc->objectIsReferenced(aDoc->object(myRef->Get()));
}
}
}
ModelAPI_AttributeReference::setObject(theObject);
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
- if (aDoc) aDoc->objectIsReferenced(aDoc->object(myRef->Get()));
}
}
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
TDF_Label aLab = myRef->Get();
- if (aDoc && !aLab.IsNull()) aDoc->objectIsNotReferenced(aDoc->object(myRef->Get()));
}
boost::shared_ptr<GeomAPI_Shape> aResult;
if (myIsInitialized) {
Handle(TNaming_NamedShape) aSelection;
- if (myRef.myRef->Label().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
+ if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
TopoDS_Shape aSelShape = aSelection->Get();
aResult = boost::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
aResult->setImpl(new TopoDS_Shape(aSelShape));
if (!aContext) return false;
if (aContext->groupName() == ModelAPI_ResultBody::group()) {
// body: just a named shape, use selection mechanism from OCCT
- TNaming_Selector aSelector(myRef.myRef->Label());
+ TNaming_Selector aSelector(selectionLabel());
TDF_LabelMap aScope; // empty means the whole document
return aSelector.Solve(aScope) == Standard_True;
const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
{
// perform the selection
- TNaming_Selector aSel(myRef.myRef->Label());
+ TNaming_Selector aSel(selectionLabel());
TopoDS_Shape aNewShape = theSubShape ? theSubShape->impl<TopoDS_Shape>() : TopoDS_Shape();
TopoDS_Shape aContext;
else
throw std::invalid_argument("a result with shape is expected");
}
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aNewShape, myRef.myRef->Label());
- TDF_Label aLab = aNS->Label();
-
aSel.Select(aNewShape, aContext);
}
}
}
// store the selected as primitive
- TNaming_Builder aBuilder(myRef.myRef->Label());
+ TNaming_Builder aBuilder(selectionLabel());
aBuilder.Generated(aSubShape);
}
+
+TDF_Label Model_AttributeSelection::selectionLabel()
+{
+ return myRef.myRef->Label().FindChild(1);
+}
virtual void selectConstruction(
const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+ /// Returns the label where TNaming_Selection results are stored
+ /// Note: there must be no attributes stored at the same label because Selector clears this lab
+ TDF_Label selectionLabel();
+
friend class Model_Data;
friend class Model_AttributeSelectionList;
};
void Model_AttributeSelectionList::clear()
{
if (!mySubs.empty()) {
+ mySize->Set(0);
mySubs.clear();
TDF_ChildIterator aSubIter(mySize->Label());
for(; aSubIter.More(); aSubIter.Next()) {
{
return myLab.Father().Tag(); // tag of the feature label
}
+
+void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID)
+{
+ // TODO: the concealment state update
+ myRefsToMe.insert(theFeature->data()->attribute(theAttrID));
+}
+
+void Model_Data::referencesToObjects(
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs)
+{
+ std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = myAttrs.begin();
+ std::list<ObjectPtr> aReferenced; // not inside of cycle to avoid excess memory menagement
+ for(; anAttr != myAttrs.end(); anAttr++) {
+ std::string aType = anAttr->second->attributeType();
+ if (aType == ModelAPI_AttributeReference::type()) { // reference to object
+ boost::shared_ptr<ModelAPI_AttributeReference> aRef = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeReference>(anAttr->second);
+ aReferenced.push_back(aRef->value());
+ theRefs.push_back(std::pair<std::string, std::list<ObjectPtr> >(anAttr->first, aReferenced));
+ } else if (aType == ModelAPI_AttributeRefAttr::type()) { // reference to attribute or object
+ boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeRefAttr>(anAttr->second);
+ aReferenced.push_back(aRef->isObject() ? aRef->object() : aRef->attr()->owner());
+ } else if (aType == ModelAPI_AttributeRefList::type()) { // list of references
+ aReferenced = boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttr->second)->list();
+ } else if (aType == ModelAPI_AttributeSelection::type()) { // selection attribute
+ boost::shared_ptr<ModelAPI_AttributeSelection> aRef = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeSelection>(anAttr->second);
+ aReferenced.push_back(aRef->context());
+ theRefs.push_back(std::pair<std::string, std::list<ObjectPtr> >(anAttr->first, aReferenced));
+ } else if (aType == ModelAPI_AttributeSelectionList::type()) { // list of selection attributes
+ boost::shared_ptr<ModelAPI_AttributeSelectionList> aRef = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeSelectionList>(anAttr->second);
+ for(int a = aRef->size() - 1; a >= 0; a--) {
+ aReferenced.push_back(aRef->value(a)->context());
+ }
+ } else
+ continue; // nothing to do, not reference
+
+ if (!aReferenced.empty()) {
+ theRefs.push_back(std::pair<std::string, std::list<ObjectPtr> >(anAttr->first, aReferenced));
+ aReferenced.clear();
+ }
+ }
+}
#include <map>
#include <list>
#include <string>
+#include <set>
class ModelAPI_Attribute;
/// needed here to emit signal that object changed on change of the attribute
ObjectPtr myObject;
+ /// List of attributes referenced to owner (updated only during the transaction change)
+ std::set<AttributePtr> myRefsToMe;
+
Model_Data();
/// Returns label of this feature
}
friend class Model_Document;
+ friend class Model_Update;
friend class Model_AttributeReference;
friend class Model_AttributeRefAttr;
friend class Model_AttributeRefList;
/// Returns the identifier of feature-owner, unique in this document
MODEL_EXPORT virtual int featureId() const;
+private:
+ // removes all information about back references
+ inline void eraseBackReferences() {myRefsToMe.clear();}
+ // adds a back reference (with identifier which attribute references to this object
+ void addBackReference(FeaturePtr theFeature, std::string theAttrID);
+ // returns all references by attributes of this data
+ // \param the returned list of pairs: id of referenced attribute and list of referenced objects
+ void referencesToObjects(std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
};
#endif
#include <Model_ResultPart.h>
#include <Model_ResultConstruction.h>
#include <Model_ResultBody.h>
+#include <ModelAPI_Validator.h>
#include <Events_Loop.h>
#include <Events_Error.h>
myDoc->SetUndoLimit(UNDO_LIMIT);
// to avoid the problem that feature is created in the current, not this, document
Model_Session::get()->setActiveDocument(anApp->getDocument(myID));
- synchronizeFeatures();
+ synchronizeFeatures(false, true);
}
return !isError;
}
myNestedNum = -1;
myDoc->AbortCommand();
}
- synchronizeFeatures(true);
+ synchronizeFeatures(true, false); // references were not changed since transaction start
// abort for all subs
std::set<std::string>::iterator aSubIter = mySubs.begin();
for (; aSubIter != mySubs.end(); aSubIter++)
myNestedNum--;
if (!myIsEmptyTr[myTransactionsAfterSave])
myDoc->Undo();
- synchronizeFeatures(true);
+ synchronizeFeatures(true, true);
// undo for all subs
std::set<std::string>::iterator aSubIter = mySubs.begin();
for (; aSubIter != mySubs.end(); aSubIter++)
if (!myIsEmptyTr[myTransactionsAfterSave])
myDoc->Redo();
myTransactionsAfterSave++;
- synchronizeFeatures(true);
+ synchronizeFeatures(true, true);
// redo for all subs
std::set<std::string>::iterator aSubIter = mySubs.begin();
for (; aSubIter != mySubs.end(); aSubIter++)
// check the feature: it must have no depended objects on it
std::list<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
for(; aResIter != theFeature->results().cend(); aResIter++) {
+ /*
if (myConcealedResults.find(*aResIter) != myConcealedResults.end()) {
Events_Error::send("Feature '" + theFeature->data()->name() + "' is used and can not be deleted");
return;
}
+ */
}
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator anObjIter(myObjs);
for(; anObjIter.More(); anObjIter.Next()) {
std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
if ((*aRIter)->groupName() != theGroupID) continue;
- bool isIn = theHidden;
+ bool isIn = theHidden && (*aRIter)->isInHistory();
if (!isIn && (*aRIter)->isInHistory()) { // check that there is nobody references this result
- isIn = myConcealedResults.find(*aRIter) == myConcealedResults.end();
+ isIn = !(*aRIter)->isConcealed();
}
if (isIn) {
if (anIndex == theIndex)
if ((*aRIter)->groupName() != theGroupID) continue;
bool isIn = theHidden;
if (!isIn && (*aRIter)->isInHistory()) { // check that there is nobody references this result
- isIn = myConcealedResults.find(*aRIter) == myConcealedResults.end();
+ isIn = !(*aRIter)->isConcealed();
}
if (isIn)
aResult++;
// check this is unique, if not, increase index by 1
for (aFIter.Initialize(myObjs); aFIter.More();) {
FeaturePtr aFeature = aFIter.Value();
- bool isSameName = aFeature->isInHistory() && aFeature->data()->name() == aName;
+ bool isSameName = aFeature->data()->name() == aName;
if (!isSameName) { // check also results to avoid same results names (actual for Parts)
const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
- isSameName = (*aRIter)->isInHistory() && (*aRIter)->data()->name() == aName;
+ isSameName = (*aRIter)->data()->name() == aName;
}
}
if (isSameName) {
}
}
-void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
+void Model_Document::synchronizeFeatures(const bool theMarkUpdated, const bool theUpdateReferences)
{
boost::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
aFIter.Next();
}
+ if (theUpdateReferences) {
+ // first cycle: erase all data about back-references
+ NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeatures(myObjs);
+ for(; aFeatures.More(); aFeatures.Next()) {
+ FeaturePtr aFeature = aFeatures.Value();
+ boost::shared_ptr<Model_Data> aFData =
+ boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
+ if (aFData) {
+ aFData->eraseBackReferences();
+ }
+ const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ for (; aRIter != aResults.cend(); aRIter++) {
+ boost::shared_ptr<Model_Data> aResData =
+ boost::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
+ if (aResData) {
+ aResData->eraseBackReferences();
+ }
+ }
+ }
+
+ // second cycle: set new back-references: only features may have reference, iterate only them
+ ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+ for(aFeatures.Initialize(myObjs); aFeatures.More(); aFeatures.Next()) {
+ FeaturePtr aFeature = aFeatures.Value();
+ boost::shared_ptr<Model_Data> aFData =
+ boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
+ if (aFData) {
+ std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
+ aFData->referencesToObjects(aRefs);
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator aRefsIter = aRefs.begin();
+ for(; aRefsIter != aRefs.end(); aRefsIter++) {
+ std::list<ObjectPtr>::iterator aReferenced = aRefsIter->second.begin();
+ for(; aReferenced != aRefsIter->second.end(); aReferenced++) {
+ boost::shared_ptr<Model_Data> aRefData =
+ boost::dynamic_pointer_cast<Model_Data>((*aReferenced)->data());
+ aRefData->addBackReference(aFeature, aRefsIter->first); // here the Concealed flag is updated
+ }
+ }
+ }
+ }
+ }
+
myExecuteFeatures = false;
aLoop->activateFlushes(true);
}
}
-void Model_Document::objectIsReferenced(const ObjectPtr& theObject)
-{
- // only bodies are concealed now
- ResultBodyPtr aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theObject);
- if (aResult) {
- if (myConcealedResults.find(aResult) != myConcealedResults.end()) {
- Events_Error::send(std::string("The object '") + aResult->data()->name() +
- "' is already referenced");
- } else {
- myConcealedResults.insert(aResult);
- boost::shared_ptr<ModelAPI_Document> aThis =
- Model_Application::getApplication()->getDocument(myID);
- ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_ResultBody::group());
-
- static Events_Loop* aLoop = Events_Loop::loop();
- static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
- aECreator->sendUpdated(aResult, EVENT_DISP);
- }
- }
-}
-
-void Model_Document::objectIsNotReferenced(const ObjectPtr& theObject)
-{
- // only bodies are concealed now
- ResultBodyPtr aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theObject);
- if (aResult) {
- std::set<ResultPtr>::iterator aFind = myConcealedResults.find(aResult);
- if (aFind != myConcealedResults.end()) {
- ResultPtr aFeature = *aFind;
- myConcealedResults.erase(aFind);
- boost::shared_ptr<ModelAPI_Document> aThis =
- Model_Application::getApplication()->getDocument(myID);
- static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
- ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent, false);
- } else {
- Events_Error::send(std::string("The object '") + aResult->data()->name() +
- "' was not referenced '");
- }
- }
-}
-
Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
{
return TDF_LabelMapHasher::HashCode(theLab, theUpper);
///! On abort, undo or redo it is not necessary: results in document are updated automatically
bool executeFeatures() {return myExecuteFeatures;}
- ///! Reutrns true is result was conecaled because of usage it by other object
- virtual bool isConcealed(const boost::shared_ptr<ModelAPI_Object>& theResult) {
- return myConcealedResults.find(boost::dynamic_pointer_cast<ModelAPI_Result>(theResult))
- != myConcealedResults.end();
- }
-
protected:
//! Returns (creates if needed) the features label
void setUniqueName(FeaturePtr theFeature);
//! Synchronizes myFeatures list with the updated document
- void synchronizeFeatures(const bool theMarkUpdated = false);
+ //! \param theMarkUpdated causes the "update" event for all features
+ //! \param theUpdateReferences causes the update of back-references
+ void synchronizeFeatures(const bool theMarkUpdated, const bool theUpdateReferences);
//! Creates new document with binary file format
Model_Document(const std::string theID, const std::string theKind);
//! Updates the results list of the feature basing on the current data tree
void updateResults(FeaturePtr theFeature);
- //! Stores information that there is a reference to this object
- void objectIsReferenced(const ObjectPtr& theObject);
- //! Removes information that there is a reference to this object
- void objectIsNotReferenced(const ObjectPtr& theObject);
-
//! Returns all sub documents
const std::set<std::string>& subDocuments() const {return mySubs;}
/// All features managed by this document (not only in history of OB)
/// For optimization mapped by labels
NCollection_DataMap<TDF_Label, FeaturePtr> myObjs;
- /// Results that are referenced and must be concealed for object browser
- std::set<ResultPtr> myConcealedResults;
///< set of identifiers of sub-documents of this document
std::set<std::string> mySubs;
Model_ResultBody::Model_ResultBody()
{
+ setIsConcealed(false);
}
void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
Model_ResultConstruction::Model_ResultConstruction()
{
myIsInHistory = true;
+ setIsConcealed(false);
}
void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
Model_ResultPart::Model_ResultPart()
{
+ setIsConcealed(false);
}
void Model_ResultPart::setData(boost::shared_ptr<ModelAPI_Data> theData)
aRT->SetRelocation(aSourceRoot, aTargetRoot);
TDF_CopyTool::Copy(aDS, aRT);
- aNew->synchronizeFeatures();
+ aNew->synchronizeFeatures(false, true);
return aNew;
}
#include <Model_Update.h>
#include <Model_Document.h>
+#include <Model_Data.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
aMustbeUpdated = true;
}
}
-
- // references
- list<boost::shared_ptr<ModelAPI_Attribute> > aRefs = theFeature->data()->attributes(
- ModelAPI_AttributeReference::type());
- list<boost::shared_ptr<ModelAPI_Attribute> >::iterator aRefsIter = aRefs.begin();
- for (; aRefsIter != aRefs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_Object> aSub = boost::dynamic_pointer_cast<
- ModelAPI_AttributeReference>(*aRefsIter)->value();
- if (updateObject(aSub)) {
- aMustbeUpdated = true;
- }
- }
- // reference to attribute or object
- list<boost::shared_ptr<ModelAPI_Attribute> > aRefAttrs = theFeature->data()->attributes(
- ModelAPI_AttributeRefAttr::type());
- for (aRefsIter = aRefAttrs.begin(); aRefsIter != aRefAttrs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*aRefsIter);
- if (!aRef) continue;
- if (aRef->isObject()) {
- boost::shared_ptr<ModelAPI_Object> aSub = aRef->object();
- if (updateObject(aSub)) {
- aMustbeUpdated = true;
- }
- } else if (aRef->attr()) { // reference to the attribute
- boost::shared_ptr<ModelAPI_Object> aSub = aRef->attr()->owner();
- if (updateObject(aSub)) {
- aMustbeUpdated = true;
- }
- }
- }
- // lists of references
- aRefs = theFeature->data()->attributes(ModelAPI_AttributeRefList::type());
- for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
- list<ObjectPtr> aListRef = boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*aRefsIter)
- ->list();
- list<ObjectPtr>::iterator aListIter = aListRef.begin();
- for (; aListIter != aListRef.end(); aListIter++) {
- boost::shared_ptr<ModelAPI_Object> aSub = *aListIter;
- if (updateObject(aSub)) {
- aMustbeUpdated = true;
- }
- }
- }
- // selection attributes: must be called "update" methods if needed
- aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelection::type());
- for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_AttributeSelection> aSel =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
- if (updateObject(aSel->context())) {
- aMustbeUpdated = true;
- // aSel->update(); // this must be done on execution since it may be long operation
- }
- }
- // lists of selection attributes: must be called "update" methods if needed
- aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelectionList::type());
- for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
- for(int a = aSel->size() - 1; a >= 0; a--) {
- if (updateObject(aSel->value(a)->context())) {
+ // check all references: if referenced objects are updated, this object also must be updated
+ std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
+ boost::shared_ptr<Model_Data> aData =
+ boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
+ aData->referencesToObjects(aRefs);
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator aRef = aRefs.begin();
+ for(; aRef != aRefs.end(); aRef++) {
+ std::list<ObjectPtr>::iterator aRefObj = aRef->second.begin();
+ for(; aRefObj != aRef->second.end(); aRefObj++) {
+ if (updateObject(*aRefObj)) {
aMustbeUpdated = true;
}
}
!theFeature->isPersistentResult() /* execute quick, not persistent results */)
{
// before execution update the selection attributes if any
- aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelection::type());
- for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
+ list<AttributePtr> aRefs =
+ theFeature->data()->attributes(ModelAPI_AttributeSelection::type());
+ list<AttributePtr>::iterator aRefsIter = aRefs.begin();
+ for (; aRefsIter != aRefs.end(); aRefsIter++) {
boost::shared_ptr<ModelAPI_AttributeSelection> aSel =
boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
aSel->update(); // this must be done on execution since it may be long operation
virtual boost::shared_ptr<ModelAPI_Feature> feature(
const boost::shared_ptr<ModelAPI_Result>& theResult) = 0;
- ///! Reutrns true is result was conecaled because of usage it by other object
- virtual bool isConcealed(const boost::shared_ptr<ModelAPI_Object>& theResult) = 0;
-
protected:
/// Only for SWIG wrapping it is here
MODELAPI_EXPORT ModelAPI_Document()
/// To use virtuality for destructors
virtual ~ModelAPI_Object() {}
+
protected:
/// Sets the data manager of an object (document does)
virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
*/
class ModelAPI_Result : public ModelAPI_Object
{
+ bool myIsConcealed; ///< the result is concealed from the data tree (referenced by other objects)
public:
- /// Returns the source feature of this result
- //virtual boost::shared_ptr<ModelAPI_Feature> owner() = 0;
+ /// Returns true if the result is concealed from the data tree (referenced by other objects)
+ inline bool isConcealed() {return myIsConcealed;}
+
+ /// Returns true if the result is concealed from the data tree (referenced by other objects)
+ inline void setIsConcealed(const bool theValue) {myIsConcealed = theValue;}
+
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Result()
+ {
+ }
- /// Returns the group identifier of this result
- //virtual std::string groupName() = 0;
};
//! Pointer on feature object
/// Returns the shape-result produced by this feature
virtual boost::shared_ptr<GeomAPI_Shape> shape() = 0;
- /// To virtually destroy the fields of successors
- virtual ~ModelAPI_ResultBody()
- {
- }
-
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
virtual void generated(
const boost::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
protected:
- /// Use plugin manager for features creation: this method is
- /// defined here only for SWIG-wrapping
- ModelAPI_ResultBody()
- {
- }
};
//! Pointer on feature object
QIntList aModes;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObj = (*aIt);
- if (!aObj->data() || !aObj->data()->isValid() || aObj->document()->isConcealed(aObj))
+ bool aHide = !aObj->data() || !aObj->data()->isValid();
+ if (!aHide) { // check that this is not hidden result
+ ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ aHide = aRes && aRes->isConcealed();
+ }
+ if (aHide)
myDisplayer->erase(aObj, false);
else {
if (myDisplayer->isVisible(aObj)) {
// it doesn't stored in the operation mgr and doesn't displayed
} else if (myOperationMgr->hasOperation()) {
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
- if (!(*aIt)->document()->isConcealed(*aIt) &&
- aOperation->hasObject(*aIt)) { // Display only current operation results
+ if (aOperation->hasObject(*aIt)) { // Display only current operation results
myDisplayer->display(*aIt, false);
isDisplayed = true;
}