+
+void BuildPlugin_Face::buildFacesByEdges(
+ const ListOfShape& theEdges,
+ const std::list< std::shared_ptr<GeomAPI_Dir> >& theNormals,
+ ListOfShape& theFaces) const
+{
+ // Get plane.
+ std::shared_ptr<GeomAPI_Pln> aPln = GeomAlgoAPI_ShapeTools::findPlane(theEdges);
+ std::shared_ptr<GeomAPI_Dir> aNormal = aPln->direction();
+ bool isReverse = !theNormals.empty();
+ std::list< std::shared_ptr<GeomAPI_Dir> >::const_iterator aNormIt = theNormals.begin();
+ for (; aNormIt != theNormals.end() && isReverse; ++aNormIt)
+ if ((*aNormIt)->dot(aNormal) > 1.e-7)
+ isReverse = false;
+ if (isReverse) {
+ aNormal->reverse();
+ aPln = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aPln->location(), aNormal));
+ }
+
+ // Get faces.
+ GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
+ aPln->direction(), theEdges, theFaces);
+
+ // Get wires from faces.
+ ListOfShape aWires;
+ for(ListOfShape::const_iterator anIt = theFaces.cbegin(); anIt != theFaces.cend(); ++anIt)
+ aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(*anIt));
+
+ // Make faces with holes.
+ theFaces.clear();
+ GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aPln->location(), aPln->direction(),
+ aWires, theFaces);
+}