Salome HOME
projects
/
modules
/
shaper.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7607e07
)
Make Data not null, but invalid after the feature remove
author
mpv
<mpv@opencascade.com>
Tue, 26 May 2015 07:33:49 +0000
(10:33 +0300)
committer
mpv
<mpv@opencascade.com>
Tue, 26 May 2015 07:33:49 +0000
(10:33 +0300)
12 files changed:
src/Model/Model_AttributeReference.cpp
patch
|
blob
|
history
src/Model/Model_FeatureValidator.cpp
patch
|
blob
|
history
src/Model/Model_Update.cpp
patch
|
blob
|
history
src/ModelAPI/ModelAPI_Object.cpp
patch
|
blob
|
history
src/ModuleBase/ModuleBase_Operation.cpp
patch
|
blob
|
history
src/ModuleBase/ModuleBase_Tools.cpp
patch
|
blob
|
history
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
patch
|
blob
|
history
src/PartSet/PartSet_SketcherMgr.cpp
patch
|
blob
|
history
src/PartSet/PartSet_Validators.cpp
patch
|
blob
|
history
src/SketchPlugin/SketchPlugin_Sketch.cpp
patch
|
blob
|
history
src/SketchSolver/SketchSolver_ConstraintManager.cpp
patch
|
blob
|
history
src/XGUI/XGUI_Workshop.cpp
patch
|
blob
|
history
diff --git
a/src/Model/Model_AttributeReference.cpp
b/src/Model/Model_AttributeReference.cpp
index a6ac5e31acfff3927684c76b6d2b792bbaee3723..700e2f7d3d387f3e1d902d34a7de0e02692f14a8 100644
(file)
--- a/
src/Model/Model_AttributeReference.cpp
+++ b/
src/Model/Model_AttributeReference.cpp
@@
-28,7
+28,7
@@
void Model_AttributeReference::setValue(ObjectPtr theObject)
REMOVE_BACK_REF(aValue);
TDF_Label anObjLab;
REMOVE_BACK_REF(aValue);
TDF_Label anObjLab;
- if (theObject.get() && theObject->data()
.get() && theObject->data()
->isValid()) {
+ if (theObject.get() && theObject->data()->isValid()) {
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theObject->data());
anObjLab = aData->label().Father(); // object label
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theObject->data());
anObjLab = aData->label().Father(); // object label
diff --git
a/src/Model/Model_FeatureValidator.cpp
b/src/Model/Model_FeatureValidator.cpp
index a809abe461a5d1653edcd6a4e8e5b3af2c817858..8cec7f4b7849ef1cf6edccede77472c3a3b9c03a 100644
(file)
--- a/
src/Model/Model_FeatureValidator.cpp
+++ b/
src/Model/Model_FeatureValidator.cpp
@@
-23,7
+23,7
@@
bool Model_FeatureValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& th
std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
// "Action" features has no data, but still valid. e.g "Remove Part"
std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
// "Action" features has no data, but still valid. e.g "Remove Part"
- if (!aData) {
+ if (!aData
->isValid()
) {
return theFeature->isAction();
}
if (!aData->isValid())
return theFeature->isAction();
}
if (!aData->isValid())
diff --git
a/src/Model/Model_Update.cpp
b/src/Model/Model_Update.cpp
index 6a2d435ff2ebad9f7e9da7e0d3888c16b4be39b2..17f344c28ec1efebaaf735712eb95aee27871092 100644
(file)
--- a/
src/Model/Model_Update.cpp
+++ b/
src/Model/Model_Update.cpp
@@
-145,7
+145,7
@@
void Model_Update::processOperation(const bool theTotalUpdate, const bool theFin
for(aFIter = myJustCreated.begin(); aFIter != myJustCreated.end(); aFIter++)
{
FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
for(aFIter = myJustCreated.begin(); aFIter != myJustCreated.end(); aFIter++)
{
FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
- if (aF && aF->data()
.get
() && aF->getKind() == "Extrusion") {
+ if (aF && aF->data()
->isValid
() && aF->getKind() == "Extrusion") {
AttributeSelectionListPtr aBase = aF->selectionList("base");
if (aBase.get()) {
for(int a = aBase->size() - 1; a >= 0; a--) {
AttributeSelectionListPtr aBase = aF->selectionList("base");
if (aBase.get()) {
for(int a = aBase->size() - 1; a >= 0; a--) {
diff --git
a/src/ModelAPI/ModelAPI_Object.cpp
b/src/ModelAPI/ModelAPI_Object.cpp
index bb3339f932430191a5dc7ccd3e8f6e955c1653b9..dc76a0792dd2d925653ae077e039dc740bce4ec9 100644
(file)
--- a/
src/ModelAPI/ModelAPI_Object.cpp
+++ b/
src/ModelAPI/ModelAPI_Object.cpp
@@
-12,7
+12,7
@@
bool ModelAPI_Object::isInHistory()
{
bool ModelAPI_Object::isInHistory()
{
- if (myData
.get() && myData
->isValid()) {
+ if (myData->isValid()) {
return myData->isInHistory();
}
return true; // default value
return myData->isInHistory();
}
return true; // default value
@@
-22,7
+22,7
@@
void ModelAPI_Object::setInHistory(
const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
{
if (isInHistory() != theFlag) {
const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
{
if (isInHistory() != theFlag) {
- if (myData
.get() && myData
->isValid()) {
+ if (myData->isValid()) {
myData->setIsInHistory(theFlag);
}
myDoc->updateHistory(theObject);
myData->setIsInHistory(theFlag);
}
myDoc->updateHistory(theObject);
@@
-68,7
+68,7
@@
void ModelAPI_Object::setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
void ModelAPI_Object::erase()
{
void ModelAPI_Object::erase()
{
- if (myData
.get
() && myData != myData->invalidPtr()) myData->erase();
+ if (myData
->isValid
() && myData != myData->invalidPtr()) myData->erase();
setData(myData->invalidPtr());
}
setData(myData->invalidPtr());
}
diff --git
a/src/ModuleBase/ModuleBase_Operation.cpp
b/src/ModuleBase/ModuleBase_Operation.cpp
index d688e90aab52c4f9500caac0ad8b8e532fc79123..8b5ed2d24abe05e4280ec276f4b45810756e8088 100644
(file)
--- a/
src/ModuleBase/ModuleBase_Operation.cpp
+++ b/
src/ModuleBase/ModuleBase_Operation.cpp
@@
-64,7
+64,7
@@
FeaturePtr ModuleBase_Operation::feature() const
bool ModuleBase_Operation::isValid() const
{
bool ModuleBase_Operation::isValid() const
{
- if (!myFeature || !myFeature->data()
.get
())
+ if (!myFeature || !myFeature->data()
->isValid
())
return true; // rename operation
if (myFeature->isAction())
return true;
return true; // rename operation
if (myFeature->isAction())
return true;
diff --git
a/src/ModuleBase/ModuleBase_Tools.cpp
b/src/ModuleBase/ModuleBase_Tools.cpp
index 745497c8abd58c1650826c19e4faab3a8b3efa8c..449dd2d3fe8562ec91477c68e8d907c67f66da17 100644
(file)
--- a/
src/ModuleBase/ModuleBase_Tools.cpp
+++ b/
src/ModuleBase/ModuleBase_Tools.cpp
@@
-150,7
+150,7
@@
QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
if (aFeature.get()) {
aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str());
if (aFeature.get()) {
aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str());
- if (aFeature->data()
.get() && aFeature->data()
->isValid()) {
+ if (aFeature->data()->isValid()) {
aFeatureStr.append(QString(", name=%1").arg(aFeature->data()->name().c_str()).toStdString()
.c_str());
}
aFeatureStr.append(QString(", name=%1").arg(aFeature->data()->name().c_str()).toStdString()
.c_str());
}
diff --git
a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
index 62e152f620af1c039655b151707d2b3a2ee32579..1441e29579bc62ba5ff71b0b2c2388084366d04f 100644
(file)
--- a/
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
+++ b/
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
@@
-251,7
+251,7
@@
GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const
{
GeomShapePtr aShape;
DataPtr aData = myFeature->data();
{
GeomShapePtr aShape;
DataPtr aData = myFeature->data();
- if (
aData.get() == NULL
)
+ if (
!aData->isValid()
)
return aShape;
AttributeSelectionPtr aSelect = aData->selection(attributeID());
return aShape;
AttributeSelectionPtr aSelect = aData->selection(attributeID());
@@
-265,7
+265,7
@@
GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const
void ModuleBase_WidgetShapeSelector::updateSelectionName()
{
DataPtr aData = myFeature->data();
void ModuleBase_WidgetShapeSelector::updateSelectionName()
{
DataPtr aData = myFeature->data();
- if (
aData.get() == NULL
)
+ if (
!aData->isValid()
)
return;
bool isNameUpdated = false;
return;
bool isNameUpdated = false;
diff --git
a/src/PartSet/PartSet_SketcherMgr.cpp
b/src/PartSet/PartSet_SketcherMgr.cpp
index 9394b1a6bb190628bbdd67204583f90df7a3f207..339e26101f43a050af6138bc4f8bb3f48a76767d 100644
(file)
--- a/
src/PartSet/PartSet_SketcherMgr.cpp
+++ b/
src/PartSet/PartSet_SketcherMgr.cpp
@@
-460,7
+460,7
@@
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
continue;
std::string aAttrId = anAttr->id();
DataPtr aData = aFeature->data();
continue;
std::string aAttrId = anAttr->id();
DataPtr aData = aFeature->data();
- if (aData
.get() != NULL
) {
+ if (aData
->isValid()
) {
std::shared_ptr<GeomDataAPI_Point2D> aPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
if (aPoint.get() != NULL) {
std::shared_ptr<GeomDataAPI_Point2D> aPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
if (aPoint.get() != NULL) {
@@
-723,7
+723,7
@@
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
DataPtr aData = myCurrentSketch->data();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
DataPtr aData = myCurrentSketch->data();
- if (
(!aData) || (!aData->isValid()
)) {
+ if (
!aData->isValid(
)) {
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
@@
-734,7
+734,7
@@
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
QObjectPtrList aObjects = aDisplayer->displayedObjects();
foreach (ObjectPtr aObj, aObjects) {
DataPtr aObjData = aObj->data();
QObjectPtrList aObjects = aDisplayer->displayedObjects();
foreach (ObjectPtr aObj, aObjects) {
DataPtr aObjData = aObj->data();
- if (
(!aObjData) || (!aObjData->isValid()
))
+ if (
!aObjData->isValid(
))
aObj->setDisplayed(false);
}
return;
aObj->setDisplayed(false);
}
return;
diff --git
a/src/PartSet/PartSet_Validators.cpp
b/src/PartSet/PartSet_Validators.cpp
index 55f0157b003a2ff8e9f36cdc1ec364f706b1d98f..e31b1b2b50257a04d870bc72860e4fac5953b839 100644
(file)
--- a/
src/PartSet/PartSet_Validators.cpp
+++ b/
src/PartSet/PartSet_Validators.cpp
@@
-264,7
+264,7
@@
bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
bool PartSet_DifferentObjectsValidator::featureHasReferences(const AttributePtr& theAttribute) const
{
std::list<std::pair<std::string, std::list<ObjectPtr> > > allRefs;
bool PartSet_DifferentObjectsValidator::featureHasReferences(const AttributePtr& theAttribute) const
{
std::list<std::pair<std::string, std::list<ObjectPtr> > > allRefs;
- if (theAttribute->owner().get() && theAttribute->owner()->data()
.get
())
+ if (theAttribute->owner().get() && theAttribute->owner()->data()
->isValid
())
theAttribute->owner()->data()->referencesToObjects(allRefs);
// collect object referenced by theAttribute
std::list<ObjectPtr>* anAttrObjs = 0;
theAttribute->owner()->data()->referencesToObjects(allRefs);
// collect object referenced by theAttribute
std::list<ObjectPtr>* anAttrObjs = 0;
diff --git
a/src/SketchPlugin/SketchPlugin_Sketch.cpp
b/src/SketchPlugin/SketchPlugin_Sketch.cpp
index 2d02f0dd10f3a64e2900c035b30f96cb48e06cb9..7b7fb78d0e1608a9afbbf4ab8c677feccadb3508 100644
(file)
--- a/
src/SketchPlugin/SketchPlugin_Sketch.cpp
+++ b/
src/SketchPlugin/SketchPlugin_Sketch.cpp
@@
-137,7
+137,7
@@
std::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::addFeature(std::string th
void SketchPlugin_Sketch::removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature)
{
void SketchPlugin_Sketch::removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature)
{
- if (!data()
.get
()) // sketch is already removed (case on undo of sketch), sync is not needed
+ if (!data()
->isValid
()) // sketch is already removed (case on undo of sketch), sync is not needed
return;
list<ObjectPtr> aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
list<ObjectPtr>::iterator aSubIt = aSubs.begin(), aLastIt = aSubs.end();
return;
list<ObjectPtr> aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
list<ObjectPtr>::iterator aSubIt = aSubs.begin(), aLastIt = aSubs.end();
diff --git
a/src/SketchSolver/SketchSolver_ConstraintManager.cpp
b/src/SketchSolver/SketchSolver_ConstraintManager.cpp
index 8e2aa58b67ccc529e56207188e713c0939a4c254..ef725b5633fe6ddc5eb464c7313c3b84b018b737 100644
(file)
--- a/
src/SketchSolver/SketchSolver_ConstraintManager.cpp
+++ b/
src/SketchSolver/SketchSolver_ConstraintManager.cpp
@@
-341,7
+341,7
@@
std::shared_ptr<ModelAPI_CompositeFeature> SketchSolver_ConstraintManager
continue;
DataPtr aData = aWP->data();
continue;
DataPtr aData = aWP->data();
- if (aData) {
+ if (aData
->isValid()
) {
std::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aFeaturesList = aWPFeatures->list();
std::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aFeaturesList = aWPFeatures->list();
diff --git
a/src/XGUI/XGUI_Workshop.cpp
b/src/XGUI/XGUI_Workshop.cpp
index dcf348ff61b4b7bf4349e4d8c397fa9c32b5fc95..b7f68ebaab0e4f82b918caf0234a44c98e0d32c9 100644
(file)
--- a/
src/XGUI/XGUI_Workshop.cpp
+++ b/
src/XGUI/XGUI_Workshop.cpp
@@
-1267,7
+1267,7
@@
void XGUI_Workshop::deleteObjects()
aDescription += tr(" %1");
QStringList aObjectNames;
foreach (ObjectPtr aObj, anObjects) {
aDescription += tr(" %1");
QStringList aObjectNames;
foreach (ObjectPtr aObj, anObjects) {
- if (!aObj->data()
.get
())
+ if (!aObj->data()
->isValid
())
continue;
aObjectNames << QString::fromStdString(aObj->data()->name());
}
continue;
aObjectNames << QString::fromStdString(aObj->data()->name());
}