X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Utils.h;h=f7691c0dd78896b9f7bdfb2391d61a2701a63b73;hb=c363fc5c3541669e07cf4d991cc1e94253147ac1;hp=52d34e6325b66990cd104e380c0c776a57bfb2a3;hpb=f5d741e54ea475315ee8f7ca822d1ecba030fc21;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Utils.h b/src/HYDROCurveCreator/CurveCreator_Utils.h index 52d34e63..f7691c0d 100644 --- a/src/HYDROCurveCreator/CurveCreator_Utils.h +++ b/src/HYDROCurveCreator/CurveCreator_Utils.h @@ -21,11 +21,18 @@ #define CURVECREATOR_UTILS_H #include "CurveCreator_Macro.hxx" +#include "CurveCreator_ICurve.hxx" #include +#include // TODO: remove #include #include #include +#include + +#include +#include // TODO: remove + class CurveCreator_Utils { @@ -52,13 +59,45 @@ public: * \retval gp_Pnt Returns the point clicked in 3D view */ CURVECREATOR_EXPORT static gp_Pnt ConvertClickToPoint( int x, int y, - Handle(V3d_View) theView ); + Handle(V3d_View) theView ); + + /** + * Generates shape on the curve + * \param theCurve a curve object, that contains data + * \param theShape a generated shape + */ + CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve, + TopoDS_Shape& theShape ); + + /** + * Find selected points in the context + * \param theContext the viewer context + * \param theCurve a curve object, that contains data + */ + CURVECREATOR_EXPORT static void getSelectedPoints( Handle(AIS_InteractiveContext) theContext, + const CurveCreator_ICurve* theCurve, + CurveCreator_ICurve::SectionToPointList& thePoints ); + + /** + * Set selected points to the context + * \param theContext the viewer context + * \param theCurve a curve object, that contains data + * \param thePoints the curve point indices to be selected in the context + */ + CURVECREATOR_EXPORT static void setSelectedPoints( + Handle(AIS_InteractiveContext) theContext, + const CurveCreator_ICurve* theCurve, + const CurveCreator_ICurve::SectionToPointList& thePoints = + CurveCreator_ICurve::SectionToPointList() ); /*! * \brief Sets the local point context for the 3D viewer. + * \param theCurve a curve object, that contains data + * \param theContext the viewer context * \param theOpen The flag to open or close the local context. */ CURVECREATOR_EXPORT static void setLocalPointContext( + const CurveCreator_ICurve* theCurve, Handle(AIS_InteractiveContext) theContext, const bool theOpen ); @@ -77,6 +116,7 @@ public: gp_Pnt& thePoint, gp_Pnt& thePoint1, gp_Pnt& thePoint2 ); +protected: /* * 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 @@ -88,7 +128,22 @@ public: Handle(V3d_View) theView, const int theX, const int theY, const Handle(Geom_Curve)& theCurve, - Standard_Real& theParameter ); + Standard_Real& theParameter, + int& theDelta ); + + /* + * Returns whether the X and Y coordinates is in the pixel tolerance + * \param theX the X coordinate of the first point + * \param theY the Y coordinate of the first point + * \param theOtherX the X coordinate of the second point + * \param theOtherY the Y coordinate of the second point + * \param theTolerance the tolerance to compare + * \param theDelta the sum of the a square of X and a square of Y + * \returns whether the points are provide to the pixel tolerance + */ + CURVECREATOR_EXPORT static bool isEqualPixels( const int theX, const int theY, + const int theOtherX, const int theOtherY, + const double theTolerance, int& theDelta ); };