X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGEOM_I%2FGEOM_IMeasureOperations_i.cc;h=e829aceabec2103f9a95aacade55111c6424349b;hb=9f730900596e9412f431c23b2bd985063814a750;hp=c2bffa8e9a4a12abe774b1140662db441c0f3b64;hpb=901ba4f298d9a24e4ca6f3cae8c223b7c51da7d8;p=modules%2Fgeom.git diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index c2bffa8e9..e829aceab 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -1443,3 +1443,97 @@ void GEOM_IMeasureOperations_i::ConvertToList(const GEOM::GEOM_IMeasureOperation theListOfResults.push_back(aCheck); } } + +//============================================================================= +/*! + * ShapeProximityCalculator + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::ShapeProximityCalculator(GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + GEOM::GEOM_Object_var anEmptyCalc; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shape + Handle(::GEOM_Object) aShape1 = GetObjectImpl(theShape1); + Handle(::GEOM_Object) aShape2 = GetObjectImpl(theShape2); + if (aShape1.IsNull() || aShape2.IsNull()) + return anEmptyCalc._retn(); + + Handle(::GEOM_Object) aCalculator = GetOperations()->ShapeProximityCalculator(aShape1, aShape2); + if (!GetOperations()->IsDone() || aCalculator.IsNull()) + return anEmptyCalc._retn(); + + return GetObject(aCalculator); +} + +//============================================================================= +/*! + * SetShapeSampling + */ + //============================================================================= +void GEOM_IMeasureOperations_i::SetShapeSampling(GEOM::GEOM_Object_ptr theCalculator, + GEOM::GEOM_Object_ptr theShape, + CORBA::Long theNbSamples) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the proximity calculator + Handle(::GEOM_Object) aCalc = GetObjectImpl(theCalculator); + if (aCalc.IsNull()) + return ; + //Get the reference shape + Handle(::GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) + return ; + + GetOperations()->SetShapeSampling(aCalc, aShape, theNbSamples); +} + +//============================================================================= +/*! + * GetCoarseProximity + */ + //============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::GetCoarseProximity(GEOM::GEOM_Object_ptr theCalculator) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shape + Handle(::GEOM_Object) aCalc = GetObjectImpl(theCalculator); + if (aCalc.IsNull()) + return -1.0; + + Standard_Real aProximity = GetOperations()->GetCoarseProximity(aCalc); + if (!GetOperations()->IsDone()) + return -1.0; + + return aProximity; +} + +//============================================================================= +/*! + * GetPreciseProximity + */ + //============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::GetPreciseProximity(GEOM::GEOM_Object_ptr theCalculator) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shape + Handle(::GEOM_Object) aCalc = GetObjectImpl(theCalculator); + if (aCalc.IsNull()) + return -1.0; + + Standard_Real aProximity = GetOperations()->GetPreciseProximity(aCalc); + if (!GetOperations()->IsDone()) + return -1.0; + + return aProximity; +}