Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/ShapeAnalysis_WireVertex.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 <Standard_Integer.hxx>
0025 #include <NCollection_Array1.hxx>
0026 #include <NCollection_HArray1.hxx>
0027 #include <gp_XYZ.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   DEFINE_STANDARD_ALLOC
0047 
0048   //! Empty constructor
0049   Standard_EXPORT ShapeAnalysis_WireVertex();
0050 
0051   Standard_EXPORT void Init(const TopoDS_Wire& wire, const double preci);
0052 
0053   Standard_EXPORT void Init(const occ::handle<ShapeExtend_WireData>& swbd, const double preci);
0054 
0055   Standard_EXPORT void Load(const TopoDS_Wire& wire);
0056 
0057   Standard_EXPORT void Load(const occ::handle<ShapeExtend_WireData>& sbwd);
0058 
0059   //! Sets the precision for work
0060   //! Analysing: for each Vertex, comparison between the end of the
0061   //! preceding edge and the start of the following edge
0062   //! Each Vertex rank corresponds to the End Vertex of the Edge of
0063   //! same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
0064   //! Edge <num> is the preceding one, <num+1> is the following one
0065   Standard_EXPORT void SetPrecision(const double preci);
0066 
0067   Standard_EXPORT void Analyze();
0068 
0069   //! Records status "Same Vertex" (logically) on Vertex <num>
0070   Standard_EXPORT void SetSameVertex(const int num);
0071 
0072   //! Records status "Same Coords" (at the Vertices Tolerances)
0073   Standard_EXPORT void SetSameCoords(const int num);
0074 
0075   //! Records status "Close Coords" (at the Precision of <me>)
0076   Standard_EXPORT void SetClose(const int num);
0077 
0078   //! <num> is the End of preceding Edge, and its projection on the
0079   //! following one lies on it at the Precision of <me>
0080   //! <ufol> gives the parameter on the following edge
0081   Standard_EXPORT void SetEnd(const int num, const gp_XYZ& pos, const double ufol);
0082 
0083   //! <num> is the Start of following Edge, its projection on the
0084   //! preceding one lies on it at the Precision of <me>
0085   //! <upre> gives the parameter on the preceding edge
0086   Standard_EXPORT void SetStart(const int num, const gp_XYZ& pos, const double upre);
0087 
0088   //! <num> is the Intersection of both Edges
0089   //! <upre> is the parameter on preceding edge, <ufol> on
0090   //! following edge
0091   Standard_EXPORT void SetInters(const int     num,
0092                                  const gp_XYZ& pos,
0093                                  const double  upre,
0094                                  const double  ufol);
0095 
0096   //! <num> cannot be said as same vertex
0097   Standard_EXPORT void SetDisjoined(const int num);
0098 
0099   //! Returns True if analysis was performed, else returns False
0100   Standard_EXPORT bool IsDone() const;
0101 
0102   //! Returns precision value used in analysis
0103   Standard_EXPORT double Precision() const;
0104 
0105   //! Returns the number of edges in analyzed wire (i.e. the
0106   //! length of all arrays)
0107   Standard_EXPORT int NbEdges() const;
0108 
0109   //! Returns analyzed wire
0110   Standard_EXPORT const occ::handle<ShapeExtend_WireData>& WireData() const;
0111 
0112   //! Returns the recorded status for a vertex
0113   //! More detail by method Data
0114   Standard_EXPORT int Status(const int num) const;
0115 
0116   Standard_EXPORT gp_XYZ Position(const int num) const;
0117 
0118   Standard_EXPORT double UPrevious(const int num) const;
0119 
0120   Standard_EXPORT double UFollowing(const int num) const;
0121 
0122   //! Returns the recorded status for a vertex
0123   //! With its recorded position and parameters on both edges
0124   //! These values are relevant regarding the status:
0125   //! Status  Meaning    Position  Preceding   Following
0126   //! 0       Same       no        no          no
0127   //! 1       SameCoord  no        no          no
0128   //! 2       Close      no        no          no
0129   //! 3       End        yes       no          yes
0130   //! 4       Start      yes       yes         no
0131   //! 5       Inters     yes       yes         yes
0132   //! -1      Disjoined  no        no          no
0133   Standard_EXPORT int Data(const int num, gp_XYZ& pos, double& upre, double& ufol) const;
0134 
0135   //! For a given status, returns the rank of the vertex which
0136   //! follows <num> and has the same status. 0 if no more
0137   //! Acts as an iterator, starts on the first one
0138   Standard_EXPORT int NextStatus(const int stat, const int num = 0) const;
0139 
0140   //! For a given criter, returns the rank of the vertex which
0141   //! follows <num> and has the same status. 0 if no more
0142   //! Acts as an iterator, starts on the first one
0143   //! Criters are:
0144   //! 0: same vertex (status 0)
0145   //! 1: a solution exists (status >= 0)
0146   //! 2: same coords (i.e. same params) (status 0 1 2)
0147   //! 3: same coods but not same vertex (status 1 2)
0148   //! 4: redefined coords (status 3 4 5)
0149   //! -1: no solution (status -1)
0150   Standard_EXPORT int NextCriter(const int crit, const int num = 0) const;
0151 
0152 private:
0153   occ::handle<ShapeExtend_WireData>        myWire;
0154   occ::handle<NCollection_HArray1<int>>    myStat;
0155   occ::handle<NCollection_HArray1<gp_XYZ>> myPos;
0156   occ::handle<NCollection_HArray1<double>> myUPre;
0157   occ::handle<NCollection_HArray1<double>> myUFol;
0158   double                                   myPreci;
0159   bool                                     myDone;
0160 };
0161 
0162 #endif // _ShapeAnalysis_WireVertex_HeaderFile