1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0028068: Samples - Add dimension functionality shows incorrect tip for an Edge in mfc Viewer3d

Warning message was updated to show actual information.
Additional checking of type of shape was added to prevent exceptions for Add Dimension functionality.
This commit is contained in:
ski 2016-11-08 17:26:23 +03:00 committed by apn
parent 2915f0b590
commit 71c089e99b
6 changed files with 21 additions and 11 deletions

View File

@ -76,7 +76,8 @@ void CAngleParamsVerticesPage::OnBnClickedVertex1Btn()
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some vertex is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"),
MB_ICONINFORMATION | MB_OK);
@ -95,7 +96,8 @@ void CAngleParamsVerticesPage::OnBnClickedVertex1Btn()
void CAngleParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;

View File

@ -69,9 +69,10 @@ void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
AfxMessageBox ( _T("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}

View File

@ -71,7 +71,8 @@ void CLengthParamsEdgesPage::OnBnClickedEdge1Btn()
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox(_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
@ -91,7 +92,8 @@ void CLengthParamsEdgesPage::OnBnClickedEdge1Btn()
void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox (_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);

View File

@ -72,7 +72,8 @@ void CLengthParamsVerticesPage::OnBnClickedVertex1Btn()
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
@ -91,7 +92,8 @@ void CLengthParamsVerticesPage::OnBnClickedVertex1Btn()
void CLengthParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_VERTEX)
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;

View File

@ -44,7 +44,8 @@ void CParamsFacesPage::OnBnClickedFacesbtn1()
{
// Check if face is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_FACE)
{
AfxMessageBox(_T("Choose the face and press the button again"),
MB_ICONINFORMATION | MB_OK);
@ -60,7 +61,8 @@ void CParamsFacesPage::OnBnClickedFacesbtn2()
{
// Check if face is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_FACE)
{
AfxMessageBox(_T("Choose the face and press the button again"),
MB_ICONINFORMATION | MB_OK);

View File

@ -59,7 +59,8 @@ void CRadiusParamsPage::OnBnClickedObjectBtn()
{
//Build dimension here
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
if (!myAISContext->LocalContext()->MoreSelected() ||
myAISContext->SelectedShape().ShapeType() != TopAbs_EDGE)
{
AfxMessageBox (_T ("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK);
return;