Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:21

0001 // Created on: 1992-05-22
0002 // Created by: Jean Claude VAUTHIER
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _DrawTrSurf_BSplineSurface_HeaderFile
0018 #define _DrawTrSurf_BSplineSurface_HeaderFile
0019 
0020 #include <Draw_MarkerShape.hxx>
0021 #include <Draw_Color.hxx>
0022 #include <DrawTrSurf_Surface.hxx>
0023 
0024 class Geom_BSplineSurface;
0025 
0026 //! This class defines a drawable BSplineSurface.
0027 //! With this class you can draw the control points and the knots
0028 //! of the surface.
0029 //! You can use the general class Surface from DrawTrSurf too,
0030 //! if you just want to sea boundaries and isoparametric curves.
0031 class DrawTrSurf_BSplineSurface : public DrawTrSurf_Surface
0032 {
0033   DEFINE_STANDARD_RTTIEXT(DrawTrSurf_BSplineSurface, DrawTrSurf_Surface)
0034   Draw_Drawable3D_FACTORY
0035 public:
0036   //! default drawing mode.
0037   //! The isoparametric curves corresponding to the knots values are drawn.
0038   //! The control points and the knots points are drawn.
0039   //! The boundaries are yellow, the isoparametric curves are blues.
0040   //! For the discretisation 50 points are computed in each parametric direction.
0041   Standard_EXPORT DrawTrSurf_BSplineSurface(const occ::handle<Geom_BSplineSurface>& S);
0042 
0043   //! The isoparametric curves corresponding to the knots values are drawn.
0044   Standard_EXPORT DrawTrSurf_BSplineSurface(const occ::handle<Geom_BSplineSurface>& S,
0045                                             const Draw_Color&                       BoundsColor,
0046                                             const Draw_Color&                       IsosColor,
0047                                             const Draw_Color&                       PolesColor,
0048                                             const Draw_Color&                       KnotsColor,
0049                                             const Draw_MarkerShape                  KnotsShape,
0050                                             const int                               KnotsSize,
0051                                             const bool                              ShowPoles,
0052                                             const bool                              ShowKnots,
0053                                             const int                               Discret,
0054                                             const double                            Deflection,
0055                                             const int                               DrawMode);
0056 
0057   //! Parametric equidistant iso curves are drawn.
0058   Standard_EXPORT DrawTrSurf_BSplineSurface(const occ::handle<Geom_BSplineSurface>& S,
0059                                             const int                               NbUIsos,
0060                                             const int                               NbVIsos,
0061                                             const Draw_Color&                       BoundsColor,
0062                                             const Draw_Color&                       IsosColor,
0063                                             const Draw_Color&                       PolesColor,
0064                                             const Draw_Color&                       KnotsColor,
0065                                             const Draw_MarkerShape                  KnotsShape,
0066                                             const int                               KnotsSize,
0067                                             const bool                              ShowPoles,
0068                                             const bool                              ShowKnots,
0069                                             const int                               Discret,
0070                                             const double                            Deflection,
0071                                             const int                               DrawMode);
0072 
0073   Standard_EXPORT void DrawOn(Draw_Display& dis) const override;
0074 
0075   void ShowPoles() { drawPoles = true; }
0076 
0077   void ShowKnots() { drawKnots = true; }
0078 
0079   //! change the number of isoparametric curves to be drawn.
0080   Standard_EXPORT void ShowIsos(const int Nu, const int Nv) override;
0081 
0082   //! change the number of isoparametric curves to be drawn.
0083   Standard_EXPORT void ShowKnotsIsos();
0084 
0085   //! rub out all the isoparametric curves.
0086   Standard_EXPORT void ClearIsos() override;
0087 
0088   void ClearPoles() { drawPoles = false; }
0089 
0090   void ClearKnots() { drawKnots = false; }
0091 
0092   Standard_EXPORT void FindPole(const double        X,
0093                                 const double        Y,
0094                                 const Draw_Display& D,
0095                                 const double        Prec,
0096                                 int&                UIndex,
0097                                 int&                VIndex) const;
0098 
0099   Standard_EXPORT void FindUKnot(const double        X,
0100                                  const double        Y,
0101                                  const Draw_Display& D,
0102                                  const double        Prec,
0103                                  int&                UIndex) const;
0104 
0105   Standard_EXPORT void FindVKnot(const double        X,
0106                                  const double        Y,
0107                                  const Draw_Display& D,
0108                                  const double        Prec,
0109                                  int&                VIndex) const;
0110 
0111   void SetPolesColor(const Draw_Color& theColor) { polesLook = theColor; }
0112 
0113   void SetKnotsColor(const Draw_Color& theColor) { knotsLook = theColor; }
0114 
0115   void SetKnotsShape(const Draw_MarkerShape theShape) { knotsForm = theShape; }
0116 
0117   Draw_MarkerShape KnotsShape() const { return knotsForm; }
0118 
0119   Draw_Color KnotsColor() const { return knotsLook; }
0120 
0121   Draw_Color PolesColor() const { return polesLook; }
0122 
0123   //! For variable copy.
0124   Standard_EXPORT occ::handle<Draw_Drawable3D> Copy() const override;
0125 
0126 private:
0127   bool             drawPoles;
0128   bool             drawKnots;
0129   bool             knotsIsos;
0130   Draw_MarkerShape knotsForm;
0131   Draw_Color       knotsLook;
0132   int              knotsDim;
0133   Draw_Color       polesLook;
0134 };
0135 
0136 #endif // _DrawTrSurf_BSplineSurface_HeaderFile