From de4f7327f40bac47f0fd5d65453f21dd69b24feb Mon Sep 17 00:00:00 2001 From: rnc Date: Thu, 12 Jul 2012 13:11:59 +0000 Subject: [PATCH] Added a mechanism to store AIS_AngleDimension objects and display them all along the sketch creation process as a control tool for the user --- src/EntityGUI/EntityGUI_3DSketcherDlg.cxx | 56 +++++++++++++++++------ src/EntityGUI/EntityGUI_3DSketcherDlg.h | 4 +- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index ace13054b..f552e01a8 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -173,7 +173,10 @@ void EntityGUI_3DSketcherDlg::Init() { myOK = false; myOrientation = 1; - + + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + myAnglePrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); /* Get setting of step value from file configuration */ @@ -308,6 +311,23 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() return; } + // Erase cotation presentation + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + + // Store last angle cotation if any + if(GroupType->RadioButton3->isChecked() && GroupAngles->SpinBox_DL->value()>Precision::Confusion()) + { + double anAngle2 = 0.0; + if (GroupAngles->checkBox->isChecked()) + anAngle2 = GroupAngles->SpinBox_DA2->value(); + + displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation, true); + } + + // Display modified presentation + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + myPointsList.append( getCurrentPoint() ); myRedoList.clear(); @@ -318,6 +338,7 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() } UpdateButtonsState(); GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } //================================================================================= @@ -459,6 +480,7 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog() void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue ) { GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + if(GroupType->RadioButton3->isChecked() && GroupAngles->SpinBox_DL->value()>Precision::Confusion()) { double anAngle2 = 0.0; @@ -722,7 +744,7 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, const double lineWidth, const int displayMode, const int color ) -{ +{ // Set color for preview shape getDisplayer()->SetColor( Quantity_NOC_RED ); @@ -752,10 +774,11 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - if(GroupType->RadioButton3->isChecked()) - displayTrihedron(3); - else - displayTrihedron(2); + // Display trihedron +// if(GroupType->RadioButton3->isChecked()) +// displayTrihedron(3); +// else + displayTrihedron(2); getDisplayer()->UnsetName(); @@ -790,11 +813,11 @@ void EntityGUI_3DSketcherDlg::displayTrihedron(int selMode) // Function : displayAngle() // Purpose : Method for displaying angle dimensions //================================================================ -void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, double theLength, int theOrientation) +void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, double theLength, int theOrientation, bool store) { if(Abs(theAngle2 - 90.0) < Precision::Angular()) return; - // Add trihedron to preview + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); XYZ Last = getLastPoint(); @@ -839,8 +862,6 @@ void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, d } } - MESSAGE("REPERE1 : Last x ="<