Salome HOME
Add Rotation
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 16 Jun 2016 09:51:34 +0000 (12:51 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:11 +0000 (14:41 +0300)
src/SketchAPI/CMakeLists.txt
src/SketchAPI/SketchAPI.i
src/SketchAPI/SketchAPI_Rotation.cpp [new file with mode: 0644]
src/SketchAPI/SketchAPI_Rotation.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchAPI/SketchAPI_swig.h

index bfaacf31424f6942b0662b00d746703f5eb1742f..af46034386d567e88d475de087ae2200334369f3 100644 (file)
@@ -11,6 +11,7 @@ SET(PROJECT_HEADERS
   SketchAPI_Sketch.h
   SketchAPI_SketchEntity.h
   SketchAPI_Point.h
+  SketchAPI_Rotation.h
   SketchAPI_Translation.h
 )
 
@@ -22,6 +23,7 @@ SET(PROJECT_SOURCES
   SketchAPI_Sketch.cpp
   SketchAPI_SketchEntity.cpp
   SketchAPI_Point.cpp
+  SketchAPI_Rotation.cpp
   SketchAPI_Translation.cpp
 )
 
index 9c331093511c7db0d0e88bd247b5f781c275ae3d..c3b13cba16f65a03b64812cd4e4997aaf569cacb 100644 (file)
@@ -27,6 +27,7 @@
 %shared_ptr(SketchAPI_Sketch)
 %shared_ptr(SketchAPI_SketchEntity)
 %shared_ptr(SketchAPI_Point)
+%shared_ptr(SketchAPI_Rotation)
 %shared_ptr(SketchAPI_Translation)
 
 // TODO(spo): move typemaps into ModelHighAPI package
 %include "SketchAPI_Arc.h"
 %include "SketchAPI_Mirror.h"
 %include "SketchAPI_Translation.h"
+%include "SketchAPI_Rotation.h"
 %include "SketchAPI_Sketch.h"
diff --git a/src/SketchAPI/SketchAPI_Rotation.cpp b/src/SketchAPI/SketchAPI_Rotation.cpp
new file mode 100644 (file)
index 0000000..b7b5c54
--- /dev/null
@@ -0,0 +1,45 @@
+// Name   : SketchAPI_Rotation.cpp
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Rotation.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Rotation::SketchAPI_Rotation(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+  initialize();
+}
+
+SketchAPI_Rotation::SketchAPI_Rotation(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature,
+    const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+    const ModelHighAPI_RefAttr & theCenter,
+    const ModelHighAPI_Double & theAngle,
+    const ModelHighAPI_Integer & theNumberOfObjects,
+    bool theFullValue)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    fillAttribute(theObjects, rotationList());
+    fillAttribute(theCenter, center());
+    fillAttribute(theAngle, angle());
+    fillAttribute(theNumberOfObjects, numberOfObjects());
+    if (theFullValue)
+      fillAttribute("SingleAngle", valueType());
+
+    execute();
+  }
+}
+
+SketchAPI_Rotation::~SketchAPI_Rotation()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
diff --git a/src/SketchAPI/SketchAPI_Rotation.h b/src/SketchAPI/SketchAPI_Rotation.h
new file mode 100644 (file)
index 0000000..e5a3281
--- /dev/null
@@ -0,0 +1,63 @@
+// Name   : SketchAPI_Rotation.h
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_MultiRotation.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelAPI_Object;
+class ModelHighAPI_Double;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Rotation
+ * \ingroup CPPHighAPI
+ * \brief Interface for Rotation feature
+ */
+class SketchAPI_Rotation : public SketchAPI_SketchEntity
+{
+public:
+  /// Constructor without values
+  SKETCHAPI_EXPORT
+  explicit SketchAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+  /// Constructor with values
+  SKETCHAPI_EXPORT
+  SketchAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+                     const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+                     const ModelHighAPI_RefAttr & theCenter,
+                     const ModelHighAPI_Double & theAngle,
+                     const ModelHighAPI_Integer & theNumberOfObjects,
+                     bool theFullValue = false);
+  /// Destructor
+  SKETCHAPI_EXPORT
+  virtual ~SketchAPI_Rotation();
+
+  INTERFACE_7(SketchPlugin_MultiRotation::ID(),
+              rotationList, SketchPlugin_MultiRotation::ROTATION_LIST_ID(), ModelAPI_AttributeRefList, /** Rotation list */,
+              center, SketchPlugin_MultiRotation::CENTER_ID(), ModelAPI_AttributeRefAttr, /** Center */,
+              angle, SketchPlugin_MultiRotation::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */,
+              numberOfObjects, SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger, /** Number of objects */,
+              valueType, SketchPlugin_MultiRotation::ANGLE_TYPE(), ModelAPI_AttributeString, /** Value type */,
+              referenceObjects, SketchPlugin_MultiRotation::ENTITY_A(), ModelAPI_AttributeRefList, /** Reference objects */,
+              rotatedObjects, SketchPlugin_MultiRotation::ENTITY_B(), ModelAPI_AttributeRefList, /** Rotated objects */
+  )
+
+};
+
+//! Pointer on Rotation object
+typedef std::shared_ptr<SketchAPI_Rotation> RotationPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_ */
index 00807ac44856c596c34558426ac8013475b31d9d..5f51c2592b71cfba4298d1c57a42299356f7a9a1 100644 (file)
@@ -36,6 +36,7 @@
 #include "SketchAPI_Line.h"
 #include "SketchAPI_Mirror.h"
 #include "SketchAPI_Point.h"
+#include "SketchAPI_Rotation.h"
 #include "SketchAPI_Translation.h"
 //--------------------------------------------------------------------------------------
 SketchAPI_Sketch::SketchAPI_Sketch(
@@ -336,6 +337,18 @@ std::shared_ptr<SketchAPI_Translation> SketchAPI_Sketch::addTranslation(
   return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, theNumberOfObjects, theFullValue));
 }
 
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Rotation> SketchAPI_Sketch::addRotation(
+    const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+    const ModelHighAPI_RefAttr & theCenter,
+    const ModelHighAPI_Double & theAngle,
+    const ModelHighAPI_Integer & theNumberOfObjects,
+    bool theFullValue)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID());
+  return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, theAngle, theNumberOfObjects, theFullValue));
+}
+
 //--------------------------------------------------------------------------------------
 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setAngle(
     const ModelHighAPI_RefAttr & theLine1,
index fb0278806eb0ed4c00ded2ee02fef2703d38a3b8..3e77725be5ecd8ae70982c691a151f86d9641d0f 100644 (file)
@@ -29,6 +29,7 @@ class SketchAPI_Circle;
 class SketchAPI_Line;
 class SketchAPI_Mirror;
 class SketchAPI_Point;
+class SketchAPI_Rotation;
 class SketchAPI_Translation;
 //--------------------------------------------------------------------------------------
 /**\class SketchAPI_Sketch
@@ -200,6 +201,15 @@ public:
       const ModelHighAPI_Integer & theNumberOfObjects,
       bool theFullValue = false);
 
+  /// Add rotation
+  SKETCHAPI_EXPORT
+  std::shared_ptr<SketchAPI_Rotation> addRotation(
+      const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+      const ModelHighAPI_RefAttr & theCenter,
+      const ModelHighAPI_Double & theAngle,
+      const ModelHighAPI_Integer & theNumberOfObjects,
+      bool theFullValue = false);
+
   /// Set angle
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelAPI_Feature> setAngle(
@@ -289,7 +299,7 @@ public:
   std::shared_ptr<ModelAPI_Feature> setVertical(
       const ModelHighAPI_RefAttr & theLine);
 
-  // TODO(spo): addRectagle, projection, Translation, Rotation
+  // TODO(spo): addRectagle, projection
 
   /// Set constraint value
   SKETCHAPI_EXPORT
index d418dd2cc64625c592db9241ecb45a302b422eba..bddb075b16f92184e2a0fac51cc7b3ad623a4c57 100644 (file)
@@ -17,6 +17,7 @@
   #include "SketchAPI_Sketch.h"
   #include "SketchAPI_SketchEntity.h"
   #include "SketchAPI_Point.h"
+  #include "SketchAPI_Rotation.h"
   #include "SketchAPI_Translation.h"
 
 #endif /* SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ */