Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #2092: Middle constraint not removed when creating a fillet
[modules/shaper.git]
/
src
/
Model
/
Model_AttributeRefAttr.cpp
diff --git
a/src/Model/Model_AttributeRefAttr.cpp
b/src/Model/Model_AttributeRefAttr.cpp
index 38e989e047ca7f10928df123f79e44117b43d02a..eff39c6f7167ad1e7ad33ffe30a2c12946f6cae3 100644
(file)
--- a/
src/Model/Model_AttributeRefAttr.cpp
+++ b/
src/Model/Model_AttributeRefAttr.cpp
@@
-7,10
+7,9
@@
#include "Model_AttributeRefAttr.h"
#include "Model_Application.h"
#include "Model_Data.h"
#include "Model_AttributeRefAttr.h"
#include "Model_Application.h"
#include "Model_Data.h"
+#include "Model_Objects.h"
#include <ModelAPI_Feature.h>
#include <ModelAPI_Feature.h>
-using namespace std;
-
bool Model_AttributeRefAttr::isObject()
{
return myID->Get().Length() == 0;
bool Model_AttributeRefAttr::isObject()
{
return myID->Get().Length() == 0;
@@
-20,10
+19,11
@@
void Model_AttributeRefAttr::setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theAttr->owner()->data());
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theAttr->owner()->data());
- string anID = aData->id(theAttr);
- if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
+ std::string anID = aData->id(theAttr);
+ ObjectPtr anObj = object();
+ if (myIsInitialized && anObj == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
return; // nothing is changed
return; // nothing is changed
- REMOVE_BACK_REF(
theAttr->owner()
);
+ REMOVE_BACK_REF(
anObj
);
myRef->Set(aData->label().Father());
myID->Set(aData->id(theAttr).c_str());
ADD_BACK_REF(theAttr->owner());
myRef->Set(aData->label().Father());
myID->Set(aData->id(theAttr).c_str());
ADD_BACK_REF(theAttr->owner());
@@
-45,7
+45,7
@@
void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
{
// the back reference from the previous object to the attribute should be removed
ObjectPtr anObject = object();
{
// the back reference from the previous object to the attribute should be removed
ObjectPtr anObject = object();
- if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
+ if (theObject
.get()
&& (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
REMOVE_BACK_REF(anObject);
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
REMOVE_BACK_REF(anObject);
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
@@
-76,21
+76,35
@@
ObjectPtr Model_AttributeRefAttr::object()
owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
- return aDoc->object(aRefLab);
+ return aDoc->object
s()->object
(aRefLab);
}
}
// not initialized
return ObjectPtr();
}
}
}
// not initialized
return ObjectPtr();
}
+bool Model_AttributeRefAttr::isInitialized()
+{
+ if (myRef->Get() == myRef->Label()) { // empty is not initialized: sketch parallelity
+ return false;
+ }
+ return ModelAPI_AttributeRefAttr::isInitialized();
+}
+
Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
{
Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
{
- myIsInitialized = theLabel.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True;
+ myLab = theLabel;
+ reinit();
+}
+
+void Model_AttributeRefAttr::reinit()
+{
+ myIsInitialized = myLab.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True;
if (!myIsInitialized) {
// create attribute: not initialized by value yet
if (!myIsInitialized) {
// create attribute: not initialized by value yet
- myID = TDataStd_Comment::Set(
theLabel
, "");
- myRef = TDF_Reference::Set(
theLabel, theLabel
); // not initialized: reference to itself
+ myID = TDataStd_Comment::Set(
myLab
, "");
+ myRef = TDF_Reference::Set(
myLab, myLab
); // not initialized: reference to itself
} else {
} else {
-
theLabel
.FindAttribute(TDF_Reference::GetID(), myRef);
+
myLab
.FindAttribute(TDF_Reference::GetID(), myRef);
}
}
}
}