Salome HOME
Add Translation
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 16 Jun 2016 09:36:03 +0000 (12:36 +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_Mirror.h
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchAPI/SketchAPI_Translation.cpp [new file with mode: 0644]
src/SketchAPI/SketchAPI_Translation.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_swig.h

index 9d6ded27cd0643dbf1b289d71f3b8cff398d0b4b..bfaacf31424f6942b0662b00d746703f5eb1742f 100644 (file)
@@ -11,6 +11,7 @@ SET(PROJECT_HEADERS
   SketchAPI_Sketch.h
   SketchAPI_SketchEntity.h
   SketchAPI_Point.h
+  SketchAPI_Translation.h
 )
 
 SET(PROJECT_SOURCES
@@ -21,6 +22,7 @@ SET(PROJECT_SOURCES
   SketchAPI_Sketch.cpp
   SketchAPI_SketchEntity.cpp
   SketchAPI_Point.cpp
+  SketchAPI_Translation.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 7359f1d9a74b22fc19527eea0be07c60095ae588..9c331093511c7db0d0e88bd247b5f781c275ae3d 100644 (file)
@@ -27,6 +27,7 @@
 %shared_ptr(SketchAPI_Sketch)
 %shared_ptr(SketchAPI_SketchEntity)
 %shared_ptr(SketchAPI_Point)
+%shared_ptr(SketchAPI_Translation)
 
 // TODO(spo): move typemaps into ModelHighAPI package
 
 %include "SketchAPI_Circle.h"
 %include "SketchAPI_Arc.h"
 %include "SketchAPI_Mirror.h"
+%include "SketchAPI_Translation.h"
 %include "SketchAPI_Sketch.h"
index 9f3848d39771ecc319b94feb5df169be703666c8..9cd2d54887bcfc74fb185d4589a29050462d131b 100644 (file)
@@ -41,7 +41,7 @@ public:
   INTERFACE_4(SketchPlugin_ConstraintMirror::ID(),
               mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(), ModelAPI_AttributeRefAttr, /** Mirror line */,
               mirrorList, SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), ModelAPI_AttributeRefList, /** Mirror list */,
-              sourceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(), ModelAPI_AttributeRefList, /** Source objects */,
+              referenceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(), ModelAPI_AttributeRefList, /** Reference objects */,
               mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(), ModelAPI_AttributeRefList, /** Mirrored objects */
   )
 
index ab58eec605dce518dcb2a81f8c4eebf7392f9a9d..00807ac44856c596c34558426ac8013475b31d9d 100644 (file)
@@ -36,6 +36,7 @@
 #include "SketchAPI_Line.h"
 #include "SketchAPI_Mirror.h"
 #include "SketchAPI_Point.h"
+#include "SketchAPI_Translation.h"
 //--------------------------------------------------------------------------------------
 SketchAPI_Sketch::SketchAPI_Sketch(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
@@ -323,6 +324,18 @@ std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
   return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects));
 }
 
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Translation> SketchAPI_Sketch::addTranslation(
+    const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+    const ModelHighAPI_RefAttr & thePoint1,
+    const ModelHighAPI_RefAttr & thePoint2,
+    const ModelHighAPI_Integer & theNumberOfObjects,
+    bool theFullValue)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID());
+  return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, theNumberOfObjects, theFullValue));
+}
+
 //--------------------------------------------------------------------------------------
 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setAngle(
     const ModelHighAPI_RefAttr & theLine1,
index 8525b4388db1867e27fd635f018ce601f8e61bae..fb0278806eb0ed4c00ded2ee02fef2703d38a3b8 100644 (file)
@@ -21,6 +21,7 @@
 class ModelAPI_CompositeFeature;
 class ModelAPI_Object;
 class ModelHighAPI_Double;
+class ModelHighAPI_Integer;
 class ModelHighAPI_RefAttr;
 class ModelHighAPI_Selection;
 class SketchAPI_Arc;
@@ -28,6 +29,7 @@ class SketchAPI_Circle;
 class SketchAPI_Line;
 class SketchAPI_Mirror;
 class SketchAPI_Point;
+class SketchAPI_Translation;
 //--------------------------------------------------------------------------------------
 /**\class SketchAPI_Sketch
  * \ingroup CPPHighAPI
@@ -189,6 +191,15 @@ public:
       const ModelHighAPI_RefAttr & theMirrorLine,
       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
 
+  /// Add translation
+  SKETCHAPI_EXPORT
+  std::shared_ptr<SketchAPI_Translation> addTranslation(
+      const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+      const ModelHighAPI_RefAttr & thePoint1,
+      const ModelHighAPI_RefAttr & thePoint2,
+      const ModelHighAPI_Integer & theNumberOfObjects,
+      bool theFullValue = false);
+
   /// Set angle
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelAPI_Feature> setAngle(
diff --git a/src/SketchAPI/SketchAPI_Translation.cpp b/src/SketchAPI/SketchAPI_Translation.cpp
new file mode 100644 (file)
index 0000000..0ba3e3b
--- /dev/null
@@ -0,0 +1,45 @@
+// Name   : SketchAPI_Translation.cpp
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Translation.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Translation::SketchAPI_Translation(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+  initialize();
+}
+
+SketchAPI_Translation::SketchAPI_Translation(
+    const std::shared_ptr<ModelAPI_Feature> & theFeature,
+    const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+    const ModelHighAPI_RefAttr & thePoint1,
+    const ModelHighAPI_RefAttr & thePoint2,
+    const ModelHighAPI_Integer & theNumberOfObjects,
+    bool theFullValue)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    fillAttribute(theObjects, translationList());
+    fillAttribute(thePoint1, startPoint());
+    fillAttribute(thePoint2, endPoint());
+    fillAttribute(theNumberOfObjects, numberOfObjects());
+    if (theFullValue)
+      fillAttribute("SingleValue", valueType());
+
+    execute();
+  }
+}
+
+SketchAPI_Translation::~SketchAPI_Translation()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
diff --git a/src/SketchAPI/SketchAPI_Translation.h b/src/SketchAPI/SketchAPI_Translation.h
new file mode 100644 (file)
index 0000000..7b6da8f
--- /dev/null
@@ -0,0 +1,62 @@
+// Name   : SketchAPI_Translation.h
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_MultiTranslation.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelAPI_Object;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Translation
+ * \ingroup CPPHighAPI
+ * \brief Interface for Translation feature
+ */
+class SketchAPI_Translation : public SketchAPI_SketchEntity
+{
+public:
+  /// Constructor without values
+  SKETCHAPI_EXPORT
+  explicit SketchAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+  /// Constructor with values
+  SKETCHAPI_EXPORT
+  SketchAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+                        const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+                        const ModelHighAPI_RefAttr & thePoint1,
+                        const ModelHighAPI_RefAttr & thePoint2,
+                        const ModelHighAPI_Integer & theNumberOfObjects,
+                        bool theFullValue = false);
+  /// Destructor
+  SKETCHAPI_EXPORT
+  virtual ~SketchAPI_Translation();
+
+  INTERFACE_7(SketchPlugin_MultiTranslation::ID(),
+              translationList, SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(), ModelAPI_AttributeRefList, /** Translation list */,
+              startPoint, SketchPlugin_MultiTranslation::START_POINT_ID(), ModelAPI_AttributeRefAttr, /** Start point */,
+              endPoint, SketchPlugin_MultiTranslation::END_POINT_ID(), ModelAPI_AttributeRefAttr, /** Start point */,
+              numberOfObjects, SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger, /** Number of objects */,
+              valueType, SketchPlugin_MultiTranslation::VALUE_TYPE(), ModelAPI_AttributeString, /** Value type */,
+              referenceObjects, SketchPlugin_MultiTranslation::ENTITY_A(), ModelAPI_AttributeRefList, /** Reference objects */,
+              translatedObjects, SketchPlugin_MultiTranslation::ENTITY_B(), ModelAPI_AttributeRefList, /** Translationed objects */
+  )
+
+};
+
+//! Pointer on Translation object
+typedef std::shared_ptr<SketchAPI_Translation> TranslationPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_ */
index c65c853f27a0bc11e34e4f4e76e099b9b08fc519..d418dd2cc64625c592db9241ecb45a302b422eba 100644 (file)
@@ -17,5 +17,6 @@
   #include "SketchAPI_Sketch.h"
   #include "SketchAPI_SketchEntity.h"
   #include "SketchAPI_Point.h"
+  #include "SketchAPI_Translation.h"
 
 #endif /* SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ */