From 85afcf29664dfb5bda0bc6239c8760d6e424b1f2 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 7 Nov 2016 16:22:13 +0300 Subject: [PATCH] Issue #1834: Fix length of lines --- src/Model/Model_AttributeDocRef.h | 3 +- src/Model/Model_AttributeRefAttrList.cpp | 3 +- src/Model/Model_AttributeRefList.cpp | 3 +- src/Model/Model_AttributeReference.cpp | 3 +- src/Model/Model_AttributeSelection.cpp | 46 ++++++++---- src/Model/Model_AttributeSelection.h | 3 +- src/Model/Model_AttributeSelectionList.cpp | 3 +- src/Model/Model_AttributeValidator.cpp | 6 +- src/Model/Model_BodyBuilder.cpp | 36 ++++++---- src/Model/Model_BodyBuilder.h | 20 ++++-- src/Model/Model_Data.cpp | 15 ++-- src/Model/Model_Data.h | 9 ++- src/Model/Model_Document.cpp | 84 ++++++++++++++-------- src/Model/Model_Document.h | 6 +- src/Model/Model_Objects.cpp | 56 ++++++++++----- src/Model/Model_Objects.h | 9 ++- src/Model/Model_ResultCompSolid.cpp | 3 +- src/Model/Model_ResultConstruction.h | 3 +- src/Model/Model_ResultPart.cpp | 9 ++- src/Model/Model_ResultPart.h | 9 ++- src/Model/Model_SelectionNaming.cpp | 40 +++++++---- src/Model/Model_SelectionNaming.h | 9 ++- src/Model/Model_Session.cpp | 12 ++-- src/Model/Model_Session.h | 7 +- src/Model/Model_Update.cpp | 68 ++++++++++++------ src/Model/Model_Update.h | 9 ++- src/Model/Model_Validator.cpp | 9 ++- src/ModelAPI/ModelAPI_Attribute.h | 3 +- src/ModelAPI/ModelAPI_AttributeDouble.h | 3 +- src/ModelAPI/ModelAPI_AttributeInteger.h | 3 +- src/ModelAPI/ModelAPI_BodyBuilder.h | 20 ++++-- src/ModelAPI/ModelAPI_CompositeFeature.h | 3 +- src/ModelAPI/ModelAPI_Data.h | 3 +- src/ModelAPI/ModelAPI_Document.h | 3 +- src/ModelAPI/ModelAPI_Events.cpp | 3 +- src/ModelAPI/ModelAPI_Events.h | 6 +- src/ModelAPI/ModelAPI_Expression.h | 3 +- src/ModelAPI/ModelAPI_Result.h | 4 +- src/ModelAPI/ModelAPI_ResultBody.cpp | 3 +- src/ModelAPI/ModelAPI_ResultBody.h | 6 +- src/ModelAPI/ModelAPI_Session.cpp | 3 +- src/ModelAPI/ModelAPI_Session.h | 3 +- src/ModelAPI/ModelAPI_Tools.cpp | 33 ++++++--- src/ModelAPI/ModelAPI_Tools.h | 4 +- 44 files changed, 392 insertions(+), 197 deletions(-) diff --git a/src/Model/Model_AttributeDocRef.h b/src/Model/Model_AttributeDocRef.h index d054fca8e..d6403fef8 100644 --- a/src/Model/Model_AttributeDocRef.h +++ b/src/Model/Model_AttributeDocRef.h @@ -19,7 +19,8 @@ class Model_AttributeDocRef : public ModelAPI_AttributeDocRef { - Handle(TDataStd_Integer) myID; ///< persistent and unique identifier of the document in the application + /// persistent and unique identifier of the document in the application + Handle(TDataStd_Integer) myID; public: /// Defines the document referenced from this attribute diff --git a/src/Model/Model_AttributeRefAttrList.cpp b/src/Model/Model_AttributeRefAttrList.cpp index e1ffa3b62..2b56f8b78 100755 --- a/src/Model/Model_AttributeRefAttrList.cpp +++ b/src/Model/Model_AttributeRefAttrList.cpp @@ -90,7 +90,8 @@ void Model_AttributeRefAttrList::remove(AttributePtr theAttr) TDF_ListIteratorOfLabelList aRefIter(aRefList); TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList); for (; aRefIter.More(); aRefIter.Next(), anIDIter.Next()) { - if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() || // append now only not removed + if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() || + // append now only not removed aRefIter.Value() != aTheObjLab || // append now only not removed (aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL)) { myRef->Append(aRefIter.Value()); diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index 9d6f25ff3..bb7a1dd26 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -129,7 +129,8 @@ int Model_AttributeRefList::size(const bool theWithEmpty) const bool Model_AttributeRefList::isInitialized() { - if (size(false) == 0) { // empty list is not initialized list: sketch will be not valid after add/undo + if (size(false) == 0) { + // empty list is not initialized list: sketch will be not valid after add/undo return false; } return ModelAPI_AttributeRefList::isInitialized(); diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index b17b72f87..0d502ded0 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -72,7 +72,8 @@ ObjectPtr Model_AttributeReference::value() if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) { std::shared_ptr aDR = std::dynamic_pointer_cast(aRefDoc); TDF_Label aRefLab; - TDF_Tool::Label(aDR->objects()->featuresLabel().Data(), anEntry->Get().ToCString(), aRefLab); + TDF_Tool::Label(aDR->objects()->featuresLabel().Data(), + anEntry->Get().ToCString(), aRefLab); if (!aRefLab.IsNull()) { return aDR->objects()->object(aRefLab); } diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 1ee049900..776460cba 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -193,7 +193,8 @@ std::shared_ptr Model_AttributeSelection::value() { GeomShapePtr aResult; if (myTmpContext.get() || myTmpSubShape.get()) { - ResultConstructionPtr aResulConstruction = std::dynamic_pointer_cast(myTmpContext); + ResultConstructionPtr aResulConstruction = + std::dynamic_pointer_cast(myTmpContext); if(aResulConstruction.get()) { // it is just reference to construction. return myTmpSubShape; @@ -212,7 +213,8 @@ std::shared_ptr Model_AttributeSelection::value() return aResult; // empty result return aContext->shape(); } - if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { // it is just reference to construction, nothing is in value + if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { + // it is just reference to construction, nothing is in value return aResult; // empty result } if (aSelLab.IsAttribute(kPART_REF_ID)) { @@ -270,7 +272,8 @@ bool Model_AttributeSelection::isInitialized() ResultPtr aContext = context(); return aContext.get() != NULL; } - if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { // it is just reference to construction, nothing is in value + if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { + // it is just reference to construction, nothing is in value return true; } @@ -359,7 +362,8 @@ TDF_LabelMap& Model_AttributeSelection::scope() } if (isGroup) aMePassed = false; bool isInScope = !aMePassed; - if (!isInScope && aComposite.get()) { // try to add sub-elements of composite if this is composite + if (!isInScope && aComposite.get()) { + // try to add sub-elements of composite if this is composite if (aComposite->isSub(*aFIter)) isInScope = true; } @@ -403,7 +407,8 @@ bool Model_AttributeSelection::update() if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape return setInvalidIfFalse(aSelLab, aContext->shape() && !aContext->shape()->isNull()); } - if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { // it is just reference to construction, not sub-shape + if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { + // it is just reference to construction, not sub-shape // if there is a sketch, the sketch-naming must be updated ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aContext); @@ -450,7 +455,8 @@ bool Model_AttributeSelection::update() anOldShape = aSelector.NamedShape()->Get(); } bool aResult = aSelector.Solve(scope()) == Standard_True; - aResult = setInvalidIfFalse(aSelLab, aResult); // must be before sending of updated attribute (1556) + // must be before sending of updated attribute (1556) + aResult = setInvalidIfFalse(aSelLab, aResult); TopoDS_Shape aNewShape; if (!aSelector.NamedShape().IsNull()) { aNewShape = aSelector.NamedShape()->Get(); @@ -488,7 +494,8 @@ bool Model_AttributeSelection::update() return setInvalidIfFalse(aSelLab, false); } - if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) { // compound is for the whole sketch selection + if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) { + // compound is for the whole sketch selection // If this is a wire with plane defined then it is a sketch-like object if (!aConstructionContext->facesNum()) // no faces, update can not work correctly return setInvalidIfFalse(aSelLab, false); @@ -498,7 +505,8 @@ bool Model_AttributeSelection::update() aNewSelected = aConstructionContext->face(0); } else { // searching for most looks-like initial face by the indexes // prepare edges of the current result for the fast searching - NCollection_DataMap allCurves; // curves and orientations of edges + // curves and orientations of edges + NCollection_DataMap allCurves; const int aSubNum = aComposite->numberOfSubs(); for(int a = 0; a < aSubNum; a++) { int aSubID = aComposite->subFeatureId(a); @@ -535,7 +543,9 @@ bool Model_AttributeSelection::update() setInvalidIfFalse(aSelLab, true); owner()->data()->sendAttributeUpdated(this); return true; - } else { // if the selection is not found, put the empty shape: it's better to have disappeared shape, than the old, the lost one + } else { + // if the selection is not found, put the empty shape: + // it's better to have disappeared shape, than the old, the lost one TNaming_Builder anEmptyBuilder(selectionLabel()); return setInvalidIfFalse(aSelLab, false); } @@ -643,9 +653,11 @@ void Model_AttributeSelection::selectBody( TDF_Label aSelLab = selectionLabel(); TopoDS_Shape aNewContext = aContext; bool isUpdated = true; - while(!aNewContext.IsNull() && isUpdated) { // searching for the very last shape that was produced from this one + while(!aNewContext.IsNull() && isUpdated) { + // searching for the very last shape that was produced from this one isUpdated = false; - if (!TNaming_Tool::HasLabel(aSelLab, aNewContext)) // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists + if (!TNaming_Tool::HasLabel(aSelLab, aNewContext)) + // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists break; for(TNaming_SameShapeIterator anIter(aNewContext, aSelLab); anIter.More(); anIter.Next()) { TDF_Label aNSLab = anIter.Label(); @@ -684,7 +696,8 @@ void Model_AttributeSelection::selectBody( } if (!isFound) { // sub-shape is not found in the up-to-date instance of the context shape setInvalidIfFalse(aSelLab, false); - Events_InfoMessage("Model_AttributeSelection", "Failed to select sub-shape already modified").send(); + Events_InfoMessage("Model_AttributeSelection", + "Failed to select sub-shape already modified").send(); return; } } @@ -707,7 +720,8 @@ void Model_AttributeSelection::selectBody( static void registerSubShape(TDF_Label theMainLabel, TopoDS_Shape theShape, const int theID, const FeaturePtr& theContextFeature, std::shared_ptr theDoc, std::map& theOrientations, - std::map& theSubNames, // name of sub-elements by ID to be exported instead of indexes + // name of sub-elements by ID to be exported instead of indexes + std::map& theSubNames, Handle(TDataStd_IntPackedMap) theRefs = Handle(TDataStd_IntPackedMap)(), const int theOrientation = 0) { @@ -887,7 +901,8 @@ bool Model_AttributeSelection::selectPart( return true; // postponed naming if (theUpdate) { Handle(TDataStd_Integer) anIndex; - if (selectionLabel().FindAttribute(TDataStd_Integer::GetID(), anIndex)) { // by internal selection + if (selectionLabel().FindAttribute(TDataStd_Integer::GetID(), anIndex)) { + // by internal selection if (anIndex->Get() > 0) { // update the selection by index return aPart->updateInPart(anIndex->Get()); @@ -1118,7 +1133,8 @@ void Model_AttributeSelection::updateInHistory() break; if (aModifierFeat == aThisFeature || aDoc->objects()->isLater(aModifierFeat, aThisFeature)) continue; // the modifier feature is later than this, so, should not be used - if (aCurrentModifierFeat == aModifierFeat || aDoc->objects()->isLater(aCurrentModifierFeat, aModifierFeat)) + if (aCurrentModifierFeat == aModifierFeat || + aDoc->objects()->isLater(aCurrentModifierFeat, aModifierFeat)) continue; // the current modifier is later than the found, so, useless Handle(TNaming_NamedShape) aNewNS; aModifIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNewNS); diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h index 720cfa79d..408680092 100644 --- a/src/Model/Model_AttributeSelection.h +++ b/src/Model/Model_AttributeSelection.h @@ -66,7 +66,8 @@ public: MODEL_EXPORT virtual void setId(int theID); /// Selects (i.e. creates Naming data structure) of sub-shape specifed by textual name - MODEL_EXPORT virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName); + MODEL_EXPORT virtual void selectSubShape(const std::string& theType, + const std::string& theSubShapeName); /// Returns true if attribute was initialized by some value MODEL_EXPORT virtual bool isInitialized(); diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 0e3943f93..4f9bfb710 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -157,7 +157,8 @@ static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { // for named shape copy exact shapes (in NamedShape Paste method the CopyTool is used) Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(anAttrIter.Value()); if (aNS.IsNull()) { - Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(); // no relocation, empty map + // no relocation, empty map + Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(); anAttrIter.Value()->Paste(aTargetAttr, aRelocTable); } else { CopyNS(aNS, aTargetAttr); diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index 09207089b..0f7c48082 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -44,7 +44,8 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, std::string anErrorMessage; for (int i = 0; i < 3; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]).append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n").append(aComponent[i]) + .append(": ").append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { theError = "Expression error: %1"; @@ -60,7 +61,8 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, std::string anErrorMessage; for (int i = 0; i < 2; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]).append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n").append(aComponent[i]) + .append(": ").append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { theError = "Expression error: %1"; diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index c8d20dbee..193014737 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -143,7 +143,8 @@ void Model_BodyBuilder::store(const std::shared_ptr& theShape, if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); if(!aName.empty()) { - std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); } } @@ -176,7 +177,8 @@ void Model_BodyBuilder::storeGenerated(const std::shared_ptr& the if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); if(!aName.empty()) { - std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); } } @@ -203,7 +205,8 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr& theO if (aShapeNew.IsNull()) return; // null shape inside aBuilder.Modify(aShapeOld, aShapeNew); - if (theDecomposeSolidsTag && aShapeNew.ShapeType() == TopAbs_COMPOUND) { // make sub elements as subs + if (theDecomposeSolidsTag && aShapeNew.ShapeType() == TopAbs_COMPOUND) { + // make sub elements as subs // register name if it is possible TCollection_AsciiString aName; @@ -227,9 +230,11 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr& theO if(!aName.IsEmpty()) { TCollection_AsciiString aShapeType = aShape.ShapeType() == TopAbs_EDGE ? "_Edge_" : aShape.ShapeType() == TopAbs_FACE ? "_Face_" : - aShape.ShapeType() == TopAbs_SOLID ? "_Solid_" : "_Shape_"; + aShape.ShapeType() == TopAbs_SOLID ? "_Solid_" : + "_Shape_"; std::string aSolidName = - (aName + aShapeType + TCollection_AsciiString(aTag - theDecomposeSolidsTag)).ToCString(); + (aName + aShapeType + TCollection_AsciiString(aTag - theDecomposeSolidsTag)) + .ToCString(); std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); aDoc->addNamingName(aSubBuilder.NamedShape()->Label(), aSolidName); @@ -241,7 +246,8 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr& theO if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); if(!aName.empty()) { - std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); } } @@ -395,7 +401,8 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( std::shared_ptr aRShape(new GeomAPI_Shape()); aRShape->setImpl((new TopoDS_Shape(aRoot))); theMS->modified(aRShape, aList); - std::list >::const_iterator anIt = aList.begin(), aLast = aList.end(); + std::list >::const_iterator + anIt = aList.begin(), aLast = aList.end(); for (; anIt != aLast; anIt++) { TopoDS_Shape aNewShape = (*anIt)->impl(); if (theSubShapes.isBound(*anIt)) { @@ -442,7 +449,8 @@ void Model_BodyBuilder::loadAndOrientGeneratedShapes ( std::shared_ptr aRShape(new GeomAPI_Shape()); aRShape->setImpl((new TopoDS_Shape(aRoot))); theMS->generated(aRShape, aList); - std::list >::const_iterator anIt = aList.begin(), aLast = aList.end(); + std::list >::const_iterator + anIt = aList.begin(), aLast = aList.end(); for (; anIt != aLast; anIt++) { TopoDS_Shape aNewShape = (*anIt)->impl(); if (theSubShapes.isBound(*anIt)) { @@ -456,15 +464,18 @@ void Model_BodyBuilder::loadAndOrientGeneratedShapes ( } TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType(); if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) { - TopAbs_ShapeEnum anExplodeShapeType = aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; + TopAbs_ShapeEnum anExplodeShapeType = + aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; const TDF_Label aLabel = builder(theTag)->NamedShape()->Label(); int aTag = 1; - std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(document()); for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) { TDF_Label aChildLabel = aLabel.FindChild(aTag); TNaming_Builder aBuilder(aChildLabel); aBuilder.Generated(aRoot, anExp.Current()); - TCollection_AsciiString aChildName = TCollection_AsciiString((theName + "_").c_str()) + aTag; + TCollection_AsciiString aChildName = + TCollection_AsciiString((theName + "_").c_str()) + aTag; TDataStd_Name::Set(aChildLabel, aChildName.ToCString()); aTag++; } @@ -766,7 +777,8 @@ void Model_BodyBuilder::loadDisconnectedEdges( } } -void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr theShape, const std::string& theName, int& theTag) +void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr theShape, + const std::string& theName, int& theTag) { if(theShape->isNull()) return; TopoDS_Shape aShape = theShape->impl(); diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index 0941d38b2..2b8a62990 100755 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -55,17 +55,19 @@ public: MODEL_EXPORT virtual void generated(const std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1); - /// Records the shape newShape which was generated from the shape oldShape during a topological + /// Records the shape newShape which was generated from the shape oldShape during a topological /// construction. As an example, consider the case of a face generated from an edge in /// construction of a prism. MODEL_EXPORT virtual void generated(const std::shared_ptr& theOldShape, - const std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1); + const std::shared_ptr& theNewShape, + const std::string& theName, const int theTag = 1); /// Records the shape newShape which is a modification of the shape oldShape. /// As an example, consider the case of a face split or merged in a Boolean operation. MODEL_EXPORT virtual void modified(const std::shared_ptr& theOldShape, - const std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1); + const std::shared_ptr& theNewShape, + const std::string& theName, const int theTag = 1); /// Records the shape oldShape which was deleted from the current label. /// As an example, consider the case of a face removed by a Boolean operation. @@ -96,13 +98,16 @@ public: GeomAPI_DataMapOfShapeShape& theSubShapes); /// Loads shapes of the first level (to be used during shape import) - MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr theShape, const std::string& theName, int& theTag); + MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr theShape, + const std::string& theName, int& theTag); /// Loads disconnected edges - MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr theShape, const std::string& theName, int& theTag); + MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr theShape, + const std::string& theName, int& theTag); /// Loads disconnected vetexes - MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr theShape, const std::string& theName, int& theTag); + MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr theShape, + const std::string& theName, int& theTag); /// Removes the stored builders MODEL_EXPORT virtual ~Model_BodyBuilder(); @@ -127,7 +132,8 @@ protected: private: /// Loads shapes of the next level (to be used during shape import) - void loadNextLevels(std::shared_ptr theShape, const std::string& theName, int& theTag); + void loadNextLevels(std::shared_ptr theShape, + const std::string& theName, int& theTag); /// builds name for the shape kept at the specified tag void buildName(const int theTag, const std::string& theName); diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 75c973242..9f69e4bdd 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -180,7 +180,8 @@ AttributePtr Model_Data::addAttribute(const std::string& theID, const std::strin anAttr->setObject(myObject); anAttr->setID(theID); } else { - Events_InfoMessage("Model_Data", "Can not create unknown type of attribute %1").arg(theAttrType).send(); + Events_InfoMessage("Model_Data", + "Can not create unknown type of attribute %1").arg(theAttrType).send(); } return aResult; } @@ -293,9 +294,11 @@ void Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSe { if (mySendAttributeUpdated == theBlock) { mySendAttributeUpdated = !theBlock; - if (mySendAttributeUpdated && !myWasChangedButBlocked.empty()) { // so, now it is ok to send the update signal + if (mySendAttributeUpdated && !myWasChangedButBlocked.empty()) { + // so, now it is ok to send the update signal if (theSendMessage) { - // make a copy to avoid iteration on modified list (may be cleared by attribute changed call) + // make a copy to avoid iteration on modified list + // (may be cleared by attribute changed call) std::list aWasChangedButBlocked = myWasChangedButBlocked; myWasChangedButBlocked.clear(); std::list::iterator aChangedIter = aWasChangedButBlocked.begin(); @@ -318,7 +321,8 @@ void Model_Data::erase() // remove in order to clear back references in other objects std::list > > aRefs; referencesToObjects(aRefs); - std::list > >::iterator anAttrIter = aRefs.begin(); + std::list > >::iterator + anAttrIter = aRefs.begin(); for(; anAttrIter != aRefs.end(); anAttrIter++) { std::list::iterator aReferenced = anAttrIter->second.begin(); for(; aReferenced != anAttrIter->second.end(); aReferenced++) { @@ -518,7 +522,8 @@ std::list findVariables(const std::set& thePara const std::string& aName = *aParamIt; double aValue; ResultParameterPtr aParam; - // theSearcher is not needed here: in expressions of features the parameters history is not needed + // theSearcher is not needed here: in expressions + // of features the parameters history is not needed if (ModelAPI_Tools::findVariable(FeaturePtr(), aName, aValue, aParam)) aResult.push_back(aParam); } diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index 8582c5c9b..c41f1a5ab 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -89,7 +89,8 @@ class Model_Data : public ModelAPI_Data /// Returns the attribute that contains real value with double precision MODEL_EXPORT virtual std::shared_ptr real(const std::string& theID); /// Returns the attribute that contains double values array - MODEL_EXPORT virtual std::shared_ptr realArray(const std::string& theID); + MODEL_EXPORT virtual + std::shared_ptr realArray(const std::string& theID); /// Returns the attribute that contains integer value MODEL_EXPORT virtual std::shared_ptr integer(const std::string& theID); @@ -160,7 +161,8 @@ class Model_Data : public ModelAPI_Data MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr); /// Blocks sending "attribute updated" if theBlock is true /// \param theBlock allows switching on/off the blocking state - /// \param theSendMessage if false, it does not send the update message even if something is changed + /// \param theSendMessage if false, it does not send the update message + /// even if something is changed /// (normally is it used in attributeChanged because this message will be sent anyway) MODEL_EXPORT virtual void blockSendAttributeUpdated( const bool theBlock, const bool theSendMessage = true); @@ -199,7 +201,8 @@ class Model_Data : public ModelAPI_Data MODEL_EXPORT virtual const std::set& refsToMe() {return myRefsToMe;} /// returns all references by attributes of this data - /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects + /// \param theRefs returned list of pairs: + /// id of referenced attribute and list of referenced objects MODEL_EXPORT virtual void referencesToObjects( std::list > >& theRefs); diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 5cc809c11..a72221515 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -66,7 +66,8 @@ static const int UNDO_LIMIT = 1000; // number of possible undo operations (big static const int TAG_GENERAL = 1; // general properties tag // general sub-labels -static const int TAG_CURRENT_FEATURE = 1; ///< where the reference to the current feature label is located (or no attribute if null feature) +/// where the reference to the current feature label is located (or no attribute if null feature) +static const int TAG_CURRENT_FEATURE = 1; 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 @@ -145,10 +146,12 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum "Can not open document: already opened and modified").send(); break; case PCDM_RS_NoDriver: - Events_InfoMessage("Model_Document", "Can not open document: driver library is not found").send(); + Events_InfoMessage("Model_Document", + "Can not open document: driver library is not found").send(); break; case PCDM_RS_UnknownFileDriver: - Events_InfoMessage("Model_Document", "Can not open document: unknown driver for opening").send(); + Events_InfoMessage("Model_Document", + "Can not open document: unknown driver for opening").send(); break; case PCDM_RS_OpenError: Events_InfoMessage("Model_Document", "Can not open document: file open error").send(); @@ -169,7 +172,8 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum Events_InfoMessage("Model_Document", "Can not open document: invalid object").send(); break; case PCDM_RS_UnrecognizedFileFormat: - Events_InfoMessage("Model_Document", "Can not open document: unrecognized file format").send(); + Events_InfoMessage("Model_Document", + "Can not open document: unrecognized file format").send(); break; case PCDM_RS_MakeFailure: Events_InfoMessage("Model_Document", "Can not open document: make failure").send(); @@ -247,7 +251,8 @@ bool Model_Document::save( if (!isDone) { switch (aStatus) { case PCDM_SS_DriverFailure: - Events_InfoMessage("Model_Document", "Can not save document: save driver-library failure").send(); + Events_InfoMessage("Model_Document", + "Can not save document: save driver-library failure").send(); break; case PCDM_SS_WriteFailure: Events_InfoMessage("Model_Document", "Can not save document: file writing failure").send(); @@ -338,7 +343,8 @@ void Model_Document::startOperation() { incrementTransactionID(); // outside of transaction in order to avoid empty transactions keeping if (myDoc->HasOpenCommand()) { // start of nested command - if (myDoc->CommitCommand()) { // commit the current: it will contain all nested after compactification + if (myDoc->CommitCommand()) { + // commit the current: it will contain all nested after compactification myTransactions.rbegin()->myOCAFNum++; // if has open command, the list is not empty } myNestedNum.push_back(0); // start of nested operation with zero transactions inside yet @@ -480,8 +486,9 @@ static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) { if (isEqualContent(anADelta->Attribute(), aCurrentAttr)) { continue; // attribute is not changed actually } - } else if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), TDataStd_AsciiString::GetID())) { - continue; // error message is disappeared + } else + if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), TDataStd_AsciiString::GetID())) { + continue; // error message is disappeared } } } @@ -496,7 +503,8 @@ bool Model_Document::finishOperation() static std::shared_ptr aSession = std::static_pointer_cast(Model_Session::get()); - // open transaction if nested is closed to fit inside all synchronizeBackRefs and flushed consequences + // open transaction if nested is closed to fit inside + // all synchronizeBackRefs and flushed consequences if (isNestedClosed) { myDoc->OpenCommand(); } @@ -547,7 +555,8 @@ bool Model_Document::finishOperation() aResult = true; // transaction may be empty if this document was created during this transaction (create part) - if (!myTransactions.empty() && myDoc->CommitCommand()) { // if commit is successfull, just increment counters + if (!myTransactions.empty() && myDoc->CommitCommand()) { + // if commit is successfull, just increment counters if (isEmptyTransaction(myDoc)) { // erase this transaction myDoc->Undo(); myDoc->ClearRedos(); @@ -593,14 +602,18 @@ static void modifiedLabels(const Handle(TDocStd_Document)& theDoc, TDF_LabelList } // add also label of the modified attributes const TDF_AttributeDeltaList& anAttrs = aDelta->AttributeDeltas(); - TDF_LabelMap anExcludedInt; /// named shape evolution also modifies integer on this label: exclude it + /// named shape evolution also modifies integer on this label: exclude it + TDF_LabelMap anExcludedInt; for (TDF_ListIteratorOfAttributeDeltaList anAttr(anAttrs); anAttr.More(); anAttr.Next()) { if (anAttr.Value()->Attribute()->ID() == TDataStd_BooleanArray::GetID()) { - continue; // Boolean array is used for feature auxiliary attributes only, feature args are not modified + // Boolean array is used for feature auxiliary attributes only, feature args are not modified + continue; } if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) { anExcludedInt.Add(anAttr.Value()->Label()); - continue; // named shape evolution is changed in history update => skip them, they are not the features arguents + // named shape evolution is changed in history update => skip them, + // they are not the features arguents + continue; } if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) { if (anExcludedInt.Contains(anAttr.Value()->Label())) @@ -680,7 +693,8 @@ bool Model_Document::canUndo() // issue 406 : if transaction is opened, but nothing to undo behind, can not undo int aCurrentNum = isOperation() ? 1 : 0; if (myDoc->GetAvailableUndos() > 0 && - (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) && // there is something to undo in nested + // there is something to undo in nested + (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) && myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */) return true; // check other subs contains operation that can be undoed @@ -887,8 +901,10 @@ void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis) if (aCurrentUp) { setCurrentFeatureUp(); } - // if user adds after high-level feature with nested, add it after all nested (otherwise the nested will be disabled) - CompositeFeaturePtr aCompositeAfter = std::dynamic_pointer_cast(theAfterThis); + // if user adds after high-level feature with nested, + // add it after all nested (otherwise the nested will be disabled) + CompositeFeaturePtr aCompositeAfter = + std::dynamic_pointer_cast(theAfterThis); if (aCompositeAfter.get()) { FeaturePtr aSub = aCompositeAfter; do { @@ -1007,7 +1023,8 @@ void Model_Document::setCurrentFeature( } } - if (theVisible && !theCurrent.get()) { // needed to avoid disabling of PartSet initial constructions + if (theVisible && !theCurrent.get()) { + // needed to avoid disabling of PartSet initial constructions FeaturePtr aNext = theCurrent.get() ? myObjs->nextFeature(theCurrent) : myObjs->firstFeature(); for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent)) { @@ -1035,7 +1052,8 @@ void Model_Document::setCurrentFeature( } else { // remove reference for the null feature aRefLab.ForgetAttribute(TDF_Reference::GetID()); } - // make all features after this feature disabled in reversed order (to remove results without deps) + // make all features after this feature disabled in reversed order + // (to remove results without deps) static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); bool aPassed = false; // flag that the current object is already passed in cycle @@ -1050,15 +1068,18 @@ void Model_Document::setCurrentFeature( if (aMain.get()) { if (isSub(aMain, anIter)) // sub-elements of not-disabled feature are not disabled aDisabledFlag = false; - else if (anOwners.find(anIter) != anOwners.end()) // disable the higher-level feature is the nested is the current + else if (anOwners.find(anIter) != anOwners.end()) + // disable the higher-level feature is the nested is the current aDisabledFlag = true; } - if (anIter->getKind() == "Parameter") {// parameters are always out of the history of features, but not parameters + if (anIter->getKind() == "Parameter") { + // parameters are always out of the history of features, but not parameters // due to the issue 1491 all parameters are kept enabled any time //if (!isCurrentParameter) aDisabledFlag = false; - } else if (isCurrentParameter) { // if paramater is active, all other features become enabled (issue 1307) + } else if (isCurrentParameter) { + // if paramater is active, all other features become enabled (issue 1307) aDisabledFlag = false; } @@ -1066,7 +1087,8 @@ void Model_Document::setCurrentFeature( static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); // state of feature is changed => so inform that it must be updated if it has such state if (!aDisabledFlag && - (anIter->data()->execState() == ModelAPI_StateMustBeUpdated || anIter->data()->execState() == ModelAPI_StateInvalidArgument)) + (anIter->data()->execState() == ModelAPI_StateMustBeUpdated || + anIter->data()->execState() == ModelAPI_StateInvalidArgument)) ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent); // flush is in the end of this method ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/); @@ -1102,7 +1124,8 @@ void Model_Document::setCurrentFeatureUp() // make the higher level composite as current (sketch becomes disabled if line is enabled) if (aPrev.get()) { FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev); - // without cycle (issue 1555): otherwise extrusion fuse will be enabled and displayed whaen inside sketch + // without cycle (issue 1555): otherwise extrusion fuse + // will be enabled and displayed whaen inside sketch if (aComp.get()) aPrev = aComp; } @@ -1374,20 +1397,23 @@ static Handle(TNaming_NamedShape) searchForOriginalShape(TopoDS_Shape theShape, while(!theShape.IsNull()) { // searching for the very initial shape that produces this one TopoDS_Shape aShape = theShape; theShape.Nullify(); - if (!TNaming_Tool::HasLabel(aMain, aShape)) // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists + // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists + if (!TNaming_Tool::HasLabel(aMain, aShape)) break; for(TNaming_SameShapeIterator anIter(aShape, aMain); anIter.More(); anIter.Next()) { TDF_Label aNSLab = anIter.Label(); Handle(TNaming_NamedShape) aNS; if (aNSLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) { - if (aShapesIter.Evolution() == TNaming_SELECTED || aShapesIter.Evolution() == TNaming_DELETE) + if (aShapesIter.Evolution() == TNaming_SELECTED || + aShapesIter.Evolution() == TNaming_DELETE) continue; // don't use the selection evolution if (aShapesIter.NewShape().IsSame(aShape)) { // found the original shape aResult = aNS; if (aResult->Evolution() == TNaming_MODIFY) theShape = aShapesIter.OldShape(); - if (!theShape.IsNull()) // otherwise may me searching for another item of this shape with longer history + // otherwise may me searching for another item of this shape with longer history + if (!theShape.IsNull()) break; } } @@ -1445,7 +1471,8 @@ std::shared_ptr Model_Document::producedByFeature( aCandidatInThis = aNS; if (aCandidatInThis->Evolution() == TNaming_MODIFY) anOldShape = aShapesIter.OldShape(); - if (!anOldShape.IsNull()) // otherwise may me searching for another item of this shape with longer history + // otherwise may me searching for another item of this shape with longer history + if (!anOldShape.IsNull()) break; } // check that the shape contains aShape as sub-shape to fill container @@ -1469,7 +1496,8 @@ std::shared_ptr Model_Document::producedByFeature( } } if (aCandidatInThis.IsNull()) { - // to fix 1512: searching for original shape of this shape if modification of it is not in this result + // to fix 1512: searching for original shape of this shape + // if modification of it is not in this result aCandidatInThis = searchForOriginalShape(aShape, myDoc->Main()); if (aCandidatInThis.IsNull()) { if (aCandidatContainer.IsNull()) diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 46ffb4c86..5cedc56a3 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -52,7 +52,8 @@ class Model_Document : public ModelAPI_Document const char* theDirName, const char* theFileName, std::list& theResults); //! Removes document data - //! \param theForever if it is false, document is just hiden (to keep possibility make it back on Undo/Redo) + //! \param theForever if it is false, document is just hiden + //! (to keep possibility make it back on Undo/Redo) MODEL_EXPORT virtual void close(const bool theForever = false); //! Starts a new operation (opens a tansaction) @@ -272,7 +273,8 @@ class Model_Document : public ModelAPI_Document //! Returns true if this document is currently active virtual bool isActive() const; - //! Returns the selection attribute that is used for calculation of selection externally from the document + //! Returns the selection attribute that is used + //! for calculation of selection externally from the document std::shared_ptr selectionInPartFeature(); friend class Model_Application; diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 0b7678a5d..1f14f1e00 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -353,7 +353,8 @@ void Model_Objects::createHistory(const std::string& theGroupID) for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) { - // if feature is in sub-component, remove it from history: it is in sub-tree of sub-component + // if feature is in sub-component, remove it from history: + // it is in sub-tree of sub-component bool isSub = ModelAPI_Tools::compositeOwner(aFeature).get() != NULL; if (isFeature) { // here may be also disabled features if (!isSub && aFeature->isInHistory()) { @@ -364,7 +365,8 @@ void Model_Objects::createHistory(const std::string& theGroupID) if (!isSub || theGroupID != ModelAPI_ResultConstruction::group()) { // do not use reference to the list here since results can be changed by "isConcealed" const std::list > aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.begin(); + std::list >::const_iterator + aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes->groupName() != theGroupID) break; // feature have only same group results @@ -474,7 +476,8 @@ std::shared_ptr Model_Objects::objectByName( if (aRIter->get() && (*aRIter)->groupName() == theGroupID) { if ((*aRIter)->data()->name() == theName) return *aRIter; - ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast(*aRIter); + ResultCompSolidPtr aCompRes = + std::dynamic_pointer_cast(*aRIter); if (aCompRes.get()) { int aNumSubs = aCompRes->numberOfSubs(); for(int a = 0; a < aNumSubs; a++) { @@ -645,7 +648,8 @@ void Model_Objects::synchronizeFeatures( aFeature = std::dynamic_pointer_cast(ModelAPI_Session::get())->createFeature( TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get()) .ToCString(), anOwner); - if (!aFeature.get()) { // somethig is wrong, most probably, the opened document has invalid structure + if (!aFeature.get()) { + // somethig is wrong, most probably, the opened document has invalid structure Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send(); aLabIter.Value()->Label().ForgetAllAttributes(); continue; @@ -664,13 +668,15 @@ void Model_Objects::synchronizeFeatures( aKeptFeatures.insert(aFeature); if (anUpdatedMap.Contains(aFeatureLabel)) { if (!theOpen) { // on abort/undo/redo reinitialize attributes is something is changed - std::list > anAttrs = aFeature->data()->attributes(""); + std::list > anAttrs = + aFeature->data()->attributes(""); std::list >::iterator anAttr = anAttrs.begin(); for(; anAttr != anAttrs.end(); anAttr++) (*anAttr)->reinit(); } ModelAPI_EventCreator::get()->sendUpdated(aFeature, anUpdateEvent); - if (aFeature->getKind() == "Parameter") { // if parameters are changed, update the results (issue 937) + if (aFeature->getKind() == "Parameter") { + // if parameters are changed, update the results (issue 937) const std::list >& aResults = aFeature->results(); std::list >::const_iterator aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { @@ -700,7 +706,8 @@ void Model_Objects::synchronizeFeatures( updateHistory(aFeature); aFeature->erase(); - // unbind after the "erase" call: on abort sketch is removes sub-objects that corrupts aFIter + // unbind after the "erase" call: on abort sketch + // is removes sub-objects that corrupts aFIter myFeatures.UnBind(aFIter.Key()); // reinitialize iterator because unbind may corrupt the previous order in the map aFIter.Initialize(myFeatures); @@ -711,8 +718,10 @@ void Model_Objects::synchronizeFeatures( if (theUpdateReferences) { synchronizeBackRefs(); } - // update results of the features (after features created because they may be connected, like sketch and sub elements) - // After synchronisation of back references because sketch must be set in sub-elements before "execute" by updateResults + // update results of the features (after features created because + // they may be connected, like sketch and sub elements) + // After synchronisation of back references because sketch + // must be set in sub-elements before "execute" by updateResults std::list aComposites; // composites must be updated after their subs (issue 360) TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID()); for (; aLabIter2.More(); aLabIter2.Next()) { @@ -730,11 +739,13 @@ void Model_Objects::synchronizeFeatures( updateResults(*aComposite); } - // the synchronize should be done after updateResults in order to correct back references of updated results + // the synchronize should be done after updateResults + // in order to correct back references of updated results if (theUpdateReferences) { synchronizeBackRefs(); } - if (!theUpdated.IsEmpty()) { // this means there is no control what was modified => remove history cash + if (!theUpdated.IsEmpty()) { + // this means there is no control what was modified => remove history cash myHistory.clear(); } @@ -744,7 +755,8 @@ void Model_Objects::synchronizeFeatures( if (theFlush) { aLoop->flush(aDeleteEvent); - aLoop->flush(aCreateEvent); // delete should be emitted before create to reacts to aborted feature + // delete should be emitted before create to reacts to aborted feature + aLoop->flush(aCreateEvent); aLoop->flush(anUpdateEvent); aLoop->flush(aCreateEvent); // after update of features, there could be results created aLoop->flush(aDeleteEvent); // or deleted @@ -774,14 +786,16 @@ void Model_Objects::synchronizeBackRefsForObject(const std::set& t std::set::iterator aCurrentIter = aData->refsToMe().begin(); while(aCurrentIter != aData->refsToMe().end()) { if (theNewRefs.find(*aCurrentIter) == theNewRefs.end()) { - // for external references from other documents this system is not working: refs are collected from - // different Model_Objects, so before remove check this external object exists and still referenced + // for external references from other documents this system + // is not working: refs are collected from + // different Model_Objects, so before remove check this + // external object exists and still referenced bool aLeaveIt = false; if ((*aCurrentIter)->owner().get() && (*aCurrentIter)->owner()->document() != myDoc && (*aCurrentIter)->owner()->data().get() && (*aCurrentIter)->owner()->data()->isValid()) { std::list > > > aRefs; (*aCurrentIter)->owner()->data()->referencesToObjects(aRefs); - std::list > > >::iterator + std::list >>>::iterator aRefIter = aRefs.begin(); for(; aRefIter != aRefs.end(); aRefIter++) { if ((*aCurrentIter)->id() == aRefIter->first) { @@ -869,7 +883,8 @@ void Model_Objects::synchronizeBackRefs() (*aRIter)->isConcealed(); } } - // the rest all refs means that feature references to the external document feature: process also them + // the rest all refs means that feature references to the external document feature: + // process also them std::map >::iterator anExtIter = allRefs.begin(); for(; anExtIter != allRefs.end(); anExtIter++) { synchronizeBackRefsForObject(anExtIter->second, anExtIter->first); @@ -891,10 +906,12 @@ void Model_Objects::storeResult(std::shared_ptr theFeatureData, theResult->init(); theResult->setDoc(myDoc); initData(theResult, resultLabel(theFeatureData, theResultIndex), TAG_FEATURE_ARGUMENTS); - if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name + if (theResult->data()->name().empty()) { + // if was not initialized, generate event and set a name std::stringstream aNewName; aNewName<name(); - // if there are several results (issue #899: any number of result), add unique prefix starting from second + // if there are several results (issue #899: any number of result), + // add unique prefix starting from second if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group()) aNewName<<"_"<data()->setName(aNewName.str()); @@ -1081,7 +1098,8 @@ void Model_Objects::updateResults(FeaturePtr theFeature) std::shared_ptr aNewP = createPart(theFeature->data(), aResIndex); theFeature->setResult(aNewP, aResIndex); if (!aNewP->partDoc().get()) - theFeature->execute(); // create the part result: it is better to restore the previous result if it is possible + // create the part result: it is better to restore the previous result if it is possible + theFeature->execute(); break; } else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) { theFeature->execute(); // construction shapes are needed for sketch solver diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index 9cca88649..86cf46e34 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -87,7 +87,8 @@ class Model_Objects //! Returns the number of features in the group int size(const std::string& theGroupID); - ///! Returns all (and disabled) results of the given type. Not fast method (iterates all features). + //! Returns all (and disabled) results of the given type. + //! Not fast method (iterates all features). void allResults(const std::string& theGroupID, std::list& theResults); //! Returns the number of all features: in the history or not @@ -157,13 +158,15 @@ class Model_Objects //! Initializes the data fields of the feature void initData(ObjectPtr theObj, TDF_Label theLab, const int theTag); - //! Allows to store the result in the data tree of the document (attaches 'data' of result to tree) + //! Allows to store the result in the data tree of the document + //! (attaches 'data' of result to tree) void storeResult(std::shared_ptr theFeatureData, std::shared_ptr theResult, const int theResultIndex = 0); //! returns the label of result by index; creates this label if it was not created before - TDF_Label resultLabel(const std::shared_ptr& theFeatureData, const int theResultIndex); + TDF_Label resultLabel(const std::shared_ptr& theFeatureData, + const int theResultIndex); //! Updates the results list of the feature basing on the current data tree void updateResults(FeaturePtr theFeature); diff --git a/src/Model/Model_ResultCompSolid.cpp b/src/Model/Model_ResultCompSolid.cpp index 823001cd6..687b0ea08 100755 --- a/src/Model/Model_ResultCompSolid.cpp +++ b/src/Model/Model_ResultCompSolid.cpp @@ -79,7 +79,8 @@ void Model_ResultCompSolid::colorConfigInfo(std::string& theSection, std::string theDefault = DEFAULT_COLOR(); } -bool Model_ResultCompSolid::setDisabled(std::shared_ptr theThis, const bool theFlag) +bool Model_ResultCompSolid::setDisabled(std::shared_ptr theThis, + const bool theFlag) { bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag); if (aChanged) { // state is changed, so modifications are needed diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index 837add0fb..151d8a46a 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -23,7 +23,8 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction std::shared_ptr myOwner; ///< owner of this result std::shared_ptr myShape; ///< shape of this result created "on the fly" bool myFacesUpToDate; ///< is true if faces in myuFaces are computed and up to date - std::vector > myFaces; ///< stores the up to date faces if they exist + /// stores the up to date faces if they exist + std::vector > myFaces; bool myIsInHistory; bool myIsInfinite; public: diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 105a9c1a0..0a4422ad1 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -27,7 +27,8 @@ #include #include -#define baseRef() std::dynamic_pointer_cast(data()->reference(BASE_REF_ID())->value()) +#define baseRef() \ + std::dynamic_pointer_cast(data()->reference(BASE_REF_ID())->value()) void Model_ResultPart::initAttributes() { @@ -68,7 +69,8 @@ void Model_ResultPart::activate() // activation may cause changes in current features in document, so it must be in transaction bool isNewTransaction = false; SessionPtr aMgr = ModelAPI_Session::get(); - if (!aMgr->isOperation()) { // open transaction even document is not created to set current docs in setActiveDocument + if (!aMgr->isOperation()) { + // open transaction even document is not created to set current docs in setActiveDocument aMgr->startOperation("Activation"); isNewTransaction = true; } @@ -242,7 +244,8 @@ std::string Model_ResultPart::nameInPart(const std::shared_ptr& t if (!aDoc.get()) // the part document is not presented for the moment return ""; TDF_Label anAccessLabel = aDoc->generalLabel(); - // make the selection attribute anyway: otherwise just by name it is not stable to search the result + // make the selection attribute anyway: + // otherwise just by name it is not stable to search the result std::string aName; // for this the context result is needed ResultPtr aContext; diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index e42df61e8..fabaacab5 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -21,11 +21,14 @@ */ class Model_ResultPart : public ModelAPI_ResultPart { - TopoDS_Shape myShape; ///< shape of this part created from bodies (updated only of Part deactivation) - std::shared_ptr myTrsf; ///< if it is just copy of original shape, keep just transformation + /// shape of this part created from bodies (updated only of Part deactivation) + TopoDS_Shape myShape; + /// if it is just copy of original shape, keep just transformation + std::shared_ptr myTrsf; public: - /// the reference to the base result document, may be null if this is the root, others make sequence of references + /// the reference to the base result document, may be null if this is the root, + /// others make sequence of references inline static const std::string& BASE_REF_ID() { static const std::string MY_BASE_REF("BaseReference"); diff --git a/src/Model/Model_SelectionNaming.cpp b/src/Model/Model_SelectionNaming.cpp index 52cfed613..a433e9960 100644 --- a/src/Model/Model_SelectionNaming.cpp +++ b/src/Model/Model_SelectionNaming.cpp @@ -52,8 +52,10 @@ std::string Model_SelectionNaming::getShapeName( ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext) { std::string aName; - // add the result name to the name of the shape (it was in BodyBuilder, but did not work on Result rename) - bool isNeedContextName = theContext->shape().get() != NULL;// && !theContext->shape()->isEqual(theSubSh); + // add the result name to the name of the shape + // (it was in BodyBuilder, but did not work on Result rename) + bool isNeedContextName = theContext->shape().get() != NULL; + // && !theContext->shape()->isEqual(theSubSh); // check if the subShape is already in DF Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theShape, myLab); Handle(TDataStd_Name) anAttr; @@ -65,7 +67,8 @@ std::string Model_SelectionNaming::getShapeName( // do nothing because this context name will be added later in this method } else { aName = TCollection_AsciiString(anAttr->Get()).ToCString(); - // indexes are added to sub-shapes not primitives (primitives must not be located at the same label) + // indexes are added to sub-shapes not primitives + // (primitives must not be located at the same label) if(!aName.empty() && aNS->Evolution() != TNaming_PRIMITIVE && isNeedContextName) { const TDF_Label& aLabel = aNS->Label();//theDoc->findNamingName(aName); static const std::string aPostFix("_"); @@ -161,7 +164,8 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext, break; case TopAbs_EDGE: { - // name structure: F1 & F2 [& F3 & F4], where F1 & F2 the faces which gives the Edge in trivial case + // name structure: F1 & F2 [& F3 & F4], + // where F1 & F2 the faces which gives the Edge in trivial case // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces if (BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) { aName = "Degenerated_Edge"; @@ -216,7 +220,8 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext, case TopAbs_VERTEX: // name structure (Monifold Topology): // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case. - // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition, but it should be kept as is to obtain safe recomputation + // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition, + // but it should be kept as is to obtain safe recomputation // 2) F1 | F2 - intersection of 2 faces definses a vertex - applicable for case // when 1 faces is cylindrical, conical, spherical or revolution and etc. // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell @@ -332,7 +337,8 @@ TopAbs_ShapeEnum translateType (const std::string& theType) } if (aShapeTypes.find(theType) != aShapeTypes.end()) return aShapeTypes[theType]; - Events_InfoMessage("Model_SelectionNaming", "Shape type defined in XML is not implemented!").send(); + Events_InfoMessage("Model_SelectionNaming", + "Shape type defined in XML is not implemented!").send(); return TopAbs_SHAPE; } @@ -645,7 +651,8 @@ std::string Model_SelectionNaming::shortName( aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end()); aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end()); aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end()); - // remove the last 's', 'e', 'f' and 'r' symbols: they are used as markers of start/end/forward/rewersed indicators + // remove the last 's', 'e', 'f' and 'r' symbols: + // they are used as markers of start/end/forward/rewersed indicators static const std::string aSyms("sefr"); std::string::iterator aSuffix = aName.end() - 1; while(aSyms.find(*aSuffix) != std::string::npos) { @@ -690,7 +697,8 @@ bool Model_SelectionNaming::selectSubShape(const std::string& theType, } } } - if (aDoc != theDoc) { // so, the first word is the document name => reduce the string for the next manips + if (aDoc != theDoc) { + // so, the first word is the document name => reduce the string for the next manips aSubShapeName = theSubShapeName.substr(aSlash + 1); if (aSubShapeName.empty() && aFoundPart.get()) { // the whole Part result theCont = aFoundPart; @@ -763,7 +771,8 @@ bool Model_SelectionNaming::selectSubShape(const std::string& theType, case TopAbs_SOLID: case TopAbs_SHELL: default: {//TopAbs_SHAPE - /// case when the whole sketch is selected, so, selection type is compound, but there is no value + /// case when the whole sketch is selected, so, + /// selection type is compound, but there is no value if (aCont.get() && aCont->shape().get()) { if (aCont->shape()->impl().ShapeType() == aType) { theCont = aCont; @@ -867,7 +876,8 @@ bool Model_SelectionNaming::selectSubShape(const std::string& theType, aType == TopAbs_FACE ? "Face" : "Wire", anIDs, true)) return false; - NCollection_DataMap allCurves; // curves and orientations of edges + // curves and orientations of edges + NCollection_DataMap allCurves; const int aSubNum = aComposite->numberOfSubs(); for(int a = 0; a < aSubNum; a++) { int aSubID = aComposite->subFeatureId(a); @@ -896,12 +906,14 @@ bool Model_SelectionNaming::selectSubShape(const std::string& theType, theShapeToBeSelected = aFoundFW; return true; } - } else if (aType == TopAbs_WIRE) { // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r" + } else if (aType == TopAbs_WIRE) { + // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r" std::map anIDs; if (!parseSubIndices(aComposite, aSubShapeName, "Wire", anIDs)) return false; - NCollection_DataMap allCurves; // curves and orientations of edges + // curves and orientations of edges + NCollection_DataMap allCurves; const int aSubNum = aComposite->numberOfSubs(); for(int a = 0; a < aSubNum; a++) { int aSubID = aComposite->subFeatureId(a); @@ -934,7 +946,9 @@ bool Model_SelectionNaming::selectSubShape(const std::string& theType, } } } - if (!aSelection.IsNull()) {// Select it (must be after N=0 checking, since for simple constructions the shape must be null) + if (!aSelection.IsNull()) { + // Select it (must be after N=0 checking, + // since for simple constructions the shape must be null) std::shared_ptr aShapeToBeSelected(new GeomAPI_Shape()); aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelection)); theShapeToBeSelected = aShapeToBeSelected; diff --git a/src/Model/Model_SelectionNaming.h b/src/Model/Model_SelectionNaming.h index 944dec588..f97e284fd 100644 --- a/src/Model/Model_SelectionNaming.h +++ b/src/Model/Model_SelectionNaming.h @@ -42,10 +42,13 @@ public: std::shared_ptr theDoc, std::shared_ptr& theShapeToBeSelected, std::shared_ptr& theCont); - /// Searches the face more appropriate to the given curves (with higher level of matched parameters) + /// Searches the face more appropriate to the given curves + /// (with higher level of matched parameters) /// \param theConstr construction result that contains one or several faces - /// \param theCurves map from the face edges curves to orientation (-1 reversed, 0 unknown, 1 forward) - /// \param theIsWire for wire algorithm isquite the same, but if in face several wires, it returns the needed wire + /// \param theCurves map from the face edges curves to orientation + /// (-1 reversed, 0 unknown, 1 forward) + /// \param theIsWire for wire algorithm isquite the same, + /// but if in face several wires, it returns the needed wire /// \returns faces fron this construction if found static std::shared_ptr findAppropriateFace( std::shared_ptr& theConstr, diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index ce6a26f9a..567dba4d4 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -175,10 +175,12 @@ FeaturePtr Model_Session::createFeature(string theFeatureID, Model_Document* the } return aCreated; } else { - Events_InfoMessage("Model_Session","Can not load plugin '%1'").arg(myCurrentPluginName).send(); + Events_InfoMessage("Model_Session", + "Can not load plugin '%1'").arg(myCurrentPluginName).send(); } } else { - Events_InfoMessage("Model_Session","Feature '%1' not found in any plugin").arg(theFeatureID).send(); + Events_InfoMessage("Model_Session", + "Feature '%1' not found in any plugin").arg(theFeatureID).send(); } return FeaturePtr(); // return nothing @@ -189,7 +191,8 @@ std::shared_ptr Model_Session::moduleDocument() Handle(Model_Application) anApp = Model_Application::getApplication(); bool aFirstCall = !anApp->hasRoot(); if (aFirstCall) { - // to be sure that plugins are loaded, even before the first "createFeature" call (in unit tests) + // to be sure that plugins are loaded, + // even before the first "createFeature" call (in unit tests) LoadPluginsInfo(); // creation of the root document is always outside of the transaction, so, avoid checking it setCheckTransactions(false); @@ -396,7 +399,8 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa } } else { // create/update/delete if (myCheckTransactions && !isOperation()) - Events_InfoMessage("Model_Session", "Modification of data structure outside of the transaction").send(); + Events_InfoMessage("Model_Session", + "Modification of data structure outside of the transaction").send(); // if part is deleted, make the root as the current document (on undo of Parts creations) static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); if (theMessage->eventID() == kDeletedEvent) { diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index f31928620..09a79a3d2 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -30,7 +30,9 @@ class Model_Session : public ModelAPI_Session, public Events_Listener std::map myPluginObjs; ///< instances of the already plugins std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently std::shared_ptr myCurrentDoc; ///< current working document - bool myCheckTransactions; ///< if true, generates error if document is updated outside of transaction + + /// if true, generates error if document is updated outside of transaction + bool myCheckTransactions; bool myOperationAttachedToNext; ///< the current operation must be committed twice, with nested public: @@ -50,7 +52,8 @@ class Model_Session : public ModelAPI_Session, public Events_Listener //! Starts a new operation (opens a transaction) //! \param theId string-identifier of the started transaction - //! \param theAttachedToNested if it is true, it means that this transaction is attached to the nested + //! \param theAttachedToNested if it is true, + //! it means that this transaction is attached to the nested //! where it is located and will be committed on the next commit with the nested MODEL_EXPORT virtual void startOperation( const std::string& theId = "", const bool theAttachedToNested = false); diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 24ef7055d..0f0fb1335 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -106,7 +106,8 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { // make it without conditions otherwise the apply button may have a bad state theFeature->data()->execState(ModelAPI_StateDone); static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); - aFactory->validate(theFeature); // need to be validated to update the "Apply" state if not previewed + // need to be validated to update the "Apply" state if not previewed + aFactory->validate(theFeature); // to redisplay split's arguments presentation, even result is not computed if (!theFeature->isPreviewNeeded()) { @@ -122,7 +123,8 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (myModified.find(theFeature) != myModified.end()) { if (theReason.get()) { #ifdef DEB_UPDATE - //std::cout<<"*** Add already modified "<name()<<" reason "<name()<name()<<" reason "<name()<name()<<" reason "<name()<name() + // <<" reason "<name()<name()<& theMessag std::dynamic_pointer_cast(theMessage); updateSelection(aMsg->objects()); } - // creation is added to "update" to avoid recomputation twice: on create and immediately after on update + // creation is added to "update" to avoid recomputation twice: + // on create and immediately after on update if (theMessage->eventID() == kCreatedEvent) { std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); @@ -244,7 +248,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag std::set::const_iterator anObjIter = anObjs.cbegin(); for(; anObjIter != anObjs.cend(); anObjIter++) { if (std::dynamic_pointer_cast((*anObjIter)->document())->executeFeatures()) { - if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) { // results creation means enabling, not update + if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) { + // results creation means enabling, not update ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent); } else { ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kRedisplayEvent); @@ -263,7 +268,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (!(*anObjIter)->data()->isValid()) continue; #ifdef DEB_UPDATE - std::cout<<">>> in event updated "<<(*anObjIter)->groupName()<<" "<<(*anObjIter)->data()->name()<>> in event updated "<<(*anObjIter)->groupName()<< + " "<<(*anObjIter)->data()->name()<groupName() == ModelAPI_ResultParameter::group()) { myIsParamUpdated = true; @@ -273,8 +279,10 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (anUpdated.get()) { if (addModified(anUpdated, FeaturePtr())) aSomeModified = true; - } else { // process the updated result as update of features that refers to this result - const std::set >& aRefs = (*anObjIter)->data()->refsToMe(); + } else { + // process the updated result as update of features that refers to this result + const std::set >& + aRefs = (*anObjIter)->data()->refsToMe(); std::set >::const_iterator aRefIter = aRefs.cbegin(); for(; aRefIter != aRefs.cend(); aRefIter++) { if (!(*aRefIter)->owner()->data()->isValid()) @@ -304,7 +312,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag addModified(*aFeature, FeaturePtr()); myIsFinish = false; } - myProcessOnFinish.clear(); // processed features must be only on finish, so clear anyway (to avoid reimport on load) + // processed features must be only on finish, so clear anyway (to avoid reimport on load) + myProcessOnFinish.clear(); if (!(theMessage->eventID() == kOpStartEvent)) { processFeatures(false); @@ -329,7 +338,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag anUpdatedIter++; } } - // the redisplay signal should be flushed in order to erase the feature presentation in the viewer + // the redisplay signal should be flushed in order + // to erase the feature presentation in the viewer // if should be done after removeFeature() of document, // by this reason, upper processFeatures() do not perform this flush Events_Loop::loop()->flush(kRedisplayEvent); @@ -401,7 +411,8 @@ static void allReasons(FeaturePtr theFeature, std::set& theReasons) } } } - if (theFeature->getKind() == "Part") { // part is not depended on its subs directly, but subs must be iterated anyway + if (theFeature->getKind() == "Part") { + // part is not depended on its subs directly, but subs must be iterated anyway CompositeFeaturePtr aPart = std::dynamic_pointer_cast(theFeature); int aNum = aPart->numberOfSubs(); for(int a = 0; a < aNum; a++) { @@ -432,7 +443,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature) myProcessed[theFeature] = 0; } else { int aCount = myProcessed[theFeature]; - if (aCount > 100) { // too many repetition of processing (in VS it may crash on 330 with stack overflow) + if (aCount > 100) { + // too many repetition of processing (in VS it may crash on 330 with stack overflow) Events_InfoMessage("Model_Update", "Feature '%1' is updated in infinitive loop").arg(theFeature->data()->name()).send(); return false; @@ -446,7 +458,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature) if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated) { aIsModified = true; std::set > aNewSet; - aNewSet.insert(theFeature); // contains itself, so, we don't know which was the reason and the reason is any + // contains itself, so, we don't know which was the reason and the reason is any + aNewSet.insert(theFeature); myModified[theFeature] = aNewSet; } } @@ -482,7 +495,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature) return false; } - // evaluate parameter before the sub-elements update: it updates dependencies on evaluation (#1085) + // evaluate parameter before the sub-elements update: + // it updates dependencies on evaluation (#1085) if (theFeature->getKind() == "Parameter") { theFeature->execute(); } @@ -491,11 +505,13 @@ bool Model_Update::processFeature(FeaturePtr theFeature) // check all features this feature depended on (recursive call of updateFeature) std::set& aReasons = myModified[theFeature]; bool allSubsUsed = aReasons.find(theFeature) != aReasons.end(); - if (allSubsUsed) { // add all subs in aReasons and temporary remove "theFeature" to avoid processing itself + if (allSubsUsed) { + // add all subs in aReasons and temporary remove "theFeature" to avoid processing itself allReasons(theFeature, aReasons); aReasons.erase(theFeature); } - // take reasons one by one (they may be added during the feature process (circle by the radius of sketch) + // take reasons one by one (they may be added during the feature process + // (circle by the radius of sketch) std::set aProcessedReasons; while(!aReasons.empty()) { FeaturePtr aReason = *(aReasons.begin()); @@ -547,7 +563,9 @@ bool Model_Update::processFeature(FeaturePtr theFeature) // this checking must be after the composite feature sub-elements processing: // composite feature status may depend on it's subelements if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) && - theFeature->getKind() != "Part") { // don't disable Part because it will make disabled all the features (performance and problems with the current feature) + theFeature->getKind() != "Part") { + // don't disable Part because it will make disabled all the features + // (performance and problems with the current feature) #ifdef DEB_UPDATE std::cout<<"Invalid args "<name()<eventByName(EVENT_OBJECT_TO_REDISPLAY); @@ -582,7 +600,9 @@ void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_Ex std::list::iterator aRIter = allResults.begin(); for (; aRIter != allResults.cend(); aRIter++) { std::shared_ptr aRes = *aRIter; - if (!aRes->isDisabled()) {// update state only for enabled results (Placement Result Part may make the original Part Result as invalid) + if (!aRes->isDisabled()) { + // update state only for enabled results + // (Placement Result Part may make the original Part Result as invalid) aRes->data()->execState(theState); } if (theFeature->data()->updateID() > aRes->data()->updateID()) { @@ -790,7 +810,8 @@ bool Model_Update::isReason(std::shared_ptr& theFeature, return true; } - return false; // this case only for not-previewed items update state, nothing is changed in args for it + // this case only for not-previewed items update state, nothing is changed in args for it + return false; } void Model_Update::executeFeature(FeaturePtr theFeature) @@ -839,10 +860,13 @@ void Model_Update::updateStability(void* theSender) // remove or add all concealment refs from this feature std::list > > aRefs; aSender->data()->referencesToObjects(aRefs); - std::list > >::iterator aRefIt = aRefs.begin(); + std::list > >::iterator + aRefIt = aRefs.begin(); for(; aRefIt != aRefs.end(); aRefIt++) { if (!aFactory->isConcealed(aFeatureSender->getKind(), aRefIt->first)) - continue; // take into account only concealed references (do not remove the sketch constraint and the edge on constraint edit) + // take into account only concealed references + // (do not remove the sketch constraint and the edge on constraint edit) + continue; std::list& aRefFeaturesList = aRefIt->second; std::list::iterator aReferenced = aRefFeaturesList.begin(); for(; aReferenced != aRefFeaturesList.end(); aReferenced++) { diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index 866f99c30..c5f277138 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -30,7 +30,8 @@ class Model_Update : public Events_Listener std::map, std::set > > myModified; /// Features which arguments were modified by not-persistent changes. - /// So, these referencing arguments must be updated due to these features info also before execution). + /// So, these referencing arguments must be updated + /// due to these features info also before execution). std::map, std::set > > myNotPersistentRefs; /// features that must be additionally processed after execution of finish operation @@ -45,7 +46,8 @@ class Model_Update : public Events_Listener std::set > myProcessOnFinish; /// to avoid infinitive cycling: feature -> count of the processing periods during this update std::map, int > myProcessed; - /// if preview in hte property panel is blocked and any update is postponed until the end of operation + /// if preview in hte property panel is blocked and + /// any update is postponed until the end of operation bool myIsPreviewBlocked; public: @@ -86,7 +88,8 @@ protected: /// Updates the properties of object because of stability state changes void updateStability(void* theSender); - /// Returns true if theFeature modification was caused by theReason (may be feature of result of this feature) + /// Returns true if theFeature modification was caused by theReason + /// (may be feature of result of this feature) bool isReason( std::shared_ptr& theFeature, std::shared_ptr theReason); diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index f7a58ddb6..0aa279fcb 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -97,13 +97,15 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID, addDefaultValidators(theValidators); } -void Model_ValidatorsFactory::validators(const std::string& theFeatureID, const std::string& theAttrID, +void Model_ValidatorsFactory::validators(const std::string& theFeatureID, + const std::string& theAttrID, Validators& theValidators) const { std::map >::const_iterator aFeatureIt = myAttrs.find(theFeatureID); if (aFeatureIt != myAttrs.cend()) { - std::map::const_iterator anAttrIt = aFeatureIt->second.find(theAttrID); + std::map::const_iterator anAttrIt = + aFeatureIt->second.find(theAttrID); if (anAttrIt != aFeatureIt->second.end()) { AttrValidators::const_iterator aValidatorsIt = anAttrIt->second.cbegin(); for (; aValidatorsIt != anAttrIt->second.cend(); aValidatorsIt++) { @@ -271,7 +273,8 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr return true; } -void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, std::string theAttribute) +void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, + std::string theAttribute) { const static std::string kDefaultId = "Model_FeatureValidator"; std::map::const_iterator it = myIDs.find(kDefaultId); diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index 95fd0544e..e742ff8d5 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -54,7 +54,8 @@ class ModelAPI_Attribute /// \return the previous block value MODELAPI_EXPORT bool blockSetInitialized(const bool theBlock); - /// Set this attribute is argument for result (change of this attribute requires update of result). + /// Set this attribute is argument for result + /// (change of this attribute requires update of result). /// By default it is true. MODELAPI_EXPORT void setIsArgument(const bool theFlag); diff --git a/src/ModelAPI/ModelAPI_AttributeDouble.h b/src/ModelAPI/ModelAPI_AttributeDouble.h index 79370eedd..927d45a68 100644 --- a/src/ModelAPI/ModelAPI_AttributeDouble.h +++ b/src/ModelAPI/ModelAPI_AttributeDouble.h @@ -48,7 +48,8 @@ class ModelAPI_AttributeDouble : public ModelAPI_Attribute MODELAPI_EXPORT virtual std::string expressionError() = 0; /// Defines the used parameters - MODELAPI_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual + void setUsedParameters(const std::set& theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; diff --git a/src/ModelAPI/ModelAPI_AttributeInteger.h b/src/ModelAPI/ModelAPI_AttributeInteger.h index 52062faef..41d2bc9a3 100644 --- a/src/ModelAPI/ModelAPI_AttributeInteger.h +++ b/src/ModelAPI/ModelAPI_AttributeInteger.h @@ -48,7 +48,8 @@ class ModelAPI_AttributeInteger : public ModelAPI_Attribute MODELAPI_EXPORT virtual std::string expressionError() = 0; /// Defines the used parameters - MODELAPI_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual + void setUsedParameters(const std::set& theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index 629e1fa9a..39c3f0d6c 100755 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -49,18 +49,21 @@ public: /// 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 std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1) = 0; + const std::shared_ptr& theNewShape, const std::string& theName, + const int theTag = 1) = 0; - /// Records the shape newShape which was generated from the shape oldShape during a topological + /// Records the shape newShape which was generated from the shape oldShape during a topological /// construction. As an example, consider the case of a face generated from an edge in /// construction of a prism. virtual void generated(const std::shared_ptr& theOldShape, - const std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1) = 0; + const std::shared_ptr& theNewShape, const std::string& theName, + const int theTag = 1) = 0; /// Records the shape newShape which is a modification of the shape oldShape. /// As an example, consider the case of a face split or merged in a Boolean operation. virtual void modified(const std::shared_ptr& theOldShape, - const std::shared_ptr& theNewShape, const std::string& theName, const int theTag = 1) = 0; + const std::shared_ptr& theNewShape, const std::string& theName, + const int theTag = 1) = 0; /// Records the shape oldShape which was deleted from the current label. /// As an example, consider the case of a face removed by a Boolean operation. @@ -91,13 +94,16 @@ public: GeomAPI_DataMapOfShapeShape& theSubShapes) = 0; /// load shapes of the first level (to be used during shape import) - virtual void loadFirstLevel(std::shared_ptr theShape, const std::string& theName, int& theTag) = 0; + virtual void loadFirstLevel(std::shared_ptr theShape, + const std::string& theName, int& theTag) = 0; /// load disconnected edges - virtual void loadDisconnectedEdges(std::shared_ptr theShape, const std::string& theName, int& theTag) = 0; + virtual void loadDisconnectedEdges(std::shared_ptr theShape, + const std::string& theName, int& theTag) = 0; /// load disconnected vetexes - virtual void loadDisconnectedVertexes(std::shared_ptr theShape, const std::string& theName,int& theTag) = 0; + virtual void loadDisconnectedVertexes(std::shared_ptr theShape, + const std::string& theName,int& theTag) = 0; /// Converts evolution of sub-shapes stored in naming structure to selection /// (theFlag = true) and back (theFlag = false) diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.h b/src/ModelAPI/ModelAPI_CompositeFeature.h index ab58f092f..945e88daf 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.h +++ b/src/ModelAPI/ModelAPI_CompositeFeature.h @@ -28,7 +28,8 @@ public: virtual int numberOfSubs(bool forTree = false) const = 0; /// Returns the sub-feature by zero-base index - virtual std::shared_ptr subFeature(const int theIndex, bool forTree = false) = 0; + virtual std::shared_ptr subFeature(const int theIndex, + bool forTree = false) = 0; /// Returns the sub-feature unique identifier in this composite feature by zero-base index virtual int subFeatureId(const int theIndex) const = 0; diff --git a/src/ModelAPI/ModelAPI_Data.h b/src/ModelAPI/ModelAPI_Data.h index 71e9aee9d..1dadf03d7 100644 --- a/src/ModelAPI/ModelAPI_Data.h +++ b/src/ModelAPI/ModelAPI_Data.h @@ -152,7 +152,8 @@ class MODELAPI_EXPORT ModelAPI_Data virtual const std::set >& refsToMe() = 0; /// returns all references by attributes of this data - /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects + /// \param theRefs returned list of pairs: id of referenced attribute and + /// list of referenced objects virtual void referencesToObjects( std::list > > >& theRefs) =0; diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 17bf94356..de5ec340e 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -42,7 +42,8 @@ public: virtual const std::string& kind() const = 0; //! Removes document data - //! \param theForever if it is false, document is just hiden (to keep possibility make it back on Undo/Redo) + //! \param theForever if it is false, document is just hiden + //! (to keep possibility make it back on Undo/Redo) virtual void close(const bool theForever = false) = 0; //! Adds to the document the new feature of the given feature id diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 0b64a091e..1eeb029cf 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -229,7 +229,8 @@ void ModelAPI_ReplaceParameterMessage::setObject(ObjectPtr theObject) // ===== ModelAPI_SolverFailedMessage ===== -ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID, const void* theSender) +ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID, + const void* theSender) : Events_Message(theID, theSender), myDOF(-1) { diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 006b4e7db..9c1718acb 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -39,7 +39,8 @@ static const char * EVENT_PLUGIN_LOADED = "PluginLoaded"; /// The active document becomes another one static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged"; -/// Event ID that order of objects in group is changed, so, tree must be fully rectreated (movement of feature) +/// Event ID that order of objects in group is changed, +/// so, tree must be fully rectreated (movement of feature) static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; @@ -306,7 +307,8 @@ class ModelAPI_ReplaceParameterMessage : public Events_Message const void* theSender); /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender = 0); + MODELAPI_EXPORT + ModelAPI_ReplaceParameterMessage(const Events_ID theID, const void* theSender = 0); /// The virtual destructor MODELAPI_EXPORT virtual ~ModelAPI_ReplaceParameterMessage(); diff --git a/src/ModelAPI/ModelAPI_Expression.h b/src/ModelAPI/ModelAPI_Expression.h index 5da1c0d69..00e8acc71 100644 --- a/src/ModelAPI/ModelAPI_Expression.h +++ b/src/ModelAPI/ModelAPI_Expression.h @@ -48,7 +48,8 @@ class ModelAPI_Expression MODELAPI_EXPORT virtual std::string error() = 0; /// Defines the used parameters (by the parameters listener) - MODELAPI_EXPORT virtual void setUsedParameters(const std::set& theUsedParameters) = 0; + MODELAPI_EXPORT virtual + void setUsedParameters(const std::set& theUsedParameters) = 0; /// Returns the used parameters MODELAPI_EXPORT virtual std::set usedParameters() const = 0; diff --git a/src/ModelAPI/ModelAPI_Result.h b/src/ModelAPI/ModelAPI_Result.h index c0958c7c0..b275f308f 100644 --- a/src/ModelAPI/ModelAPI_Result.h +++ b/src/ModelAPI/ModelAPI_Result.h @@ -26,8 +26,8 @@ class ModelAPI_Result : public ModelAPI_Object public: /// Reference to the color of the result. - /// The integer array is used. It contains tree values for red green and blue values. The values are in - /// [0, 255] range + /// The integer array is used. It contains tree values for red green and blue values. + /// The values are in [0, 255] range inline static const std::string& COLOR_ID() { static const std::string MY_COLOR_ID("Color"); diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index bdf9947d2..eb5067d40 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -116,7 +116,8 @@ void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS, void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape, const int theTag, - const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate) + const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, + const bool theIsStoreSeparate) { myBuilder->loadAndOrientModifiedShapes( theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate); diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 6847000c4..8b532746d 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -61,7 +61,8 @@ public: /// \brief Stores the shape (called by the execution method). /// param[in] theShape shape to store. - /// param[in] theIsStoreSameShapes if false stores reference to the same shape if it is already in document. + /// param[in] theIsStoreSameShapes if false stores reference to the same shape + /// if it is already in document. MODELAPI_EXPORT virtual void store(const std::shared_ptr& theShape, const bool theIsStoreSameShapes = true); @@ -111,7 +112,8 @@ public: /// load and orient modified shapes MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape, const int theTag, - const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate = false); + const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, + const bool theIsStoreSeparate = false); /// load and orient generated shapes MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape, diff --git a/src/ModelAPI/ModelAPI_Session.cpp b/src/ModelAPI/ModelAPI_Session.cpp index 946096f28..cd2e11acf 100644 --- a/src/ModelAPI/ModelAPI_Session.cpp +++ b/src/ModelAPI/ModelAPI_Session.cpp @@ -59,7 +59,8 @@ std::shared_ptr ModelAPI_Session::get() return MY_MANAGER; } -const ModelAPI_EventCreator* MY_API_CREATOR = 0; ///< instance of the events creator, one pre application +/// instance of the events creator, one pre application +const ModelAPI_EventCreator* MY_API_CREATOR = 0; const ModelAPI_EventCreator* ModelAPI_EventCreator::get() { diff --git a/src/ModelAPI/ModelAPI_Session.h b/src/ModelAPI/ModelAPI_Session.h index 6d385ea5b..3b0c4d413 100644 --- a/src/ModelAPI/ModelAPI_Session.h +++ b/src/ModelAPI/ModelAPI_Session.h @@ -46,7 +46,8 @@ class MODELAPI_EXPORT ModelAPI_Session //! Starts a new operation (opens a transaction) //! \param theId of operation for history (optional) - //! \param theAttachedToNested if it is true, it means that this transaction is attached to the nested + //! \param theAttachedToNested if it is true, + //! it means that this transaction is attached to the nested //! where it is located and will be committed on the next commit with the nested virtual void startOperation( const std::string& theId = "", const bool theAttachedToNested = false) = 0; diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index ee9de24e1..90b84bc98 100755 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -159,7 +159,8 @@ std::string getFeatureError(const FeaturePtr& theFeature) return anError; } -ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, const std::string& theName) +ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, + const std::string& theName) { for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) { ObjectPtr anObject = theDocument->object(theGroup, anIndex); @@ -185,8 +186,8 @@ bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher, return true; } -bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue, ResultParameterPtr& theParam, - const DocumentPtr& theDocument) +bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue, + ResultParameterPtr& theParam, const DocumentPtr& theDocument) { SessionPtr aSession = ModelAPI_Session::get(); std::list aDocList; @@ -204,7 +205,9 @@ bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& ou ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub) { - if (theMain != theSub) { // to optimize and avoid of crash on partset document close (don't touch the sub-document structure) + // to optimize and avoid of crash on partset document close + // (don't touch the sub-document structure) + if (theMain != theSub) { for (int a = theMain->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) { ResultPartPtr aPart = std::dynamic_pointer_cast( theMain->object(ModelAPI_ResultPart::group(), a)); @@ -218,7 +221,9 @@ ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub) FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub) { - if (theMain != theSub) { // to optimize and avoid of crash on partset document close (don't touch the sub-document structure) + // to optimize and avoid of crash on partset document close + // (don't touch the sub-document structure) + if (theMain != theSub) { for (int a = theMain->size(ModelAPI_Feature::group()) - 1; a >= 0; a--) { FeaturePtr aPartFeat = std::dynamic_pointer_cast( theMain->object(ModelAPI_Feature::group(), a)); @@ -364,7 +369,8 @@ bool removeFeatures(const std::set& theFeatures, } } if (isDone && theFlushRedisplay) { - // the redisplay signal should be flushed in order to erase the feature presentation in the viewer + // the redisplay signal should be flushed in order to erase + // the feature presentation in the viewer // if should be done after removeFeature() of document Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } @@ -412,7 +418,8 @@ void addRefsToFeature(const FeaturePtr& theFeature, #endif if (theReferences.find(aRefFeature) == theReferences.end()) theReferences.insert(aRefFeature); - addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences, theRecLevel, theReferences); + addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences, + theRecLevel, theReferences); } } @@ -445,7 +452,8 @@ void findReferences(const std::set& theFeatures, aLast = aSelRefFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aCFeature = *anIt; - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(aCFeature); + CompositeFeaturePtr aComposite = + std::dynamic_pointer_cast(aCFeature); if (aComposite.get() && aComposite->isSub(aFeature)) continue; /// composite of the current feature should be skipped aFilteredFeatures.insert(aCFeature); @@ -454,7 +462,8 @@ void findReferences(const std::set& theFeatures, } if (theUseRecursion) { #ifdef DEBUG_CYCLING_1550 - findReferences(aSelRefFeatures, theReferences, theUseComposite, theUseRecursion, theRecLevel); + findReferences(aSelRefFeatures, theReferences, theUseComposite, + theUseRecursion, theRecLevel); #else findReferences(theReferences[aFeature], theReferences, theUseComposite, theUseRecursion, theRecLevel); @@ -518,7 +527,8 @@ void findAllReferences(const std::set& theFeatures, std::cout << " Ref: " << getFeatureInfo(aFeature) << std::endl; #endif aRecLevel++; - addRefsToFeature(aFeature, aMainList, theReferences, aRecLevel, aResultRefList/*aMainRefList*/); + addRefsToFeature(aFeature, aMainList, theReferences, + aRecLevel, aResultRefList/*aMainRefList*/); } theReferences[aMainListFeature] = aResultRefList; } @@ -545,7 +555,8 @@ void findRefsToFeatures(const std::set& theFeatures, std::set::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; - CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(aRefFeature); + CompositeFeaturePtr aComposite = + std::dynamic_pointer_cast(aRefFeature); if (aComposite.get() && aComposite->isSub(aFeature)) continue; /// composite of the current feature should not be removed diff --git a/src/ModelAPI/ModelAPI_Tools.h b/src/ModelAPI/ModelAPI_Tools.h index d9c685d6e..39e6f76d2 100755 --- a/src/ModelAPI/ModelAPI_Tools.h +++ b/src/ModelAPI/ModelAPI_Tools.h @@ -147,8 +147,8 @@ MODELAPI_EXPORT void findAllReferences(const std::set& theFeatures, * \param theFeaturesRefsTo an out list of referenced features */ MODELAPI_EXPORT void findRefsToFeatures(const std::set& aFeatures, - const std::map >& aReferences, - std::set& aFeaturesRefsTo); + const std::map >& aReferences, + std::set& aFeaturesRefsTo); /*! Finds referenced of the feature to objects and collects concealed results. * \param theFeatures a model feature -- 2.30.2