]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for crash and invisible bodies on Debian Squeeze SALOME version.
authormpv <mikhail.ponikarov@opencascade.com>
Tue, 18 Nov 2014 06:29:17 +0000 (09:29 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Tue, 18 Nov 2014 06:29:17 +0000 (09:29 +0300)
The problem is still unclear, possible there will be new fixes needed later.

19 files changed:
src/GeomAPI/GeomAPI_PlanarEdges.cpp
src/GeomAPI/GeomAPI_PlanarEdges.h
src/Model/Model_ResultConstruction.cpp
src/Model/Model_ResultConstruction.h
src/Model/Model_ResultGroup.cpp
src/Model/Model_ResultGroup.h
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Object.cpp [new file with mode: 0644]
src/ModelAPI/ModelAPI_Result.cpp [new file with mode: 0644]
src/ModelAPI/ModelAPI_Result.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultConstruction.h
src/ModelAPI/ModelAPI_ResultGroup.h
src/ModelAPI/ModelAPI_Tools.cpp
src/ModuleBase/ModuleBase_Definitions.h
src/NewGeom/CMakeLists.txt
src/PartSetPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Feature.h
src/XGUI/XGUI_Workshop.h

index f12d62204838cccd8a44cbbdcb1e2107a79771c7..912e9cd6950e277269baf7e2c21d00b8aafefbab 100644 (file)
@@ -48,3 +48,41 @@ std::list<boost::shared_ptr<GeomAPI_Shape> > 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<GeomAPI_Pnt>& theOrigin)
+{
+  myOrigin = theOrigin;
+}
+boost::shared_ptr<GeomAPI_Pnt> GeomAPI_PlanarEdges::origin() const {
+  return myOrigin;
+}
+void GeomAPI_PlanarEdges::setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX) {
+  myDirX = theDirX;
+}
+boost::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirX() const {
+  return myDirX;
+}
+void GeomAPI_PlanarEdges::setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY) {
+  myDirY = theDirY;
+}
+boost::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::dirY() const {
+  return myDirY;
+}
+void GeomAPI_PlanarEdges::setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm) {
+  myNorm = theNorm;
+}
+boost::shared_ptr<GeomAPI_Dir> GeomAPI_PlanarEdges::norm() const {
+  return myNorm;
+}
index af8422619f84f1e08f1b9cfe9a7be1cfd8a83c70..2b94de9b358ede3e77e990d64fdfdc7d5cba15d4 100644 (file)
@@ -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<GeomAPI_Shape> theEdge);
   GEOMAPI_EXPORT std::list<boost::shared_ptr<GeomAPI_Shape> > 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<GeomAPI_Pnt>& theOrigin) 
-  { myOrigin = theOrigin; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Pnt> origin() const { return myOrigin; }
+  GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin);
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Pnt> origin() const;
 
   /// Set/Get X direction vector
-  GEOMAPI_EXPORT void setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX) { myDirX = theDirX; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirX() const { return myDirX; }
+  GEOMAPI_EXPORT void setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX);
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirX() const;
 
   /// Set/Get Y direction vector
-  GEOMAPI_EXPORT void setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY) { myDirY = theDirY; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirY() const { return myDirY; }
+  GEOMAPI_EXPORT void setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY);
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirY() const;
 
   /// Set/Get Normal direction vector
-  GEOMAPI_EXPORT void setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm) { myNorm = theNorm; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> norm() const { return myNorm; }
+  GEOMAPI_EXPORT void setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm);
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> norm() const;
 
 private:
   boost::shared_ptr<GeomAPI_Pnt> myOrigin;
index 8af38252d8805c917b64bb5b34ace6b63ed55860..749c90211d92a0cefec5a5cf75d78df8e231a478 100644 (file)
@@ -9,7 +9,7 @@ void Model_ResultConstruction::setShape(boost::shared_ptr<GeomAPI_Shape> theShap
   myShape = theShape;
 }
 
-boost::shared_ptr<GeomAPI_Shape>& Model_ResultConstruction::shape()
+boost::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape()
 {
   return myShape;
 }
index 5b6e9b472f9008069d0e7c274144c83014406de3..a9683cdcf52d3f7ce3287b6e253405c6edc308dc 100644 (file)
@@ -30,7 +30,7 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction
   /// Sets the result
   MODEL_EXPORT virtual void setShape(boost::shared_ptr<GeomAPI_Shape> theShape);
   /// Returns the shape-result produced by this feature
-  MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape>& shape();
+  MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
 
   /// Sets the flag that it must be displayed in history (default is true)
   MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
index 3e467395d827eded82e71d7e8ceb128c715bc4df..5c90173934e13f62952db75a5b60d0a05d6fd271 100644 (file)
@@ -12,7 +12,7 @@ Model_ResultGroup::Model_ResultGroup(boost::shared_ptr<ModelAPI_Data> theOwnerDa
   myOwnerData = theOwnerData;
 }
 
-boost::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape() const
+boost::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape()
 {
   boost::shared_ptr<GeomAPI_Shape> aResult;
   if (myOwnerData) {
index 30e3588985df75aa18e674e1e648f2748410846b..7703dd4360c6f90bcdfccb3ce1c6fa9e1eeefdc7 100644 (file)
@@ -19,7 +19,7 @@ class Model_ResultGroup : public ModelAPI_ResultGroup
   boost::shared_ptr<ModelAPI_Data> myOwnerData;  ///< data of owner of this result
 public:
   /// Returns the compound of selected entities
-  MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape() const;
+  MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
 
   /// Removes the stored builders
   MODEL_EXPORT virtual ~Model_ResultGroup() {}
index c266b505ea1a194910a7ab7a020a72b448717532..7e79f12fb6d4d2e6bc3c130d3167d6b42a7136e6 100644 (file)
@@ -7,29 +7,14 @@
 
 #include <ModelAPI.h>
 #include <ModelAPI_Object.h>
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeDocRef.h>
-#include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_AttributeInteger.h>
-#include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_AttributeReference.h>
-#include <ModelAPI_AttributeSelection.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_AttributeString.h>
-#include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
-#include <ModelAPI_Result.h>
 
 #include <boost/shared_ptr.hpp>
 
 #include <list>
 #include <string>
 
-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 (file)
index 0000000..40f1b23
--- /dev/null
@@ -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_Data> ModelAPI_Object::data() const {
+  return myData;
+}
+
+bool ModelAPI_Object::isSame(const boost::shared_ptr<ModelAPI_Object>& theObject) {
+  return theObject.get() == this;
+}
+
+boost::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const {
+  return myDoc;
+}
+
+void ModelAPI_Object::attributeChanged() {
+}
+
+ModelAPI_Object::~ModelAPI_Object() {
+}
+
+void ModelAPI_Object::setData(boost::shared_ptr<ModelAPI_Data> theData) {
+  myData = theData;
+}
+
+void ModelAPI_Object::setDoc(boost::shared_ptr<ModelAPI_Document> 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 (file)
index 0000000..0968507
--- /dev/null
@@ -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() {
+}
index eb664ec221c92ccb1a0befd1b1a9a5ab3d035c76..c702ba25a85c5c476469d77b57eee3c5bc928e5b 100644 (file)
@@ -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<GeomAPI_Shape> shape() {return boost::shared_ptr<GeomAPI_Shape>();}
 };
 
 //! Pointer on feature object
index cce169833c42946840385e7b82ff2af581471aa4..86e368ef37cf6a1ce1c503cbe04363e35c3008fa 100644 (file)
@@ -47,9 +47,6 @@ public:
   virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
                                  const boost::shared_ptr<GeomAPI_Shape>& theNewShape) = 0;
 
-  /// Returns the shape-result produced by this feature
-  virtual boost::shared_ptr<GeomAPI_Shape> 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(
index 972b3a96512a53c358fbafbf5c9e1d42c207a7a4..8f040209ff666763269d5c8b94a169e3513786e2 100644 (file)
@@ -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<GeomAPI_Shape>& shape() = 0;
-
   /// Sets the result
   virtual void setShape(boost::shared_ptr<GeomAPI_Shape> theShape) = 0;
 
index a8b183c12c62f4b10643f3a92650a7256a1572f3..6d4f85222739038dda30fb426311c2cb1ce86688 100644 (file)
@@ -32,8 +32,6 @@ public:
     return MY_GROUP;
   }
 
-  /// Returns the compound of selected entities
-  virtual boost::shared_ptr<GeomAPI_Shape> shape() const = 0;
 };
 
 //! Pointer on feature object
index 8656f2fd7545adda30c425bc11eeeee263e04519..d765e77026544c089a45c76f28e4e2295b970c28 100644 (file)
@@ -11,7 +11,7 @@ namespace ModelAPI_Tools {
 
   boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
   {
-
+/*
     ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
     if (aBody)
       return aBody->shape();
@@ -25,5 +25,7 @@ namespace ModelAPI_Tools {
     if (aGroup)
       return aGroup->shape();
     return boost::shared_ptr<GeomAPI_Shape>();
+    */
+    return theResult->shape();
   }
 }
index 926de63ca9fb4a83dc85f9403c747bdecc31abe0..8cfed34b4fb03ff03b6368febb536a29dad7aad2 100644 (file)
@@ -3,11 +3,9 @@
 
 #include <QList>
 #include <ModelAPI_Feature.h>
-#include <ModelAPI_Result.h>
 
 typedef QList<int> QIntList;       //!< list of int values
 typedef QList<short> QShortList;     //!< list of short int values
 typedef QList<double> QDoubleList;    //!< list of double values
 typedef QList<FeaturePtr> QFeatureList;  //!< List of features
-typedef QList<ResultPtr> QResultList;  //!< List of results
 #endif
index dcc5bdae5f8d38b2d72bec640556f748019309c3..cf0f687418de3c8782315c823730c23db65e7faa 100644 (file)
@@ -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}
index 2988a3b26a5dfab12ae8b9034cfdbd36dbd208da..3cad36fe02fefebb1ab4037b20d369f0e20bab6e 100644 (file)
@@ -21,6 +21,7 @@ TARGET_LINK_LIBRARIES(PartSetPlugin ${PROJECT_LIBRARIES} ModelAPI)
 
 INCLUDE_DIRECTORIES(
   ../ModelAPI
+  ../GeomAPI
 )
 
 SET(XML_RESOURCES
index 2f4c3aaf17fd94aba30aaf0180fa38cfe00a25f2..486b8495ff102786dac42918dfcd357486dfd64a 100644 (file)
@@ -10,6 +10,7 @@
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_AISObject.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_AttributeSelection.h>
 
 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)
index 764e19f2d626079bbe01ce7dffca429f9ddd32ba..5542006a1586e97e103122470946abd17dfe0c73 100644 (file)
@@ -5,7 +5,6 @@
 #include "XGUI_Constants.h"
 #include <Events_Listener.h>
 #include <ModuleBase_Definitions.h>
-#include <ModelAPI_ResultPart.h>
 #include <ModelAPI_Document.h>
 
 #include <QObject>
@@ -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<ModelAPI_ResultPart> theFeature);
 
   //! Delete features
   void deleteObjects(const QList<ObjectPtr>& theList);