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