mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 12:30:36 +05:00
Implement Check intersection level in Engine and TUI
This commit is contained in:
parent
8e43b2d3fa
commit
8499f032ec
@ -187,6 +187,20 @@ module GEOM
|
|||||||
FDT_String
|
FDT_String
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enumeration represents the level of checking shape on
|
||||||
|
* self-interference. It defines which interferferences will be checked.
|
||||||
|
*/
|
||||||
|
enum si_check_level
|
||||||
|
{
|
||||||
|
SI_V_V, // only V/V interferences
|
||||||
|
SI_V_E, // V/V and V/E interferences
|
||||||
|
SI_E_E, // V/V, V/E and E/E interferences
|
||||||
|
SI_V_F, // V/V, V/E, E/E and V/F interferences
|
||||||
|
SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences
|
||||||
|
SI_ALL // all interferences
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Object creation parameters
|
* \brief Object creation parameters
|
||||||
@ -4080,10 +4094,12 @@ module GEOM
|
|||||||
/*!
|
/*!
|
||||||
* \brief Check a topology of the given shape on self-intersections presence.
|
* \brief Check a topology of the given shape on self-intersections presence.
|
||||||
* \param theShape Shape to check validity of.
|
* \param theShape Shape to check validity of.
|
||||||
|
* \param theCheckLevel the level of self-interference check.
|
||||||
* \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs.
|
* \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs.
|
||||||
* \return TRUE, if the shape does not have any self-intersections.
|
* \return TRUE, if the shape does not have any self-intersections.
|
||||||
*/
|
*/
|
||||||
boolean CheckSelfIntersections (in GEOM_Object theShape,
|
boolean CheckSelfIntersections (in GEOM_Object theShape,
|
||||||
|
in long theCheckLevel,
|
||||||
out ListOfLong theIntersections);
|
out ListOfLong theIntersections);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1501,6 +1501,7 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::PrintShapeErrors
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
|
bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
|
||||||
(Handle(GEOM_Object) theShape,
|
(Handle(GEOM_Object) theShape,
|
||||||
|
const SICheckLevel theCheckLevel,
|
||||||
Handle(TColStd_HSequenceOfInteger)& theIntersections)
|
Handle(TColStd_HSequenceOfInteger)& theIntersections)
|
||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
@ -1534,6 +1535,7 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
|
|||||||
//
|
//
|
||||||
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
|
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
|
||||||
aCSI.SetArguments(aLCS);
|
aCSI.SetArguments(aLCS);
|
||||||
|
aCSI.SetLevelOfCheck(theCheckLevel);
|
||||||
|
|
||||||
// 1. Launch the checker
|
// 1. Launch the checker
|
||||||
aCSI.Perform();
|
aCSI.Perform();
|
||||||
|
@ -85,6 +85,20 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
|
|||||||
SK_ADVANCED, // all advanced shapes (temporary implementation)
|
SK_ADVANCED, // all advanced shapes (temporary implementation)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enumeration represents the level of checking shape on
|
||||||
|
* self-interference. It defines which interferferences will be checked.
|
||||||
|
*/
|
||||||
|
enum SICheckLevel
|
||||||
|
{
|
||||||
|
SI_V_V = 0, // only V/V interferences
|
||||||
|
SI_V_E, // V/V and V/E interferences
|
||||||
|
SI_E_E, // V/V, V/E and E/E interferences
|
||||||
|
SI_V_F, // V/V, V/E, E/E and V/F interferences
|
||||||
|
SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences
|
||||||
|
SI_ALL // all interferences
|
||||||
|
};
|
||||||
|
|
||||||
Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
|
Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
|
||||||
Handle(TColStd_HSequenceOfInteger)& theIntegers,
|
Handle(TColStd_HSequenceOfInteger)& theIntegers,
|
||||||
Handle(TColStd_HSequenceOfReal)& theDoubles);
|
Handle(TColStd_HSequenceOfReal)& theDoubles);
|
||||||
@ -141,6 +155,7 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
|
|||||||
const std::list<ShapeError> &theErrors);
|
const std::list<ShapeError> &theErrors);
|
||||||
|
|
||||||
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
|
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
|
||||||
|
const SICheckLevel theCheckLevel,
|
||||||
Handle(TColStd_HSequenceOfInteger)& theIntersections);
|
Handle(TColStd_HSequenceOfInteger)& theIntersections);
|
||||||
|
|
||||||
Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
|
Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
|
||||||
|
@ -706,6 +706,7 @@ char* GEOM_IMeasureOperations_i::PrintShapeErrors
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
|
CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Long theCheckLevel,
|
||||||
GEOM::ListOfLong_out theIntersections)
|
GEOM::ListOfLong_out theIntersections)
|
||||||
{
|
{
|
||||||
// Set a not done flag
|
// Set a not done flag
|
||||||
@ -720,10 +721,35 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Obj
|
|||||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
|
||||||
if (!aShape.IsNull()) {
|
if (!aShape.IsNull()) {
|
||||||
|
GEOMImpl_IMeasureOperations::SICheckLevel aCheckLevel;
|
||||||
|
|
||||||
|
switch(theCheckLevel) {
|
||||||
|
case GEOM::SI_V_V:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_V;
|
||||||
|
break;
|
||||||
|
case GEOM::SI_V_E:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_E;
|
||||||
|
break;
|
||||||
|
case GEOM::SI_E_E:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_E;
|
||||||
|
break;
|
||||||
|
case GEOM::SI_V_F:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_F;
|
||||||
|
break;
|
||||||
|
case GEOM::SI_E_F:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_F;
|
||||||
|
break;
|
||||||
|
case GEOM::SI_ALL:
|
||||||
|
default:
|
||||||
|
aCheckLevel = GEOMImpl_IMeasureOperations::SI_ALL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
|
Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
|
||||||
|
|
||||||
// Detect self-intersections
|
// Detect self-intersections
|
||||||
isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers);
|
isGood = GetOperations()->CheckSelfIntersections
|
||||||
|
(aShape, aCheckLevel, anIntegers);
|
||||||
|
|
||||||
int nbInts = anIntegers->Length();
|
int nbInts = anIntegers->Length();
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
|
|||||||
const GEOM::GEOM_IMeasureOperations::ShapeErrors &theErrors);
|
const GEOM::GEOM_IMeasureOperations::ShapeErrors &theErrors);
|
||||||
|
|
||||||
CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
|
CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Long theCheckLevel,
|
||||||
GEOM::ListOfLong_out theIntersections);
|
GEOM::ListOfLong_out theIntersections);
|
||||||
|
|
||||||
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
|
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
|
||||||
|
@ -10562,22 +10562,38 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
|||||||
|
|
||||||
## Detect self-intersections in the given shape.
|
## Detect self-intersections in the given shape.
|
||||||
# @param theShape Shape to check.
|
# @param theShape Shape to check.
|
||||||
|
# @param theCheckLevel is the level of self-intersection check.
|
||||||
|
# Possible input values are:
|
||||||
|
# - GEOM.SI_V_V(0) - only V/V interferences
|
||||||
|
# - GEOM.SI_V_E(1) - V/V and V/E interferences
|
||||||
|
# - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
|
||||||
|
# - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
|
||||||
|
# - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
|
||||||
|
# - GEOM.SI_ALL(5) - all interferences.
|
||||||
# @return TRUE, if the shape contains no self-intersections.
|
# @return TRUE, if the shape contains no self-intersections.
|
||||||
#
|
#
|
||||||
# @ref tui_measurement_tools_page "Example"
|
# @ref tui_measurement_tools_page "Example"
|
||||||
@ManageTransactions("MeasuOp")
|
@ManageTransactions("MeasuOp")
|
||||||
def CheckSelfIntersections(self, theShape):
|
def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
|
||||||
"""
|
"""
|
||||||
Detect self-intersections in the given shape.
|
Detect self-intersections in the given shape.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
theShape Shape to check.
|
theShape Shape to check.
|
||||||
|
theCheckLevel is the level of self-intersection check.
|
||||||
|
Possible input values are:
|
||||||
|
- GEOM.SI_V_V(0) - only V/V interferences
|
||||||
|
- GEOM.SI_V_E(1) - V/V and V/E interferences
|
||||||
|
- GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
|
||||||
|
- GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
|
||||||
|
- GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
|
||||||
|
- GEOM.SI_ALL(5) - all interferences.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
TRUE, if the shape contains no self-intersections.
|
TRUE, if the shape contains no self-intersections.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestMeasures.py
|
# Example: see GEOM_TestMeasures.py
|
||||||
(IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape)
|
(IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
|
||||||
RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
|
RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
|
||||||
return IsValid
|
return IsValid
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections
|
|||||||
int nbPairs = 0;
|
int nbPairs = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HasSelfInte = !anOper->CheckSelfIntersections(myObj, myInters);
|
HasSelfInte = !anOper->CheckSelfIntersections(myObj, GEOM::SI_ALL, myInters);
|
||||||
nbPairs = myInters->length()/2;
|
nbPairs = myInters->length()/2;
|
||||||
|
|
||||||
if (nbPairs*2 != myInters->length()) {
|
if (nbPairs*2 != myInters->length()) {
|
||||||
@ -384,12 +384,10 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onInteListSelectionChanged()
|
|||||||
{
|
{
|
||||||
erasePreview();
|
erasePreview();
|
||||||
int aCurItem = myGrp->ListBox1->currentRow();
|
int aCurItem = myGrp->ListBox1->currentRow();
|
||||||
int aNbItems = myGrp->ListBox1->count();
|
|
||||||
if (aCurItem < 0)
|
if (aCurItem < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//int nbPairs = myInters->length()/2;
|
|
||||||
|
|
||||||
QStringList aSubShapeList;
|
QStringList aSubShapeList;
|
||||||
TopoDS_Shape aSelShape;
|
TopoDS_Shape aSelShape;
|
||||||
if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
|
if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user