X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Point.cpp;h=08ff70a3a7a2ed8a7f5cdba439c975df2f0fe4ef;hb=f49e611d444c66d735a381bb9541717b4115b8b1;hp=f08cd5fa42661a5d97b3d325f02e52af0fa71928;hpb=ed85a646b6e504a93705b1a08af06674ec75c9e7;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index f08cd5fa4..08ff70a3a 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -79,7 +79,7 @@ void ConstructionPlugin_Point::execute() { GeomShapePtr aShape; - // to support compatibility with old documents where aCreationMethod did not exist + // to support compatibility with old documents where aCreationMethod did not exist std::string aCreationMethod = string(CREATION_METHOD()).get() && !string(CREATION_METHOD())->value().empty() ? string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ(); @@ -92,7 +92,20 @@ void ConstructionPlugin_Point::execute() } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) { aShape = createByLinesIntersection(); }*/ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) { - aShape = createByLineAndPlaneIntersection(); + // this may produce several points + std::list > aPoints = createByLineAndPlaneIntersection(); + if (!aPoints.empty()) { // if no points found produce the standard error later + int anIndex = 0; + std::list >::iterator aPIter = aPoints.begin(); + for(; aPIter != aPoints.end(); aPIter++, anIndex++) { + std::shared_ptr aConstr = + document()->createConstruction(data(), anIndex); + aConstr->setShape(*aPIter); + setResult(aConstr, anIndex); + } + removeResults(anIndex); + return; + } } if(!aShape.get()) { @@ -100,6 +113,7 @@ void ConstructionPlugin_Point::execute() return; } + removeResults(1); // for case the point type was switched from multi-results type std::shared_ptr aConstr = document()->createConstruction(data()); aConstr->setShape(aShape); setResult(aConstr); @@ -191,7 +205,8 @@ std::shared_ptr ConstructionPlugin_Point::createByLinesIntersect */ //================================================================================================== -std::shared_ptr ConstructionPlugin_Point::createByLineAndPlaneIntersection() +std::list > + ConstructionPlugin_Point::createByLineAndPlaneIntersection() { // Get line. AttributeSelectionPtr aLineSelection = selection(INTERSECTION_LINE()); @@ -218,5 +233,6 @@ std::shared_ptr ConstructionPlugin_Point::createByLineAndPlaneIn } } - return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace); + return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace, + aPlaneSelection->context()->groupName() == ModelAPI_ResultConstruction::group()); }