Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-13 08:43:54

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 //! This class provides some useful basic tools to build IGESGeom
0036 //! curves, especially :
0037 //! define a curve in a plane in 3D space (ex. Circular or Conic
0038 //! arc, or Copious Data defined in 2D)
0039 //! make a CopiousData from a list of points/vectors
0040 class IGESConvGeom_GeomBuilder
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Creates a GeomBuilder at initial state.
0046   Standard_EXPORT IGESConvGeom_GeomBuilder();
0047 
0048   //! Clears list of Points/Vectors and data about Transformation
0049   Standard_EXPORT void Clear();
0050 
0051   //! Adds a XY (Z=0) to the list of points
0052   Standard_EXPORT void AddXY(const gp_XY& val);
0053 
0054   //! Adds a XYZ to the list of points
0055   Standard_EXPORT void AddXYZ(const gp_XYZ& val);
0056 
0057   //! Adds a Vector part to the list of points. It will be used
0058   //! for CopiousData, datatype=3, only.
0059   //! AddXY and AddXYZ consider a null vector part (0,0,0)
0060   //! AddVec adds to the last added XY or XYZ
0061   Standard_EXPORT void AddVec(const gp_XYZ& val);
0062 
0063   //! Returns the count of already recorded points
0064   Standard_EXPORT Standard_Integer NbPoints() const;
0065 
0066   //! Returns a point given its rank (if added as XY, Z will be 0)
0067   Standard_EXPORT gp_XYZ Point(const Standard_Integer num) const;
0068 
0069   //! Makes a CopiousData with the list of recorded Points/Vectors
0070   //! according to <datatype>, which must be 1,2 or 3
0071   //! If <polyline> is given True, the CopiousData is coded as a
0072   //! Polyline, but <datatype> must not be 3
0073   //! <datatype> = 1 : Common Z is computed as average of all Z
0074   //! <datatype> = 1 or 2 : Vectors are ignored
0075   Standard_EXPORT Handle(IGESGeom_CopiousData) MakeCopiousData(
0076     const Standard_Integer datatype,
0077     const Standard_Boolean polyline = Standard_False) const;
0078 
0079   //! Returns the Position in which the method EvalXYZ will
0080   //! evaluate a XYZ. It can be regarded as defining a local system.
0081   //! It is initially set to Identity
0082   Standard_EXPORT gp_Trsf Position() const;
0083 
0084   //! Sets final position from an already defined Trsf
0085   Standard_EXPORT void SetPosition(const gp_Trsf& pos);
0086 
0087   //! Sets final position from an Ax3
0088   Standard_EXPORT void SetPosition(const gp_Ax3& pos);
0089 
0090   //! Sets final position from an Ax2
0091   Standard_EXPORT void SetPosition(const gp_Ax2& pos);
0092 
0093   //! Sets final position from an Ax1
0094   //! (this means that origin point and Z-axis are defined, the
0095   //! other axes are defined arbitrarily)
0096   Standard_EXPORT void SetPosition(const gp_Ax1& pos);
0097 
0098   //! Returns True if the Position is Identity
0099   Standard_EXPORT Standard_Boolean IsIdentity() const;
0100 
0101   //! Returns True if the Position is a Translation only
0102   //! Remark : Identity and ZOnly will answer True
0103   Standard_EXPORT Standard_Boolean IsTranslation() const;
0104 
0105   //! Returns True if the Position corresponds to a Z-Displacement,
0106   //! i.e. is a Translation only, and only on Z
0107   //! Remark : Identity will answer True
0108   Standard_EXPORT Standard_Boolean IsZOnly() const;
0109 
0110   //! Evaluates a XYZ value in the Position already defined.
0111   //! Returns the transformed coordinates.
0112   //! For a 2D definition, X,Y will then be used to define a XY and
0113   //! Z will be regarded as a Z Displacement (can be ignored)
0114   Standard_EXPORT void EvalXYZ(const gp_XYZ&  val,
0115                                Standard_Real& X,
0116                                Standard_Real& Y,
0117                                Standard_Real& Z) const;
0118 
0119   //! Returns the IGES Transformation which corresponds to the
0120   //! Position. Even if it is an Identity : IsIdentity should be
0121   //! tested first.
0122   //! <unit> is the unit value in which the model is created :
0123   //! it is used to convert translation part
0124   Standard_EXPORT Handle(IGESGeom_TransformationMatrix) MakeTransformation(
0125     const Standard_Real unit = 1) const;
0126 
0127 protected:
0128 private:
0129   Handle(TColgp_HSequenceOfXYZ) theXYZ;
0130   Handle(TColgp_HSequenceOfXYZ) theVec;
0131   gp_Trsf                       thepos;
0132 };
0133 
0134 #endif // _IGESConvGeom_GeomBuilder_HeaderFile