Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:34

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 
0040 class XCAFDoc_DocumentTool;
0041 DEFINE_STANDARD_HANDLE(XCAFDoc_DocumentTool, TDataStd_GenericEmpty)
0042 
0043 //! Defines sections structure of an XDE document.
0044 //! attribute marking CAF document as being DECAF document.
0045 //! Creates the sections structure of the document.
0046 class XCAFDoc_DocumentTool : public TDataStd_GenericEmpty
0047 {
0048 
0049 public:
0050 
0051   Standard_EXPORT static const Standard_GUID& GetID();
0052   
0053   //! Create (if not exist) DocumentTool attribute
0054   //! on 0.1 label if <IsAcces> is true, else
0055   //! on <L> label.
0056   //! This label will be returned by DocLabel();
0057   //! If the attribute is already set it won't be reset on
0058   //! <L> even if <IsAcces> is false.
0059   //! ColorTool and ShapeTool attributes are also set by this method.
0060   Standard_EXPORT static Handle(XCAFDoc_DocumentTool) Set (const TDF_Label& L, 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(const TDF_Label& acces);
0147 
0148   //! Checks for the ClippingPlaneTool attribute on the label's document
0149   //! Returns TRUE if Tool exists, ELSE if it has not been created
0150   Standard_EXPORT static Standard_Boolean CheckClippingPlaneTool(const TDF_Label& theAcces);
0151 
0152   //! Creates (if it does not exist) NotesTool attribute on NotesLabel().
0153   Standard_EXPORT static Handle(XCAFDoc_NotesTool) NotesTool(const TDF_Label& acces);
0154 
0155   //! Checks for the NotesTool attribute on the label's document
0156   //! Returns TRUE if Tool exists, ELSE if it has not been created
0157   Standard_EXPORT static Standard_Boolean CheckNotesTool(const TDF_Label& theAcces);
0158 
0159   //! Returns value of current internal unit for the document
0160   //! converted to base unit type.
0161   Standard_EXPORT static Standard_Boolean GetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0162                                                         Standard_Real& theResut,
0163                                                         const UnitsMethods_LengthUnit theBaseUnit);
0164 
0165   //! Returns value of current internal unit for the document in meter
0166   Standard_EXPORT static Standard_Boolean GetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0167                                                         Standard_Real& theResut);
0168 
0169   //! Sets value of current internal unit to the document in meter
0170   Standard_EXPORT static void SetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0171                                             const Standard_Real theUnitValue);
0172 
0173   //! Sets value of current internal unit to the document
0174   //! @param theUnitValue must be represented in the base unit type
0175   Standard_EXPORT static void SetLengthUnit(const Handle(TDocStd_Document)& theDoc,
0176                                             const Standard_Real theUnitValue,
0177                                             const UnitsMethods_LengthUnit theBaseUnit);
0178 
0179 public:
0180 
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) Standard_OVERRIDE;
0190   
0191 
0192   DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_DocumentTool,TDataStd_GenericEmpty)
0193 };
0194 
0195 #endif // _XCAFDoc_DocumentTool_HeaderFile