+ data()->addAttribute(X(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(Y(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(Z(), ModelAPI_AttributeDouble::typeId());
+
+ data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
+
+ /*data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(DISTANCE_VALUE(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(DISTANCE_PERCENT(), ModelAPI_AttributeBoolean::typeId());
+ data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
+
+ data()->addAttribute(POINT(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(PLANE(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(FIRST_LINE(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(SECOND_LINE(), ModelAPI_AttributeSelection::typeId());
+*/
+ data()->addAttribute(INTERSECTION_LINE(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(USE_OFFSET(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId());
+}
+
+//==================================================================================================
+void ConstructionPlugin_Point::execute()
+{
+ GeomShapePtr aShape;
+
+ // to support compatibility with old documents where aCreationMethod did not exist
+ std::string aCreationMethod =
+ string(CREATION_METHOD()).get() && !string(CREATION_METHOD())->value().empty() ?
+ string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ();
+ if(aCreationMethod == CREATION_METHOD_BY_XYZ()) {
+ aShape = createByXYZ();
+ }/* else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+ aShape = createByDistanceOnEdge();
+ } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
+ aShape = createByProjection();
+ } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
+ aShape = createByLinesIntersection();
+ }*/ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
+ // this may produce several points
+ std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
+ if (!aPoints.empty()) { // if no points found produce the standard error later
+ int anIndex = 0;
+ std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
+ for(; aPIter != aPoints.end(); aPIter++, anIndex++) {
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
+ document()->createConstruction(data(), anIndex);
+ aConstr->setShape(*aPIter);
+ setResult(aConstr, anIndex);
+ }
+ removeResults(anIndex);
+ return;
+ }
+ }
+
+ if(!aShape.get()) {
+ setError("Error: intersection not found.");
+ return;
+ }
+
+ removeResults(1); // for case the point type was switched from multi-results type
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+ aConstr->setShape(aShape);
+ setResult(aConstr);
+}
+
+//==================================================================================================
+bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult,
+ AISObjectPtr thePrs,
+ std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
+{
+ bool isCustomized = theDefaultPrs.get() != NULL &&
+ theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
+ //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
+ return true;