From: mpv Date: Tue, 18 Nov 2014 06:29:17 +0000 (+0300) Subject: Fix for crash and invisible bodies on Debian Squeeze SALOME version. X-Git-Tag: V_0.5.2~2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0fcae5b2e143e67306603d26f0b5e01cbe33d2bb;p=modules%2Fshaper.git Fix for crash and invisible bodies on Debian Squeeze SALOME version. The problem is still unclear, possible there will be new fixes needed later. --- diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.cpp b/src/GeomAPI/GeomAPI_PlanarEdges.cpp index f12d62204..912e9cd69 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.cpp +++ b/src/GeomAPI/GeomAPI_PlanarEdges.cpp @@ -48,3 +48,41 @@ std::list > GeomAPI_PlanarEdges::getEdges() } return aResult; } + +bool GeomAPI_PlanarEdges::hasPlane() const { + return myOrigin && myNorm && myDirX && myDirY; +} + +bool GeomAPI_PlanarEdges::isVertex() const { + return false; +} + +bool GeomAPI_PlanarEdges::isEdge() const { + return false; +} + +void GeomAPI_PlanarEdges::setOrigin(const boost::shared_ptr& theOrigin) +{ + myOrigin = theOrigin; +} +boost::shared_ptr GeomAPI_PlanarEdges::origin() const { + return myOrigin; +} +void GeomAPI_PlanarEdges::setDirX(const boost::shared_ptr& theDirX) { + myDirX = theDirX; +} +boost::shared_ptr GeomAPI_PlanarEdges::dirX() const { + return myDirX; +} +void GeomAPI_PlanarEdges::setDirY(const boost::shared_ptr& theDirY) { + myDirY = theDirY; +} +boost::shared_ptr GeomAPI_PlanarEdges::dirY() const { + return myDirY; +} +void GeomAPI_PlanarEdges::setNorm(const boost::shared_ptr& theNorm) { + myNorm = theNorm; +} +boost::shared_ptr GeomAPI_PlanarEdges::norm() const { + return myNorm; +} diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.h b/src/GeomAPI/GeomAPI_PlanarEdges.h index af8422619..2b94de9b3 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.h +++ b/src/GeomAPI/GeomAPI_PlanarEdges.h @@ -25,39 +25,32 @@ class GeomAPI_PlanarEdges : public GeomAPI_Shape /// Creation of empty (null) shape GEOMAPI_EXPORT GeomAPI_PlanarEdges(); - GEOMAPI_EXPORT virtual bool isVertex() const - { - return false; - } + GEOMAPI_EXPORT virtual bool isVertex() const; /// Returns whether the shape is an edge - GEOMAPI_EXPORT virtual bool isEdge() const - { - return false; - } + GEOMAPI_EXPORT virtual bool isEdge() const; GEOMAPI_EXPORT void addEdge(boost::shared_ptr theEdge); GEOMAPI_EXPORT std::list > getEdges(); /// Returns True if the wire is defined in a plane - GEOMAPI_EXPORT bool hasPlane() const { return myOrigin && myNorm && myDirX && myDirY; } + GEOMAPI_EXPORT bool hasPlane() const; /// Set/Get origin point - GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr& theOrigin) - { myOrigin = theOrigin; } - GEOMAPI_EXPORT boost::shared_ptr origin() const { return myOrigin; } + GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr& theOrigin); + GEOMAPI_EXPORT boost::shared_ptr origin() const; /// Set/Get X direction vector - GEOMAPI_EXPORT void setDirX(const boost::shared_ptr& theDirX) { myDirX = theDirX; } - GEOMAPI_EXPORT boost::shared_ptr dirX() const { return myDirX; } + GEOMAPI_EXPORT void setDirX(const boost::shared_ptr& theDirX); + GEOMAPI_EXPORT boost::shared_ptr dirX() const; /// Set/Get Y direction vector - GEOMAPI_EXPORT void setDirY(const boost::shared_ptr& theDirY) { myDirY = theDirY; } - GEOMAPI_EXPORT boost::shared_ptr dirY() const { return myDirY; } + GEOMAPI_EXPORT void setDirY(const boost::shared_ptr& theDirY); + GEOMAPI_EXPORT boost::shared_ptr dirY() const; /// Set/Get Normal direction vector - GEOMAPI_EXPORT void setNorm(const boost::shared_ptr& theNorm) { myNorm = theNorm; } - GEOMAPI_EXPORT boost::shared_ptr norm() const { return myNorm; } + GEOMAPI_EXPORT void setNorm(const boost::shared_ptr& theNorm); + GEOMAPI_EXPORT boost::shared_ptr norm() const; private: boost::shared_ptr myOrigin; diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 8af38252d..749c90211 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -9,7 +9,7 @@ void Model_ResultConstruction::setShape(boost::shared_ptr theShap myShape = theShape; } -boost::shared_ptr& Model_ResultConstruction::shape() +boost::shared_ptr Model_ResultConstruction::shape() { return myShape; } diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index 5b6e9b472..a9683cdcf 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -30,7 +30,7 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction /// Sets the result MODEL_EXPORT virtual void setShape(boost::shared_ptr theShape); /// Returns the shape-result produced by this feature - MODEL_EXPORT virtual boost::shared_ptr& shape(); + MODEL_EXPORT virtual boost::shared_ptr shape(); /// Sets the flag that it must be displayed in history (default is true) MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory); diff --git a/src/Model/Model_ResultGroup.cpp b/src/Model/Model_ResultGroup.cpp index 3e467395d..5c9017393 100644 --- a/src/Model/Model_ResultGroup.cpp +++ b/src/Model/Model_ResultGroup.cpp @@ -12,7 +12,7 @@ Model_ResultGroup::Model_ResultGroup(boost::shared_ptr theOwnerDa myOwnerData = theOwnerData; } -boost::shared_ptr Model_ResultGroup::shape() const +boost::shared_ptr Model_ResultGroup::shape() { boost::shared_ptr aResult; if (myOwnerData) { diff --git a/src/Model/Model_ResultGroup.h b/src/Model/Model_ResultGroup.h index 30e358898..7703dd436 100644 --- a/src/Model/Model_ResultGroup.h +++ b/src/Model/Model_ResultGroup.h @@ -19,7 +19,7 @@ class Model_ResultGroup : public ModelAPI_ResultGroup boost::shared_ptr myOwnerData; ///< data of owner of this result public: /// Returns the compound of selected entities - MODEL_EXPORT virtual boost::shared_ptr shape() const; + MODEL_EXPORT virtual boost::shared_ptr shape(); /// Removes the stored builders MODEL_EXPORT virtual ~Model_ResultGroup() {} diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index c266b505e..7e79f12fb 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -7,29 +7,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include #include -class ModelAPI_Data; -class ModelAPI_Document; -class ModelAPI_Result; - /**\class ModelAPI_Feature * \ingroup DataModel * \brief Feature function that represents the particular functionality diff --git a/src/ModelAPI/ModelAPI_Object.cpp b/src/ModelAPI/ModelAPI_Object.cpp new file mode 100644 index 000000000..40f1b236c --- /dev/null +++ b/src/ModelAPI/ModelAPI_Object.cpp @@ -0,0 +1,41 @@ +// File: ModelAPI_Object.cpp +// Created: 19 May 2014 +// Author: Mikhail PONIKAROV + +#include "ModelAPI_Object.h" + + +bool ModelAPI_Object::isInHistory() { + return true; +} + +boost::shared_ptr ModelAPI_Object::data() const { + return myData; +} + +bool ModelAPI_Object::isSame(const boost::shared_ptr& theObject) { + return theObject.get() == this; +} + +boost::shared_ptr ModelAPI_Object::document() const { + return myDoc; +} + +void ModelAPI_Object::attributeChanged() { +} + +ModelAPI_Object::~ModelAPI_Object() { +} + +void ModelAPI_Object::setData(boost::shared_ptr theData) { + myData = theData; +} + +void ModelAPI_Object::setDoc(boost::shared_ptr theDoc) { + myDoc = theDoc; +} + +void ModelAPI_Object::erase() { + if (myData) myData->erase(); + setData(DataPtr()); +} diff --git a/src/ModelAPI/ModelAPI_Result.cpp b/src/ModelAPI/ModelAPI_Result.cpp new file mode 100644 index 000000000..096850702 --- /dev/null +++ b/src/ModelAPI/ModelAPI_Result.cpp @@ -0,0 +1,19 @@ +// File: ModelAPI_Result.cpp +// Created: 07 Jul 2014 +// Author: Mikhail PONIKAROV + +#include "ModelAPI_Result.h" + +bool ModelAPI_Result::isConcealed() { + return myIsConcealed; +} + +void ModelAPI_Result::setIsConcealed(const bool theValue) { + myIsConcealed = theValue; +} + +ModelAPI_Result::ModelAPI_Result() { +} + +ModelAPI_Result::~ModelAPI_Result() { +} diff --git a/src/ModelAPI/ModelAPI_Result.h b/src/ModelAPI/ModelAPI_Result.h index eb664ec22..c702ba25a 100644 --- a/src/ModelAPI/ModelAPI_Result.h +++ b/src/ModelAPI/ModelAPI_Result.h @@ -6,6 +6,7 @@ #define ModelAPI_Result_H_ #include "ModelAPI_Object.h" +#include "GeomAPI_Shape.h" class ModelAPI_Feature; @@ -30,6 +31,8 @@ class ModelAPI_Result : public ModelAPI_Object { } + /// Returns the shape-result produced by this feature (or null if no shapes) + virtual boost::shared_ptr shape() {return boost::shared_ptr();} }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index cce169833..86e368ef3 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -47,9 +47,6 @@ public: virtual void storeModified(const boost::shared_ptr& theOldShape, const boost::shared_ptr& theNewShape) = 0; - /// Returns the shape-result produced by this feature - virtual boost::shared_ptr shape() = 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( diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.h b/src/ModelAPI/ModelAPI_ResultConstruction.h index 972b3a965..8f040209f 100644 --- a/src/ModelAPI/ModelAPI_ResultConstruction.h +++ b/src/ModelAPI/ModelAPI_ResultConstruction.h @@ -33,9 +33,6 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result return MY_GROUP; } - /// Returns the shape-result produced by this feature - virtual boost::shared_ptr& shape() = 0; - /// Sets the result virtual void setShape(boost::shared_ptr theShape) = 0; diff --git a/src/ModelAPI/ModelAPI_ResultGroup.h b/src/ModelAPI/ModelAPI_ResultGroup.h index a8b183c12..6d4f85222 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.h +++ b/src/ModelAPI/ModelAPI_ResultGroup.h @@ -32,8 +32,6 @@ public: return MY_GROUP; } - /// Returns the compound of selected entities - virtual boost::shared_ptr shape() const = 0; }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 8656f2fd7..d765e7702 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -11,7 +11,7 @@ namespace ModelAPI_Tools { boost::shared_ptr shape(const ResultPtr& theResult) { - +/* ResultBodyPtr aBody = boost::dynamic_pointer_cast(theResult); if (aBody) return aBody->shape(); @@ -25,5 +25,7 @@ namespace ModelAPI_Tools { if (aGroup) return aGroup->shape(); return boost::shared_ptr(); + */ + return theResult->shape(); } } diff --git a/src/ModuleBase/ModuleBase_Definitions.h b/src/ModuleBase/ModuleBase_Definitions.h index 926de63ca..8cfed34b4 100644 --- a/src/ModuleBase/ModuleBase_Definitions.h +++ b/src/ModuleBase/ModuleBase_Definitions.h @@ -3,11 +3,9 @@ #include #include -#include typedef QList QIntList; //!< list of int values typedef QList QShortList; //!< list of short int values typedef QList QDoubleList; //!< list of double values typedef QList QFeatureList; //!< List of features -typedef QList QResultList; //!< List of results #endif diff --git a/src/NewGeom/CMakeLists.txt b/src/NewGeom/CMakeLists.txt index dcc5bdae5..cf0f68741 100644 --- a/src/NewGeom/CMakeLists.txt +++ b/src/NewGeom/CMakeLists.txt @@ -47,6 +47,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI ${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/ModuleBase ${PROJECT_SOURCE_DIR}/src/ModelAPI + ${PROJECT_SOURCE_DIR}/src/GeomAPI ${PROJECT_SOURCE_DIR}/src/Config ${SALOME_GUI_INCLUDE} ${SALOME_KERNEL_INCLUDE} diff --git a/src/PartSetPlugin/CMakeLists.txt b/src/PartSetPlugin/CMakeLists.txt index 2988a3b26..3cad36fe0 100644 --- a/src/PartSetPlugin/CMakeLists.txt +++ b/src/PartSetPlugin/CMakeLists.txt @@ -21,6 +21,7 @@ TARGET_LINK_LIBRARIES(PartSetPlugin ${PROJECT_LIBRARIES} ModelAPI) INCLUDE_DIRECTORIES( ../ModelAPI + ../GeomAPI ) SET(XML_RESOURCES diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 2f4c3aaf1..486b8495f 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -10,6 +10,7 @@ #include #include #include +#include class SketchPlugin_Sketch; class GeomAPI_Pnt2d; @@ -55,7 +56,7 @@ class SketchPlugin_Feature : public ModelAPI_Feature /// Returns true is sketch element is under the rigid constraint SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;} - bool isExternal() const + inline bool isExternal() const { AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID()); if (aAttr) diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 764e19f2d..5542006a1 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -5,7 +5,6 @@ #include "XGUI_Constants.h" #include #include -#include #include #include @@ -41,6 +40,7 @@ class QDockWidget; class ModelAPI_ObjectUpdatedMessage; class ModelAPI_ObjectDeletedMessage; +class ModelAPI_ResultPart; class QAction; /**\class XGUI_Workshop @@ -147,7 +147,7 @@ Q_OBJECT //! Activates or deactivates a part //! If PartPtr is Null pointer then PartSet will be activated - void activatePart(ResultPartPtr theFeature); + void activatePart(boost::shared_ptr theFeature); //! Delete features void deleteObjects(const QList& theList);