Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/DBRep.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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   DEFINE_STANDARD_ALLOC
0034 
0035   //! Creation of isoparametric curves.
0036   //! Implements ProgressIndicator for DRAW
0037   //! Sets <S> in the variable <Name>.
0038   //! Overwrite the variable if already set.
0039   Standard_EXPORT static void Set(const char* const Name, const TopoDS_Shape& S);
0040 
0041   //! Returns the shape in the variable.
0042   //! @param[in][out] theName   variable name, or "." to pick up shape interactively (the picked
0043   //! name will be returned then)
0044   //! @param[in] theType        shape type filter; function will return NULL if shape has different
0045   //! type
0046   //! @param[in] theToComplain  when TRUE, prints a message on cout if the variable is not set
0047   static TopoDS_Shape Get(const char*&     theName,
0048                           TopAbs_ShapeEnum theType       = TopAbs_SHAPE,
0049                           bool             theToComplain = false)
0050   {
0051     return getShape(theName, theType, theToComplain);
0052   }
0053 
0054   //! Returns the shape in the variable.
0055   //! @param[in][out] theName   variable name, or "." to pick up shape interactively (the picked
0056   //! name will be returned then)
0057   //! @param[in] theType        shape type filter; function will return NULL if shape has different
0058   //! type
0059   //! @param[in] theToComplain  when TRUE, prints a message on cout if the variable is not set
0060   static TopoDS_Shape Get(TCollection_AsciiString& theName,
0061                           TopAbs_ShapeEnum         theType       = TopAbs_SHAPE,
0062                           bool                     theToComplain = false)
0063   {
0064     const char*  aNamePtr = theName.ToCString();
0065     TopoDS_Shape aShape   = getShape(aNamePtr, theType, theToComplain);
0066     if (aNamePtr != theName.ToCString())
0067     {
0068       theName = aNamePtr;
0069     }
0070     return aShape;
0071   }
0072 
0073   //! Returns the shape in the variable.
0074   //! @param[in] theName  variable name
0075   //! @param[in] theType  shape type filter; function will return NULL if shape has different type
0076   //! @param[in] theToComplain  when TRUE, prints a message on cout if the variable is not set
0077   static TopoDS_Shape GetExisting(const TCollection_AsciiString& theName,
0078                                   TopAbs_ShapeEnum               theType       = TopAbs_SHAPE,
0079                                   bool                           theToComplain = false)
0080   {
0081     if (theName.Length() == 1 && theName.Value(1) == '.')
0082     {
0083       return TopoDS_Shape();
0084     }
0085 
0086     const char* aNamePtr = theName.ToCString();
0087     return getShape(aNamePtr, theType, theToComplain);
0088   }
0089 
0090   //! Defines the basic commands.
0091   Standard_EXPORT static void BasicCommands(Draw_Interpretor& theCommands);
0092 
0093   //! Return global parameters.
0094   Standard_EXPORT static DBRep_Params& Parameters();
0095 
0096   //! True if HLR, False if wireframe.
0097   static bool HLRMode() { return Parameters().WithHLR; }
0098 
0099   //! True if display Rg1Lines.
0100   static bool Rg1Mode() { return Parameters().WithRg1; }
0101 
0102   //! True if display RgNLines.
0103   static bool RgNMode() { return Parameters().WithRgN; }
0104 
0105   //! True if display HiddenLines.
0106   static bool HidMode() { return Parameters().WithHid; }
0107 
0108   //! discretisation angle for edges.
0109   static double HLRAngle() { return Parameters().HLRAngle; }
0110 
0111   //! number of iso in U and V
0112   static int NbIsos() { return Parameters().NbIsos; }
0113 
0114   //! Discretization number of points for curves
0115   static int Discretisation() { return Parameters().Discretization; }
0116 
0117 protected:
0118   //! Returns the shape in the variable.
0119   //! @param[in][out] theName   variable name, or "." to pick up shape interactively (the picked
0120   //! name will be returned then)
0121   //! @param[in] theType        shape type filter; function will return NULL if shape has different
0122   //! type
0123   //! @param[in] theToComplain  when TRUE, prints a message on cout if the variable is not set
0124   Standard_EXPORT static TopoDS_Shape getShape(const char*&     theName,
0125                                                TopAbs_ShapeEnum theType,
0126                                                bool             theToComplain);
0127 };
0128 
0129 #endif // _DBRep_HeaderFile