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<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())
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--) {
bool ModelAPI_Object::isInHistory()
{
- if (myData.get() && myData->isValid()) {
+ if (myData->isValid()) {
return myData->isInHistory();
}
return true; // default value
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);
void ModelAPI_Object::erase()
{
- if (myData.get() && myData != myData->invalidPtr()) myData->erase();
+ if (myData->isValid() && myData != myData->invalidPtr()) myData->erase();
setData(myData->invalidPtr());
}
bool ModuleBase_Operation::isValid() const
{
- if (!myFeature || !myFeature->data().get())
+ if (!myFeature || !myFeature->data()->isValid())
return true; // rename operation
if (myFeature->isAction())
return true;
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());
}
{
GeomShapePtr aShape;
DataPtr aData = myFeature->data();
- if (aData.get() == NULL)
+ if (!aData->isValid())
return aShape;
AttributeSelectionPtr aSelect = aData->selection(attributeID());
void ModuleBase_WidgetShapeSelector::updateSelectionName()
{
DataPtr aData = myFeature->data();
- if (aData.get() == NULL)
+ if (!aData->isValid())
return;
bool isNameUpdated = false;
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) {
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();
QObjectPtrList aObjects = aDisplayer->displayedObjects();
foreach (ObjectPtr aObj, aObjects) {
DataPtr aObjData = aObj->data();
- if ((!aObjData) || (!aObjData->isValid()))
+ if (!aObjData->isValid())
aObj->setDisplayed(false);
}
return;
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;
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();
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();
aDescription += tr(" %1");
QStringList aObjectNames;
foreach (ObjectPtr aObj, anObjects) {
- if (!aObj->data().get())
+ if (!aObj->data()->isValid())
continue;
aObjectNames << QString::fromStdString(aObj->data()->name());
}