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