0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / ChFiDS / ChFiDS_CommonPoint.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-11-29
2// Created by: Isabelle GRIGNON
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _ChFiDS_CommonPoint_HeaderFile
18#define _ChFiDS_CommonPoint_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TopoDS_Edge.hxx>
25#include <TopoDS_Vertex.hxx>
26#include <gp_Pnt.hxx>
27#include <gp_Vec.hxx>
28#include <Standard_Real.hxx>
29#include <Standard_Boolean.hxx>
30#include <TopAbs_Orientation.hxx>
31class Standard_DomainError;
32class Standard_TypeMismatch;
33class TopoDS_Vertex;
34class TopoDS_Edge;
35class gp_Pnt;
36class gp_Vec;
37
38
39//! point start/end of fillet common to 2 adjacent filets
40//! and to an edge on one of 2 faces participating
41//! in the construction of the fillet
42class ChFiDS_CommonPoint
43{
44public:
45
46 DEFINE_STANDARD_ALLOC
47
48
49 //! Empty constructor.
50 Standard_EXPORT ChFiDS_CommonPoint();
51
52 //! default value for all fields
53 Standard_EXPORT void Reset();
54
55 //! Sets the values of a point which is a vertex on
56 //! the initial facet of restriction of one
57 //! of the surface.
ac8f1774 58 void SetVertex (const TopoDS_Vertex& theVertex)
59 {
60 isvtx = Standard_True;
61 vtx = theVertex;
62 }
63
42cf5bc1 64 //! Sets the values of a point which is on the arc
65 //! A, at parameter Param.
66 Standard_EXPORT void SetArc (const Standard_Real Tol, const TopoDS_Edge& A, const Standard_Real Param, const TopAbs_Orientation TArc);
67
68 //! Sets the value of the parameter on the spine
69 Standard_EXPORT void SetParameter (const Standard_Real Param);
70
71 //! Set the 3d point for a commonpoint that is not
72 //! a vertex or on an arc.
ac8f1774 73 void SetPoint (const gp_Pnt& thePoint) { point = thePoint; }
42cf5bc1 74
75 //! Set the output 3d vector
ac8f1774 76 void SetVector (const gp_Vec& theVector)
77 {
78 hasvector = Standard_True;
79 vector = theVector;
80 }
42cf5bc1 81
82 //! This method set the fuzziness on the point.
ac8f1774 83 void SetTolerance (const Standard_Real Tol)
84 {
85 if (Tol > tol)
86 {
87 tol = Tol;
88 }
89 }
42cf5bc1 90
91 //! This method returns the fuzziness on the point.
ac8f1774 92 Standard_Real Tolerance() const { return tol; }
42cf5bc1 93
94 //! Returns TRUE if the point is a vertex on the initial
95 //! restriction facet of the surface.
ac8f1774 96 Standard_Boolean IsVertex() const { return isvtx; }
42cf5bc1 97
98 //! Returns the information about the point when it is
99 //! on the domain of the first patch, i-e when the function
100 //! IsVertex returns True.
101 //! Otherwise, an exception is raised.
ac8f1774 102 const TopoDS_Vertex& Vertex() const
103 {
104 if (!isvtx) { throw Standard_DomainError(); }
105 return vtx;
106 }
107
42cf5bc1 108 //! Returns TRUE if the point is a on an edge of the initial
109 //! restriction facet of the surface.
ac8f1774 110 Standard_Boolean IsOnArc() const { return isonarc; }
42cf5bc1 111
112 //! Returns the arc of restriction containing the
113 //! vertex.
114 Standard_EXPORT const TopoDS_Edge& Arc() const;
115
116 //! Returns the transition of the point on the arc
117 //! returned by Arc().
118 Standard_EXPORT TopAbs_Orientation TransitionOnArc() const;
119
120 //! Returns the parameter of the point on the
121 //! arc returned by the method Arc().
122 Standard_EXPORT Standard_Real ParameterOnArc() const;
123
124 //! Returns the parameter the paramter on the spine
125 Standard_EXPORT Standard_Real Parameter() const;
126
127 //! Returns the 3d point
ac8f1774 128 const gp_Pnt& Point() const { return point; }
42cf5bc1 129
130 //! Returns TRUE if the output vector is stored.
ac8f1774 131 Standard_Boolean HasVector() const { return hasvector; }
42cf5bc1 132
133 //! Returns the output 3d vector
ac8f1774 134 const gp_Vec& Vector() const
135 {
136 if (!hasvector) { throw Standard_DomainError ("ChFiDS_CommonPoint::Vector"); }
137 return vector;
138 }
42cf5bc1 139
140private:
141
42cf5bc1 142 TopoDS_Edge arc;
143 TopoDS_Vertex vtx;
144 gp_Pnt point;
145 gp_Vec vector;
146 Standard_Real tol;
147 Standard_Real prmarc;
148 Standard_Real prmtg;
42cf5bc1 149 TopAbs_Orientation traarc;
ac8f1774 150 Standard_Boolean isonarc;
42cf5bc1 151 Standard_Boolean isvtx;
152 Standard_Boolean hasvector;
153
42cf5bc1 154};
155
42cf5bc1 156#endif // _ChFiDS_CommonPoint_HeaderFile