]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ConstructionAPI/ConstructionAPI_Point.cpp
Salome HOME
2.3.3.1 Point creation by projection of another point on a line
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.cpp
index ca427fe7de5930e12a5b2c886d5afd58384d0180..350c8857e8c483e6183390f2bd0b443d35c6b47b 100644 (file)
@@ -70,7 +70,10 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
     if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) {
       // If first object is vertex and second object is face then set by projection.
       setByProjectionOnFace(theObject1, theObject2);
-    } /*else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
+    } else if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::EDGE) {
+      // If first object is vertex and second object is edge then set by projection.
+      setByProjectionOnEdge(theObject1, theObject2);
+    } /* else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
       // If both objects are edges then set by lines intersection.
       setByLinesIntersection(theObject1, theObject2);
     } */ else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
@@ -121,6 +124,18 @@ void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theE
   execute();
 }
 
+//==================================================================================================
+void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
+                                                  const ModelHighAPI_Selection& theEdge)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE(),
+                mycreationMethod);
+  fillAttribute(theVertex, mypoinToProjectOnEdge);
+  fillAttribute(theEdge, myedgeForPointProjection);
+
+  execute();
+}
+
 //==================================================================================================
 void ConstructionAPI_Point::setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
                                                   const ModelHighAPI_Selection& theFace)
@@ -185,6 +200,8 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
       theDumper << ratio() << ", " << true;
     }
     theDumper << ", " << reverse()->value();
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE()) {
+    theDumper << mypoinToProjectOnEdge << ", " << myedgeForPointProjection;
   } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_FACE()) {
     theDumper << mypoinToProjectOnFace << ", " << myfaceForPointProjection;
   }