+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2,
+ const ModelHighAPI_Selection& theObject3)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ {
+ GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
+ GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
+ GeomAPI_Shape::ShapeType aType3 = getShapeType(theObject3);
+ if (aType1 == GeomAPI_Shape::FACE
+ && aType2 == GeomAPI_Shape::FACE
+ && aType3 == GeomAPI_Shape::FACE)
+ {
+ setByPlanesIntersection(theObject1, theObject2, theObject3);
+ }
+ }
+}
+
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject,
+ const bool theIsCircularEdge,
+ const bool theIsXYZSelection)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ {
+ if (theIsCircularEdge) {
+ setByCenterOfCircle(theObject);
+ } else if (theObject.shapeType() == "VERTEX" && theIsXYZSelection) {
+ // This is tricky way to get vertex shape.
+ fillAttribute(theObject, mypointToProject);
+ GeomShapePtr aShape = mypointToProject->value();
+ if (!aShape.get()) {
+ ResultPtr aContext = mypointToProject->context();
+ if (!aContext.get()) {
+ fillAttribute(ModelHighAPI_Selection(), mypointToProject);
+ return;
+ }
+ aShape = aContext->shape();
+ }
+
+ if (!aShape.get()) {
+ fillAttribute(ModelHighAPI_Selection(), mypointToProject);
+ return;
+ }
+
+ GeomVertexPtr aVertex = aShape->vertex();
+ if (!aVertex.get()) {
+ fillAttribute(ModelHighAPI_Selection(), mypointToProject);
+ return;
+ }
+
+ GeomPointPtr aPnt = aVertex->point();
+ if (!aPnt.get()) {
+ fillAttribute(ModelHighAPI_Selection(), mypointToProject);
+ return;
+ }
+
+ fillAttribute(ModelHighAPI_Selection(), mypointToProject);
+ setByXYZ(aPnt->x(), aPnt->y(), aPnt->z());
+ } else {
+ setByCenterOfGravity(theObject);
+ }
+ }
+}
+