+ // Get point.
+ AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
+ GeomShapePtr aPointShape = aPointSelection->value();
+ if(!aPointShape.get()) {
+ aPointShape = aPointSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection = selection(FACE_FOR_POINT_PROJECTION());
+ GeomShapePtr aPlaneShape = aPlaneSelection->value();
+ if(!aPlaneShape.get()) {
+ aPlaneShape = aPlaneSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aPlaneShape));
+
+ return GeomAlgoAPI_PointBuilder::vertexByProjection(aVertex, aFace);
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersection()
+{
+ // Get first line.
+ AttributeSelectionPtr aFirstLineSelection= selection(INTERSECTION_LINE_1());
+ GeomShapePtr aFirstLineShape = aFirstLineSelection->value();
+ if(!aFirstLineShape.get()) {
+ aFirstLineShape = aFirstLineSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Edge> aFirstEdge(new GeomAPI_Edge(aFirstLineShape));
+
+ // Get second line.
+ AttributeSelectionPtr aSecondLineSelection= selection(INTERSECTION_LINE_2());
+ GeomShapePtr aSecondLineShape = aSecondLineSelection->value();
+ if(!aSecondLineShape.get()) {
+ aSecondLineShape = aSecondLineSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Edge> aSecondEdge(new GeomAPI_Edge(aSecondLineShape));
+
+ return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge);
+}
+
+//==================================================================================================
+std::list<std::shared_ptr<GeomAPI_Vertex> >
+ ConstructionPlugin_Point::createByLineAndPlaneIntersection()
+{
+ // Get line.
+ AttributeSelectionPtr aLineSelection = selection(INTERSECTION_LINE());
+ GeomShapePtr aLineShape = aLineSelection->value();
+ if(!aLineShape.get()) {
+ aLineShape = aLineSelection->context()->shape();
+ }
+ GeomEdgePtr anEdge;
+ if (aLineShape->isEdge()) {
+ anEdge = aLineShape->edge();
+ }
+ else if (aLineShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aLineShape);
+ anEdge = anIt.current()->edge();
+ }
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection= selection(INTERSECTION_PLANE());
+ GeomShapePtr aPlaneShape = aPlaneSelection->value();
+ if(!aPlaneShape.get()) {
+ aPlaneShape = aPlaneSelection->context()->shape();
+ }
+ GeomFacePtr aFace;
+ if (aPlaneShape->isFace()) {
+ aFace = aPlaneShape->face();
+ }
+ else if (aPlaneShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aPlaneShape);
+ aFace = anIt.current()->face();
+ }
+
+ if (!string(USE_OFFSET())->value().empty()) {
+ double anOffset = real(OFFSET())->value();
+ if (boolean(REVERSE_OFFSET())->value())
+ anOffset = -anOffset;
+ if (fabs(anOffset) > 1.e-9) { // move face
+ aFace->translate(aFace->getPlane()->direction(), anOffset);
+ }
+ }
+
+ return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace);
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByPlanesIntersection()
+{
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection1 = selection(INTERSECTION_PLANE_1());
+ GeomShapePtr aPlaneShape1 = aPlaneSelection1->value();
+ if (!aPlaneShape1.get()) {
+ aPlaneShape1 = aPlaneSelection1->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aPlaneShape1));
+ std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection2 = selection(INTERSECTION_PLANE_2());
+ GeomShapePtr aPlaneShape2 = aPlaneSelection2->value();
+ if (!aPlaneShape2.get()) {
+ aPlaneShape2 = aPlaneSelection2->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aPlaneShape2));
+ std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection3 = selection(INTERSECTION_PLANE_3());
+ GeomShapePtr aPlaneShape3 = aPlaneSelection3->value();
+ if (!aPlaneShape3.get()) {
+ aPlaneShape3 = aPlaneSelection3->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace3(new GeomAPI_Face(aPlaneShape3));
+ std::shared_ptr<GeomAPI_Pln> aPln3 = aFace3->getPlane();
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+ std::shared_ptr<GeomAPI_Lin> anIntersectLine = aPln1->intersect(aPln2);
+ if (!anIntersectLine.get()) {
+ return aVertex;
+ }
+
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aPln3->intersect(anIntersectLine);
+ if (aPnt.get()) {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfGravity()
+{
+ // Get shape.
+ AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_GRAVITY());
+ GeomShapePtr aShape = aShapeSelection->value();
+ if (!aShape.get())
+ {
+ aShape = aShapeSelection->context()->shape();
+ }
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+ std::shared_ptr<GeomAPI_Pnt> aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShape);
+ if (aPnt.get())
+ {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfCircle()
+{
+ // Get shape.
+ AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_CIRCLE());
+ GeomShapePtr aShape = aShapeSelection->value();
+ if (!aShape.get()) {
+ aShape = aShapeSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
+ std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aCirc->center();
+ if (aPnt.get()) {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;