Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2009-04-06
0002 // Created by: Sergey ZARITCHNY
0003 // Copyright (c) 2009-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 _TDataXtd_Constraint_HeaderFile
0017 #define _TDataXtd_Constraint_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TDataXtd_ConstraintEnum.hxx>
0023 #include <TDF_Attribute.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <TDF_LabelList.hxx>
0026 #include <Standard_OStream.hxx>
0027 
0028 class TDataStd_Real;
0029 class Standard_GUID;
0030 class TDF_Label;
0031 class TNaming_NamedShape;
0032 class TDF_RelocationTable;
0033 class TDF_DataSet;
0034 
0035 
0036 class TDataXtd_Constraint;
0037 DEFINE_STANDARD_HANDLE(TDataXtd_Constraint, TDF_Attribute)
0038 
0039 //! The groundwork to define constraint attributes.
0040 //! The constraint attribute contains the following sorts of data:
0041 //! -   Type whether the constraint attribute is a
0042 //! geometric constraint or a dimension
0043 //! -   Value the real number value of a numeric
0044 //! constraint such as an angle or a radius
0045 //! -   Geometries to identify the geometries
0046 //! underlying the topological attributes which
0047 //! define the constraint (up to 4)
0048 //! -   Plane for 2D constraints.
0049 class TDataXtd_Constraint : public TDF_Attribute
0050 {
0051 
0052 public:
0053 
0054   
0055   //! Returns the GUID for constraints.
0056   Standard_EXPORT static const Standard_GUID& GetID();
0057   
0058   //! Finds or creates the 2D constraint attribute
0059   //! defined by the planar topological attribute plane
0060   //! and the label label.
0061   //! Constraint methods
0062   //! ==================
0063   Standard_EXPORT static Handle(TDataXtd_Constraint) Set (const TDF_Label& label);
0064   
0065   Standard_EXPORT TDataXtd_Constraint();
0066   
0067 
0068   //! Finds or creates the constraint attribute defined
0069   //! by the topological attribute G1 and the constraint type type.
0070   Standard_EXPORT void Set (const TDataXtd_ConstraintEnum type, const Handle(TNaming_NamedShape)& G1);
0071   
0072 
0073   //! Finds or creates the constraint attribute defined
0074   //! by the topological attributes G1 and G2, and by
0075   //! the constraint type type.
0076   Standard_EXPORT void Set (const TDataXtd_ConstraintEnum type, const Handle(TNaming_NamedShape)& G1, const Handle(TNaming_NamedShape)& G2);
0077   
0078 
0079   //! Finds or creates the constraint attribute defined
0080   //! by the topological attributes G1, G2 and G3, and
0081   //! by the constraint type type.
0082   Standard_EXPORT void Set (const TDataXtd_ConstraintEnum type, const Handle(TNaming_NamedShape)& G1, const Handle(TNaming_NamedShape)& G2, const Handle(TNaming_NamedShape)& G3);
0083   
0084 
0085   //! Finds or creates the constraint attribute defined
0086   //! by the topological attributes G1, G2, G3 and G4,
0087   //! and by the constraint type type.
0088   //! methods to read constraint fields
0089   //! =================================
0090   Standard_EXPORT void Set (const TDataXtd_ConstraintEnum type, const Handle(TNaming_NamedShape)& G1, const Handle(TNaming_NamedShape)& G2, const Handle(TNaming_NamedShape)& G3, const Handle(TNaming_NamedShape)& G4);
0091   
0092 
0093   //! Returns true if this constraint attribute is valid.
0094   //! By default, true is returned.
0095   //! When the value of a dimension is changed or
0096   //! when a geometry is moved, false is returned
0097   //! until the solver sets it back to true.
0098   Standard_EXPORT Standard_Boolean Verified() const;
0099   
0100 
0101   //! Returns the type of constraint.
0102   //! This will be an element of the
0103   //! TDataXtd_ConstraintEnum enumeration.
0104   Standard_EXPORT TDataXtd_ConstraintEnum GetType() const;
0105   
0106   //! Returns true if this constraint attribute is
0107   //! two-dimensional.
0108   Standard_EXPORT Standard_Boolean IsPlanar() const;
0109   
0110   //! Returns the topological attribute of the plane
0111   //! used for planar - i.e., 2D - constraints.
0112   //! This plane is attached to another label.
0113   //! If the constraint is not planar, in other words, 3D,
0114   //! this function will return a null handle.
0115   Standard_EXPORT const Handle(TNaming_NamedShape)& GetPlane() const;
0116   
0117   //! Returns true if this constraint attribute is a
0118   //! dimension, and therefore has a value.
0119   Standard_EXPORT Standard_Boolean IsDimension() const;
0120   
0121   //! Returns the value of a dimension.
0122   //! This value is a reference to a TDataStd_Real attribute.
0123   //! If the attribute is not a dimension, this value will
0124   //! be 0. Use IsDimension to test this condition.
0125   Standard_EXPORT const Handle(TDataStd_Real)& GetValue() const;
0126   
0127 
0128   //! Returns the number of geometry attributes in this constraint attribute.
0129   //! This number will be between 1 and 4.
0130   Standard_EXPORT Standard_Integer NbGeometries() const;
0131   
0132   //! Returns the integer index Index used to access
0133   //! the array of the constraint or stored geometries of a dimension
0134   //! Index has a value between 1 and 4.
0135   //! methods to write constraint fields (use builder)
0136   //! ==================================
0137   Standard_EXPORT Handle(TNaming_NamedShape) GetGeometry (const Standard_Integer Index) const;
0138   
0139   //! Removes the geometries involved in the
0140   //! constraint or dimension from the array of
0141   //! topological attributes where they are stored.
0142   Standard_EXPORT void ClearGeometries();
0143   
0144   //! Finds or creates the type of constraint CTR.
0145   Standard_EXPORT void SetType (const TDataXtd_ConstraintEnum CTR);
0146   
0147   //! Finds or creates the plane of the 2D constraint
0148   //! attribute, defined by the planar topological attribute plane.
0149   Standard_EXPORT void SetPlane (const Handle(TNaming_NamedShape)& plane);
0150   
0151 
0152   //! Finds or creates the real number value V of the dimension constraint attribute.
0153   Standard_EXPORT void SetValue (const Handle(TDataStd_Real)& V);
0154   
0155 
0156   //! Finds or creates the underlying geometry of the
0157   //! constraint defined by the topological attribute G
0158   //! and the integer index Index.
0159   Standard_EXPORT void SetGeometry (const Standard_Integer Index, const Handle(TNaming_NamedShape)& G);
0160   
0161 
0162   //! Returns true if this constraint attribute defined by status is valid.
0163   //! By default, true is returned.
0164   //! When the value of a dimension is changed or
0165   //! when a geometry is moved, false is returned until
0166   //! the solver sets it back to true.
0167   //! If status is false, Verified is set to false.
0168   Standard_EXPORT void Verified (const Standard_Boolean status);
0169   
0170   Standard_EXPORT void Inverted (const Standard_Boolean status);
0171   
0172   Standard_EXPORT Standard_Boolean Inverted() const;
0173   
0174   Standard_EXPORT void Reversed (const Standard_Boolean status);
0175   
0176   Standard_EXPORT Standard_Boolean Reversed() const;
0177   
0178   //! collects constraints on Childs for label <aLabel>
0179   Standard_EXPORT static void CollectChildConstraints (const TDF_Label& aLabel, TDF_LabelList& TheList);
0180   
0181   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0182   
0183   Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
0184   
0185   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0186   
0187   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
0188   
0189   Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
0190   
0191   Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& DS) const Standard_OVERRIDE;
0192 
0193 
0194 
0195 
0196   DEFINE_STANDARD_RTTIEXT(TDataXtd_Constraint,TDF_Attribute)
0197 
0198 protected:
0199 
0200 
0201 
0202 
0203 private:
0204 
0205 
0206   TDataXtd_ConstraintEnum myType;
0207   Handle(TDataStd_Real) myValue;
0208   Handle(TDF_Attribute) myGeometries[4];
0209   Handle(TNaming_NamedShape) myPlane;
0210   Standard_Boolean myIsReversed;
0211   Standard_Boolean myIsInverted;
0212   Standard_Boolean myIsVerified;
0213 };
0214 
0215 #endif // _TDataXtd_Constraint_HeaderFile