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
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());
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();
if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) {
std::shared_ptr<Model_Document> aDR = std::dynamic_pointer_cast<Model_Document>(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);
}
{
GeomShapePtr aResult;
if (myTmpContext.get() || myTmpSubShape.get()) {
- ResultConstructionPtr aResulConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myTmpContext);
+ ResultConstructionPtr aResulConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myTmpContext);
if(aResulConstruction.get()) {
// it is just reference to construction.
return myTmpSubShape;
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)) {
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;
}
}
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;
}
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<ModelAPI_ResultConstruction>(aContext);
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();
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);
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<Handle(Geom_Curve), int> allCurves; // curves and orientations of edges
+ // curves and orientations of edges
+ NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
int aSubID = aComposite->subFeatureId(a);
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);
}
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();
}
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;
}
}
static void registerSubShape(TDF_Label theMainLabel, TopoDS_Shape theShape,
const int theID, const FeaturePtr& theContextFeature, std::shared_ptr<Model_Document> theDoc,
std::map<int, int>& theOrientations,
- std::map<int, std::string>& 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<int, std::string>& theSubNames,
Handle(TDataStd_IntPackedMap) theRefs = Handle(TDataStd_IntPackedMap)(),
const int theOrientation = 0)
{
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());
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);
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();
// 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);
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";
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";
if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
if(!aName.empty()) {
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
}
}
if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
if(!aName.empty()) {
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
}
}
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;
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<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aSubBuilder.NamedShape()->Label(), aSolidName);
if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
if(!aName.empty()) {
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(document());
aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
}
}
std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->modified(aRShape, aList);
- std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
+ anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
if (theSubShapes.isBound(*anIt)) {
std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->generated(aRShape, aList);
- std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
+ anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
if (theSubShapes.isBound(*anIt)) {
}
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<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(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++;
}
}
}
-void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag)
+void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& 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<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1);
+ const std::shared_ptr<GeomAPI_Shape>& 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<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1);
+ const std::shared_ptr<GeomAPI_Shape>& 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.
GeomAPI_DataMapOfShapeShape& theSubShapes);
/// Loads shapes of the first level (to be used during shape import)
- MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
+ MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag);
/// Loads disconnected edges
- MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
+ MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag);
/// Loads disconnected vetexes
- MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
+ MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag);
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_BodyBuilder();
private:
/// Loads shapes of the next level (to be used during shape import)
- void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
+ void loadNextLevels(std::shared_ptr<GeomAPI_Shape> 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);
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;
}
{
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<ModelAPI_Attribute*> aWasChangedButBlocked = myWasChangedButBlocked;
myWasChangedButBlocked.clear();
std::list<ModelAPI_Attribute*>::iterator aChangedIter = aWasChangedButBlocked.begin();
// remove in order to clear back references in other objects
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator anAttrIter = aRefs.begin();
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator
+ anAttrIter = aRefs.begin();
for(; anAttrIter != aRefs.end(); anAttrIter++) {
std::list<ObjectPtr>::iterator aReferenced = anAttrIter->second.begin();
for(; aReferenced != anAttrIter->second.end(); aReferenced++) {
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);
}
/// Returns the attribute that contains real value with double precision
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID);
/// Returns the attribute that contains double values array
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDoubleArray> realArray(const std::string& theID);
+ MODEL_EXPORT virtual
+ std::shared_ptr<ModelAPI_AttributeDoubleArray> realArray(const std::string& theID);
/// Returns the attribute that contains integer value
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeInteger>
integer(const std::string& theID);
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);
MODEL_EXPORT virtual const std::set<AttributePtr>& 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<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
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
"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();
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();
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();
{
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
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
}
}
}
static std::shared_ptr<Model_Session> aSession =
std::static_pointer_cast<Model_Session>(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();
}
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();
}
// 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()))
// 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
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<ModelAPI_CompositeFeature>(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<ModelAPI_CompositeFeature>(theAfterThis);
if (aCompositeAfter.get()) {
FeaturePtr aSub = aCompositeAfter;
do {
}
}
- 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)) {
} 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
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;
}
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*/);
// 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;
}
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;
}
}
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
}
}
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())
const char* theDirName, const char* theFileName, std::list<std::string>& 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)
//! 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<ModelAPI_AttributeSelectionList> selectionInPartFeature();
friend class Model_Application;
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()) {
if (!isSub || theGroupID != ModelAPI_ResultConstruction::group()) {
// do not use reference to the list here since results can be changed by "isConcealed"
const std::list<std::shared_ptr<ModelAPI_Result> > aResults = aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator
+ aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRes->groupName() != theGroupID) break; // feature have only same group results
if (aRIter->get() && (*aRIter)->groupName() == theGroupID) {
if ((*aRIter)->data()->name() == theName)
return *aRIter;
- ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
+ ResultCompSolidPtr aCompRes =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
if (aCompRes.get()) {
int aNumSubs = aCompRes->numberOfSubs();
for(int a = 0; a < aNumSubs; a++) {
aFeature = std::dynamic_pointer_cast<Model_Session>(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;
aKeptFeatures.insert(aFeature);
if (anUpdatedMap.Contains(aFeatureLabel)) {
if (!theOpen) { // on abort/undo/redo reinitialize attributes is something is changed
- std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs = aFeature->data()->attributes("");
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ aFeature->data()->attributes("");
std::list<std::shared_ptr<ModelAPI_Attribute> >::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<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
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);
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<FeaturePtr> aComposites; // composites must be updated after their subs (issue 360)
TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
for (; aLabIter2.More(); aLabIter2.Next()) {
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();
}
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
std::set<AttributePtr>::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<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > > aRefs;
(*aCurrentIter)->owner()->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >::iterator
+ std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> >>>::iterator
aRefIter = aRefs.begin();
for(; aRefIter != aRefs.end(); aRefIter++) {
if ((*aCurrentIter)->id() == aRefIter->first) {
(*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<ObjectPtr, std::set<AttributePtr> >::iterator anExtIter = allRefs.begin();
for(; anExtIter != allRefs.end(); anExtIter++) {
synchronizeBackRefsForObject(anExtIter->second, anExtIter->first);
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<<theFeatureData->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<<"_"<<theResultIndex + 1;
theResult->data()->setName(aNewName.str());
std::shared_ptr<ModelAPI_ResultPart> 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
//! 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<ResultPtr>& theResults);
//! Returns the number of all features: in the history or not
//! 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<ModelAPI_Data> theFeatureData,
std::shared_ptr<ModelAPI_Result> 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<ModelAPI_Data>& theFeatureData, const int theResultIndex);
+ TDF_Label resultLabel(const std::shared_ptr<ModelAPI_Data>& theFeatureData,
+ const int theResultIndex);
//! Updates the results list of the feature basing on the current data tree
void updateResults(FeaturePtr theFeature);
theDefault = DEFAULT_COLOR();
}
-bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
+bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+ const bool theFlag)
{
bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
if (aChanged) { // state is changed, so modifications are needed
std::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
std::shared_ptr<GeomAPI_Shape> 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<std::shared_ptr<GeomAPI_Face> > myFaces; ///< stores the up to date faces if they exist
+ /// stores the up to date faces if they exist
+ std::vector<std::shared_ptr<GeomAPI_Face> > myFaces;
bool myIsInHistory;
bool myIsInfinite;
public:
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
-#define baseRef() std::dynamic_pointer_cast<Model_ResultPart>(data()->reference(BASE_REF_ID())->value())
+#define baseRef() \
+ std::dynamic_pointer_cast<Model_ResultPart>(data()->reference(BASE_REF_ID())->value())
void Model_ResultPart::initAttributes()
{
// 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;
}
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;
*/
class Model_ResultPart : public ModelAPI_ResultPart
{
- TopoDS_Shape myShape; ///< shape of this part created from bodies (updated only of Part deactivation)
- std::shared_ptr<gp_Trsf> 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<gp_Trsf> 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");
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;
// 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("_");
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";
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
}
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;
}
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) {
}
}
}
- 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;
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<TopoDS_Shape>().ShapeType() == aType) {
theCont = aCont;
aType == TopAbs_FACE ? "Face" : "Wire", anIDs, true))
return false;
- NCollection_DataMap<Handle(Geom_Curve), int> allCurves; // curves and orientations of edges
+ // curves and orientations of edges
+ NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
int aSubID = aComposite->subFeatureId(a);
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<int, int> anIDs;
if (!parseSubIndices(aComposite, aSubShapeName, "Wire", anIDs))
return false;
- NCollection_DataMap<Handle(Geom_Curve), int> allCurves; // curves and orientations of edges
+ // curves and orientations of edges
+ NCollection_DataMap<Handle(Geom_Curve), int> allCurves;
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
int aSubID = aComposite->subFeatureId(a);
}
}
}
- 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<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelection));
theShapeToBeSelected = aShapeToBeSelected;
std::shared_ptr<Model_Document> theDoc, std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected,
std::shared_ptr<ModelAPI_Result>& 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<GeomAPI_Shape> findAppropriateFace(
std::shared_ptr<ModelAPI_Result>& theConstr,
}
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
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);
}
} 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) {
std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
std::shared_ptr<ModelAPI_Document> 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:
//! 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);
// 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()) {
if (myModified.find(theFeature) != myModified.end()) {
if (theReason.get()) {
#ifdef DEB_UPDATE
- //std::cout<<"*** Add already modified "<<theFeature->name()<<" reason "<<theReason->name()<<std::endl;
+ //std::cout<<"*** Add already modified "
+ // <<theFeature->name()<<" reason "<<theReason->name()<<std::endl;
#endif
myModified[theFeature].insert(theReason);
}
myModified[theFeature] = aNewSet;
#ifdef DEB_UPDATE
if (theReason.get()) {
- //std::cout<<"*** Add modified "<<theFeature->name()<<" reason "<<theReason->name()<<std::endl;
+ //std::cout<<"*** Add modified "<<theFeature->name()
+ // <<" reason "<<theReason->name()<<std::endl;
} else {
//std::cout<<"*** Add modified "<<theFeature->name()<<std::endl;
}
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(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<ModelAPI_ObjectUpdatedMessage> aMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
for(; anObjIter != anObjs.cend(); anObjIter++) {
if (std::dynamic_pointer_cast<Model_Document>((*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);
if (!(*anObjIter)->data()->isValid())
continue;
#ifdef DEB_UPDATE
- std::cout<<">>> in event updated "<<(*anObjIter)->groupName()<<" "<<(*anObjIter)->data()->name()<<std::endl;
+ std::cout<<">>> in event updated "<<(*anObjIter)->groupName()<<
+ " "<<(*anObjIter)->data()->name()<<std::endl;
#endif
if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
myIsParamUpdated = true;
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<std::shared_ptr<ModelAPI_Attribute> >& aRefs = (*anObjIter)->data()->refsToMe();
+ } else {
+ // process the updated result as update of features that refers to this result
+ const std::set<std::shared_ptr<ModelAPI_Attribute> >&
+ aRefs = (*anObjIter)->data()->refsToMe();
std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.cbegin();
for(; aRefIter != aRefs.cend(); aRefIter++) {
if (!(*aRefIter)->owner()->data()->isValid())
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);
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);
}
}
}
- 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<ModelAPI_CompositeFeature>(theFeature);
int aNum = aPart->numberOfSubs();
for(int a = 0; a < aNum; a++) {
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;
if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated) {
aIsModified = true;
std::set<std::shared_ptr<ModelAPI_Feature> > 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;
}
}
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();
}
// check all features this feature depended on (recursive call of updateFeature)
std::set<FeaturePtr>& 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<FeaturePtr> aProcessedReasons;
while(!aReasons.empty()) {
FeaturePtr aReason = *(aReasons.begin());
// 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 "<<theFeature->name()<<std::endl;
#endif
return true;
}
-void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_ExecState theState)
+void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_ExecState theState)
{
// make updated and redisplay all results
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
std::list<ResultPtr>::iterator aRIter = allResults.begin();
for (; aRIter != allResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> 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()) {
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)
// remove or add all concealment refs from this feature
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
aSender->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator aRefIt = aRefs.begin();
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >::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<ObjectPtr>& aRefFeaturesList = aRefIt->second;
std::list<ObjectPtr>::iterator aReferenced = aRefFeaturesList.begin();
for(; aReferenced != aRefFeaturesList.end(); aReferenced++) {
std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
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::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
myNotPersistentRefs;
/// features that must be additionally processed after execution of finish operation
std::set<std::shared_ptr<ModelAPI_Feature> > myProcessOnFinish;
/// to avoid infinitive cycling: feature -> count of the processing periods during this update
std::map<std::shared_ptr<ModelAPI_Feature>, 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:
/// 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<ModelAPI_Feature>& theFeature, std::shared_ptr<ModelAPI_Object> theReason);
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<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeatureIt =
myAttrs.find(theFeatureID);
if (aFeatureIt != myAttrs.cend()) {
- std::map<std::string, AttrValidators>::const_iterator anAttrIt = aFeatureIt->second.find(theAttrID);
+ std::map<std::string, AttrValidators>::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++) {
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<std::string, ModelAPI_Validator*>::const_iterator it = myIDs.find(kDefaultId);
/// \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);
MODELAPI_EXPORT virtual std::string expressionError() = 0;
/// Defines the used parameters
- MODELAPI_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
+ MODELAPI_EXPORT virtual
+ void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
MODELAPI_EXPORT virtual std::set<std::string> usedParameters() const = 0;
MODELAPI_EXPORT virtual std::string expressionError() = 0;
/// Defines the used parameters
- MODELAPI_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
+ MODELAPI_EXPORT virtual
+ void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
MODELAPI_EXPORT virtual std::set<std::string> usedParameters() const = 0;
/// 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<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1) = 0;
+ const std::shared_ptr<GeomAPI_Shape>& 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<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1) = 0;
+ const std::shared_ptr<GeomAPI_Shape>& 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<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1) = 0;
+ const std::shared_ptr<GeomAPI_Shape>& 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.
GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
/// load shapes of the first level (to be used during shape import)
- virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag) = 0;
+ virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag) = 0;
/// load disconnected edges
- virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag) = 0;
+ virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
+ const std::string& theName, int& theTag) = 0;
/// load disconnected vetexes
- virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName,int& theTag) = 0;
+ virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> 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)
virtual int numberOfSubs(bool forTree = false) const = 0;
/// Returns the sub-feature by zero-base index
- virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> 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;
virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >& 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<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >& theRefs) =0;
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
// ===== 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)
{
/// 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";
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();
MODELAPI_EXPORT virtual std::string error() = 0;
/// Defines the used parameters (by the parameters listener)
- MODELAPI_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
+ MODELAPI_EXPORT virtual
+ void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
/// Returns the used parameters
MODELAPI_EXPORT virtual std::set<std::string> usedParameters() const = 0;
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");
void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> 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);
/// \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<GeomAPI_Shape>& theShape,
const bool theIsStoreSameShapes = true);
/// load and orient modified shapes
MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> 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<GeomAPI_Shape> theShapeIn, const int theKindOfShape,
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()
{
//! 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;
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);
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<DocumentPtr> aDocList;
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<ModelAPI_ResultPart>(
theMain->object(ModelAPI_ResultPart::group(), a));
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<ModelAPI_Feature>(
theMain->object(ModelAPI_Feature::group(), a));
}
}
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));
}
#endif
if (theReferences.find(aRefFeature) == theReferences.end())
theReferences.insert(aRefFeature);
- addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences, theRecLevel, theReferences);
+ addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences,
+ theRecLevel, theReferences);
}
}
aLast = aSelRefFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aCFeature = *anIt;
- CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCFeature);
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCFeature);
if (aComposite.get() && aComposite->isSub(aFeature))
continue; /// composite of the current feature should be skipped
aFilteredFeatures.insert(aCFeature);
}
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);
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;
}
std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
- CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeature);
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeature);
if (aComposite.get() && aComposite->isSub(aFeature))
continue; /// composite of the current feature should not be removed
* \param theFeaturesRefsTo an out list of referenced features
*/
MODELAPI_EXPORT void findRefsToFeatures(const std::set<FeaturePtr>& aFeatures,
- const std::map<FeaturePtr, std::set<FeaturePtr> >& aReferences,
- std::set<FeaturePtr>& aFeaturesRefsTo);
+ const std::map<FeaturePtr, std::set<FeaturePtr> >& aReferences,
+ std::set<FeaturePtr>& aFeaturesRefsTo);
/*! Finds referenced of the feature to objects and collects concealed results.
* \param theFeatures a model feature