Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1990-12-19
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1990-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 _TopLoc_Location_HeaderFile
0018 #define _TopLoc_Location_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopLoc_SListOfItemLocation.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_OStream.hxx>
0027 
0028 class gp_Trsf;
0029 class TopLoc_Datum3D;
0030 
0031 //! A Location is a composite transition. It comprises a
0032 //! series of elementary reference coordinates, i.e.
0033 //! objects of type TopLoc_Datum3D, and the powers to
0034 //! which these objects are raised.
0035 class TopLoc_Location 
0036 {
0037 public:
0038 
0039   DEFINE_STANDARD_ALLOC
0040 
0041   
0042   //! Constructs an empty local coordinate system object.
0043   //! Note: A Location constructed from a default datum is said to be "empty".
0044   Standard_EXPORT TopLoc_Location();
0045   
0046   //! Constructs the local coordinate system object defined
0047   //! by the transformation T. T invokes in turn, a TopLoc_Datum3D object.
0048   Standard_EXPORT TopLoc_Location(const gp_Trsf& T);
0049   
0050   //! Constructs the local coordinate system object defined by the 3D datum D.
0051   //! Exceptions
0052   //! Standard_ConstructionError if the transformation
0053   //! T does not represent a 3D coordinate system.
0054   Standard_EXPORT TopLoc_Location(const Handle(TopLoc_Datum3D)& D);
0055   
0056   //! Returns true if this location is equal to the Identity transformation.
0057     Standard_Boolean IsIdentity() const;
0058   
0059   //! Resets this location to the Identity transformation.
0060     void Identity();
0061   
0062   //! Returns    the  first   elementary  datum  of  the
0063   //! Location.  Use the NextLocation function recursively to access
0064   //! the other data comprising this location.
0065   //! Exceptions
0066   //! Standard_NoSuchObject if this location is empty.
0067     const Handle(TopLoc_Datum3D)& FirstDatum() const;
0068   
0069   //! Returns   the  power  elevation  of    the   first
0070   //! elementary datum.
0071   //! Exceptions
0072   //! Standard_NoSuchObject if this location is empty.
0073     Standard_Integer FirstPower() const;
0074   
0075   //! Returns  a Location representing  <me> without the
0076   //! first datum. We have the relation :
0077   //!
0078   //! <me> = NextLocation() * FirstDatum() ^ FirstPower()
0079   //! Exceptions
0080   //! Standard_NoSuchObject if this location is empty.
0081     const TopLoc_Location& NextLocation() const;
0082   
0083   //! Returns  the transformation    associated  to  the
0084   //! coordinate system.
0085   Standard_EXPORT const gp_Trsf& Transformation() const;
0086 Standard_EXPORT operator gp_Trsf() const;
0087   
0088   //! Returns the inverse of <me>.
0089   //!
0090   //! <me> * Inverted() is an Identity.
0091   Standard_NODISCARD Standard_EXPORT TopLoc_Location Inverted() const;
0092   
0093   //! Returns <me> * <Other>, the  elementary datums are
0094   //! concatenated.
0095   Standard_NODISCARD Standard_EXPORT TopLoc_Location Multiplied (const TopLoc_Location& Other) const;
0096 Standard_NODISCARD TopLoc_Location operator* (const TopLoc_Location& Other) const
0097 {
0098   return Multiplied(Other);
0099 }
0100   
0101   //! Returns  <me> / <Other>.
0102   Standard_NODISCARD Standard_EXPORT TopLoc_Location Divided (const TopLoc_Location& Other) const;
0103 Standard_NODISCARD TopLoc_Location operator/ (const TopLoc_Location& Other) const
0104 {
0105   return Divided(Other);
0106 }
0107   
0108   //! Returns <Other>.Inverted() * <me>.
0109   Standard_NODISCARD Standard_EXPORT TopLoc_Location Predivided (const TopLoc_Location& Other) const;
0110   
0111   //! Returns me at the power <pwr>.   If <pwr>  is zero
0112   //! returns  Identity.  <pwr> can  be lower  than zero
0113   //! (usual meaning for powers).
0114   Standard_NODISCARD Standard_EXPORT TopLoc_Location Powered (const Standard_Integer pwr) const;
0115 
0116   //! Returns a hashed value for this local coordinate system. This value is used, with map tables, to store and
0117   //! retrieve the object easily
0118   //! @return a computed hash code
0119   size_t HashCode () const;
0120   
0121   //! Returns true if this location and the location Other
0122   //! have the same elementary data, i.e. contain the same
0123   //! series of TopLoc_Datum3D and respective powers.
0124   //! This method is an alias for operator ==.
0125   Standard_EXPORT Standard_Boolean IsEqual (const TopLoc_Location& Other) const;
0126 Standard_Boolean operator == (const TopLoc_Location& Other) const
0127 {
0128   return IsEqual(Other);
0129 }
0130   
0131   //! Returns true if this location and the location Other do
0132   //! not have the same elementary data, i.e. do not
0133   //! contain the same series of TopLoc_Datum3D and respective powers.
0134   //! This method is an alias for operator !=.
0135   Standard_EXPORT Standard_Boolean IsDifferent (const TopLoc_Location& Other) const;
0136 Standard_Boolean operator != (const TopLoc_Location& Other) const
0137 {
0138   return IsDifferent(Other);
0139 }
0140   
0141   //! Dumps the content of me into the stream
0142   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0143 
0144   //! Prints the contents of <me> on the stream <s>.
0145   Standard_EXPORT void ShallowDump (Standard_OStream& S) const;
0146 
0147   //! Clear myItems
0148   void Clear()
0149   {
0150     myItems.Clear();
0151   }
0152 
0153 
0154   static Standard_Real ScalePrec()
0155   {
0156     return  1.e-14;
0157   }
0158 
0159 protected:
0160 
0161 
0162 
0163 
0164 
0165 private:
0166 
0167 
0168 
0169   TopLoc_SListOfItemLocation myItems;
0170 
0171 
0172 };
0173 
0174 #include <TopLoc_Location.lxx>
0175 
0176 #endif // _TopLoc_Location_HeaderFile