X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FCurveCreator%2FCurveCreator_Utils.hxx;h=b0e29b555003a6ebe39be3fb3ae7d7018acdc1f0;hb=5a3993c7b06b1f7b0d79e66af3411d9982cf2b62;hp=0494fceeffe9c70c110c283622d2dc77467dbc6d;hpb=34c4dd8f29522c302d80dd3d35537eee9320e047;p=modules%2Fgeom.git diff --git a/src/CurveCreator/CurveCreator_Utils.hxx b/src/CurveCreator/CurveCreator_Utils.hxx index 0494fceef..b0e29b555 100644 --- a/src/CurveCreator/CurveCreator_Utils.hxx +++ b/src/CurveCreator/CurveCreator_Utils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2013-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,11 +29,14 @@ #include #include #include +#include #include #include +#include #include #include // TODO: remove +#include class CurveCreator_Curve; @@ -54,6 +57,21 @@ public: Handle(V3d_View) theView, int& x, int& y ); + /** + * Generates a random color + */ + CURVECREATOR_EXPORT static Quantity_Color getRandColor(); + + /** + * Convert QColor to Quantity_Color + */ + CURVECREATOR_EXPORT static Quantity_Color colorConv(QColor color); + + /** + * Convert Quantity_Color to QColor + */ + CURVECREATOR_EXPORT static QColor colorConv(Quantity_Color color); + /*! * \brief Returns the point clicked in 3D view. * @@ -69,9 +87,11 @@ public: * Generates shape on the curve * \param theCurve a curve object, that contains data * \param theShape a generated shape + * \param Sect2Shape optional out map: section to constructed shape (wire+vertices) */ CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve, - TopoDS_Shape& theShape ); + TopoDS_Shape& theShape, + NCollection_IndexedDataMap* Sect2Shape = NULL); /** * Generates a curve from a shape. @@ -133,10 +153,28 @@ public: gp_Pnt& thePoint, gp_Pnt& thePoint1, gp_Pnt& thePoint2 ); + /** + * The algorithm builds the cubic B-spline passing through the points that the + * tangent vector in each given point P is calculated by the following way: + * if point P is preceded by a point A and is followed by a point B then + * the tangent vector is equal to (P - A) / |P - A| + (B - P) / |B - P|; + * if point P is preceded by a point A but is not followed by any point then + * the tangent vector is equal to P - A; + * if point P is followed by a point B but is not preceded by any point then + * the tangent vector is equal to B - P. + */ CURVECREATOR_EXPORT static bool constructBSpline( const Handle(TColgp_HArray1OfPnt)& thePoints, const Standard_Boolean theIsClosed, Handle(Geom_BSplineCurve)& theBSpline ); + /** + * Constructs the wire corresponding to the section. + */ + CURVECREATOR_EXPORT static TopoDS_Wire ConstructWire( + Handle(TColgp_HArray1OfPnt) thePoints, + const bool theIsPolyline, + const bool theIsClosed); + protected: /* * Returns whether the clicked point belong to the curve or has a very near projection @@ -186,7 +224,7 @@ protected: * \param IsBSpline BSpline flag. Output parameter. * \return the array of points. Null handle in case of failure. */ - static Handle_TColgp_HArray1OfPnt getPoints + static Handle(TColgp_HArray1OfPnt) getPoints (const TopoDS_Shape &theShape, bool &IsClosed, bool &IsBSpline); @@ -207,7 +245,7 @@ protected: * \param thePlnStatus the current status on input. It can be modified on * output. */ - static void FindPlane(const Handle_TColgp_HArray1OfPnt &thePoints, + static void FindPlane(const Handle(TColgp_HArray1OfPnt) &thePoints, gp_Pln &thePlane, Standard_Integer &thePlnStatus);