// History:
// 29/03/16 - Sergey POKHODENKO - Creation of the file
-//--------------------------------------------------------------------------------------
#include "ConstructionAPI_Point.h"
-//--------------------------------------------------------------------------------------
+
#include <ModelHighAPI_Tools.h>
-//--------------------------------------------------------------------------------------
-ConstructionAPI_Point::ConstructionAPI_Point(
- const std::shared_ptr<ModelAPI_Feature> & theFeature)
+
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
{
initialize();
}
-ConstructionAPI_Point::ConstructionAPI_Point(
- const std::shared_ptr<ModelAPI_Feature> & theFeature,
- const ModelHighAPI_Double & theX,
- const ModelHighAPI_Double & theY,
- const ModelHighAPI_Double & theZ)
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theX,
+ const ModelHighAPI_Double& theY,
+ const ModelHighAPI_Double& theZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setByXYZ(theX, theY, theZ);
+ }
+}
+
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theEdge,
+ const ModelHighAPI_Double& theDistanceValue,
+ const bool theDistancePercent,
+ const bool theReverse)
: ModelHighAPI_Interface(theFeature)
{
- if (initialize())
- setPoint(theX, theY, theZ);
+ if(initialize()) {
+ setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
+ }
}
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ /// If first object is vertex and second object is face then set by projection.
+ /// TODO: check
+ setByProjection(theObject1, theObject2);
+ }
+}
+
+//==================================================================================================
ConstructionAPI_Point::~ConstructionAPI_Point()
{
}
-//--------------------------------------------------------------------------------------
-void ConstructionAPI_Point::setPoint(const ModelHighAPI_Double & theX,
- const ModelHighAPI_Double & theY,
- const ModelHighAPI_Double & theZ)
+//==================================================================================================
+void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
+ const ModelHighAPI_Double& theY,
+ const ModelHighAPI_Double& theZ)
{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
fillAttribute(theX, myx);
fillAttribute(theY, myy);
fillAttribute(theZ, myz);
execute();
}
-//--------------------------------------------------------------------------------------
-// TODO(spo): make add* as static functions of the class
-PointPtr addPoint(
- const std::shared_ptr<ModelAPI_Document> & thePart,
- const ModelHighAPI_Double& theX,
- const ModelHighAPI_Double& theY,
- const ModelHighAPI_Double& theZ)
+//==================================================================================================
+void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
+ const ModelHighAPI_Double& theDistanceValue,
+ const bool theDistancePercent,
+ const bool theReverse)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod);
+ fillAttribute(theEdge, myedge);
+ fillAttribute(theDistanceValue, mydistanceValue);
+ fillAttribute(theDistancePercent, mydistancePercent);
+ fillAttribute(theReverse, myreverse);
+
+ execute();
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVertex,
+ const ModelHighAPI_Selection& thePlane)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(), mycreationMethod);
+ fillAttribute(theVertex, mypoint);
+ fillAttribute(thePlane, myplane);
+
+ execute();
+}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theX,
+ const ModelHighAPI_Double& theY,
+ const ModelHighAPI_Double& theZ)
{
// TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theEdge,
+ const ModelHighAPI_Double& theDistanceValue,
+ const bool theDistancePercent,
+ const bool theReverse)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+ return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));
+}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+ return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2));
+}