-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOMImpl_IPoint.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
#include <ShapeAnalysis.hxx>
aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
}
else if (aType == POINT_XYZ_REF) {
- Handle(GEOM_Function) aRefPoint = aPI.GetRef();
- TopoDS_Shape aRefShape = aRefPoint->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetRef();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_VERTEX) {
Standard_TypeMismatch::Raise
("Point creation aborted : referenced shape is not a vertex");
aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ());
}
else if (aType == POINT_CURVE_PAR) {
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
aPnt = aCurve->Value(aP);
}
else if (aType == POINT_CURVE_COORD) {
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
}
else if (aType == POINT_CURVE_LENGTH) {
// RefCurve
- Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- if (aRefCurve.IsNull()) {
+ Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+ if (aRefFunc.IsNull()) {
Standard_NullObject::Raise
("Point On Curve creation aborted : curve object is null");
}
- TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
+ TopoDS_Shape aRefShape1 = aRefFunc->GetValue();
if (aRefShape1.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
aPnt = AdapCurve.Value(aParam);
}
else if (aType == POINT_SURFACE_PAR) {
- Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise
("Point On Surface creation aborted : surface shape is not a face");
aPnt = aSurf->Value(U,V);
}
else if (aType == POINT_SURFACE_COORD) {
- Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
if (aRefShape.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise
("Point On Surface creation aborted : surface shape is not a face");
("Point On Surface creation aborted : cannot project point");
}
}
+ else if (aType == POINT_FACE_ANY) {
+ Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefFunc->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise
+ ("Point On Surface creation aborted : surface shape is not a face");
+ }
+ TopoDS_Face F = TopoDS::Face(aRefShape);
+ gp_Pnt2d aP2d;
+ GEOMAlgo_Tools3D::PntInFace(F, aPnt, aP2d);
+ }
else if (aType == POINT_LINES_INTERSECTION) {
Handle(GEOM_Function) aRef1 = aPI.GetLine1();
Handle(GEOM_Function) aRef2 = aPI.GetLine2();