]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge remote-tracking branch 'origin/PortingSalome760' into Dev_1.3.0
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Jun 2015 13:49:04 +0000 (16:49 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Jun 2015 13:49:04 +0000 (16:49 +0300)
30 files changed:
CMakeLists.txt
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp [new file with mode: 0755]
src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h [new file with mode: 0755]
src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.h
src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp [new file with mode: 0755]
src/FeaturesPlugin/FeaturesPlugin_Rotation.h [new file with mode: 0755]
src/FeaturesPlugin/extrusioncut_widget.xml [new file with mode: 0755]
src/FeaturesPlugin/placement_widget.xml
src/FeaturesPlugin/plugin-Features.xml
src/FeaturesPlugin/rotation_widget.xml [new file with mode: 0755]
src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Objects.cpp
src/Model/Model_Objects.h
src/ModelAPI/ModelAPI_Document.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/NewGeom/resources/LightApp.xml
src/NewGeom/resources/SalomeApp.xml
src/PartSet/PartSet_PartDataModel.cpp
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/placement_from.png [new file with mode: 0755]
src/PartSet/icons/placement_to.png [new file with mode: 0755]
src/XGUI/XGUI_Displayer.cpp

index 203796b6c9ccb68f087d8ea4e4959afbebdab4f7..6558ade49586cd6920478d0fb80b335207391536 100644 (file)
@@ -1,7 +1,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
 
 PROJECT (NewGEOM)
-SET (NewGeom_Version 1.2.0)
+SET (NewGeom_Version 1.2.1)
 
 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
 
index 6bd7dcd403cf35baf3c01587efe2831f1a07ddc0..4aa8619f0dbc2cd105de6d4fac68e47b68df89f1 100644 (file)
@@ -7,7 +7,9 @@ SET(PROJECT_HEADERS
     FeaturesPlugin.h
     FeaturesPlugin_Plugin.h
     FeaturesPlugin_Extrusion.h
+    FeaturesPlugin_ExtrusionCut.h
     FeaturesPlugin_Revolution.h
+    FeaturesPlugin_Rotation.h
     FeaturesPlugin_Boolean.h
     FeaturesPlugin_Group.h
     FeaturesPlugin_Placement.h
@@ -16,7 +18,9 @@ SET(PROJECT_HEADERS
 SET(PROJECT_SOURCES
     FeaturesPlugin_Plugin.cpp
     FeaturesPlugin_Extrusion.cpp
+    FeaturesPlugin_ExtrusionCut.cpp
     FeaturesPlugin_Revolution.cpp
+    FeaturesPlugin_Rotation.cpp
     FeaturesPlugin_Boolean.cpp
     FeaturesPlugin_Group.cpp
     FeaturesPlugin_Placement.cpp
@@ -25,7 +29,9 @@ SET(PROJECT_SOURCES
 SET(XML_RESOURCES
   plugin-Features.xml
   extrusion_widget.xml
+  extrusioncut_widget.xml
   revolution_widget.xml
+  rotation_widget.xml
   boolean_widget.xml
   group_widget.xml
   placement_widget.xml
diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp
new file mode 100755 (executable)
index 0000000..cfd5b5d
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        FeaturesPlugin_ExtrusionCut.cpp
+// Created:     12 May 2015
+// Author:      Dmitry Bobylev
+
+#include <FeaturesPlugin_ExtrusionCut.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::initAttributes()
+{
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::AXIS_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID());
+
+  AttributeSelectionListPtr aSelection = 
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+    FeaturesPlugin_ExtrusionCut::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+  // extrusion works with faces always
+  aSelection->setSelectionType("SOLID");
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::execute()
+{
+}
diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h
new file mode 100755 (executable)
index 0000000..8285682
--- /dev/null
@@ -0,0 +1,94 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        FeaturesPlugin_ExtrusionCut.h
+// Created:     12 May 2015
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesPlugin_ExtrusionCut_H_
+#define FeaturesPlugin_ExtrusionCut_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_ExtrusionCut
+ *  \ingroup Plugins
+ */
+class FeaturesPlugin_ExtrusionCut : public ModelAPI_Feature
+{
+ public:
+  /// Revolution kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_REVOLUTION_ID("ExtrusionCut");
+    return MY_REVOLUTION_ID;
+  }
+
+  /// attribute name of references sketch entities list, it should contain a sketch result or
+  /// a pair a sketch result to sketch face
+  inline static const std::string& LIST_ID()
+  {
+    static const std::string MY_GROUP_LIST_ID("main_objects");
+    return MY_GROUP_LIST_ID;
+  }
+
+  /// attribute name of an object to which the extrusion grows
+  inline static const std::string& SKETCH_OBJECT_ID()
+  {
+    static const std::string MY_TO_OBJECT_ID("sketch");
+    return MY_TO_OBJECT_ID;
+  }
+
+  /// Attribute name of an object to which the extrusion grows.
+  inline static const std::string& AXIS_OBJECT_ID()
+  {
+    static const std::string MY_TO_OBJECT_ID("axis_object");
+    return MY_TO_OBJECT_ID;
+  }
+
+  /// attribute name of extrusion size
+  inline static const std::string& TO_SIZE_ID()
+  {
+    static const std::string MY_TO_SIZE_ID("to_size");
+    return MY_TO_SIZE_ID;
+  }
+
+  /// attribute name of extrusion size
+  inline static const std::string& FROM_SIZE_ID()
+  {
+    static const std::string MY_FROM_SIZE_ID("from_size");
+    return MY_FROM_SIZE_ID;
+  }
+
+  /// attribute name of an object to which the extrusion grows
+  inline static const std::string& TO_OBJECT_ID()
+  {
+    static const std::string MY_TO_OBJECT_ID("to_object");
+    return MY_TO_OBJECT_ID;
+  }
+
+  /// attribute name of tool object
+  inline static const std::string& FROM_OBJECT_ID()
+  {
+    static const std::string MY_FROM_OBJECT_ID("from_object");
+    return MY_FROM_OBJECT_ID;
+  }
+
+  /// Returns the kind of a feature
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID();
+    return MY_KIND;
+  }
+
+  /// Creates a new part document if needed.
+  FEATURESPLUGIN_EXPORT virtual void execute();
+
+  /// Request for initialization of data model of the feature: adding all attributes.
+  FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Use plugin manager for features creation.
+  FeaturesPlugin_ExtrusionCut();
+};
+
+#endif
index 3ba02779f5b5a7cdb10b849ae6676bb742986070..d069858d45e3c528412516c8e6b3c73911cc7f88 100644 (file)
@@ -10,6 +10,7 @@
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeSelectionList.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
@@ -26,6 +27,13 @@ FeaturesPlugin_Placement::FeaturesPlugin_Placement()
 
 void FeaturesPlugin_Placement::initAttributes()
 {
+  /* Modification for specification of 1.3.0
+  AttributeSelectionListPtr aSelection = 
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+    FeaturesPlugin_Placement::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+  // extrusion works with faces always
+  aSelection->setSelectionType("SOLID");
+  */
   data()->addAttribute(FeaturesPlugin_Placement::BASE_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(FeaturesPlugin_Placement::ATTRACT_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId());
index 8039f37e2c84db33e0dd46c78f0dcf7e2f043a3f..b83d07e9593f40e72586cca0a23d2f3c5ef5320b 100644 (file)
@@ -31,6 +31,14 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature
     static const std::string MY_PLACEMENT_ID("Placement");
     return MY_PLACEMENT_ID;
   }
+  /// attribute name of references sketch entities list, it should contain a sketch result or
+  /// a pair a sketch result to sketch face
+  /*Modification for specification of 1.3.0
+  inline static const std::string& LIST_ID()
+  {
+    static const std::string MY_GROUP_LIST_ID("base");
+    return MY_GROUP_LIST_ID;
+  }*/
   /// attribute name of referenced object
   inline static const std::string& BASE_OBJECT_ID()
   {
index c35243e8d9d2c25a68808428ac32d808b28764d4..100dddf3e297f2b0c2fb4e8763de45cff852e8c6 100644 (file)
@@ -4,9 +4,11 @@
 
 #include <FeaturesPlugin_Boolean.h>
 #include <FeaturesPlugin_Extrusion.h>
+#include <FeaturesPlugin_ExtrusionCut.h>
 #include <FeaturesPlugin_Group.h>
 #include <FeaturesPlugin_Placement.h>
 #include <FeaturesPlugin_Revolution.h>
+#include <FeaturesPlugin_Rotation.h>
 
 #include <ModelAPI_Session.h>
 
@@ -30,13 +32,17 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
     return FeaturePtr(new FeaturesPlugin_Extrusion);
   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
-    return FeaturePtr(new FeaturesPlugin_Revolution);
+   return FeaturePtr(new FeaturesPlugin_Revolution);
+  } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
+    return FeaturePtr(new FeaturesPlugin_Rotation);
   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
     return FeaturePtr(new FeaturesPlugin_Boolean);
   } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
     return FeaturePtr(new FeaturesPlugin_Group);
   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
     return FeaturePtr(new FeaturesPlugin_Placement);
+  } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
+    return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
   }
   // feature of such kind is not found
   return FeaturePtr();
index edf556918281231a509b37055225d29a1a677995..63341f8c45057be7c4a8a320f165381428921b0c 100644 (file)
@@ -23,9 +23,9 @@
 
 #define FACE 4
 #define EDGE 6
-#define _GENERATE_TAG 1
-#define _FIRST_TAG 2
-#define _LAST_TAG 3
+#define _LATERAL_TAG 1
+#define _FROM_TAG 2
+#define _TO_TAG 3
 
 //=================================================================================================
 FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
@@ -168,27 +168,27 @@ void FeaturesPlugin_Revolution::LoadNamingDS(GeomAlgoAPI_Revolution& theFeature,
   GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape();
   theFeature.mapOfShapes(*aSubShapes);
 
-  std::string aGeneratedName = "Generated";
-  theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_GENERATE_TAG, aGeneratedName, *aSubShapes);
+  std::string aGeneratedName = "LateralFace";
+  theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, aGeneratedName, *aSubShapes);
 
-  //Insert bottom face
+  //Insert from face
   std::string aBotName = "FromFace";
   std::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
   if(!aBottomFace->isNull()) {
     if(aSubShapes->isBound(aBottomFace)) {
       aBottomFace = aSubShapes->find(aBottomFace);
     }
-    theResultBody->generated(aBottomFace, aBotName, _FIRST_TAG);
+    theResultBody->generated(aBottomFace, aBotName, _FROM_TAG);
   }
 
-  //Insert top face
+  //Insert to face
   std::string aTopName = "ToFace";
   std::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
   if (!aTopFace->isNull()) {
     if (aSubShapes->isBound(aTopFace)) {
       aTopFace = aSubShapes->find(aTopFace);
     }
-    theResultBody->generated(aTopFace, aTopName, _LAST_TAG);
+    theResultBody->generated(aTopFace, aTopName, _TO_TAG);
   }
 
 }
diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
new file mode 100755 (executable)
index 0000000..8493688
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        FeaturesPlugin_Rotation.cpp
+// Created:     12 May 2015
+// Author:      Dmitry Bobylev
+
+#include <FeaturesPlugin_Rotation.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_Rotation::FeaturesPlugin_Rotation()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::initAttributes()
+{
+  AttributeSelectionListPtr aSelection = 
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+    FeaturesPlugin_Rotation::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+  // revolution works with faces always
+  aSelection->setSelectionType("SOLID");
+
+  data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::execute()
+{
+}
diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h
new file mode 100755 (executable)
index 0000000..b8a65d6
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        FeaturesPlugin_Rotation.h
+// Created:     12 May 2015
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesPlugin_Rotation_H_
+#define FeaturesPlugin_Rotation_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_Rotation
+ *  \ingroup Plugins
+ *  \brief Feature for creation of revolution from the planar face.
+ *  Revolution creates the lateral faces based on edges of the base face and
+ *  the start and end faces and/or start and end angles.
+ */
+class FeaturesPlugin_Rotation : public ModelAPI_Feature
+{
+ public:
+  /// Revolution kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_REVOLUTION_ID("Rotation");
+    return MY_REVOLUTION_ID;
+  }
+
+  /// Attribute name of references sketch entities list, it should contain a sketch result or
+  /// a pair a sketch result to sketch face.
+  inline static const std::string& LIST_ID()
+  {
+    static const std::string MY_GROUP_LIST_ID("base");
+    return MY_GROUP_LIST_ID;
+  }
+
+  /// Attribute name of an object to which the extrusion grows.
+  inline static const std::string& AXIS_OBJECT_ID()
+  {
+    static const std::string MY_TO_OBJECT_ID("axis_object");
+    return MY_TO_OBJECT_ID;
+  }
+
+  /// Attribute name of revolution angle.
+  inline static const std::string& ANGLE_ID()
+  {
+    static const std::string MY_TO_ANGLE_ID("angle");
+    return MY_TO_ANGLE_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_Rotation::ID();
+    return MY_KIND;
+  }
+
+  /// Creates a new part document if needed.
+  FEATURESPLUGIN_EXPORT virtual void execute();
+
+  /// Request for initialization of data model of the feature: adding all attributes.
+  FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Use plugin manager for features creation.
+  FeaturesPlugin_Rotation();
+};
+
+#endif
diff --git a/src/FeaturesPlugin/extrusioncut_widget.xml b/src/FeaturesPlugin/extrusioncut_widget.xml
new file mode 100755 (executable)
index 0000000..7e510b1
--- /dev/null
@@ -0,0 +1,65 @@
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+  <groupbox title="Revolution">
+    <shape_selector id="main_objects"
+    label="Select an object"
+    icon=":icons/sketch.png"
+    tooltip="Select a destination element"
+    shape_types="face edge vertex"
+    default="&lt;sketch&gt;"
+  />
+  <shape_selector id="axis_object"
+                    icon=":icons/axis.png"
+                    label="Axis"
+                    tooltip="Select an edge for axis"
+                    shape_types="edge"
+                    default="">
+    <validator id="GeomValidators_ShapeType" parameters="line"/>
+    </shape_selector>
+    <groupbox title="From">
+    <shape_selector id="from_object"
+                    icon=":icons/plane.png"
+                    label="Plane face"
+                    tooltip="Select a planar face"
+                    shape_types="face"
+                    default="&lt;sketch&gt;">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>
+    <doublevalue
+      id="from_size"
+      label="Angle"
+      min="0"
+      step="1.0"
+      default="0"
+      icon=":icons/angle_down.png"
+      tooltip="Height">
+    </doublevalue>
+  </groupbox>
+  <groupbox title="To">
+    <shape_selector id="to_object"
+                    icon=":icons/plane_inverted.png"
+                    label="Plane face"
+                    tooltip="Select a planar face"
+                    shape_types="face"
+                    default="&lt;sketch&gt;">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>
+    <doublevalue
+      id="to_size"
+      label="Angle"
+      min="0"
+      step="1.0"
+      default="0"
+      icon=":icons/angle_down.png"
+      tooltip="Height">
+    </doublevalue>
+  </groupbox>
+  </groupbox>
+  <multi_selector id="main_objects"
+    label="Cut from:"
+    icon=":icons/cut_shape.png"
+    tooltip="Select a sketch face"
+    type_choice="Solids">
+  </multi_selector>
+</source>
index 109d0d62cf7f4fa3f97fefe89734e455fa5a12c1..2e6b8f2375504eebcc59ac3eeea13eeb9d71e2d4 100644 (file)
@@ -1,15 +1,26 @@
 <!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
 
 <source>
+  <!--Modification for specification of 1.3.0
+  <multi_selector id="base"
+    label="Select a sketch face"
+    icon=":icons/cut_shape.png"
+    tooltip="Select a sketch face"
+    type_choice="Solids">
+  </multi_selector>-->
+  <!--Modification for specification of 1.3.0
+    icon=":icons/placement_from.png"-->
   <shape_selector id="placement_base_object" 
     label="Select an object" 
     icon=":icons/cut_shape.png" 
     tooltip="Select a destination element"
     shape_types="face edge vertex"
   />
+  <!--Modification for specification of 1.3.0
+      icon=":icons/placement_to.png"-->
   <shape_selector id="placement_attractable_object" 
     label="Select an object" 
-    icon=":icons/cut_shape.png" 
+    icon=":icons/cut_shape.png"
     tooltip="Select an element of moved object" 
     shape_types="face edge vertex" 
     concealment="true" >
index 288ae115b13ca606470c8ad0254a43099eeaa167..c6f0a65f361b869a231a6748d3b748757a9266a5 100644 (file)
       <feature id="Placement" title="Placement" tooltip="Perform moving of an object to specified position" icon=":icons/placement.png">
           <source path="placement_widget.xml"/>
       </feature>
+      <!--Modification for specification of 1.3.0
+      <feature id="Rotation" title="Movement" tooltip="" icon=":icons/placement.png">
+        <source path="rotation_widget.xml"/>
+      </feature>
+      <feature id="ExtrusionCut" title="RevolutionCut" tooltip="" icon=":icons/placement.png">
+        <source path="extrusioncut_widget.xml"/>
+      </feature>-->
     </group>
     <group id="Collections">
       <feature id="Group"
diff --git a/src/FeaturesPlugin/rotation_widget.xml b/src/FeaturesPlugin/rotation_widget.xml
new file mode 100755 (executable)
index 0000000..2b38c9a
--- /dev/null
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+  <multi_selector id="base"
+    label="Select a sketch face"
+    icon=":icons/cut_shape.png"
+    tooltip="Select a sketch face"
+    type_choice="Solids">
+  </multi_selector>
+  <shape_selector id="axis_object"
+                  icon=":icons/axis.png"
+                  label="Axis"
+                  tooltip="Select an edge for axis"
+                  shape_types="edge"
+                  default="">
+  </shape_selector>
+  <doublevalue
+    id="angle"
+    label="Angle"
+    min="0"
+    step="1.0"
+    default="0"
+    icon=":icons/radius.png"
+    tooltip="Angle">
+  </doublevalue>
+</source>
\ No newline at end of file
index 618bc7c96e1372abc6e3be6c76c4006a8a65ada1..50e621abe4e9eb494f53972e7becc6839bf91bba 100644 (file)
@@ -85,12 +85,12 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theS
     for(NCollection_Map<TopoDS_Shape>::Iterator aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) {
       const TopoDS_Shape& aShape = aShapeIt.Value();
       const TopTools_ListOfShape& aGeneratedList = aBuilder->Generated(aShape);
-      const TopTools_ListOfShape& aModifiedList = aBuilder->Modified(aShape);
       for(TopTools_ListIteratorOfListOfShape anIt(aGeneratedList); anIt.More(); anIt.Next()) {
         aTempShapes.Add(anIt.Value());
         aResultShapes.Add(anIt.Value());
         hasResults = true;
       }
+      const TopTools_ListOfShape& aModifiedList = aBuilder->Modified(aShape);
       for(TopTools_ListIteratorOfListOfShape anIt(aModifiedList); anIt.More(); anIt.Next()) {
         aTempShapes.Add(anIt.Value());
         aResultShapes.Add(anIt.Value());
index 9c60540a9c058c247d8e68255ebd6bffe1527b1f..f2377dd32cdb133408b72bef37bf095310f44f53 100644 (file)
@@ -143,6 +143,8 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     }
     aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aRevolBuilder)));
     aResult = aRevolBuilder->Shape();
+
+    // Setting naming.
     myFirst->setImpl(new TopoDS_Shape(aRevolBuilder->FirstShape()));
     myLast->setImpl(new TopoDS_Shape(aRevolBuilder->LastShape()));
   } else if(myFromShape && myToShape) { // Case 2: When both bounding planes were set.
@@ -178,10 +180,10 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     aToTrsf.SetRotation(anAxis, aToRotAngle / 180.0 * M_PI);
     BRepBuilderAPI_Transform aFromTransform(aFromSolid, aFromTrsf, true);
     BRepBuilderAPI_Transform aToTransform(aToSolid, aToTrsf, true);
-    aFromSolid = aFromTransform.Shape();
     TopoDS_Shape aRotatedFromFace = aFromTransform.Modified(aFromFace).First();
     TopoDS_Shape aRotatedToFace = aToTransform.Modified(aToFace).First();
-    aToSolid   = aToTransform.Shape();
+    aFromSolid = aFromTransform.Shape();
+    aToSolid = aToTransform.Shape();
 
     // Making revolution to the 360 angle.
     BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aBasisFace, anAxis, 2 * M_PI, Standard_True);
@@ -197,9 +199,6 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     }
     aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aFromCutBuilder)));
     aResult = aFromCutBuilder->Shape();
-    if(aFromCutBuilder->Modified(aRotatedFromFace).Extent() > 0) {
-      myFirst->setImpl(new TopoDS_Shape(aFromCutBuilder->Modified(aRotatedFromFace).First()));
-    }
 
     // Cutting revolution with to plane.
     BRepAlgoAPI_Cut* aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
@@ -209,16 +208,23 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     }
     aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aToCutBuilder)));
     aResult = aToCutBuilder->Shape();
-    if(aToCutBuilder->Modified(aRotatedToFace).Extent() > 0) {
-      myLast->setImpl(new TopoDS_Shape(aToCutBuilder->Modified(aRotatedToFace).First()));
-    }
-    if(aToCutBuilder->Modified(myFirst->impl<TopoDS_Shape>()).Extent() > 0) {
-      myFirst->setImpl(new TopoDS_Shape(aToCutBuilder->Modified(myFirst->impl<TopoDS_Shape>()).First()));
-    }
 
     // If after cut we got more than one solids then take closest to the center of mass of the base face.
     aResult = findClosest(aResult, aBasisCentr);
 
+    // Setting naming.
+    for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More (); anExp.Next ()) {
+      const TopoDS_Shape& aFaceOnResult = anExp.Current();
+      Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aFaceOnResult));
+      Handle(Geom_Surface) aFromSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedFromFace));
+      Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedToFace));
+      if(aFaceSurface == aFromSurface) {
+        myFirst->setImpl(new TopoDS_Shape(aFaceOnResult));
+      }
+      if(aFaceSurface == aToSurface) {
+        myLast->setImpl(new TopoDS_Shape(aFaceOnResult));
+      }
+    }
   } else { //Case 3: When only one bounding plane was set.
     // Getting bounding face.
     TopoDS_Face aBoundingFace;
@@ -259,6 +265,7 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     gp_Trsf aBoundingTrsf;
     aBoundingTrsf.SetRotation(anAxis, aBoundingRotAngle / 180.0 * M_PI);
     BRepBuilderAPI_Transform aBoundingTransform(aBoundingSolid, aBoundingTrsf, true);
+    TopoDS_Shape aRotatedBoundingFace = aBoundingTransform.Modified(aBoundingFace).First();
     aBoundingSolid = aBoundingTransform.Shape();
 
     // Making revolution to the 360 angle.
@@ -276,8 +283,11 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aBoundingCutBuilder)));
     aResult = aBoundingCutBuilder->Shape();
     TopExp_Explorer anExp1(aResult, TopAbs_SOLID);
+
+    // Setting naming.
     if(aBoundingCutBuilder->Modified(aBoundingFace).Extent() > 0) {
-      myLast->setImpl(new TopoDS_Shape(aBoundingCutBuilder->Modified(aBoundingFace).First()));
+      std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myFirst : myLast;
+      aPtr->setImpl(new TopoDS_Shape(aBoundingCutBuilder->Modified(aBoundingFace).First()));
     }
 
     // Try to cut with base face. If it can not be done then keep result of cut with bounding plane.
@@ -293,6 +303,7 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
     double aBasisRotAngle = isFromFaceSet ? myToAngle : -myFromAngle;
     aBasisTrsf.SetRotation(anAxis, aBasisRotAngle / 180.0 * M_PI);
     BRepBuilderAPI_Transform aBasisTransform(aBasisSolid, aBasisTrsf, true);
+    TopoDS_Shape aRotatedBasisFace = aBasisTransform.Modified(aBasisFace).First();
     aBasisSolid = aBasisTransform.Shape();
 
     // Cutting revolution with basis face.
@@ -304,14 +315,27 @@ void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasi
       if(anExp.More()) {
         aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aBasisCutBuilder)));
         aResult = aCutResult;
-        if(aBasisCutBuilder->Modified(aBasisFace).Extent() > 0) {
-          myFirst->setImpl(new TopoDS_Shape(aBasisCutBuilder->Modified(aBasisFace).First()));
-        }
       }
     }
 
     // If after cut we got more than one solids then take closest to the center of mass of the base face.
     aResult = findClosest(aResult, aBasisCentr);
+
+    // Setting naming.
+    for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More (); anExp.Next ()) {
+      const TopoDS_Shape& aFaceOnResult = anExp.Current();
+      Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aFaceOnResult));
+      Handle(Geom_Surface) aBoundingSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedBoundingFace));
+      Handle(Geom_Surface) aBasisSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedBasisFace));
+      if(aFaceSurface == aBoundingSurface) {
+        std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myFirst : myLast;
+        aPtr->setImpl(new TopoDS_Shape(aFaceOnResult));
+      }
+      if(aFaceSurface == aBasisSurface) {
+        std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myLast : myFirst;
+        aPtr->setImpl(new TopoDS_Shape(aFaceOnResult));
+      }
+    }
   }
 
   TopExp_Explorer anExp(aResult, TopAbs_SOLID);
index 517b4231f5695d97fe0e7aaba24849cf97b8b46c..c2e4c355f64ea7028dcabb986617bf00e319b82a 100644 (file)
@@ -662,6 +662,11 @@ std::shared_ptr<ModelAPI_Feature> Model_Document::currentFeature(const bool theV
 void Model_Document::setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
   const bool theVisible)
 {
+  // blocks the flush signals to avoid each objects visualization in the viewer
+  // they should not be shown once after all modifications are performed
+  Events_Loop* aLoop = Events_Loop::loop();
+  aLoop->activateFlushes(false);
+
   TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE);
   CompositeFeaturePtr aMain; // main feature that may nest the new current
   if (theCurrent.get()) {
@@ -707,8 +712,8 @@ void Model_Document::setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurr
     aRefLab.ForgetAttribute(TDF_Reference::GetID());
   }
   // make all features after this feature disabled in reversed order (to remove results without deps)
-  static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
   static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
 
   bool aPassed = false; // flag that the current object is already passed in cycle
@@ -730,6 +735,10 @@ void Model_Document::setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurr
       ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
     }
   }
+  // unblock  the flush signals and up them after this
+  aLoop->activateFlushes(true);
+
+  aLoop->flush(aCreateEvent);
   aLoop->flush(aRedispEvent);
   aLoop->flush(aDeleteEvent);
 }
@@ -818,3 +827,8 @@ ResultPtr Model_Document::findByName(const std::string theName)
 {
   return myObjs->findByName(theName);
 }
+
+std::list<std::shared_ptr<ModelAPI_Feature> > Model_Document::allFeatures()
+{
+  return myObjs->allFeatures();
+}
index 7969d17245c4cd08aa59da983961a659f73d09dc..20adb3d05e8e2231417026378b04a97d1dbe5701 100644 (file)
@@ -168,6 +168,10 @@ class Model_Document : public ModelAPI_Document
   //! selection by name.
   ResultPtr findByName(const std::string theName);
 
+  ///! Returns all features of the document including the hidden features which are not in
+  ///! history. Not very fast method, for calling once, not in big cycles.
+  MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
+
  protected:
   //! Returns (creates if needed) the general label
   TDF_Label generalLabel() const;
index 54033a49b0e8c519d48f41d548692550fe8c5934..be9e80ff3baa9d5699588845a9592874b507fc34 100644 (file)
@@ -898,6 +898,20 @@ FeaturePtr Model_Objects::lastFeature()
   return FeaturePtr(); // no features at all
 }
 
+std::list<std::shared_ptr<ModelAPI_Feature> > Model_Objects::allFeatures()
+{
+  std::list<std::shared_ptr<ModelAPI_Feature> > aResult;
+  Handle(TDataStd_ReferenceArray) aRefs;
+  if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
+    for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) {
+      FeaturePtr aFeature = feature(aRefs->Value(a));
+      if (aFeature.get())
+        aResult.push_back(aFeature);
+    }
+  }
+  return aResult;
+}
+
 Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
 {
   return TDF_LabelMapHasher::HashCode(theLab, theUpper);
index ef1d403b64cdc18275bc0bb93e001d65d61e8a24..cd7f440e75a95f065045ebc982e410372ab86bcf 100644 (file)
@@ -174,6 +174,11 @@ class Model_Objects
   /// be created before)
   std::string featureResultGroup(FeaturePtr theFeature);
 
+  ///! Returns all features of the document including the hidden features which are not in
+  ///! history. Not very fast method, for calling once, not in big cycles.
+  std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
+
+
  private:
   TDF_Label myMain; ///< main label of the data storage
 
index 5f344ea085160b4f18000328183db249ea526a73..38f02b147cd412e93f2347cdbd8b056572dfd47b 100644 (file)
@@ -125,6 +125,10 @@ public:
   virtual std::shared_ptr<ModelAPI_Feature> feature(
       const std::shared_ptr<ModelAPI_Result>& theResult) = 0;
 
+  ///! Returns all features of the document including the hidden features which are not in
+  ///! history. Not very fast method, for calling once, not in big cycles.
+  virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures() = 0;
+
 protected:
   /// Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document();
index 45b7a205369407e674ac229c9a2fcbc3e5a3667c..755d74c59217940d963bcbfe16987332b829acb5 100644 (file)
@@ -68,7 +68,10 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
     myTypeCombo->setVisible(false);
   }
 
-  QLabel* aListLabel = new QLabel(tr("Selected objects:"), this);
+// Modification for specification of 1.3.0
+  std::string aLabelText = "";//theData->getProperty("label");
+  QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
+                                                      : tr("Selected objects:"), this);
   aMainLay->addWidget(aListLabel, 1, 0);
   // if the xml definition contains one type, an information label should be shown near to the latest
   if (aShapeTypes.size() == 1) {
@@ -100,9 +103,6 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
 
 ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
 {
-  activateShapeSelection(false);
-  activateFilters(myWorkshop, false);
-
   delete myShapeValidator;
 }
 
index b021cb0b7e26ee335e0ec2a2bd350974258998e9..cf5f6549e2d2a230c8d42b28944796b30a615c09 100644 (file)
@@ -102,9 +102,6 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen
 //********************************************************************
 ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector()
 {
-  activateSelection(false);
-  activateFilters(myWorkshop, false);
-
   delete myShapeValidator;
 }
 
index f259e23ca255924ca4b465d7bbcf49b564b483e3..96d21fc89e4ea22d28d06265a8bf9572b3307fbb 100644 (file)
@@ -23,7 +23,7 @@
     <!-- Major module parameters -->
     <parameter name="name" value="NewGeom"/>
     <parameter name="icon" value="newgeom.png"/>
-    <parameter name="version" value="1.2.0"/>
+    <parameter name="version" value="1.2.1"/>
     <parameter name="documentation" value="newgeom_help"/>
   </section>
   <section name="newgeom_help" >
index bc6282f5337f7bdd4d51cca72eaaca9da70e1c39..9e8da8cd457b32f6ee6a11660d4420504ac1d7d3 100644 (file)
@@ -27,7 +27,7 @@
     <!-- Major module parameters -->
     <parameter name="name" value="NewGeom"/>
     <parameter name="icon" value="newgeom.png"/>
-    <parameter name="version" value="1.2.0"/>
+    <parameter name="version" value="1.2.1"/>
     <parameter name="documentation" value="newgeom_help"/>
   </section>
   <section name="newgeom_help" >
index d124d80fc5272b0b2955a1074a38da7999387e5f..12e7312da2961b8c010f9b1c82becc7ae096c3af 100644 (file)
@@ -17,6 +17,9 @@
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultGroup.h>
 #include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Events.h>
+
+#include <Events_Loop.h>
 
 #include <QIcon>
 #include <QBrush>
index efc034cb5ee420db422506a8e656f3bf722389fb..1f679d3247efb759dd69ce8b019b0723f362fb8a 100644 (file)
@@ -36,6 +36,8 @@
      <file>icons/shape_group.png</file>
      <file>icons/fixed.png</file>
      <file>icons/placement.png</file>
+     <file>icons/placement_from.png</file>
+     <file>icons/placement_to.png</file>
      <file>icons/geom_export.png</file>
      <file>icons/horisontal.png</file>
      <file>icons/vertical.png</file>
diff --git a/src/PartSet/icons/placement_from.png b/src/PartSet/icons/placement_from.png
new file mode 100755 (executable)
index 0000000..3dee133
Binary files /dev/null and b/src/PartSet/icons/placement_from.png differ
diff --git a/src/PartSet/icons/placement_to.png b/src/PartSet/icons/placement_to.png
new file mode 100755 (executable)
index 0000000..219138f
Binary files /dev/null and b/src/PartSet/icons/placement_to.png differ
index 844473e788626226546fe24bc6b629f2038b5c37..19da29c51b8a0764f19e6e33d66ad7383c7a2657 100644 (file)
@@ -151,11 +151,13 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
 
     bool isCustomized = customizeObject(theObject);
 
-    aContext->Display(anAISIO, isShading? Shading : Wireframe, 0, false, true, AIS_DS_Displayed); 
+    int aDispMode = isShading? Shading : Wireframe;
     if (isShading)
       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
-    emit objectDisplayed(theObject, theAIS);
+    anAISIO->SetDisplayMode(aDispMode);
+    aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed); 
 
+    emit objectDisplayed(theObject, theAIS);
     activate(anAISIO, myActiveSelectionModes);
  } 
   if (isUpdateViewer)