Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:23

0001 // Created on: 1991-07-04
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1991-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 _DBRep_DrawableShape_HeaderFile
0018 #define _DBRep_DrawableShape_HeaderFile
0019 
0020 #include <DBRep_ListOfEdge.hxx>
0021 #include <DBRep_ListOfFace.hxx>
0022 #include <DBRep_ListOfHideData.hxx>
0023 #include <Draw_Color.hxx>
0024 #include <Draw_Drawable3D.hxx>
0025 #include <Draw_Interpretor.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <NCollection_Vector.hxx>
0028 #include <Standard_OStream.hxx>
0029 #include <TopoDS_Shape.hxx>
0030 
0031 class Draw_Display;
0032 class Poly_Triangulation;
0033 class gp_Trsf;
0034 
0035 //! Drawable structure to display a  shape. Contains a
0036 //! list of edges and a list of faces.
0037 class DBRep_DrawableShape : public Draw_Drawable3D
0038 {
0039   DEFINE_STANDARD_RTTIEXT(DBRep_DrawableShape, Draw_Drawable3D)
0040   Draw_Drawable3D_FACTORY
0041 public:
0042 
0043   Standard_EXPORT DBRep_DrawableShape(const TopoDS_Shape& C, const Draw_Color& FreeCol, const Draw_Color& ConnCol, const Draw_Color& EdgeCol, const Draw_Color& IsosCol, const Standard_Real size, const Standard_Integer nbisos, const Standard_Integer discret);
0044   
0045   //! Changes the number of isoparametric curves in a shape.
0046   Standard_EXPORT void ChangeNbIsos (const Standard_Integer NbIsos);
0047   
0048   //! Returns the number of isoparametric curves in a shape.
0049   Standard_EXPORT Standard_Integer NbIsos() const;
0050   
0051   //! Changes the number of isoparametric curves in a shape.
0052   Standard_EXPORT void ChangeDiscret (const Standard_Integer Discret);
0053   
0054   //! Returns the discretisation value of curve
0055   Standard_EXPORT Standard_Integer Discret() const;
0056   
0057   //! Return const &
0058   Standard_EXPORT TopoDS_Shape Shape() const;
0059   
0060   //! When True  the orientations  of the edges and free
0061   //! vertices  are displayed.
0062   Standard_EXPORT void DisplayOrientation (const Standard_Boolean D);
0063   
0064   //! When True  the triangulations  of the faces
0065   //! are displayed even if there is a surface.
0066   Standard_EXPORT void DisplayTriangulation (const Standard_Boolean D);
0067   
0068   //! When True  the polygons  of the edges
0069   //! are displayed even if there is a geometric curve.
0070   Standard_EXPORT void DisplayPolygons (const Standard_Boolean D);
0071   
0072   //! Performs Hidden lines.
0073   Standard_EXPORT void DisplayHLR (const Standard_Boolean withHLR, const Standard_Boolean withRg1, const Standard_Boolean withRgN, const Standard_Boolean withHid, const Standard_Real ang);
0074   
0075   Standard_EXPORT Standard_Boolean DisplayTriangulation() const;
0076   
0077   Standard_EXPORT Standard_Boolean DisplayPolygons() const;
0078   
0079   Standard_EXPORT void GetDisplayHLR (Standard_Boolean& withHLR, Standard_Boolean& withRg1, Standard_Boolean& withRgN, Standard_Boolean& withHid, Standard_Real& ang) const;
0080   
0081   Standard_EXPORT void DrawOn (Draw_Display& dis) const Standard_OVERRIDE;
0082   
0083   Standard_EXPORT void DisplayHiddenLines (Draw_Display& dis);
0084   
0085   //! For variable copy.
0086   Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
0087   
0088   //! For variable dump.
0089   Standard_EXPORT virtual void Dump (Standard_OStream& S) const Standard_OVERRIDE;
0090 
0091   //! Save drawable into stream.
0092   Standard_EXPORT virtual void Save (Standard_OStream& theStream) const Standard_OVERRIDE;
0093 
0094   //! For variable whatis command.
0095   Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
0096   
0097   //! Returns the subshape touched by the last pick.
0098   //! u,v are the parameters of the closest point.
0099   Standard_EXPORT static void LastPick (TopoDS_Shape& S, Standard_Real& u, Standard_Real& v);
0100 
0101 public:
0102 
0103   //! Auxiliary method computing nodal normals for presentation purposes.
0104   //! @param theNormals [out] vector of computed normals (pair of points [from, to])
0105   //! @param theFace    [in]  input face
0106   //! @param theLength  [in]  normal length
0107   //! @return FALSE if normals can not be computed
0108   Standard_EXPORT static Standard_Boolean addMeshNormals (NCollection_Vector<std::pair<gp_Pnt, gp_Pnt> >& theNormals,
0109                                                           const TopoDS_Face&  theFace,
0110                                                           const Standard_Real theLength);
0111 
0112   //! Auxiliary method computing nodal normals for presentation purposes.
0113   //! @param theNormals [out] map of computed normals (grouped per Face)
0114   //! @param theShape   [in]  input shape which will be exploded into Faces
0115   //! @param theLength  [in]  normal length
0116   Standard_EXPORT static void addMeshNormals (NCollection_DataMap<TopoDS_Face, NCollection_Vector<std::pair<gp_Pnt, gp_Pnt> > > & theNormals,
0117                                               const TopoDS_Shape& theShape,
0118                                               const Standard_Real theLength);
0119 
0120   //! Auxiliary method computing surface normals distributed within the Face for presentation purposes.
0121   //! @param theNormals  [out] vector of computed normals (pair of points [from, to])
0122   //! @param theFace     [in]  input face
0123   //! @param theLength   [in]  normal length
0124   //! @param theNbAlongU [in]  number along U
0125   //! @param theNbAlongV [in]  number along V
0126   //! @return FALSE if normals can not be computed
0127   Standard_EXPORT static Standard_Boolean addSurfaceNormals (NCollection_Vector<std::pair<gp_Pnt, gp_Pnt> >& theNormals,
0128                                                              const TopoDS_Face&     theFace,
0129                                                              const Standard_Real    theLength,
0130                                                              const Standard_Integer theNbAlongU,
0131                                                              const Standard_Integer theNbAlongV);
0132 
0133   //! Auxiliary method computing surface normals distributed within the Face for presentation purposes.
0134   //! @param theNormals  [out] map of computed normals (grouped per Face)
0135   //! @param theShape    [in]  input shape which will be exploded into Faces
0136   //! @param theLength   [in]  normal length
0137   //! @param theNbAlongU [in]  number along U
0138   //! @param theNbAlongV [in]  number along V
0139   //! @return FALSE if normals can not be computed
0140   Standard_EXPORT static void addSurfaceNormals (NCollection_DataMap<TopoDS_Face, NCollection_Vector<std::pair<gp_Pnt, gp_Pnt> > >& theNormals,
0141                                                  const TopoDS_Shape&    theShape,
0142                                                  const Standard_Real    theLength,
0143                                                  const Standard_Integer theNbAlongU,
0144                                                  const Standard_Integer theNbAlongV);
0145 
0146 private:
0147 
0148   void display (const Handle(Poly_Triangulation)& T, const gp_Trsf& tr, Draw_Display& dis) const;
0149 
0150   //! Updates internal data necessary for display
0151   void updateDisplayData () const;
0152 
0153 private:
0154 
0155   TopoDS_Shape myShape;
0156 
0157   mutable DBRep_ListOfEdge myEdges;
0158   mutable DBRep_ListOfFace myFaces;
0159   DBRep_ListOfHideData myHidData;
0160 
0161   Standard_Real mySize;
0162   Standard_Integer myDiscret;
0163   Draw_Color myFreeCol;
0164   Draw_Color myConnCol;
0165   Draw_Color myEdgeCol;
0166   Draw_Color myIsosCol;
0167   Standard_Integer myNbIsos;
0168   Standard_Boolean myDispOr;
0169   Standard_Boolean mytriangulations;
0170   Standard_Boolean mypolygons;
0171   Standard_Boolean myHLR;
0172   Standard_Boolean myRg1;
0173   Standard_Boolean myRgN;
0174   Standard_Boolean myHid;
0175   Standard_Real myAng;
0176 
0177 };
0178 
0179 DEFINE_STANDARD_HANDLE(DBRep_DrawableShape, Draw_Drawable3D)
0180 
0181 #endif // _DBRep_DrawableShape_HeaderFile