- QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
- if ((aList.size() == 0) || (aList.size() > 2))
- return false;
-
- ModuleBase_ViewerPrsPtr aPrs = aList.first();
- const GeomShapePtr& aShape = aPrs->shape();
- if (!aShape.get() || aShape->isNull() || aShape->shapeType() != GeomAPI_Shape::EDGE)
- return false;
- GeomAPI_Edge aEdge1(aShape);
-
- if (aEdge1.isLine() || aEdge1.isArc()) {
- if (aList.size() == 2) {
- // Check second selection
- aPrs = aList.last();
- const GeomShapePtr& aShape2 = aPrs->shape();
- if (!aShape2.get() || aShape2->isNull() || aShape2->shapeType() != GeomAPI_Shape::EDGE)
- return false;
- GeomAPI_Edge aEdge2(aShape2);
-
- if (aEdge1.isLine() && aEdge2.isArc())
- return true;
- else if (aEdge1.isArc() && aEdge2.isLine())
- return true;
- else
- return false;
- } else
- return true;
- }
- return false;
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && (aNbEdges == 1 || (aNbEdges == 2 && aShapes[GeomAbs_Line] == 1));