X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Utils.h;h=cc0817fac079fd3dedb8a27672254e9b97ede8d5;hb=8edd427af3997521bda72ca3c416cc1d490565d5;hp=f727601d588f5e0cf4943466c1ec3a2b8d74efe2;hpb=7e825ec456c9331ef0df1cb59865cc55f0d8516a;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Utils.h b/src/HYDROCurveCreator/CurveCreator_Utils.h index f727601d..cc0817fa 100644 --- a/src/HYDROCurveCreator/CurveCreator_Utils.h +++ b/src/HYDROCurveCreator/CurveCreator_Utils.h @@ -22,13 +22,34 @@ #include "CurveCreator_Macro.hxx" -#include +#include +#include // TODO: remove #include +#include +#include +#include + +#include +#include // TODO: remove + +class CurveCreator_ICurve; class CurveCreator_Utils { public: + /*! + * \brief Returns the point clicked in 3D view. + * + * \param x The X coordinate in the view. + * \param y The Y coordinate in the view. + * \param theView View where the given point takes place. + * \retval gp_Pnt Returns the point clicked in 3D view + */ + CURVECREATOR_EXPORT static void ConvertPointToClick( const gp_Pnt& thePoint, + Handle(V3d_View) theView, + int& x, int& y ); + /*! * \brief Returns the point clicked in 3D view. * @@ -37,7 +58,80 @@ public: * \param theView View where the given point takes place. * \retval gp_Pnt Returns the point clicked in 3D view */ - CURVECREATOR_EXPORT static gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) theView ); + CURVECREATOR_EXPORT static gp_Pnt ConvertClickToPoint( int x, int y, + Handle(V3d_View) theView ); + + /** + * Generates shape on the curve + * \param theCurve a curve object, that contains data + * \param theISection a curve section index + * \param theShape a generated shape + */ + CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve, + const int theISection, + TopoDS_Shape& theShape, + std::vector& theAdditional ); + + /** + * Find selected points in the context + * \param theContext the viewer context + */ + CURVECREATOR_EXPORT static std::list getSelectedPoints( + Handle(AIS_InteractiveContext) theContext ); + + /*! + * \brief Sets the local point context for the 3D viewer. + * \param theOpen The flag to open or close the local context. + */ + CURVECREATOR_EXPORT static void setLocalPointContext( + Handle(AIS_InteractiveContext) theContext, + const bool theOpen ); + + /** + * Find the neighbour points by the clicked coordinates + * \param theContext the viewer context. + * \param theContext the V3D view. + * \param theX the X coordinate in the view. + * \param theY the Y coordinate in the view. + * \param thePoint the output point to be append to the model curve + * \param thePoint1 the output point to bound the line where a new point should be inserted + * \param thePoint2 the output point to bound the line where a new point should be inserted + */ + CURVECREATOR_EXPORT static bool getNeighbourPoints( + Handle(AIS_InteractiveContext) theContext, + Handle(V3d_View) theView, + const int theX, const int theY, + gp_Pnt& thePoint, gp_Pnt& thePoint1, + gp_Pnt& thePoint2 ); + +protected: + /** + * Checks whether the point belongs to the OCC object + * \param theObject a line or shape with a bspline inside + * \param theX the X coordinate in the view. + * \param theY the Y coordinate in the view. + * \param thePoint the output point to be append to the model curve + * \param thePoint1 the output point to bound the line where a new point should be inserted + * \param thePoint2 the output point to bound the line where a new point should be inserted + */ + CURVECREATOR_EXPORT static bool pointOnObject( Handle(V3d_View) theView, + Handle(AIS_InteractiveObject) theObject, + const int theX, const int theY, + gp_Pnt& thePoint, gp_Pnt& thePoint1, + gp_Pnt& thePoint2 ); + + /* + * Returns whether the clicked point belong to the curve or has a very near projection + * \param theX the X coordinate of a point clicked in the OCC viewer + * \param theY the Y coordinate of a point clicked in the OCC viewer + * \param theCurve a geometry curve + * \param theOutPoint a found projected point on the curve + */ + CURVECREATOR_EXPORT static bool hasProjectPointOnCurve( + Handle(V3d_View) theView, + const int theX, const int theY, + const Handle(Geom_Curve)& theCurve, + Standard_Real& theParameter ); };