mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-14 21:30:33 +05:00
Implementation of levels check
This commit is contained in:
parent
4899e8946b
commit
7920e0b001
@ -6977,5 +6977,29 @@ Do you want to create new material?</translation>
|
|||||||
<source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
|
<source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
|
||||||
<translation>Warning: there were errors during the operation, so the list may be incomplete.</translation>
|
<translation>Warning: there were errors during the operation, so the list may be incomplete.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_V_V</source>
|
||||||
|
<translation>Vertex to Vertex</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_V_E</source>
|
||||||
|
<translation>Vertex to Edge + all above</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_E_E</source>
|
||||||
|
<translation>Edge to Edge + all above</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_V_F</source>
|
||||||
|
<translation>Vertex to Face + all above</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_E_F</source>
|
||||||
|
<translation>Edge to Face + all above</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_CHECK_INTE_ALL</source>
|
||||||
|
<translation>All interferences</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -131,7 +131,7 @@ MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (Geom
|
|||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
myHelpFileName = "using_measurement_tools_page.html#check_self_intersections_anchor";
|
myHelpFileName = "check_self_intersections_page.html";
|
||||||
|
|
||||||
/* Initialisation */
|
/* Initialisation */
|
||||||
Init();
|
Init();
|
||||||
@ -151,6 +151,15 @@ MeasureGUI_CheckSelfIntersectionsDlg::~MeasureGUI_CheckSelfIntersectionsDlg()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_CheckSelfIntersectionsDlg::Init()
|
void MeasureGUI_CheckSelfIntersectionsDlg::Init()
|
||||||
{
|
{
|
||||||
|
// Fill in the combo box.
|
||||||
|
myLevelBox->insertItem(GEOM::SI_V_V, tr("GEOM_CHECK_INTE_V_V"));
|
||||||
|
myLevelBox->insertItem(GEOM::SI_V_E, tr("GEOM_CHECK_INTE_V_E"));
|
||||||
|
myLevelBox->insertItem(GEOM::SI_E_E, tr("GEOM_CHECK_INTE_E_E"));
|
||||||
|
myLevelBox->insertItem(GEOM::SI_V_F, tr("GEOM_CHECK_INTE_V_F"));
|
||||||
|
myLevelBox->insertItem(GEOM::SI_E_F, tr("GEOM_CHECK_INTE_E_F"));
|
||||||
|
myLevelBox->insertItem(GEOM::SI_ALL, tr("GEOM_CHECK_INTE_ALL"));
|
||||||
|
myLevelBox->setCurrentIndex(GEOM::SI_ALL);
|
||||||
|
|
||||||
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
|
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
|
||||||
this, SLOT(DeactivateActiveDialog()));
|
this, SLOT(DeactivateActiveDialog()));
|
||||||
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
|
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
|
||||||
@ -163,6 +172,9 @@ void MeasureGUI_CheckSelfIntersectionsDlg::Init()
|
|||||||
SLOT(onInteListSelectionChanged()));
|
SLOT(onInteListSelectionChanged()));
|
||||||
connect(myShapeList, SIGNAL(itemSelectionChanged()),
|
connect(myShapeList, SIGNAL(itemSelectionChanged()),
|
||||||
SLOT(onSubShapesListSelectionChanged()));
|
SLOT(onSubShapesListSelectionChanged()));
|
||||||
|
connect(myLevelBox, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT(clear()));
|
||||||
|
connect(myComputeButton, SIGNAL(clicked()), this, SLOT(onCompute()));
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
|
||||||
@ -178,7 +190,75 @@ void MeasureGUI_CheckSelfIntersectionsDlg::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : clear
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void MeasureGUI_CheckSelfIntersectionsDlg::clear()
|
||||||
|
{
|
||||||
|
myTextView->setText("");
|
||||||
|
disconnect(myInteList, SIGNAL(itemSelectionChanged()), this, 0);
|
||||||
|
disconnect(myShapeList, SIGNAL(itemSelectionChanged()), this, 0);
|
||||||
|
myInteList->clear();
|
||||||
|
myShapeList->clear();
|
||||||
|
connect(myInteList, SIGNAL(itemSelectionChanged()),
|
||||||
|
SLOT(onInteListSelectionChanged()));
|
||||||
|
connect(myShapeList, SIGNAL(itemSelectionChanged()),
|
||||||
|
SLOT(onSubShapesListSelectionChanged()));
|
||||||
|
erasePreview();
|
||||||
|
buttonOk()->setEnabled(false);
|
||||||
|
buttonApply()->setEnabled(false);
|
||||||
|
myComputeButton->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onCompute
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void MeasureGUI_CheckSelfIntersectionsDlg::onCompute()
|
||||||
|
{
|
||||||
|
bool hasSelfInte = false;
|
||||||
|
QString anErrMsg("");
|
||||||
|
|
||||||
|
if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
|
||||||
|
myTextView->setText(anErrMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status and apply buttons
|
||||||
|
QString aMsg("");
|
||||||
|
|
||||||
|
if (hasSelfInte) {
|
||||||
|
aMsg += tr("GEOM_SELF_INTERSECTIONS_FOUND");
|
||||||
|
buttonOk()->setEnabled(true);
|
||||||
|
buttonApply()->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
aMsg += tr("GEOM_NO_SELF_INTERSECTIONS");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!anErrMsg.isEmpty()) {
|
||||||
|
aMsg += "\n\n";
|
||||||
|
aMsg += anErrMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
myTextView->setText(aMsg);
|
||||||
|
|
||||||
|
// Pairs
|
||||||
|
QStringList anInteList;
|
||||||
|
QString anInteStr ("");
|
||||||
|
int nbPairs = myInters->length()/2;
|
||||||
|
|
||||||
|
for (int i = 1; i <= nbPairs; i++) {
|
||||||
|
anInteStr = "Intersection # ";
|
||||||
|
anInteStr += QString::number(i);
|
||||||
|
anInteList.append(anInteStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
myInteList->addItems(anInteList);
|
||||||
|
myComputeButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ActivateThisDialog
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_CheckSelfIntersectionsDlg::ActivateThisDialog()
|
void MeasureGUI_CheckSelfIntersectionsDlg::ActivateThisDialog()
|
||||||
@ -235,7 +315,7 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::ClickOnApply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument
|
// function : extractPrefix
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool MeasureGUI_CheckSelfIntersectionsDlg::extractPrefix() const
|
bool MeasureGUI_CheckSelfIntersectionsDlg::extractPrefix() const
|
||||||
@ -277,6 +357,8 @@ void MeasureGUI_CheckSelfIntersectionsDlg::SetEditCurrentArgument()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument()
|
void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
// Clear the dialog.
|
||||||
|
clear();
|
||||||
myObj = GEOM::GEOM_Object::_nil();
|
myObj = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
@ -291,15 +373,11 @@ void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
if (aSelectedObject->_is_nil()) {
|
if (aSelectedObject->_is_nil()) {
|
||||||
myEditObjName->setText("");
|
myEditObjName->setText("");
|
||||||
processObject();
|
|
||||||
erasePreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myObj = aSelectedObject;
|
myObj = aSelectedObject;
|
||||||
myEditObjName->setText(GEOMBase::GetName(myObj));
|
myEditObjName->setText(GEOMBase::GetName(myObj));
|
||||||
processObject();
|
|
||||||
DISPLAY_PREVIEW_MACRO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -327,9 +405,10 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections
|
|||||||
GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
|
GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
|
||||||
bool isOK = true;
|
bool isOK = true;
|
||||||
int nbPairs = 0;
|
int nbPairs = 0;
|
||||||
|
int aLevel = myLevelBox->currentIndex();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HasSelfInte = !anOper->CheckSelfIntersections(myObj, GEOM::SI_ALL, myInters);
|
HasSelfInte = !anOper->CheckSelfIntersections(myObj, aLevel, myInters);
|
||||||
nbPairs = myInters->length()/2;
|
nbPairs = myInters->length()/2;
|
||||||
|
|
||||||
if (nbPairs*2 != myInters->length()) {
|
if (nbPairs*2 != myInters->length()) {
|
||||||
@ -356,64 +435,6 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections
|
|||||||
return isOK;
|
return isOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : processObject
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void MeasureGUI_CheckSelfIntersectionsDlg::processObject()
|
|
||||||
{
|
|
||||||
disconnect(myInteList, SIGNAL(itemSelectionChanged()), this, 0 );
|
|
||||||
disconnect(myShapeList, SIGNAL(itemSelectionChanged()), this, 0 );
|
|
||||||
myInteList->clear();
|
|
||||||
myShapeList->clear();
|
|
||||||
connect(myInteList, SIGNAL(itemSelectionChanged()),
|
|
||||||
SLOT(onInteListSelectionChanged()));
|
|
||||||
connect(myShapeList, SIGNAL(itemSelectionChanged()),
|
|
||||||
SLOT(onSubShapesListSelectionChanged()));
|
|
||||||
erasePreview();
|
|
||||||
|
|
||||||
bool hasSelfInte = false;
|
|
||||||
QString anErrMsg("");
|
|
||||||
|
|
||||||
if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
|
|
||||||
myTextView->setText(anErrMsg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status and apply buttons
|
|
||||||
QString aMsg("");
|
|
||||||
|
|
||||||
if (hasSelfInte) {
|
|
||||||
aMsg += tr("GEOM_SELF_INTERSECTIONS_FOUND");
|
|
||||||
buttonOk()->setEnabled(true);
|
|
||||||
buttonApply()->setEnabled(true);
|
|
||||||
} else {
|
|
||||||
aMsg += tr("GEOM_NO_SELF_INTERSECTIONS");
|
|
||||||
buttonOk()->setEnabled(false);
|
|
||||||
buttonApply()->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anErrMsg.isEmpty()) {
|
|
||||||
aMsg += "\n\n";
|
|
||||||
aMsg += anErrMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
myTextView->setText(aMsg);
|
|
||||||
|
|
||||||
// Pairs
|
|
||||||
QStringList anInteList;
|
|
||||||
QString anInteStr ("");
|
|
||||||
int nbPairs = myInters->length()/2;
|
|
||||||
|
|
||||||
for (int i = 1; i <= nbPairs; i++) {
|
|
||||||
anInteStr = "Intersection # ";
|
|
||||||
anInteStr += QString::number(i);
|
|
||||||
anInteList.append(anInteStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
myInteList->addItems(anInteList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onInteListSelectionChanged
|
// function : onInteListSelectionChanged
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -55,12 +55,12 @@ protected:
|
|||||||
virtual bool extractPrefix() const;
|
virtual bool extractPrefix() const;
|
||||||
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
|
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
|
||||||
|
|
||||||
void processObject();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void onInteListSelectionChanged();
|
void onInteListSelectionChanged();
|
||||||
void onSubShapesListSelectionChanged();
|
void onSubShapesListSelectionChanged();
|
||||||
|
void clear();
|
||||||
|
void onCompute();
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
bool ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
|
Loading…
Reference in New Issue
Block a user