Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-22 08:31:07

0001 // Created on: 2000-08-30
0002 // Created by: data exchange team
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XCAFDoc_DocumentTool_HeaderFile
0017 #define _XCAFDoc_DocumentTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TDataStd_GenericEmpty.hxx>
0023 #include <Standard_Boolean.hxx>
0024 #include <UnitsMethods_LengthUnit.hxx>
0025 
0026 class Standard_GUID;
0027 class TDF_Label;
0028 class TDocStd_Document;
0029 class XCAFDoc_ShapeTool;
0030 class XCAFDoc_ColorTool;
0031 class XCAFDoc_ClippingPlaneTool;
0032 class XCAFDoc_LayerTool;
0033 class XCAFDoc_DimTolTool;
0034 class XCAFDoc_MaterialTool;
0035 class XCAFDoc_NotesTool;
0036 class XCAFDoc_ViewTool;
0037 class XCAFDoc_VisMaterialTool;
0038 
0039 class XCAFDoc_DocumentTool;
0040 DEFINE_STANDARD_HANDLE(XCAFDoc_DocumentTool, TDataStd_GenericEmpty)
0041 
0042 //! Defines sections structure of an XDE document.
0043 //! attribute marking CAF document as being DECAF document.
0044 //! Creates the sections structure of the document.
0045 class XCAFDoc_DocumentTool : public TDataStd_GenericEmpty
0046 {
0047 
0048 public:
0049   Standard_EXPORT static const Standard_GUID& GetID();
0050 
0051   //! Create (if not exist) DocumentTool attribute
0052   //! on 0.1 label if <IsAcces> is true, else
0053   //! on <L> label.
0054   //! This label will be returned by DocLabel();
0055   //! If the attribute is already set it won't be reset on
0056   //! <L> even if <IsAcces> is false.
0057   //! ColorTool and ShapeTool attributes are also set by this method.
0058   Standard_EXPORT static Handle(XCAFDoc_DocumentTool) Set(
0059     const TDF_Label&       L,
0060     const Standard_Boolean IsAcces = Standard_True);
0061 
0062   Standard_EXPORT static Standard_Boolean IsXCAFDocument(const Handle(TDocStd_Document)& Doc);
0063 
0064   //! Returns label where the DocumentTool attribute is or
0065   //! 0.1 if DocumentTool is not yet set.
0066   Standard_EXPORT static TDF_Label DocLabel(const TDF_Label& acces);
0067 
0068   //! Returns sub-label of DocLabel() with tag 1.
0069   Standard_EXPORT static TDF_Label ShapesLabel(const TDF_Label& acces);
0070 
0071   //! Returns sub-label of DocLabel() with tag 2.
0072   Standard_EXPORT static TDF_Label ColorsLabel(const TDF_Label& acces);
0073 
0074   //! Returns sub-label of DocLabel() with tag 3.
0075   Standard_EXPORT static TDF_Label LayersLabel(const TDF_Label& acces);
0076 
0077   //! Returns sub-label of DocLabel() with tag 4.
0078   Standard_EXPORT static TDF_Label DGTsLabel(const TDF_Label& acces);
0079 
0080   //! Returns sub-label of DocLabel() with tag 5.
0081   Standard_EXPORT static TDF_Label MaterialsLabel(const TDF_Label& acces);
0082 
0083   //! Returns sub-label of DocLabel() with tag 7.
0084   Standard_EXPORT static TDF_Label ViewsLabel(const TDF_Label& acces);
0085 
0086   //! Returns sub-label of DocLabel() with tag 8.
0087   Standard_EXPORT static TDF_Label ClippingPlanesLabel(const TDF_Label& acces);
0088 
0089   //! Returns sub-label of DocLabel() with tag 9.
0090   Standard_EXPORT static TDF_Label NotesLabel(const TDF_Label& acces);
0091 
0092   //! Returns sub-label of DocLabel() with tag 10.
0093   Standard_EXPORT static TDF_Label VisMaterialLabel(const TDF_Label& theLabel);
0094 
0095   //! Creates (if it does not exist) ShapeTool attribute on ShapesLabel().
0096   Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool(const TDF_Label& acces);
0097 
0098   //! Checks for the ShapeTool attribute on the label's document
0099   //! Returns TRUE if Tool exists, ELSE if it has not been created
0100   Standard_EXPORT static Standard_Boolean CheckShapeTool(const TDF_Label& theAcces);
0101 
0102   //! Creates (if it does not exist) ColorTool attribute on ColorsLabel().
0103   Standard_EXPORT static Handle(XCAFDoc_ColorTool) ColorTool(const TDF_Label& acces);
0104 
0105   //! Checks for the ColorTool attribute on the label's document
0106   //! Returns TRUE if Tool exists, ELSE if it has not been created
0107   Standard_EXPORT static Standard_Boolean CheckColorTool(const TDF_Label& theAcces);
0108 
0109   //! Creates (if it does not exist) XCAFDoc_VisMaterialTool attribute on VisMaterialLabel().
0110   //! Should not be confused with MaterialTool() defining physical/manufacturing materials.
0111   Standard_EXPORT static Handle(XCAFDoc_VisMaterialTool) VisMaterialTool(const TDF_Label& theLabel);
0112 
0113   //! Checks for the VisMaterialTool attribute on the label's document
0114   //! Returns TRUE if Tool exists, ELSE if it has not been created
0115   Standard_EXPORT static Standard_Boolean CheckVisMaterialTool(const TDF_Label& theAcces);
0116 
0117   //! Creates (if it does not exist) LayerTool attribute on LayersLabel().
0118   Standard_EXPORT static Handle(XCAFDoc_LayerTool) LayerTool(const TDF_Label& acces);
0119 
0120   //! Checks for the LayerTool attribute on the label's document
0121   //! Returns TRUE if Tool exists, ELSE if it has not been created
0122   Standard_EXPORT static Standard_Boolean CheckLayerTool(const TDF_Label& theAcces);
0123 
0124   //! Creates (if it does not exist) DimTolTool attribute on DGTsLabel().
0125   Standard_EXPORT static Handle(XCAFDoc_DimTolTool) DimTolTool(const TDF_Label& acces);
0126 
0127   //! Checks for the DimTolTool attribute on the label's document
0128   //! Returns TRUE if Tool exists, ELSE if it has not been created
0129   Standard_EXPORT static Standard_Boolean CheckDimTolTool(const TDF_Label& theAcces);
0130 
0131   //! Creates (if it does not exist) DimTolTool attribute on DGTsLabel().
0132   Standard_EXPORT static Handle(XCAFDoc_MaterialTool) MaterialTool(const TDF_Label& acces);
0133 
0134   //! Checks for the MaterialTool attribute on the label's document
0135   //! Returns TRUE if Tool exists, ELSE if it has not been created
0136   Standard_EXPORT static Standard_Boolean CheckMaterialTool(const TDF_Label& theAcces);
0137 
0138   //! Creates (if it does not exist) ViewTool attribute on ViewsLabel().
0139   Standard_EXPORT static Handle(XCAFDoc_ViewTool) ViewTool(const TDF_Label& acces);
0140 
0141   //! Checks for the ViewTool attribute on the label's document
0142   //! Returns TRUE if Tool exists, ELSE if it has not been created
0143   Standard_EXPORT static Standard_Boolean CheckViewTool(const TDF_Label& theAcces);
0144 
0145   //! Creates (if it does not exist) ClippingPlaneTool attribute on ClippingPlanesLabel().
0146   Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) ClippingPlaneTool(
0147     const TDF_Label& acces);
0148 
0149   //! Checks for the ClippingPlaneTool attribute on the label's document
0150   //! Returns TRUE if Tool exists, ELSE if it has not been created
0151   Standard_EXPORT static Standard_Boolean CheckClippingPlaneTool(const TDF_Label& theAcces);
0152 
0153   //! Creates (if it does not exist) NotesTool attribute on NotesLabel().
0154   Standard_EXPORT static Handle(XCAFDoc_NotesTool) NotesTool(const TDF_Label& acces);
0155 
0156   //! Checks for the NotesTool attribute on the label's document
0157   //! Returns TRUE if Tool exists, ELSE if it has not been created
0158   Standard_EXPORT static Standard_Boolean CheckNotesTool(const TDF_Label& theAcces);
0159 
0160   //! Returns value of current internal unit for the document
0161   //! converted to base unit type.
0162   Standard_EXPORT static Standard_Boolean GetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0163                                                         Standard_Real&                  theResut,
0164                                                         const UnitsMethods_LengthUnit theBaseUnit);
0165 
0166   //! Returns value of current internal unit for the document in meter
0167   Standard_EXPORT static Standard_Boolean GetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0168                                                         Standard_Real&                  theResut);
0169 
0170   //! Sets value of current internal unit to the document in meter
0171   Standard_EXPORT static void SetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0172                                             const Standard_Real             theUnitValue);
0173 
0174   //! Sets value of current internal unit to the document
0175   //! @param theUnitValue must be represented in the base unit type
0176   Standard_EXPORT static void SetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0177                                             const Standard_Real             theUnitValue,
0178                                             const UnitsMethods_LengthUnit   theBaseUnit);
0179 
0180 public:
0181   Standard_EXPORT XCAFDoc_DocumentTool();
0182 
0183   //! to be called when reading this attribute from file
0184   Standard_EXPORT void Init() const;
0185 
0186   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0187 
0188   //! To init this derived attribute after the attribute restore using the base restore-methods
0189   Standard_EXPORT Standard_Boolean AfterRetrieval(const Standard_Boolean forceIt = Standard_False)
0190     Standard_OVERRIDE;
0191 
0192   DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_DocumentTool, TDataStd_GenericEmpty)
0193 };
0194 
0195 #endif // _XCAFDoc_DocumentTool_HeaderFile