From: ski Date: Tue, 8 Nov 2016 14:26:23 +0000 (+0300) Subject: 0028068: Samples - Add dimension functionality shows incorrect tip for an Edge in... X-Git-Tag: V7_1_0_beta~12 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=71c089e99be0fcbf214febf2494bf7cf35cd1a19 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. --- diff --git a/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp b/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp index 321506f529..d3f478399a 100644 --- a/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp +++ b/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp @@ -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; diff --git a/samples/mfc/standard/Common/LengthParamsEdgePage.cpp b/samples/mfc/standard/Common/LengthParamsEdgePage.cpp index 6535e66c43..de8e3b55ea 100644 --- a/samples/mfc/standard/Common/LengthParamsEdgePage.cpp +++ b/samples/mfc/standard/Common/LengthParamsEdgePage.cpp @@ -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; } diff --git a/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp b/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp index 5dd10bd4dd..966eaa78db 100644 --- a/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp +++ b/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp @@ -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); diff --git a/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp b/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp index 4aeae3b23d..a9d4ab1f97 100644 --- a/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp +++ b/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp @@ -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; diff --git a/samples/mfc/standard/Common/ParamsFacesPage.cpp b/samples/mfc/standard/Common/ParamsFacesPage.cpp index 3aa5d740eb..55b2b3186e 100644 --- a/samples/mfc/standard/Common/ParamsFacesPage.cpp +++ b/samples/mfc/standard/Common/ParamsFacesPage.cpp @@ -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); diff --git a/samples/mfc/standard/Common/RadiusParamsPage.cpp b/samples/mfc/standard/Common/RadiusParamsPage.cpp index d479e26f27..1a80ed3ef9 100644 --- a/samples/mfc/standard/Common/RadiusParamsPage.cpp +++ b/samples/mfc/standard/Common/RadiusParamsPage.cpp @@ -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;