From 2928584ae0e88591f8962bde6986f03283c6b819 Mon Sep 17 00:00:00 2001 From: sbh Date: Fri, 23 Jan 2015 20:36:47 +0300 Subject: [PATCH] Fix of lost presentation in debian squeeze in release mode --- src/ModelAPI/CMakeLists.txt | 1 + src/ModelAPI/ModelAPI_CompositeFeature.cpp | 13 +++++++++++++ src/ModelAPI/ModelAPI_CompositeFeature.h | 11 +++++++---- src/ModuleBase/ModuleBase_IModule.cpp | 10 ++++++---- src/ModuleBase/ModuleBase_Operation.cpp | 12 +++++++++++- src/ModuleBase/ModuleBase_Operation.h | 4 ++-- 6 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 src/ModelAPI/ModelAPI_CompositeFeature.cpp diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index 05fe6e971..fc00bafd6 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -49,6 +49,7 @@ SET(PROJECT_SOURCES ModelAPI_Result.cpp ModelAPI_ResultPart.cpp ModelAPI_ResultConstruction.cpp + ModelAPI_CompositeFeature.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.cpp b/src/ModelAPI/ModelAPI_CompositeFeature.cpp new file mode 100644 index 000000000..ba5d1cd5c --- /dev/null +++ b/src/ModelAPI/ModelAPI_CompositeFeature.cpp @@ -0,0 +1,13 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModelAPI_CompositeFeature.h +// Created: 20 Oct 2014 +// Author: Mikhail PONIKAROV + +#include + +ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() +{ + +} + diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.h b/src/ModelAPI/ModelAPI_CompositeFeature.h index 3498b8fb1..df78236d9 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.h +++ b/src/ModelAPI/ModelAPI_CompositeFeature.h @@ -1,23 +1,26 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -// File: ModelAPI_CompositeFeature.hxx +// File: ModelAPI_CompositeFeature.h // Created: 20 Oct 2014 // Author: Mikhail PONIKAROV -#ifndef ModelAPI_CompositeFeature_H_ -#define ModelAPI_CompositeFeature_H_ +#ifndef MODELAPI_COMPOSITEFEATURE_H_ +#define MODELAPI_COMPOSITEFEATURE_H_ +#include "ModelAPI.h" #include "ModelAPI_Feature.h" /**\class ModelAPI_CompositeFeature * \ingroup DataModel * \brief Feature that consists of other features: like sketcher - * with edges inside. It just allows t oadd a feature to this feature only + * with edges inside. It just allows to add a feature to this feature only * instead of adding in both document and this feature. */ class ModelAPI_CompositeFeature : public ModelAPI_Feature { public: + MODELAPI_EXPORT virtual ~ModelAPI_CompositeFeature(); + /// Adds feature to the sketch and to its document virtual std::shared_ptr addFeature(std::string theID) = 0; diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index 0e2ce8d7f..e44ee809d 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -74,9 +74,11 @@ ModuleBase_Operation* ModuleBase_IModule::createOperation(const std::string& the ModuleBase_Operation* aCurOperation = myWorkshop->currentOperation(); if (aCurOperation) { FeaturePtr aFeature = aCurOperation->feature(); - CompositeFeaturePtr aCompFea = std::dynamic_pointer_cast(aFeature); - if (aCompFea) - anOperation->setParentFeature(aCompFea); + CompositeFeaturePtr aCompFeature = + std::dynamic_pointer_cast(aFeature); + if (aCompFeature) { + anOperation->setParentFeature(aCompFeature); + } } std::string aPluginFileName = myFeaturesInFiles[theFeatureId]; @@ -127,4 +129,4 @@ void ModuleBase_IModule::editFeature(FeaturePtr theFeature) ModuleBase_Operation* anOperation = createOperation(aFeatureId); anOperation->setFeature(theFeature); sendOperation(anOperation); -} \ No newline at end of file +} diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index e9cfa075f..96060b463 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -90,7 +90,7 @@ void ModuleBase_Operation::flushCreated() FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage) { - if (myParentFeature) { + if (myParentFeature.get()) { myFeature = myParentFeature->addFeature(getDescription()->operationId().toStdString()); } else { std::shared_ptr aDoc = document(); @@ -246,6 +246,16 @@ void ModuleBase_Operation::activateByPreselection() } +void ModuleBase_Operation::setParentFeature(CompositeFeaturePtr theParent) +{ + myParentFeature = theParent; +} + +CompositeFeaturePtr ModuleBase_Operation::parentFeature() const +{ + return myParentFeature; +} + void ModuleBase_Operation::initSelection(ModuleBase_ISelection* theSelection, ModuleBase_IViewer* theViewer) { diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 596b51d1d..77c8d3fe3 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -120,10 +120,10 @@ Q_OBJECT /// If the operation works with feature which is sub-feature of another one /// then this variable has to be initialised by parent feature /// before operation feature creating - void setParentFeature(CompositeFeaturePtr theParent) { myParentFeature = theParent; } + void setParentFeature(CompositeFeaturePtr theParent); /// \return Installed parent feature (can be NULL) - CompositeFeaturePtr parentFeature() const { return myParentFeature; } + CompositeFeaturePtr parentFeature() const; signals: /// The operation is started -- 2.39.2