Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:46:25

0001 // Created on: 1991-06-25
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_HeaderFile
0018 #define _DBRep_HeaderFile
0019 
0020 #include <DBRep_Params.hxx>
0021 #include <Draw_Interpretor.hxx>
0022 #include <TopoDS_Shape.hxx>
0023 
0024 //! Used to display BRep objects  using the DrawTrSurf
0025 //! package.
0026 //! The DrawableShape is a Display object build from a
0027 //! Shape.
0028 //! Provides methods to manage a directory of named shapes.
0029 //! Provides a set of Draw commands for Shapes.
0030 class DBRep 
0031 {
0032 public:
0033 
0034   DEFINE_STANDARD_ALLOC
0035 
0036   
0037   //! Creation of isoparametric curves.
0038   //! Implements ProgressIndicator for DRAW
0039   //! Sets  <S> in the  variable  <Name>.  Overwrite the
0040   //! variable if already set.
0041   Standard_EXPORT static void Set (const Standard_CString Name, const TopoDS_Shape& S);
0042   
0043   //! Returns the shape in the variable.
0044   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
0045   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
0046   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
0047   static TopoDS_Shape Get (Standard_CString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
0048   {
0049     return getShape (theName, theType, theToComplain);
0050   }
0051 
0052   //! Returns the shape in the variable.
0053   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
0054   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
0055   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
0056   static TopoDS_Shape Get (TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
0057   {
0058     Standard_CString aNamePtr = theName.ToCString();
0059     TopoDS_Shape aShape = getShape (aNamePtr, theType, theToComplain);
0060     if (aNamePtr != theName.ToCString())
0061     {
0062       theName = aNamePtr;
0063     }
0064     return aShape;
0065   }
0066 
0067   //! Returns the shape in the variable.
0068   //! @param theName [in] variable name
0069   //! @param theType [in] shape type filter; function will return NULL if shape has different type
0070   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
0071   static TopoDS_Shape GetExisting (const TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
0072   {
0073     if (theName.Length() == 1
0074      && theName.Value (1) == '.')
0075     {
0076       return TopoDS_Shape();
0077     }
0078 
0079     Standard_CString aNamePtr = theName.ToCString();
0080     return getShape (aNamePtr, theType, theToComplain);
0081   }
0082 
0083   //! Defines the basic commands.
0084   Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands);
0085 
0086   //! Return global parameters.
0087   Standard_EXPORT static DBRep_Params& Parameters();
0088 
0089   //! True if HLR, False if wireframe.
0090   static Standard_Boolean HLRMode() { return Parameters().WithHLR; }
0091 
0092   //! True if display Rg1Lines.
0093   static Standard_Boolean Rg1Mode() { return Parameters().WithRg1; }
0094 
0095   //! True if display RgNLines.
0096   static Standard_Boolean RgNMode() { return Parameters().WithRgN; }
0097 
0098   //! True if display HiddenLines.
0099   static Standard_Boolean HidMode() { return Parameters().WithHid; }
0100 
0101   //! discretisation angle for edges.
0102   static Standard_Real HLRAngle() { return Parameters().HLRAngle; }
0103 
0104   //! number of iso in U and V
0105   static Standard_Integer NbIsos() { return Parameters().NbIsos; }
0106 
0107   //! Discretization number of points for curves
0108   static Standard_Integer Discretisation() { return Parameters().Discretization; }
0109 
0110 protected:
0111 
0112   //! Returns the shape in the variable.
0113   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
0114   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
0115   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
0116   Standard_EXPORT static TopoDS_Shape getShape (Standard_CString& theName,
0117                                                 TopAbs_ShapeEnum theType,
0118                                                 Standard_Boolean theToComplain);
0119 
0120 };
0121 
0122 #endif // _DBRep_HeaderFile