1 // Copyright (C) 2022-2024 CEA, EDF, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <GEOM_Function.hxx>
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
32 class GEOMImpl_IProximity
36 GEOMImpl_IProximity(Handle(GEOM_Function) theFunction) : _func(theFunction) {}
38 void SetShapes(Handle(GEOM_Function) theShape1, Handle(GEOM_Function) theShape2)
40 _func->SetReference(PROXIMITY_ARG_SHAPE1, theShape1);
41 _func->SetReference(PROXIMITY_ARG_SHAPE2, theShape2);
44 void GetShapes(Handle(GEOM_Function)& theShape1, Handle(GEOM_Function)& theShape2) const
46 theShape1 = _func->GetReference(PROXIMITY_ARG_SHAPE1);
47 theShape2 = _func->GetReference(PROXIMITY_ARG_SHAPE2);
50 void SetNbSamples(const Standard_Integer thePosition, const Standard_Integer theNbSamples) const
52 _func->SetInteger(thePosition, theNbSamples);
55 Standard_Integer GetNbSamples(const Standard_Integer thePosition) const
57 return _func->GetInteger(thePosition);
60 void SetProximityPoints(const gp_Pnt& thePoint1, const gp_Pnt& thePoint2)
62 setPoint(PROXIMITY_ARG_POINT1, thePoint1);
63 setPoint(PROXIMITY_ARG_POINT2, thePoint2);
66 void SetStatusOfPoints(const Standard_Integer theStatus1, const Standard_Integer theStatus2)
68 setStatus(PROXIMITY_ARG_STATUS1, theStatus1);
69 setStatus(PROXIMITY_ARG_STATUS2, theStatus2);
72 void GetProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2)
74 thePoint1 = getPoint(PROXIMITY_ARG_POINT1);
75 thePoint2 = getPoint(PROXIMITY_ARG_POINT2);
78 void GetStatusOfPoints(Standard_Integer& theStatus1, Standard_Integer& theStatus2)
80 theStatus1 = getStatus(PROXIMITY_ARG_STATUS1);
81 theStatus2 = getStatus(PROXIMITY_ARG_STATUS2);
84 void SetValue(const Standard_Real theValue)
86 _func->SetReal(PROXIMITY_ARG_VALUE, theValue);
89 Standard_Real GetValue() const
91 return _func->GetReal(PROXIMITY_ARG_VALUE);
95 void setPoint(const Standard_Integer thePosition, const gp_Pnt& thePoint)
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);
104 void setStatus(const Standard_Integer thePosition, const Standard_Integer theStatus)
106 _func->SetInteger(thePosition, theStatus);
109 gp_Pnt getPoint(const Standard_Integer thePosition)
111 Handle(TColStd_HArray1OfReal) aCoords = _func->GetRealArray(thePosition);
112 return gp_Pnt(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
115 Standard_Integer getStatus(const Standard_Integer thePosition)
117 return _func->GetInteger(thePosition);
121 Handle(GEOM_Function) _func;