Salome HOME
[Code coverage ModelHighAPI]: Improve coverage
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Selection.cpp
index 7738eb38f0ac3b207cd173063cf264809de51419..b9a9f0be5479305cc4eb0eb2cba7994a96107591 100644 (file)
@@ -58,6 +58,28 @@ ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
 {
 }
 
+ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
+                                               const std::list<double>& theSubShapeInnerPoint)
+: myVariantType(VT_TypeInnerPointPair)
+{
+  double aCoordinates[3] = { 0.0, 0.0, 0.0 };
+  double* aCIt = aCoordinates;
+  std::list<double>::const_iterator aPIt = theSubShapeInnerPoint.begin();
+  for (; aPIt != theSubShapeInnerPoint.end(); ++aPIt, ++aCIt)
+    *aCIt = *aPIt;
+
+  GeomPointPtr anInnerPoint(new GeomAPI_Pnt(aCoordinates[0], aCoordinates[1], aCoordinates[2]));
+  myTypeInnerPointPair = std::pair<std::string, GeomPointPtr>(theType, anInnerPoint);
+}
+
+ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
+  const std::string& theContextName, const int theIndex)
+  : myVariantType(VT_WeakNamingPair)
+  , myWeakNamingPair(theType, std::pair<std::string, int>(theContextName, theIndex))
+{
+}
+
+
 ModelHighAPI_Selection::~ModelHighAPI_Selection()
 {
 }
@@ -77,6 +99,10 @@ void ModelHighAPI_Selection::fillAttribute(
     case VT_TypeInnerPointPair:
       theAttribute->selectSubShape(myTypeInnerPointPair.first, myTypeInnerPointPair.second);
       return;
+    case VT_WeakNamingPair:
+      theAttribute->selectSubShape(
+        myWeakNamingPair.first, myWeakNamingPair.second.first, myWeakNamingPair.second.second);
+      break;
   }
 
   if (theAttribute->isInvalid()) {
@@ -103,6 +129,11 @@ void ModelHighAPI_Selection::appendToList(
       // Note: the reverse order (first - type, second - selected point)
       theAttribute->append(myTypeInnerPointPair.second, myTypeInnerPointPair.first);
       return;
+    case VT_WeakNamingPair:
+      // Note: the reverse order (first - type, second - selected point)
+      theAttribute->append(
+        myWeakNamingPair.first, myWeakNamingPair.second.first, myWeakNamingPair.second.second);
+      return;
   }
 }
 
@@ -190,6 +221,7 @@ void ModelHighAPI_Selection::setDeflection(double theValue)
   aDeflectionAttr->setValue(theValue);
 }
 
+// LCOV_EXCL_START
 void ModelHighAPI_Selection::setTransparency(double theValue)
 {
   if (myVariantType != VT_ResultSubShapePair)
@@ -200,6 +232,7 @@ void ModelHighAPI_Selection::setTransparency(double theValue)
 
   aTransparencyAttr->setValue(theValue);
 }
+// LCOV_EXCL_STOP
 
 int ModelHighAPI_Selection::numberOfSubs() const
 {