Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:55

0001 // Created on: 1998-06-03
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeAnalysis_WireVertex_HeaderFile
0018 #define _ShapeAnalysis_WireVertex_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TColStd_HArray1OfInteger.hxx>
0025 #include <TColgp_HArray1OfXYZ.hxx>
0026 #include <TColStd_HArray1OfReal.hxx>
0027 #include <Standard_Integer.hxx>
0028 class ShapeExtend_WireData;
0029 class TopoDS_Wire;
0030 class gp_XYZ;
0031 
0032 // resolve name collisions with X11 headers
0033 #ifdef Status
0034   #undef Status
0035 #endif
0036 
0037 //! Analyzes and records status of vertices in a Wire
0038 //!
0039 //! The Wire has formerly been loaded in a ShapeExtend_WireData
0040 //! For each Vertex, a status and some data can be attached
0041 //! (case found, position and parameters)
0042 //! Then, these information can be used to fix problems
0043 class ShapeAnalysis_WireVertex 
0044 {
0045 public:
0046 
0047   DEFINE_STANDARD_ALLOC
0048 
0049   
0050   //! Empty constructor
0051   Standard_EXPORT ShapeAnalysis_WireVertex();
0052   
0053   Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
0054   
0055   Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
0056   
0057   Standard_EXPORT void Load (const TopoDS_Wire& wire);
0058   
0059   Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
0060   
0061   //! Sets the precision for work
0062   //! Analysing: for each Vertex, comparison between the end of the
0063   //! preceding edge and the start of the following edge
0064   //! Each Vertex rank corresponds to the End Vertex of the Edge of
0065   //! same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
0066   //! Edge <num> is the preceding one, <num+1> is the following one
0067   Standard_EXPORT void SetPrecision (const Standard_Real preci);
0068   
0069   Standard_EXPORT void Analyze();
0070   
0071   //! Records status "Same Vertex" (logically) on Vertex <num>
0072   Standard_EXPORT void SetSameVertex (const Standard_Integer num);
0073   
0074   //! Records status "Same Coords" (at the Vertices Tolerances)
0075   Standard_EXPORT void SetSameCoords (const Standard_Integer num);
0076   
0077   //! Records status "Close Coords" (at the Precision of <me>)
0078   Standard_EXPORT void SetClose (const Standard_Integer num);
0079   
0080   //! <num> is the End of preceding Edge, and its projection on the
0081   //! following one lies on it at the Precision of <me>
0082   //! <ufol> gives the parameter on the following edge
0083   Standard_EXPORT void SetEnd (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real ufol);
0084   
0085   //! <num> is the Start of following Edge, its projection on the
0086   //! preceding one lies on it at the Precision of <me>
0087   //! <upre> gives the parameter on the preceding edge
0088   Standard_EXPORT void SetStart (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre);
0089   
0090   //! <num> is the Intersection of both Edges
0091   //! <upre> is the parameter on preceding edge, <ufol> on
0092   //! following edge
0093   Standard_EXPORT void SetInters (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre, const Standard_Real ufol);
0094   
0095   //! <num> cannot be said as same vertex
0096   Standard_EXPORT void SetDisjoined (const Standard_Integer num);
0097   
0098   //! Returns True if analysis was performed, else returns False
0099   Standard_EXPORT Standard_Boolean IsDone() const;
0100   
0101   //! Returns precision value used in analysis
0102   Standard_EXPORT Standard_Real Precision() const;
0103   
0104   //! Returns the number of edges in analyzed wire (i.e. the
0105   //! length of all arrays)
0106   Standard_EXPORT Standard_Integer NbEdges() const;
0107   
0108   //! Returns analyzed wire
0109   Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
0110   
0111   //! Returns the recorded status for a vertex
0112   //! More detail by method Data
0113   Standard_EXPORT Standard_Integer Status (const Standard_Integer num) const;
0114   
0115   Standard_EXPORT gp_XYZ Position (const Standard_Integer num) const;
0116   
0117   Standard_EXPORT Standard_Real UPrevious (const Standard_Integer num) const;
0118   
0119   Standard_EXPORT Standard_Real UFollowing (const Standard_Integer num) const;
0120   
0121   //! Returns the recorded status for a vertex
0122   //! With its recorded position and parameters on both edges
0123   //! These values are relevant regarding the status:
0124   //! Status  Meaning    Position  Preceding   Following
0125   //! 0       Same       no        no          no
0126   //! 1       SameCoord  no        no          no
0127   //! 2       Close      no        no          no
0128   //! 3       End        yes       no          yes
0129   //! 4       Start      yes       yes         no
0130   //! 5       Inters     yes       yes         yes
0131   //! -1      Disjoined  no        no          no
0132   Standard_EXPORT Standard_Integer Data (const Standard_Integer num, gp_XYZ& pos, Standard_Real& upre, Standard_Real& ufol) const;
0133   
0134   //! For a given status, returns the rank of the vertex which
0135   //! follows <num> and has the same status. 0 if no more
0136   //! Acts as an iterator, starts on the first one
0137   Standard_EXPORT Standard_Integer NextStatus (const Standard_Integer stat, const Standard_Integer num = 0) const;
0138   
0139   //! For a given criter, returns the rank of the vertex which
0140   //! follows <num> and has the same status. 0 if no more
0141   //! Acts as an iterator, starts on the first one
0142   //! Criters are:
0143   //! 0: same vertex (status 0)
0144   //! 1: a solution exists (status >= 0)
0145   //! 2: same coords (i.e. same params) (status 0 1 2)
0146   //! 3: same coods but not same vertex (status 1 2)
0147   //! 4: redefined coords (status 3 4 5)
0148   //! -1: no solution (status -1)
0149   Standard_EXPORT Standard_Integer NextCriter (const Standard_Integer crit, const Standard_Integer num = 0) const;
0150 
0151 
0152 
0153 
0154 protected:
0155 
0156 
0157 
0158 
0159 
0160 private:
0161 
0162 
0163 
0164   Handle(ShapeExtend_WireData) myWire;
0165   Handle(TColStd_HArray1OfInteger) myStat;
0166   Handle(TColgp_HArray1OfXYZ) myPos;
0167   Handle(TColStd_HArray1OfReal) myUPre;
0168   Handle(TColStd_HArray1OfReal) myUFol;
0169   Standard_Real myPreci;
0170   Standard_Boolean myDone;
0171 
0172 
0173 };
0174 
0175 
0176 
0177 
0178 
0179 
0180 
0181 #endif // _ShapeAnalysis_WireVertex_HeaderFile