0028068: Samples - Add dimension functionality shows incorrect tip for an Edge in...
authorski <ski@opencascade.com>
Tue, 8 Nov 2016 14:26:23 +0000 (17:26 +0300)
committerapn <apn@opencascade.com>
Tue, 8 Nov 2016 15:57:42 +0000 (18:57 +0300)
Warning message was updated to show actual information.
Additional checking of type of shape was added to prevent exceptions for Add Dimension functionality.

samples/mfc/standard/Common/AngleParamsVerticesPage.cpp
samples/mfc/standard/Common/LengthParamsEdgePage.cpp
samples/mfc/standard/Common/LengthParamsEdgesPage.cpp
samples/mfc/standard/Common/LengthParamsVerticesPage.cpp
samples/mfc/standard/Common/ParamsFacesPage.cpp
samples/mfc/standard/Common/RadiusParamsPage.cpp

index 321506f529774eeae681dade8c87d8f879af8da1..d3f478399ab97f09138a9c0d0103a10d768de92a 100644 (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;
index 6535e66c43b893c6e615aca57d1baf34dd1b7e9a..de8e3b55ea9cfedfb32c94567d8d398881cfd1de 100644 (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;
   }
 
index 5dd10bd4dd14478f6079f40140a72349c7fa0878..966eaa78dbf3c43bf459f5ba96c14c0ce4eeb47a 100644 (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);
index 4aeae3b23da1706420ac6a91b7803d9e12c3e98c..a9d4ab1f9731f1219cdfa6d9d013ea6f621de54e 100644 (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;
index 3aa5d740eb8144e5539965daa7cd717c3ca91a32..55b2b3186ed04be1f5f9d03cff0f6569217d2b66 100644 (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);
index d479e26f278acc6ce83c46eaa237bfb96e24d084..1a80ed3ef9a8178863b02cd334f5316a6c876e57 100644 (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;