Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-09-21
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1993-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 _IGESData_ToolLocation_HeaderFile
0018 #define _IGESData_ToolLocation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Interface_GeneralLib.hxx>
0024 #include <TColStd_Array1OfInteger.hxx>
0025 #include <Standard_Transient.hxx>
0026 class IGESData_IGESModel;
0027 class IGESData_Protocol;
0028 class IGESData_IGESEntity;
0029 class gp_GTrsf;
0030 class gp_Trsf;
0031 
0032 
0033 class IGESData_ToolLocation;
0034 DEFINE_STANDARD_HANDLE(IGESData_ToolLocation, Standard_Transient)
0035 
0036 //! This Tool determines and gives access to effective Locations
0037 //! of IGES Entities as defined by the IGES Norm. These Locations
0038 //! can be for each Entity :
0039 //! - on one part, explicitly defined by a Transf in Directory
0040 //! Part (this Transf can be itself compound); if not defined,
0041 //! no proper Transformation is defined
0042 //! - on the other part, implicitly defined by a reference from
0043 //! another Entity : its Parent
0044 //! Both implicit and explicit locations are combinable.
0045 //!
0046 //! Implicit definition can be itself defined, either through the
0047 //! definition of an Entity (i.e. a Composite Curve references
0048 //! a list of Curves), or by a specific Associativity, of type
0049 //! SingleParentEntity, by which the Location of the Parent is
0050 //! applied to the Childs defined by this Associativity.
0051 //! Remark that a Transf itself has no Location, but it can be
0052 //! compound
0053 //!
0054 //! This is a TShared object, then it is easier to use in an
0055 //! interactive session
0056 class IGESData_ToolLocation : public Standard_Transient
0057 {
0058 
0059 public:
0060 
0061   
0062   //! Creates a ToolLocation on a given Model, filled with the help
0063   //! of a Protocol (which allows to known Entities referenced by
0064   //! other ones)
0065   Standard_EXPORT IGESData_ToolLocation(const Handle(IGESData_IGESModel)& amodel, const Handle(IGESData_Protocol)& protocol);
0066   
0067   //! Does the effective work of determining Locations of Entities
0068   Standard_EXPORT void Load();
0069   
0070   //! Sets a precision for the Analysis of Locations
0071   //! (default by constructor is 1.E-05)
0072   Standard_EXPORT void SetPrecision (const Standard_Real prec);
0073   
0074   //! Sets the "Reference" information for <child> as being <parent>
0075   //! Sets an Error Status if already set (see method IsAmbiguous)
0076   Standard_EXPORT void SetReference (const Handle(IGESData_IGESEntity)& parent, const Handle(IGESData_IGESEntity)& child);
0077   
0078   //! Sets the "Associativity" information for <child> as being
0079   //! <parent> (it must be the Parent itself, not the Associativity)
0080   Standard_EXPORT void SetParentAssoc (const Handle(IGESData_IGESEntity)& parent, const Handle(IGESData_IGESEntity)& child);
0081   
0082   //! Resets all information about dependences for <child>
0083   Standard_EXPORT void ResetDependences (const Handle(IGESData_IGESEntity)& child);
0084   
0085   //! Unitary action which defines Entities referenced by <ent>
0086   //! (except those in Directory Part and Associativities List)
0087   //! as Dependent (their Locations are related to that of <ent>)
0088   Standard_EXPORT void SetOwnAsDependent (const Handle(IGESData_IGESEntity)& ent);
0089   
0090   //! Returns True if <ent> is kind of TransfEntity. Then, it has
0091   //! no location, while it can be used to define a Location)
0092   Standard_EXPORT Standard_Boolean IsTransf (const Handle(IGESData_IGESEntity)& ent) const;
0093   
0094   //! Returns True if <ent> is an Associativity (IGES Type 402).
0095   //! Then, Location does not apply.
0096   Standard_EXPORT Standard_Boolean IsAssociativity (const Handle(IGESData_IGESEntity)& ent) const;
0097   
0098   //! Returns True if <ent> has a Transformation Matrix in proper
0099   //! (referenced from its Directory Part)
0100   Standard_EXPORT Standard_Boolean HasTransf (const Handle(IGESData_IGESEntity)& ent) const;
0101   
0102   //! Returns the Explicit Location defined by the Transformation
0103   //! Matrix of <ent>. Identity if there is none
0104   Standard_EXPORT gp_GTrsf ExplicitLocation (const Handle(IGESData_IGESEntity)& ent) const;
0105   
0106   //! Returns True if more than one Parent has been determined for
0107   //! <ent>, by adding direct References and Associativities
0108   Standard_EXPORT Standard_Boolean IsAmbiguous (const Handle(IGESData_IGESEntity)& ent) const;
0109   
0110   //! Returns True if <ent> is dependent from one and only one other
0111   //! Entity, either by Reference or by Associativity
0112   Standard_EXPORT Standard_Boolean HasParent (const Handle(IGESData_IGESEntity)& ent) const;
0113   
0114   //! Returns the unique Parent recorded for <ent>.
0115   //! Returns a Null Handle if there is none
0116   Standard_EXPORT Handle(IGESData_IGESEntity) Parent (const Handle(IGESData_IGESEntity)& ent) const;
0117   
0118   //! Returns True if the Parent, if there is one, is defined by
0119   //! a SingleParentEntity Associativity
0120   //! Else, if HasParent is True, it is by Reference
0121   Standard_EXPORT Standard_Boolean HasParentByAssociativity (const Handle(IGESData_IGESEntity)& ent) const;
0122   
0123   //! Returns the effective Location of the Parent of <ent>, if
0124   //! there is one : this Location is itself given as compound
0125   //! according dependences on the Parent, if there are some.
0126   //! Returns an Identity Transformation if no Parent is recorded.
0127   Standard_EXPORT gp_GTrsf ParentLocation (const Handle(IGESData_IGESEntity)& ent) const;
0128   
0129   //! Returns the effective Location of an Entity, i.e. the
0130   //! composition of its proper Transformation Matrix (returned by
0131   //! Transf) and its Parent's Location (returned by ParentLocation)
0132   Standard_EXPORT gp_GTrsf EffectiveLocation (const Handle(IGESData_IGESEntity)& ent) const;
0133   
0134   //! Analysis a Location given as a GTrsf, by trying to convert it
0135   //! to a Trsf (i.e. to a True Location of which effect is
0136   //! described by an Isometry or a Similarity)
0137   //! Works with the Precision given by default or by SetPrecision
0138   //! Calls ConvertLocation (see below)
0139   Standard_EXPORT Standard_Boolean AnalyseLocation (const gp_GTrsf& loc, gp_Trsf& result) const;
0140   
0141   //! Conversion of a Location, from GTrsf form to Trsf form
0142   //! Works with a precision given as argument.
0143   //! Returns True if the Conversion is possible, (hence, <result>
0144   //! contains the converted location), False else
0145   //! <unit>, if given, indicates the unit in which <loc> is defined
0146   //! in meters. It concerns the translation part (to be converted.
0147   //!
0148   //! As a class method, it can be called separately
0149   Standard_EXPORT static Standard_Boolean ConvertLocation (const Standard_Real prec, const gp_GTrsf& loc, gp_Trsf& result, const Standard_Real uni = 1);
0150 
0151 
0152 
0153 
0154   DEFINE_STANDARD_RTTIEXT(IGESData_ToolLocation,Standard_Transient)
0155 
0156 protected:
0157 
0158 
0159 
0160 
0161 private:
0162 
0163 
0164   Standard_Real theprec;
0165   Handle(IGESData_IGESModel) themodel;
0166   Interface_GeneralLib thelib;
0167   TColStd_Array1OfInteger therefs;
0168   TColStd_Array1OfInteger theassocs;
0169 
0170 
0171 };
0172 
0173 
0174 
0175 
0176 
0177 
0178 
0179 #endif // _IGESData_ToolLocation_HeaderFile