Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:57

0001 // Created on: 1994-11-16
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IGESConvGeom_GeomBuilder_HeaderFile
0018 #define _IGESConvGeom_GeomBuilder_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TColgp_HSequenceOfXYZ.hxx>
0025 #include <gp_Trsf.hxx>
0026 #include <Standard_Integer.hxx>
0027 class gp_XY;
0028 class gp_XYZ;
0029 class IGESGeom_CopiousData;
0030 class gp_Ax3;
0031 class gp_Ax2;
0032 class gp_Ax1;
0033 class IGESGeom_TransformationMatrix;
0034 
0035 
0036 //! This class provides some useful basic tools to build IGESGeom
0037 //! curves, especially :
0038 //! define a curve in a plane in 3D space (ex. Circular or Conic
0039 //! arc, or Copious Data defined in 2D)
0040 //! make a CopiousData from a list of points/vectors
0041 class IGESConvGeom_GeomBuilder 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Creates a GeomBuilder at initial state.
0049   Standard_EXPORT IGESConvGeom_GeomBuilder();
0050   
0051   //! Clears list of Points/Vectors and data about Transformation
0052   Standard_EXPORT void Clear();
0053   
0054   //! Adds a XY (Z=0) to the list of points
0055   Standard_EXPORT void AddXY (const gp_XY& val);
0056   
0057   //! Adds a XYZ to the list of points
0058   Standard_EXPORT void AddXYZ (const gp_XYZ& val);
0059   
0060   //! Adds a Vector part to the list of points. It will be used
0061   //! for CopiousData, datatype=3, only.
0062   //! AddXY and AddXYZ consider a null vector part (0,0,0)
0063   //! AddVec adds to the last added XY or XYZ
0064   Standard_EXPORT void AddVec (const gp_XYZ& val);
0065   
0066   //! Returns the count of already recorded points
0067   Standard_EXPORT Standard_Integer NbPoints() const;
0068   
0069   //! Returns a point given its rank (if added as XY, Z will be 0)
0070   Standard_EXPORT gp_XYZ Point (const Standard_Integer num) const;
0071   
0072   //! Makes a CopiousData with the list of recorded Points/Vectors
0073   //! according to <datatype>, which must be 1,2 or 3
0074   //! If <polyline> is given True, the CopiousData is coded as a
0075   //! Polyline, but <datatype> must not be 3
0076   //! <datatype> = 1 : Common Z is computed as average of all Z
0077   //! <datatype> = 1 or 2 : Vectors are ignored
0078   Standard_EXPORT Handle(IGESGeom_CopiousData) MakeCopiousData (const Standard_Integer datatype, const Standard_Boolean polyline = Standard_False) const;
0079   
0080   //! Returns the Position in which the method EvalXYZ will
0081   //! evaluate a XYZ. It can be regarded as defining a local system.
0082   //! It is initially set to Identity
0083   Standard_EXPORT gp_Trsf Position() const;
0084   
0085   //! Sets final position from an already defined Trsf
0086   Standard_EXPORT void SetPosition (const gp_Trsf& pos);
0087   
0088   //! Sets final position from an Ax3
0089   Standard_EXPORT void SetPosition (const gp_Ax3& pos);
0090   
0091   //! Sets final position from an Ax2
0092   Standard_EXPORT void SetPosition (const gp_Ax2& pos);
0093   
0094   //! Sets final position from an Ax1
0095   //! (this means that origin point and Z-axis are defined, the
0096   //! other axes are defined arbitrarily)
0097   Standard_EXPORT void SetPosition (const gp_Ax1& pos);
0098   
0099   //! Returns True if the Position is Identity
0100   Standard_EXPORT Standard_Boolean IsIdentity() const;
0101   
0102   //! Returns True if the Position is a Translation only
0103   //! Remark : Identity and ZOnly will answer True
0104   Standard_EXPORT Standard_Boolean IsTranslation() const;
0105   
0106   //! Returns True if the Position corresponds to a Z-Displacement,
0107   //! i.e. is a Translation only, and only on Z
0108   //! Remark : Identity will answer True
0109   Standard_EXPORT Standard_Boolean IsZOnly() const;
0110   
0111   //! Evaluates a XYZ value in the Position already defined.
0112   //! Returns the transformed coordinates.
0113   //! For a 2D definition, X,Y will then be used to define a XY and
0114   //! Z will be regarded as a Z Displacement (can be ignored)
0115   Standard_EXPORT void EvalXYZ (const gp_XYZ& val, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
0116   
0117   //! Returns the IGES Transformation which corresponds to the
0118   //! Position. Even if it is an Identity : IsIdentity should be
0119   //! tested first.
0120   //! <unit> is the unit value in which the model is created :
0121   //! it is used to convert translation part
0122   Standard_EXPORT Handle(IGESGeom_TransformationMatrix) MakeTransformation (const Standard_Real unit = 1) const;
0123 
0124 
0125 
0126 
0127 protected:
0128 
0129 
0130 
0131 
0132 
0133 private:
0134 
0135 
0136 
0137   Handle(TColgp_HSequenceOfXYZ) theXYZ;
0138   Handle(TColgp_HSequenceOfXYZ) theVec;
0139   gp_Trsf thepos;
0140 
0141 
0142 };
0143 
0144 
0145 
0146 
0147 
0148 
0149 
0150 #endif // _IGESConvGeom_GeomBuilder_HeaderFile