Version: 9.16.0
GEOMImpl_IProximity.hxx
Go to the documentation of this file.
1// Copyright (C) 2022-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include <GEOM_Function.hxx>
21
22#define PROXIMITY_ARG_SHAPE1 1
23#define PROXIMITY_ARG_SHAPE2 2
24#define PROXIMITY_ARG_SAMPLES1 3
25#define PROXIMITY_ARG_SAMPLES2 4
26#define PROXIMITY_ARG_POINT1 5
27#define PROXIMITY_ARG_POINT2 6
28#define PROXIMITY_ARG_VALUE 7
29#define PROXIMITY_ARG_STATUS1 8
30#define PROXIMITY_ARG_STATUS2 9
31
33{
34public:
35
36 GEOMImpl_IProximity(Handle(GEOM_Function) theFunction) : _func(theFunction) {}
37
38 void SetShapes(Handle(GEOM_Function) theShape1, Handle(GEOM_Function) theShape2)
39 {
40 _func->SetReference(PROXIMITY_ARG_SHAPE1, theShape1);
41 _func->SetReference(PROXIMITY_ARG_SHAPE2, theShape2);
42 }
43
44 void GetShapes(Handle(GEOM_Function)& theShape1, Handle(GEOM_Function)& theShape2) const
45 {
46 theShape1 = _func->GetReference(PROXIMITY_ARG_SHAPE1);
47 theShape2 = _func->GetReference(PROXIMITY_ARG_SHAPE2);
48 }
49
50 void SetNbSamples(const Standard_Integer thePosition, const Standard_Integer theNbSamples) const
51 {
52 _func->SetInteger(thePosition, theNbSamples);
53 }
54
55 Standard_Integer GetNbSamples(const Standard_Integer thePosition) const
56 {
57 return _func->GetInteger(thePosition);
58 }
59
60 void SetProximityPoints(const gp_Pnt& thePoint1, const gp_Pnt& thePoint2)
61 {
64 }
65
66 void SetStatusOfPoints(const Standard_Integer theStatus1, const Standard_Integer theStatus2)
67 {
70 }
71
72 void GetProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2)
73 {
74 thePoint1 = getPoint(PROXIMITY_ARG_POINT1);
75 thePoint2 = getPoint(PROXIMITY_ARG_POINT2);
76 }
77
78 void GetStatusOfPoints(Standard_Integer& theStatus1, Standard_Integer& theStatus2)
79 {
80 theStatus1 = getStatus(PROXIMITY_ARG_STATUS1);
81 theStatus2 = getStatus(PROXIMITY_ARG_STATUS2);
82 }
83
84 void SetValue(const Standard_Real theValue)
85 {
86 _func->SetReal(PROXIMITY_ARG_VALUE, theValue);
87 }
88
89 Standard_Real GetValue() const
90 {
91 return _func->GetReal(PROXIMITY_ARG_VALUE);
92 }
93
94private:
95 void setPoint(const Standard_Integer thePosition, const gp_Pnt& thePoint)
96 {
97 Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
98 aCoords->SetValue(1, thePoint.X());
99 aCoords->SetValue(2, thePoint.Y());
100 aCoords->SetValue(3, thePoint.Z());
101 _func->SetRealArray(thePosition, aCoords);
102 }
103
104 void setStatus(const Standard_Integer thePosition, const Standard_Integer theStatus)
105 {
106 _func->SetInteger(thePosition, theStatus);
107 }
108
109 gp_Pnt getPoint(const Standard_Integer thePosition)
110 {
111 Handle(TColStd_HArray1OfReal) aCoords = _func->GetRealArray(thePosition);
112 return gp_Pnt(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
113 }
114
115 Standard_Integer getStatus(const Standard_Integer thePosition)
116 {
117 return _func->GetInteger(thePosition);
118 }
119
120private:
121 Handle(GEOM_Function) _func;
122};
#define PROXIMITY_ARG_POINT1
Definition: GEOMImpl_IProximity.hxx:26
#define PROXIMITY_ARG_VALUE
Definition: GEOMImpl_IProximity.hxx:28
#define PROXIMITY_ARG_STATUS2
Definition: GEOMImpl_IProximity.hxx:30
#define PROXIMITY_ARG_SHAPE1
Definition: GEOMImpl_IProximity.hxx:22
#define PROXIMITY_ARG_POINT2
Definition: GEOMImpl_IProximity.hxx:27
#define PROXIMITY_ARG_STATUS1
Definition: GEOMImpl_IProximity.hxx:29
#define PROXIMITY_ARG_SHAPE2
Definition: GEOMImpl_IProximity.hxx:23
Definition: GEOMImpl_IProximity.hxx:33
void SetProximityPoints(const gp_Pnt &thePoint1, const gp_Pnt &thePoint2)
Definition: GEOMImpl_IProximity.hxx:60
Standard_Integer getStatus(const Standard_Integer thePosition)
Definition: GEOMImpl_IProximity.hxx:115
void setStatus(const Standard_Integer thePosition, const Standard_Integer theStatus)
Definition: GEOMImpl_IProximity.hxx:104
void GetShapes(Handle(GEOM_Function)&theShape1, Handle(GEOM_Function)&theShape2) const
Definition: GEOMImpl_IProximity.hxx:44
void SetStatusOfPoints(const Standard_Integer theStatus1, const Standard_Integer theStatus2)
Definition: GEOMImpl_IProximity.hxx:66
void SetShapes(Handle(GEOM_Function) theShape1, Handle(GEOM_Function) theShape2)
Definition: GEOMImpl_IProximity.hxx:38
void GetProximityPoints(gp_Pnt &thePoint1, gp_Pnt &thePoint2)
Definition: GEOMImpl_IProximity.hxx:72
void SetNbSamples(const Standard_Integer thePosition, const Standard_Integer theNbSamples) const
Definition: GEOMImpl_IProximity.hxx:50
void SetValue(const Standard_Real theValue)
Definition: GEOMImpl_IProximity.hxx:84
Handle(GEOM_Function) _func
void GetStatusOfPoints(Standard_Integer &theStatus1, Standard_Integer &theStatus2)
Definition: GEOMImpl_IProximity.hxx:78
GEOMImpl_IProximity(Handle(GEOM_Function) theFunction)
Definition: GEOMImpl_IProximity.hxx:36
void setPoint(const Standard_Integer thePosition, const gp_Pnt &thePoint)
Definition: GEOMImpl_IProximity.hxx:95
Standard_Real GetValue() const
Definition: GEOMImpl_IProximity.hxx:89
Standard_Integer GetNbSamples(const Standard_Integer thePosition) const
Definition: GEOMImpl_IProximity.hxx:55
gp_Pnt getPoint(const Standard_Integer thePosition)
Definition: GEOMImpl_IProximity.hxx:109