Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/XCAFDoc_DimTolTool.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: 2004-01-09
0002 // Created by: Sergey KUUL
0003 // Copyright (c) 2004-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_DimTolTool_HeaderFile
0017 #define _XCAFDoc_DimTolTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TDataStd_GenericEmpty.hxx>
0023 #include <Standard_Boolean.hxx>
0024 #include <TDF_Label.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <NCollection_Array1.hxx>
0028 #include <NCollection_HArray1.hxx>
0029 #include <TopoDS_Shape.hxx>
0030 #include <NCollection_IndexedDataMap.hxx>
0031 
0032 class XCAFDoc_ShapeTool;
0033 class TDF_Label;
0034 class Standard_GUID;
0035 class TCollection_HAsciiString;
0036 
0037 //! Attribute containing GD&T section of XCAF document.
0038 //! Provide tools for GD&T section management.
0039 class XCAFDoc_DimTolTool : public TDataStd_GenericEmpty
0040 {
0041 
0042 public:
0043   Standard_EXPORT XCAFDoc_DimTolTool();
0044 
0045   //! Creates (if not exist) DimTolTool attribute.
0046   Standard_EXPORT static occ::handle<XCAFDoc_DimTolTool> Set(const TDF_Label& L);
0047 
0048   //! Returns the standard GD&T tool GUID.
0049   Standard_EXPORT static const Standard_GUID& GetID();
0050 
0051   //! Returns the label under which GD&T table is stored.
0052   Standard_EXPORT TDF_Label BaseLabel() const;
0053 
0054   //! Returns internal XCAFDoc_ShapeTool tool
0055   Standard_EXPORT const occ::handle<XCAFDoc_ShapeTool>& ShapeTool();
0056 
0057   //! Returns True if the label belongs to a GD&T table and
0058   //! is a Dimension definition.
0059   Standard_EXPORT bool IsDimension(const TDF_Label& theLab) const;
0060 
0061   //! Returns a sequence of Dimension labels currently stored
0062   //! in the GD&T table.
0063   Standard_EXPORT void GetDimensionLabels(NCollection_Sequence<TDF_Label>& theLabels) const;
0064 
0065   //! Sets a dimension to sequences target labels.
0066   Standard_EXPORT void SetDimension(const NCollection_Sequence<TDF_Label>& theFirstLS,
0067                                     const NCollection_Sequence<TDF_Label>& theSecondLS,
0068                                     const TDF_Label&                       theDimL) const;
0069 
0070   //! Sets a dimension to target labels.
0071   Standard_EXPORT void SetDimension(const TDF_Label& theFirstL,
0072                                     const TDF_Label& theSecondL,
0073                                     const TDF_Label& theDimL) const;
0074 
0075   //! Sets a dimension to the target label.
0076   Standard_EXPORT void SetDimension(const TDF_Label& theL, const TDF_Label& theDimL) const;
0077 
0078   //! Returns all Dimension labels defined for theShapeL.
0079   Standard_EXPORT bool GetRefDimensionLabels(const TDF_Label&                 theShapeL,
0080                                              NCollection_Sequence<TDF_Label>& theDimensions) const;
0081 
0082   //! Adds a dimension definition to the GD&T table and returns its label.
0083   Standard_EXPORT TDF_Label AddDimension();
0084 
0085   //! Returns True if the label belongs to the GD&T table and is a dimension tolerance.
0086   Standard_EXPORT bool IsGeomTolerance(const TDF_Label& theLab) const;
0087 
0088   //! Returns a sequence of Tolerance labels currently stored in the GD&T table.
0089   Standard_EXPORT void GetGeomToleranceLabels(NCollection_Sequence<TDF_Label>& theLabels) const;
0090 
0091   //! Sets a geometry tolerance from theGeomTolL to theL label.
0092   //! Checks if theGeomTolL is a geometry tolerance definition first.
0093   Standard_EXPORT void SetGeomTolerance(const TDF_Label& theL, const TDF_Label& theGeomTolL) const;
0094 
0095   //! Sets a geometry tolerance from theGeomTolL to sequence of labels theL.
0096   //! Checks if theGeomTolL is a geometry tolerance definition first.
0097   Standard_EXPORT void SetGeomTolerance(const NCollection_Sequence<TDF_Label>& theL,
0098                                         const TDF_Label&                       theGeomTolL) const;
0099 
0100   //! Returns all GeomTolerance labels defined for theShapeL.
0101   Standard_EXPORT bool GetRefGeomToleranceLabels(const TDF_Label&                 theShapeL,
0102                                                  NCollection_Sequence<TDF_Label>& theDimTols) const;
0103 
0104   //! Adds a GeomTolerance definition to the GD&T table and returns its label.
0105   Standard_EXPORT TDF_Label AddGeomTolerance();
0106 
0107   //! Returns True if theLab belongs to the GD&T table and is a dmension tolerance.
0108   Standard_EXPORT bool IsDimTol(const TDF_Label& theLab) const;
0109 
0110   //! Returns a sequence of D&GTs currently stored in the GD&T table.
0111   Standard_EXPORT void GetDimTolLabels(NCollection_Sequence<TDF_Label>& Labels) const;
0112 
0113   //! Finds a dimension tolerance definition in the GD&T table
0114   //! satisfying the specified kind, values, name and description
0115   //! and returns its label if found.
0116   //! Returns False if dimension tolerance is not found in DGTtable.
0117   Standard_EXPORT bool FindDimTol(const int                                       theKind,
0118                                   const occ::handle<NCollection_HArray1<double>>& theVal,
0119                                   const occ::handle<TCollection_HAsciiString>&    theName,
0120                                   const occ::handle<TCollection_HAsciiString>&    theDescription,
0121                                   TDF_Label&                                      lab) const;
0122 
0123   //! Finds a dimension tolerance in the GD&T table
0124   //! satisfying the specified kind, values, name and description
0125   //! and returns its label if found (or Null label else).
0126   Standard_EXPORT TDF_Label
0127     FindDimTol(const int                                       theKind,
0128                const occ::handle<NCollection_HArray1<double>>& theVal,
0129                const occ::handle<TCollection_HAsciiString>&    theName,
0130                const occ::handle<TCollection_HAsciiString>&    theDescription) const;
0131 
0132   //! Adds a dimension tolerance definition with the specified
0133   //! kind, value, name and description to the GD&T table and returns its label.
0134   Standard_EXPORT TDF_Label
0135     AddDimTol(const int                                       theKind,
0136               const occ::handle<NCollection_HArray1<double>>& theVal,
0137               const occ::handle<TCollection_HAsciiString>&    theName,
0138               const occ::handle<TCollection_HAsciiString>&    theDescription) const;
0139 
0140   //! Sets existing dimension tolerance to theL label.
0141   Standard_EXPORT void SetDimTol(const TDF_Label& theL, const TDF_Label& theDimTolL) const;
0142 
0143   //! Creates a dimension tolerance and sets it to theL label.
0144   Standard_EXPORT TDF_Label
0145     SetDimTol(const TDF_Label&                                theL,
0146               const int                                       theKind,
0147               const occ::handle<NCollection_HArray1<double>>& theVal,
0148               const occ::handle<TCollection_HAsciiString>&    theName,
0149               const occ::handle<TCollection_HAsciiString>&    theDescription) const;
0150 
0151   //! Gets all shape labels referred by theL label of the GD&T table.
0152   //! Returns False if there are no shape labels added to the sequences.
0153   Standard_EXPORT static bool GetRefShapeLabel(const TDF_Label&                 theL,
0154                                                NCollection_Sequence<TDF_Label>& theShapeLFirst,
0155                                                NCollection_Sequence<TDF_Label>& theShapeLSecond);
0156 
0157   //! Returns dimension tolerance assigned to theDimTolL label.
0158   //! Returns False if no such dimension tolerance is assigned.
0159   Standard_EXPORT bool GetDimTol(const TDF_Label&                          theDimTolL,
0160                                  int&                                      theKind,
0161                                  occ::handle<NCollection_HArray1<double>>& theVal,
0162                                  occ::handle<TCollection_HAsciiString>&    theName,
0163                                  occ::handle<TCollection_HAsciiString>&    theDescription) const;
0164 
0165   //! Returns True if label belongs to the GD&T table and
0166   //! is a Datum definition.
0167   Standard_EXPORT bool IsDatum(const TDF_Label& lab) const;
0168 
0169   //! Returns a sequence of Datums currently stored
0170   //! in the GD&T table.
0171   Standard_EXPORT void GetDatumLabels(NCollection_Sequence<TDF_Label>& Labels) const;
0172 
0173   //! Finds a datum satisfying the specified name, description and
0174   //! identification and returns its label if found.
0175   Standard_EXPORT bool FindDatum(const occ::handle<TCollection_HAsciiString>& theName,
0176                                  const occ::handle<TCollection_HAsciiString>& theDescription,
0177                                  const occ::handle<TCollection_HAsciiString>& theIdentification,
0178                                  TDF_Label&                                   lab) const;
0179 
0180   //! Adds a datum definition to the GD&T table and returns its label.
0181   Standard_EXPORT TDF_Label
0182     AddDatum(const occ::handle<TCollection_HAsciiString>& theName,
0183              const occ::handle<TCollection_HAsciiString>& theDescription,
0184              const occ::handle<TCollection_HAsciiString>& theIdentification) const;
0185 
0186   //! Adds a datum definition to the GD&T table and returns its label.
0187   Standard_EXPORT TDF_Label AddDatum();
0188 
0189   //! Sets a datum to the sequence of shape labels.
0190   Standard_EXPORT void SetDatum(const NCollection_Sequence<TDF_Label>& theShapeLabels,
0191                                 const TDF_Label&                       theDatumL) const;
0192 
0193   //! Sets a datum to theL label and binds it with theTolerL label.
0194   //! A datum with the specified name, description and identification
0195   //! is created if it isn't found in the GD&T table.
0196   Standard_EXPORT void SetDatum(
0197     const TDF_Label&                             theL,
0198     const TDF_Label&                             theTolerL,
0199     const occ::handle<TCollection_HAsciiString>& theName,
0200     const occ::handle<TCollection_HAsciiString>& theDescription,
0201     const occ::handle<TCollection_HAsciiString>& theIdentification) const;
0202 
0203   //! Sets a datum from theDatumL label to theToletL label.
0204   Standard_EXPORT void SetDatumToGeomTol(const TDF_Label& theDatumL,
0205                                          const TDF_Label& theTolerL) const;
0206 
0207   //! Returns datum assigned to theDatumL label.
0208   //! Returns False if no such datum is assigned.
0209   Standard_EXPORT bool GetDatum(const TDF_Label&                       theDatumL,
0210                                 occ::handle<TCollection_HAsciiString>& theName,
0211                                 occ::handle<TCollection_HAsciiString>& theDescription,
0212                                 occ::handle<TCollection_HAsciiString>& theIdentification) const;
0213 
0214   //! Returns all Datum labels defined for theDimTolL label.
0215   Standard_EXPORT static bool GetDatumOfTolerLabels(const TDF_Label&                 theDimTolL,
0216                                                     NCollection_Sequence<TDF_Label>& theDatums);
0217 
0218   //! Returns all Datum labels with XCAFDimTolObjects_DatumObject defined for label theDimTolL.
0219   Standard_EXPORT static bool GetDatumWithObjectOfTolerLabels(
0220     const TDF_Label&                 theDimTolL,
0221     NCollection_Sequence<TDF_Label>& theDatums);
0222 
0223   //! Returns all GeomToleranses labels defined for theDatumL label.
0224   Standard_EXPORT bool GetTolerOfDatumLabels(const TDF_Label&                 theDatumL,
0225                                              NCollection_Sequence<TDF_Label>& theTols) const;
0226 
0227   //! Returns Datum label defined for theShapeL label.
0228   Standard_EXPORT bool GetRefDatumLabel(const TDF_Label&                 theShapeL,
0229                                         NCollection_Sequence<TDF_Label>& theDatum) const;
0230 
0231   //! Returns true if the given GDT is marked as locked.
0232   Standard_EXPORT bool IsLocked(const TDF_Label& theViewL) const;
0233 
0234   //! Mark the given GDT as locked.
0235   Standard_EXPORT void Lock(const TDF_Label& theViewL) const;
0236 
0237   //! fill the map GDT label -> shape presentation
0238   Standard_EXPORT void GetGDTPresentations(
0239     NCollection_IndexedDataMap<TDF_Label, TopoDS_Shape>& theGDTLabelToShape) const;
0240 
0241   //! Set shape presentation for GDT labels according to given map (theGDTLabelToPrs)
0242   //! theGDTLabelToPrsName map is an additional argument, can be used to set presentation names.
0243   //! If label is not in the theGDTLabelToPrsName map, the presentation name will be empty
0244   Standard_EXPORT void SetGDTPresentations(
0245     NCollection_IndexedDataMap<TDF_Label, TopoDS_Shape>& theGDTLabelToPrs);
0246 
0247   //! Unlock the given GDT.
0248   Standard_EXPORT void Unlock(const TDF_Label& theViewL) const;
0249 
0250   Standard_EXPORT const Standard_GUID& ID() const override;
0251 
0252   //! Dumps the content of me into the stream
0253   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0254 
0255   DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_DimTolTool, TDataStd_GenericEmpty)
0256 
0257 private:
0258   occ::handle<XCAFDoc_ShapeTool> myShapeTool;
0259 };
0260 
0261 #endif // _XCAFDoc_DimTolTool_HeaderFile