From d7d7cf10701449a572b135d4899b7df58e34d8a7 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Fri, 27 Mar 2020 15:46:51 +0100 Subject: [PATCH] Style fixes : remove trailing spaces. --- src/EntityGUI/EntityGUI_3DSketcherDlg.cxx | 264 +++++------ src/EntityGUI/EntityGUI_IsolineDlg.cxx | 4 +- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 422 +++++++++--------- src/GEOMBase/GEOMBase_Skeleton.cxx | 26 +- src/GroupGUI/GroupGUI_GroupDlg.cxx | 14 +- .../MeasureGUI_CreateDimensionDlg.cxx | 34 +- 6 files changed, 382 insertions(+), 382 deletions(-) diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 2f095a079..a2e6929d2 100644 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -191,7 +191,7 @@ void AIS_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentation }; bool isSame (double d1, double d2) -{ +{ return Abs(d1 - d2) <= Precision::Confusion(); } @@ -234,12 +234,12 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, Q GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL")); GroupType->RadioButton3->setText(tr("(X,Y,Z)")); GroupType->RadioButton4->setText(tr("GEOM_ANGLES")); - + myTypeGroup1 = new QButtonGroup(this); myTypeGroup1->setExclusive(true); myTypeGroup1->addButton(GroupType->RadioButton1, 0); myTypeGroup1->addButton(GroupType->RadioButton2, 1); - + myTypeGroup2 = new QButtonGroup(this); myTypeGroup2->setExclusive(true); myTypeGroup2->addButton(GroupType->RadioButton3, 0); @@ -259,13 +259,13 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, Q GroupAngles->buttonUndo->setIcon(image1); GroupAngles->buttonRedo->setIcon(image2); GroupAngles->TextLabel1->setText(tr("GEOM_LENGTH")); - GroupAngles->TextLabel2->setText(tr("GEOM_ANGLE")); + GroupAngles->TextLabel2->setText(tr("GEOM_ANGLE")); GroupAngles->checkBox ->setText(tr("GEOM_ANGLE_2")); GroupAngles->checkBox_2->setText(tr("GEOM_HEIGHT")); GroupControls = new EntityGUI_Controls(centralWidget()); GroupControls->GroupBox1->setTitle(tr("GEOM_CONTROLS")); - GroupControls->CheckBox1->setText(tr("GEOM_SHOW_LENGTH")); + GroupControls->CheckBox1->setText(tr("GEOM_SHOW_LENGTH")); GroupControls->CheckBox2->setText(tr("GEOM_SHOW_ANGLE")); GroupControls->CheckBox3->setText(tr("GEOM_SHOW_POINTS_COORD")); GroupControls->lineEdit_1->setReadOnly(true); @@ -356,7 +356,7 @@ void EntityGUI_3DSketcherDlg::Init() GroupControls->CheckBox1->setChecked(true); GroupControls->CheckBox2->setChecked(true); GroupControls->CheckBox3->setChecked(true); - + isLengthVisible = true; isAngleVisible = true; @@ -404,14 +404,14 @@ void EntityGUI_3DSketcherDlg::Init() connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); initName(tr("GEOM_3DSKETCHER")); - + GroupControls->CheckBox3->click(); UpdateButtonsState(); - + myMode = 0; myCoordType = 0; - + GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); } @@ -422,21 +422,21 @@ void EntityGUI_3DSketcherDlg::Init() void EntityGUI_3DSketcherDlg::TypeClicked (int id) { QButtonGroup* send = (QButtonGroup*) sender(); - + int coordType = myCoordType; int mode = myMode; - + if (send == myTypeGroup1) { if(id == myMode) return; - mode = id; + mode = id; } else if (send == myTypeGroup2) { if (id == myCoordType) return; - coordType = id; + coordType = id; } - + GroupAngles->hide(); Group3Spin->show(); @@ -504,15 +504,15 @@ void EntityGUI_3DSketcherDlg::TypeClicked (int id) // purpose : called when the point coordinates is Applyed //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnAddPoint() -{ +{ QString msg; if (!isValid(msg)) { showError(msg); return; } - + myPrsType = prsType(); - + // if(myMode == 1) displayDimensions( /*store = */true); @@ -534,9 +534,9 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() GroupAngles->SpinBox_DL->setValue(0.0); GroupAngles->SpinBox_DA2->setValue(0.0); } - + UpdatePointCoordinates(); - + UpdateButtonsState(); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); } @@ -547,7 +547,7 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() //================================================================================= void EntityGUI_3DSketcherDlg::UpdateButtonsState() { - if (myPointsList.count() == 0) + if (myPointsList.count() == 0) { GroupType->RadioButton1->click(); GroupType->RadioButton3->click(); @@ -569,13 +569,13 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates() { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6); - + if (myPointsList.count() == 0) { GroupControls->lineEdit_1->setText(""); GroupControls->lineEdit_2->setText(""); GroupControls->lineEdit_3->setText(""); - + GroupControls->lineEdit_4->setText(""); GroupControls->lineEdit_5->setText(""); GroupControls->lineEdit_6->setText(""); @@ -585,7 +585,7 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates() GroupControls->lineEdit_1->setText(DlgRef::PrintDoubleValue(getLastPoint().x, aPrecision)); GroupControls->lineEdit_2->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision)); GroupControls->lineEdit_3->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision)); - + GroupControls->lineEdit_4->setText(""); GroupControls->lineEdit_5->setText(""); GroupControls->lineEdit_6->setText(""); @@ -596,7 +596,7 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates() GroupControls->lineEdit_5->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision)); GroupControls->lineEdit_6->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision)); } - + } //================================================================================= @@ -607,7 +607,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() { myIsUndoRedo = true; if (myPointsList.count() > 0) { - + myRedoList.append(myPointsList.last()); // Erase dimensions presentations @@ -615,7 +615,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true); - + removeLastIOFromPrs(); // Display modified presentation @@ -624,13 +624,13 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() if (isAngleVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); - + // Remove last point from list myWorkPoint = myPointsList.last(); myPointsList.removeLast(); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); UpdateButtonsState(); - + // Update of point coordinates in the control groupbox UpdatePointCoordinates(); @@ -647,7 +647,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() { myIsUndoRedo = true; if (myRedoList.count() > 0) { - + myPointsList.append(myRedoList.last()); // Erase dimensions presentations @@ -655,7 +655,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true); - + restoreLastIOToPrs(); // Display modified presentation @@ -664,13 +664,13 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() if (isAngleVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); - + // Remove last point from redo list myWorkPoint = myRedoList.last(); myRedoList.removeLast(); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); UpdateButtonsState(); - + // Update of point coordinates in the control groupbox UpdatePointCoordinates(); @@ -687,7 +687,7 @@ void EntityGUI_3DSketcherDlg::removeLastIOFromPrs () { AIS_ListOfInteractive anIOList; XYZ Last = getLastPoint(); - + for (int l = 0; lGetObjects(anIOList); @@ -715,12 +715,12 @@ void EntityGUI_3DSketcherDlg::removeLastIOFromPrs () void EntityGUI_3DSketcherDlg::restoreLastIOToPrs () { XYZ LastDeleted = myRedoList.last(); - + for (int l = 0; lPrependObject(myLengthIORedoList.First()); // Restore last removed IO myLengthIORedoList.RemoveFirst(); // Remove it from redo list - } + } for (int a = 0; aPrependObject(myAngleIORedoList.First()); // Restore last removed IO @@ -889,7 +889,7 @@ void EntityGUI_3DSketcherDlg::BoxChecked (bool checked) GroupControls->lineEdit_4->setVisible(checked); GroupControls->lineEdit_5->setVisible(checked); GroupControls->lineEdit_6->setVisible(checked); - + GroupControls->label_1->setVisible(checked); GroupControls->label_2->setVisible(checked); GroupControls->label_3->setVisible(checked); @@ -898,14 +898,14 @@ void EntityGUI_3DSketcherDlg::BoxChecked (bool checked) GroupControls->label_6->setVisible(checked); GroupControls->label_7->setVisible(checked); GroupControls->label_8->setVisible(checked); - + GroupControls->updateGeometry(); GroupControls->resize(minimumSizeHint()); - } + } updateGeometry(); resize(minimumSizeHint()); - + GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); } @@ -1087,11 +1087,11 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int aPrecision = resMgr->integerValue("Geometry", "length_precision", 7); - + bool spherical = GroupAngles->checkBox->isChecked(); bool cylindrical = GroupAngles->checkBox_2->isChecked(); - if (myCoordType == 1) + if (myCoordType == 1) { if (GroupAngles->radioButton_1->isChecked()) xyz.command = "OXY"; @@ -1099,17 +1099,17 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const xyz.command = "OYZ"; else xyz.command = "OXZ"; - + if (cylindrical) // Cylindrical coordinates (radius, angle, height) xyz.command += "C"; else xyz.command += "S"; // Spherical coordinates (radius, angle1, angle2) --> polar if angle2 = 0 - + if (myMode == 0) // Absolute coordinates xyz.command += "A "; else if (myMode == 1) // Relative coordinates xyz.command += "R "; - + double anAngle = GroupAngles->SpinBox_DA->value(); double aLength = GroupAngles->SpinBox_DL->value(); @@ -1120,7 +1120,7 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const anAngle2 = GroupAngles->SpinBox_DA2->value(); da2 = GroupAngles->SpinBox_DA2->text(); } - + double aHeight = 0.0; QString dh = "0"; if (cylindrical) { @@ -1131,8 +1131,8 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const xyz.command += QString::number(anAngle, 'g', aPrecision) + " "; xyz.params = - GroupAngles->SpinBox_DA->text() + ":"; - + GroupAngles->SpinBox_DA->text() + ":"; + if(cylindrical) { xyz.command += @@ -1147,21 +1147,21 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const xyz.params += dh + ":"; } - + xyz.command += QString::number(aLength, 'g', aPrecision); xyz.params += GroupAngles->SpinBox_DL->text(); - + // Calculate point coordinates for preview anAngle = anAngle * M_PI/180.0; anAngle2 = anAngle2 * M_PI/180.0; double aProjectedLength = aLength * cos(anAngle2); - + XYZ xyzP = getLastPoint(); if (myMode == 0) - xyzP.x=xyzP.y=xyzP.z=0.0; + xyzP.x=xyzP.y=xyzP.z=0.0; if (GroupAngles->radioButton_1->isChecked()) // OXY { xyz.x = xyzP.x + aProjectedLength * cos(anAngle); @@ -1222,7 +1222,7 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const xyz.A = myPrsType.A; // Number of angle diomensions xyz.L = myPrsType.L; // Number of length dimensions xyz.T = myPrsType.T; // Number of text objects - + return xyz; } @@ -1233,10 +1233,10 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const // relative positioning of dimension presentations //================================================================================= gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const -{ +{ bool withAngle = (myCoordType == 1); bool twoAngles = GroupAngles->checkBox->isChecked(); - + XYZ Last = getLastPoint(); XYZ Current; if( myIsUndoRedo ) { @@ -1244,34 +1244,34 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const } else { Current = getCurrentPoint(); } - + XYZ Penultimate = getPenultimatePoint(); - + gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z); if (myMode == 0) // Absolute coordinates P1 = gp::Origin(); - + gp_Pnt P2 = gp_Pnt(Current.x,Current.y,Current.z); gp_Pnt P3 = gp_Pnt(Penultimate.x,Penultimate.y,Penultimate.z); - + gp_Vec Vec1(P1,P2); gp_Vec Vec2(P1,P3); - - gp_Dir aNormal; // Normal defining the plane of the presentation - + + gp_Dir aNormal; // Normal defining the plane of the presentation + if (withAngle) // If one angle { - // Transformation from the current coordinate system + // Transformation from the current coordinate system // to the reference coordinate system gp_Trsf aTransform = toReferenceSystem (P1); gp_Dir N1 = gp::DZ(); gp_Dir N2 = gp::DY(); N1.Transform(aTransform); N2.Transform(aTransform); - + if (Vec1.CrossMagnitude(N1) > Precision::Confusion()) { - // The plane is orthogonal to the angle presentation plane + // The plane is orthogonal to the angle presentation plane // and contains the current edge aNormal = N1.Crossed(gp_Dir(Vec1)); } @@ -1279,19 +1279,19 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const aNormal = N2; if (twoAngles) - { + { gp_Vec V = Vec1.Transformed(aTransform.Inverted()); gp_Vec Vec3(V.X(),V.Y(),0.0); - + // Express the coordinates in the reference coordinate system (OXY) - Vec3.Transform(aTransform); - if(Abs(Vec1.CrossMagnitude(Vec3)) > Precision::Confusion()) - { + Vec3.Transform(aTransform); + if(Abs(Vec1.CrossMagnitude(Vec3)) > Precision::Confusion()) + { // set the normal as the cross product of the current edge with its projection // it ensures that the dimension changes side when the angle becomes negative - aNormal = gp_Dir(Vec1.Crossed(Vec3)); - } - } + aNormal = gp_Dir(Vec1.Crossed(Vec3)); + } + } } else { @@ -1306,7 +1306,7 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const } // If no angles, the plane is the one formed by the last edge and the current one if(Abs(Vec1.CrossMagnitude(Vec2)) > Precision::Confusion()) { - aNormal = gp_Dir(Vec1.Crossed(Vec2)); + aNormal = gp_Dir(Vec1.Crossed(Vec2)); } } return aNormal; @@ -1386,15 +1386,15 @@ void EntityGUI_3DSketcherDlg::displayTrihedron (int selMode) { // Add trihedron to preview SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - + SOCC_Viewer* anOCCViewer = dynamic_cast( vw->getViewManager()->getViewModel() ); if( !anOCCViewer ) return; - + Handle(AIS_InteractiveContext) anAISContext = anOCCViewer->getAISContext(); if( !anAISContext ) return; - + gp_Pnt P(getLastPoint().x,getLastPoint().y,getLastPoint().z); Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(P,gp::DZ(),gp::DX()); Handle(AIS_Trihedron) anIO = new AIS_Trihedron(anAxis); @@ -1420,39 +1420,39 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) XYZ Current = getCurrentPoint(); gp_Pnt Last_Pnt(Last.x,Last.y,Last.z); - + gp_Pnt P0 = Last_Pnt; gp_Pnt Origin = gp::Origin(); if (myMode == 0) // Absolute coordinates P0 = Origin; - + gp_Pnt Current_Pnt(Current.x,Current.y,Current.z); gp_Pnt P1, P2; - + // Check if last end current point are coincident if (Last_Pnt.IsEqual(Current_Pnt, 1e-7)) return; - + gp_Dir aNormal = getPresentationPlane(); - + if (myCoordType == 0) { - bool oneDimensionalMove = (isSame(Last_Pnt.X(), Current_Pnt.X()) && + bool oneDimensionalMove = (isSame(Last_Pnt.X(), Current_Pnt.X()) && isSame(Last_Pnt.Y(), Current_Pnt.Y()) ) || - (isSame(Last_Pnt.Y(), Current_Pnt.Y()) && + (isSame(Last_Pnt.Y(), Current_Pnt.Y()) && isSame(Last_Pnt.Z(), Current_Pnt.Z()) ) || - (isSame(Last_Pnt.X(), Current_Pnt.X()) && + (isSame(Last_Pnt.X(), Current_Pnt.X()) && isSame(Last_Pnt.Z(), Current_Pnt.Z()) ); - + if (myMode == 0) { - std::string aCoordText = "( " + doubleToString(Current_Pnt.X()) + + std::string aCoordText = "( " + doubleToString(Current_Pnt.X()) + ", " + doubleToString(Current_Pnt.Y()) + ", " + doubleToString(Current_Pnt.Z()) + " )"; displayText(aCoordText, Current_Pnt, store); } - else - { + else + { if (oneDimensionalMove) { // For better colocation of dimensions if only one coordinate changes (aNormal is a better choice) @@ -1468,25 +1468,25 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) } else if (myCoordType == 1) // ANGLES { - bool spherical = GroupAngles->checkBox->isChecked(); + bool spherical = GroupAngles->checkBox->isChecked(); bool cylindrical = GroupAngles->checkBox_2->isChecked(); - + double anAngle1 = GroupAngles->SpinBox_DA->value(); double aLength = GroupAngles->SpinBox_DL->value(); - + // Set the coordinates in the current coordinate system P1.SetCoord( aLength, 0.0, 0.0); // X direction P2.SetCoord( aLength * cos(anAngle1 * M_PI / 180. ), aLength * sin(anAngle1 * M_PI / 180. ), - 0.0); - + 0.0); + // Express the coordinates in the reference coordinate system (OXY) gp_Trsf aTransform = toReferenceSystem(P0); - P1.Transform(aTransform); + P1.Transform(aTransform); P2.Transform(aTransform); P1.Translate(Origin, P0); P2.Translate(Origin, P0); - + if(myMode !=0 || !store) displayAngle(anAngle1, P0, P1, P2, store); else @@ -1494,7 +1494,7 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) std::string anAngleText = doubleToString(anAngle1) + " deg."; displayText(anAngleText, Current_Pnt, store); } - + if(spherical) { double anAngle2 = GroupAngles->SpinBox_DA2->value(); @@ -1505,17 +1505,17 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) { bool sameRadius = isSame ( radius(Last_Pnt), radius(Current_Pnt) ); bool sameHeight = isSame ( height(Last_Pnt), height(Current_Pnt) ); - + gp_Vec aVec(P2, Current_Pnt); - + if (myMode == 0 && !sameRadius) { - displayLength(P0.Translated(aVec), P2.Translated(aVec), aNormal, store); // Radius + displayLength(P0.Translated(aVec), P2.Translated(aVec), aNormal, store); // Radius } else if (myMode == 1) displayLength(P0, P2, aNormal, store); - - if ( cylindrical && + + if ( cylindrical && (myMode == 1 || !sameHeight) ) displayLength(P2, Current_Pnt, aNormal.Reversed(), store); // Height } @@ -1527,31 +1527,31 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) // Purpose : Method for displaying angle dimensions //================================================================ void EntityGUI_3DSketcherDlg::displayAngle (double theAngle, - gp_Pnt P0, - gp_Pnt P1, + gp_Pnt P0, + gp_Pnt P1, gp_Pnt P2, bool store) { SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - + // Creation of the AIS object - Handle(AIS_AngleDimension) anAngleIO = createAISAngleDimension(theAngle, - P0, - P1, + Handle(AIS_AngleDimension) anAngleIO = createAISAngleDimension(theAngle, + P0, + P1, P2); if (anAngleIO.IsNull()) return; - + if (store) { // Erase dimensions presentations ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); myAnglePrs->PrependObject(anAngleIO); - + // Display modified presentation if (isAngleVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); - + // Update dimension presentation angle count for later undo / redo myPrsType.A += 1; } @@ -1559,11 +1559,11 @@ void EntityGUI_3DSketcherDlg::displayAngle (double theAngle, { SOCC_Prs* aSPrs = dynamic_cast (((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); - + if (aSPrs) { aSPrs->AddObject(anAngleIO); - GEOMBase_Helper::displayPreview(aSPrs, true, true); + GEOMBase_Helper::displayPreview(aSPrs, true, true); } } } @@ -1580,12 +1580,12 @@ void EntityGUI_3DSketcherDlg::displayLength (gp_Pnt P1, bool store) { SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - + double aLength = P1.Distance(P2); - + if (aLength < Precision::Confusion()) return; - + Handle(AIS_LengthDimension) anIO = createAISLengthDimension(aLength, P1, P2, theNormal); if (store) @@ -1597,7 +1597,7 @@ void EntityGUI_3DSketcherDlg::displayLength (gp_Pnt P1, // Display modified presentation if (isLengthVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); - + // Update dimension presentation length count for later undo / redo myPrsType.L += 1; } @@ -1623,7 +1623,7 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, bool store ) { SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - + Handle(AIS_Text) anIO = new AIS_Text(TCollection_ExtendedString(theText.c_str()), P); if (store) @@ -1634,7 +1634,7 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, // Display modified presentation ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); - + // Update dimension presentation text count for later undo / redo myPrsType.T += 1; } @@ -1656,15 +1656,15 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, // Purpose : Method for creation of a length dimension object // Returns an Handle on the AIS_LengthDimension object //================================================================ -Handle(AIS_LengthDimension) EntityGUI_3DSketcherDlg::createAISLengthDimension(double theLength, - gp_Pnt P1, - gp_Pnt P2, +Handle(AIS_LengthDimension) EntityGUI_3DSketcherDlg::createAISLengthDimension(double theLength, + gp_Pnt P1, + gp_Pnt P2, gp_Dir theNormal) { // Plane construction gce_MakePln gce_MP(P1, theNormal); Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value()); - + TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(P1); TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(P2); @@ -1694,14 +1694,14 @@ Handle(AIS_LengthDimension) EntityGUI_3DSketcherDlg::createAISLengthDimension(do // Purpose : Method for creation of an angle dimension object // Returns an Handle on the AIS_AngleDimension object //================================================================ -Handle(AIS_AngleDimension) EntityGUI_3DSketcherDlg::createAISAngleDimension(double theAngle, - gp_Pnt P0, - gp_Pnt P1, +Handle(AIS_AngleDimension) EntityGUI_3DSketcherDlg::createAISAngleDimension(double theAngle, + gp_Pnt P0, + gp_Pnt P1, gp_Pnt P2) { // Length of the built segment double aLength = P0.Distance(P1); - + // Check input data if (Abs(theAngle) < Precision::Angular() || aLength < Precision::Confusion()) @@ -1823,11 +1823,11 @@ std::string EntityGUI_3DSketcherDlg::doubleToString (double num) // Purpose : //================================================================ gp_Trsf EntityGUI_3DSketcherDlg::toReferenceSystem(gp_Pnt origin) const -{ +{ gp_Trsf T; // Identity transformation gp_Ax3 reference_system; // OXY reference_system.SetLocation(origin); - + gp_Ax3 current_system = reference_system; switch (myOrientation) { @@ -1842,9 +1842,9 @@ gp_Trsf EntityGUI_3DSketcherDlg::toReferenceSystem(gp_Pnt origin) const break; } } - + T.SetTransformation( current_system, reference_system ); - + return T; } @@ -1866,7 +1866,7 @@ double EntityGUI_3DSketcherDlg::radius (gp_Pnt thePnt) const // Get the point coordinates in the current coordinates system gp_Trsf aTrsf = toCurrentSystem(gp::Origin()); gp_Pnt aPnt = thePnt.Transformed(aTrsf); - + double radius = sqrt(aPnt.X()*aPnt.X() + aPnt.Y()*aPnt.Y()); return radius; } @@ -1880,6 +1880,6 @@ double EntityGUI_3DSketcherDlg::height (gp_Pnt thePnt) const // Get the point coordinates in the current coordinates system gp_Trsf aTrsf = toCurrentSystem(gp::Origin()); gp_Pnt aPnt = thePnt.Transformed(aTrsf); - + return aPnt.Z(); } diff --git a/src/EntityGUI/EntityGUI_IsolineDlg.cxx b/src/EntityGUI/EntityGUI_IsolineDlg.cxx index 5b5d97320..073f72094 100644 --- a/src/EntityGUI/EntityGUI_IsolineDlg.cxx +++ b/src/EntityGUI/EntityGUI_IsolineDlg.cxx @@ -33,7 +33,7 @@ //================================================================================= // class : EntityGUI_IsolineDlg -// purpose : +// purpose : //================================================================================= EntityGUI_IsolineDlg::EntityGUI_IsolineDlg (GeometryGUI *theGeometryGUI, QWidget *parent, @@ -83,7 +83,7 @@ EntityGUI_IsolineDlg::EntityGUI_IsolineDlg (GeometryGUI *theGeometryGUI, //================================================================================= // function : ~EntityGUI_IsolineDlg() -// purpose : +// purpose : //================================================================================= EntityGUI_IsolineDlg::~EntityGUI_IsolineDlg() { diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 9b7e384aa..93fa03f9b 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -91,7 +91,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); setModal( modal ); setAttribute( Qt::WA_DeleteOnClose ); - + // Disable rectangular selection // SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); // ((OCCViewer_ViewWindow*)theViewWindow)->setEnabledDrawMode( false ); @@ -103,9 +103,9 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, // OCCViewer_ViewSketcher* aViewSketcher = ((OCCViewer_ViewWindow*)theViewWindow)->getSketcher( OCCViewer_ViewWindow::Rect ); // aViewSketcher->deactivate() // aViewSketcher->setVisible(false); - + // this->setMouseTracking(false); - + myGeometryGUI->SetActiveDialogBox(this); MainWidget = new EntityGUI_Skeleton( this ); @@ -152,17 +152,17 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, planeButton = new QPushButton (GroupBox1); planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) ); planeLayout->addWidget(planeButton,0,2); - + selButton = new QPushButton (GroupBox1); selButton->setIcon(image5); planeLayout->addWidget(selButton,1,0); - + WPlaneLineEdit = new QLineEdit (GroupBox1); WPlaneLineEdit->setReadOnly(true); planeLayout->addWidget(WPlaneLineEdit,1,1,1,2); - + planeLayout->setColumnStretch(1,1); - + topLayout->addWidget(GroupBox1); topLayout->addWidget( MainWidget ); topLayout->setStretch( 1, 1); @@ -176,10 +176,10 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, GroupPt2 = new EntityGUI_Point( MainWidget->DestCnt ); - GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) ); + GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) ); GroupPt2->RB_Point1->setText( tr( "GEOM_SKETCHER_NONE" ) ); GroupPt2->RB_Point2->setText( tr( "GEOM_SKETCHER_RADIUS" ) ); - GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) ); + GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) ); GroupD1 = new EntityGUI_Dir1( MainWidget->DestCnt ); @@ -250,7 +250,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, Group4Spin->checkBox->setText( tr( "GEOM_REVERSE" ) ); Group4Spin->buttonUndo->setIcon( image1 ); Group4Spin->buttonRedo->setIcon( image2 ); - + GroupRect = new DlgRef_4Spin( MainWidget->SkeletonCnt ); GroupRect->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); GroupRect->TextLabel1->setText("X1:"); @@ -258,7 +258,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, GroupRect->TextLabel3->setText("X2:"); GroupRect->TextLabel4->setText("Y2:"); - // Defines a palette for the error message on Group4Spin and Group2Sel + // Defines a palette for the error message on Group4Spin and Group2Sel QPalette palette; QColor color("red"); palette.setColor(Group4Spin->label->foregroundRole(), color); @@ -365,7 +365,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - + // install event filter on spin-boxes to provide Apply action on Return pressed Group1Spin->SpinBox_DX->installEventFilter(this); Group1Sel1Spin->SpinBox_DX->installEventFilter(this); @@ -390,7 +390,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() { // SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); - + myGeometryGUI->SetActiveDialogBox( 0 ); // ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(false); } @@ -444,9 +444,9 @@ void EntityGUI_SketcherDlg::Init() { /* init variables */ autoApply = false; - + myEditCurrentArgument = WPlaneLineEdit; // Initiate the parameters selection with the first WPlaneLineEdit - + myCommand.append( "Sketcher" ); myUndoCommand.append( "Sketcher" ); @@ -461,11 +461,11 @@ void EntityGUI_SketcherDlg::Init() myLastY2 = 0.0; myHelpFileName = "create_sketcher_page.html"; - + GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations(); myGlobalCS = aBasicOp->MakeMarker( 0,0,0, 1,0,0, - 0,1,0 ); + 0,1,0 ); myWPlane = myGlobalCS; myLCSList.push_back( WPlaneToLCS(myGlobalCS) ); @@ -485,12 +485,12 @@ void EntityGUI_SketcherDlg::Init() initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" ); - - initSpinBox( GroupRect->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" ); + + initSpinBox( GroupRect->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( GroupRect->SpinBox_DY1, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( GroupRect->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( GroupRect->SpinBox_DY2, COORD_MIN, COORD_MAX, step, "length_precision" ); - + /* displays Dialog */ // MainWidget->RadioButton1->setEnabled( false ); @@ -506,17 +506,17 @@ void EntityGUI_SketcherDlg::Init() TypeClicked( 0 ); // If a face has already been selected use it. Placed after FindLocalCS to avoid clearing the combobox // that should be filled with the possibly selected face - + OnFirstPoint(); - - SelectionIntoArgument(); - + + SelectionIntoArgument(); + resize(100,100); - + setPrefix(tr("GEOM_SKETCH")); ActivateLocalCS(); - + setIsWaitCursorEnabled( false ); GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -554,7 +554,7 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) myConstructorId = constructorId; MainWidget->buttonEnd->setText(tr("GEOM_BUT_CLOSE")); MainWidget->buttonClose->setEnabled(true); - + if ( myConstructorId == 0 ) { // SEGMENT GroupPt2->RB_Point1->setChecked( true ); GroupPt ->setEnabled( true ); @@ -563,7 +563,7 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) GroupD2->setEnabled( true ); MainWidget->RB_Dest1->setEnabled( true ); MainWidget->RB_Dest1->setChecked( true ); - + MainWidget->GroupDest ->setEnabled( true ); MainWidget->GroupDest1->setEnabled( true ); MainWidget->GroupDest ->show(); @@ -580,9 +580,9 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) GroupD2->RB_Dir21->setChecked( true ); GroupD1->setEnabled( true ); GroupD2->setEnabled( false ); - MainWidget->RB_Dest1->setEnabled( true ); + MainWidget->RB_Dest1->setEnabled( true ); MainWidget->RB_Dest1->setChecked( true ); - + MainWidget->GroupDest ->setEnabled( true ); MainWidget->GroupDest1->setEnabled( true ); MainWidget->GroupDest ->show(); @@ -607,14 +607,14 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) GroupD2 ->hide(); MainWidget->GroupDest ->hide(); MainWidget->GroupDest1->hide(); - + MainWidget->buttonEnd->setText(tr("Apply and Close")); MainWidget->buttonClose->setEnabled(false); - + GroupRect->setEnabled( true ); MainWidget->RadioButton1->setEnabled( true ); MainWidget->RadioButton2->setEnabled( true ); - + RectClicked(); } } @@ -626,24 +626,24 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) void EntityGUI_SketcherDlg::RectClicked() { InitClick(); - + // Connect the selection manager (disconnected in InitClick()) connect( myGeometryGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - + GroupRect->show(); - + myX1=0; - GroupRect->SpinBox_DX1->setValue(myX1); + GroupRect->SpinBox_DX1->setValue(myX1); myY1=0; GroupRect->SpinBox_DY1->setValue(myY1); myX2=10; GroupRect->SpinBox_DX2->setValue(myX2); myY2=10; GroupRect->SpinBox_DY2->setValue(myY2); - + resize( minimumSizeHint() ); - + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -694,15 +694,15 @@ void EntityGUI_SketcherDlg::DestClicked( int constructorId ) void EntityGUI_SketcherDlg::PointClicked( int constructorId ) { MESSAGE("PointClicked") - myConstructorPntId = constructorId; + myConstructorPntId = constructorId; GroupPt->RB_Point3->setEnabled( true ); int buttonId = GroupPt2->ButtonGroup->checkedId(); if (buttonId >= 0){ // = If a button is checked Point2Clicked(buttonId); } - else{ + else{ GroupPt2->RB_Point1->setChecked( true ); - Point2Clicked( 1 ); + Point2Clicked( 1 ); } } @@ -736,18 +736,18 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) } else if ( constructorId == 0 ){ // Point + radius mySketchType = PT_ABS_RADIUS; - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); myX = 0.0; Group3Spin->SpinBox_DX->setValue( myX ); myY = 0.0; Group3Spin->SpinBox_DY->setValue( myY ); myRadius=0.0; - Group3Spin->SpinBox_DZ->setValue( myRadius ); + Group3Spin->SpinBox_DZ->setValue( myRadius ); Group3Spin->show(); Group3Spin->buttonApply->setFocus(); @@ -755,20 +755,20 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) } else if ( constructorId == 2 ){ // Point + center mySketchType = PT_ABS_CENTER; - initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" ); Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X2" ) ); Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_X" ) ); - Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) ); + Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) ); myXc = 0.0; Group4Spin->SpinBox_DX->setValue( myXc ); myYc = 0.0; Group4Spin->SpinBox_DY->setValue( myYc ); myX = 0.0; - Group4Spin->SpinBox_DZ->setValue( myX ); + Group4Spin->SpinBox_DZ->setValue( myX ); myY = 0.0; Group4Spin->SpinBox_DS->setValue( myY ); Group4Spin->show(); @@ -794,14 +794,14 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } - else if ( constructorId == 0 ){ // Point + radius + else if ( constructorId == 0 ){ // Point + radius mySketchType = PT_REL_RADIUS; - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); myDX = 10.0; Group3Spin->SpinBox_DX->setValue( myDX ); myDY = 0.0; @@ -815,20 +815,20 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) } else if ( constructorId == 2 ){ // Point + center mySketchType = PT_REL_CENTER; - initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" ); Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_DY2" ) ); Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_DX" ) ); - Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) ); + Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) ); myDXc = 0.0; Group4Spin->SpinBox_DX->setValue( myDXc ); myDYc = 0.0; Group4Spin->SpinBox_DY->setValue( myDYc ); myDX = 0.0; - Group4Spin->SpinBox_DZ->setValue( myDX ); + Group4Spin->SpinBox_DZ->setValue( myDX ); myDY = 0.0; Group4Spin->SpinBox_DS->setValue( myDY ); Group4Spin->show(); @@ -842,17 +842,17 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) if ( constructorId == 1 ){ // No additional parameter mySketchType = PT_SEL; myEditCurrentArgument = Group1Sel->LineEdit1; - Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); + Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); Group1Sel->show(); Group1Sel->buttonApply->setFocus(); SelectionIntoArgument(); } - else if ( constructorId == 0 ){ // Point + radius + else if ( constructorId == 0 ){ // Point + radius mySketchType = PT_SEL_RADIUS; myEditCurrentArgument = Group1Sel1Spin->LineEdit1; initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); - Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); - Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); + Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); myRadius=0.0; Group1Sel1Spin->SpinBox_DX->setValue( myRadius ); @@ -860,10 +860,10 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) Group1Sel1Spin->buttonApply->setFocus(); SelectionIntoArgument(); } - else if ( constructorId == 2 ){ // Point + center + else if ( constructorId == 2 ){ // Point + center mySketchType = PT_SEL_CENTER; myEditCurrentArgument = Group2Sel->LineEdit1; - Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); + Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); Group2Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER2" ) ); Group2Sel->LineEdit1->setEnabled(true); Group2Sel->PushButton1->setDown(true); @@ -878,7 +878,7 @@ void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) resize( minimumSizeHint() ); connect( myGeometryGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - + } @@ -893,9 +893,9 @@ void EntityGUI_SketcherDlg::Dir1Clicked( int constructorId ) if (dirButtonId >= 0){ // = If a button is checked Dir2Clicked(dirButtonId); } - else{ + else{ GroupD2->RB_Dir21->setChecked( true ); - Dir2Clicked( 2 ); + Dir2Clicked( 2 ); } } @@ -910,15 +910,15 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) Group3Spin->SpinBox_DX->blockSignals(true); // Block signals in order not to modify Group3Spin->SpinBox_DY->blockSignals(true); // default values Group3Spin->SpinBox_DZ->blockSignals(true); - + Group2Spin->SpinBox_DX->blockSignals(true); Group2Spin->SpinBox_DY->blockSignals(true); - - Group4Spin->SpinBox_DX->blockSignals(true); + + Group4Spin->SpinBox_DX->blockSignals(true); Group4Spin->SpinBox_DY->blockSignals(true); Group4Spin->SpinBox_DZ->blockSignals(true); - Group4Spin->SpinBox_DS->blockSignals(true); - + Group4Spin->SpinBox_DS->blockSignals(true); + // Get setting of step value from file configuration double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); @@ -947,7 +947,7 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) } else if ( constructorId == 1 ) { // Y mySketchType = DIR_ANGLE_Y; - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" ); Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group2Spin->SpinBox_DY->setValue( myY ); } @@ -1090,17 +1090,17 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) } } Group3Spin->SpinBox_DX->blockSignals(false); // Restore signals - Group3Spin->SpinBox_DY->blockSignals(false); + Group3Spin->SpinBox_DY->blockSignals(false); Group3Spin->SpinBox_DZ->blockSignals(false); - + Group2Spin->SpinBox_DX->blockSignals(false); Group2Spin->SpinBox_DY->blockSignals(false); - - Group4Spin->SpinBox_DX->blockSignals(false); + + Group4Spin->SpinBox_DX->blockSignals(false); Group4Spin->SpinBox_DY->blockSignals(false); Group4Spin->SpinBox_DZ->blockSignals(false); - Group4Spin->SpinBox_DS->blockSignals(false); - + Group4Spin->SpinBox_DS->blockSignals(false); + resize( minimumSizeHint() ); GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -1159,7 +1159,7 @@ void EntityGUI_SketcherDlg::ClickOnEnd() ( Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() ) || ( Group1Sel->buttonApply->isEnabled() && Group1Sel->isVisible() ) || ( Group2Sel->buttonApply->isEnabled() && Group2Sel->isVisible() ) || - ( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) { + ( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) { ClickOnApply(); }*/ // ClickOnApply(); // TEST remove then @@ -1237,7 +1237,7 @@ bool EntityGUI_SketcherDlg::ClickOnApply() (Group4Spin->SpinBox_DX)->setFocus(); (Group4Spin->SpinBox_DX)->selectAll(); } - + return true; } @@ -1309,9 +1309,9 @@ void EntityGUI_SketcherDlg::ClickOnRedo() myUndoParameters.pop_back(); mySketchState = NEXT_POINT; - + OnNextPoint(); - + setEnabledUndo( true ); if ( myUndoCommand.count() == 1 ) @@ -1362,9 +1362,9 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - + this->activateWindow(); - + if (aSelList.Extent() == 0) { selButton->setDown(false); @@ -1372,32 +1372,32 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() WPlaneLineEdit->setText(tr("GEOM_SKETCHER_WPLANE")); return; } - else if (aSelList.Extent() != 1) + else if (aSelList.Extent() != 1) return; - + double tmpX = myX; double tmpY = myY; myX = myLastX1; myY = myLastY1; - + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if (myEditCurrentArgument == WPlaneLineEdit) aNeedType = TopAbs_FACE; - - + + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - - if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) + + if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) - { - QString aName = GEOMBase::GetName( aSelectedObject.get() ); - if (myEditCurrentArgument==WPlaneLineEdit) - { + { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + if (myEditCurrentArgument==WPlaneLineEdit) + { // Check if the face is planar Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); GeomLib_IsPlanarSurface aPlanarCheck(aSurf, Precision::Confusion()); - + if (aPlanarCheck.IsPlanar()) { myEditCurrentArgument->setText(aName); @@ -1410,9 +1410,9 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(tr("GEOM_SKETCHER_WPLANE")); // The following leads to crash TODO : find a way to return a warning -// Standard_Failure::Raise(tr("GEOM_SKETCHER_NOT_PLANAR").toStdString().c_str()); +// Standard_Failure::Raise(tr("GEOM_SKETCHER_NOT_PLANAR").toStdString().c_str()); } - } + } else { gp_Trsf aTrans; @@ -1423,27 +1423,27 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() aShape = aTransformation.Shape(); gp_Pnt aPnt; - if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) + if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) { myEditCurrentArgument->setText(aName); myX = aPnt.X(); - myY = aPnt.Y(); + myY = aPnt.Y(); double Xcoord = myX; double Ycoord = myY; - + switch (mySketchType) { case PT_ABS: disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - + Group2Spin->SpinBox_DX->setValue(Xcoord); Group2Spin->SpinBox_DY->setValue(Ycoord); - + connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); break; - + case PT_RELATIVE: if (myLastX1 && myLastY1) { @@ -1454,22 +1454,22 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() { Xcoord = myX - tmpX; Ycoord = myY - tmpY; - } + } Group2Spin->SpinBox_DX->setValue(Xcoord); - Group2Spin->SpinBox_DY->setValue(Ycoord); - break; - + Group2Spin->SpinBox_DY->setValue(Ycoord); + break; + case PT_ABS_RADIUS: disconnect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); disconnect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - + Group3Spin->SpinBox_DX->setValue(Xcoord); Group3Spin->SpinBox_DY->setValue(Ycoord); - + connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); break; - + case PT_REL_RADIUS: if (myLastX1 && myLastY1) { @@ -1480,22 +1480,22 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() { Xcoord = myX - tmpX; Ycoord = myY - tmpY; - } + } Group3Spin->SpinBox_DX->setValue(Xcoord); Group3Spin->SpinBox_DY->setValue(Ycoord); - break; - + break; + case PT_ABS_CENTER: disconnect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); disconnect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - + Group4Spin->SpinBox_DX->setValue(Xcoord); Group4Spin->SpinBox_DY->setValue(Ycoord); - + connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); break; - + case PT_REL_CENTER: if (myLastX1 && myLastY1) { @@ -1506,17 +1506,17 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() { Xcoord = myXc - tmpX; Ycoord = myYc - tmpY; - } + } else { Xcoord = myXc; Ycoord = myYc; } - + Group4Spin->SpinBox_DX->setValue(Xcoord); - Group4Spin->SpinBox_DY->setValue(Ycoord); - break; - + Group4Spin->SpinBox_DY->setValue(Ycoord); + break; + } } } @@ -1525,11 +1525,11 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() if(!autoApply){ GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } - else { + else { ClickOnApply(); autoApply = false; } - + } @@ -1581,11 +1581,11 @@ void EntityGUI_SketcherDlg::SetEditCurrentArgument() //================================================================================= void EntityGUI_SketcherDlg::LineEditReturnPressed() { - if ( sender() == Group1Sel->LineEdit1 ) + if ( sender() == Group1Sel->LineEdit1 ) myEditCurrentArgument = Group1Sel->LineEdit1; - else if ( sender() == Group1Sel1Spin->LineEdit1 ) + else if ( sender() == Group1Sel1Spin->LineEdit1 ) myEditCurrentArgument = Group1Sel1Spin->LineEdit1; - else if ( sender() == Group2Sel->LineEdit1 ) + else if ( sender() == Group2Sel->LineEdit1 ) myEditCurrentArgument = Group2Sel->LineEdit1; else if ( sender() == Group2Sel->LineEdit2 ) myEditCurrentArgument = Group2Sel->LineEdit2; @@ -1636,10 +1636,10 @@ void EntityGUI_SketcherDlg::ActivateThisDialog() //myGeometryGUI->SetState( 0 ); // globalSelection( GEOM_POINT ); - + myEditCurrentArgument = WPlaneLineEdit; myEditCurrentArgument->setFocus(); - + if ( sender() == Group1Sel->LineEdit1 ) { myEditCurrentArgument = Group1Sel->LineEdit1; myEditCurrentArgument->setFocus(); @@ -1656,7 +1656,7 @@ void EntityGUI_SketcherDlg::ActivateThisDialog() myEditCurrentArgument = Group2Sel->LineEdit2; myEditCurrentArgument->setFocus(); } - + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -1694,19 +1694,19 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con { // NOTE Basing the autoapply functionality on the background picture has no sense anymore // The import picture functionality is now used for drawing on top of a picture - + // SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); // OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); -// +// // QString theImgFileName; // vp->background().texture( theImgFileName ); ////////////// VSR: temporarily - + double x, y; x = y = 0; - + BRepBuilderAPI_MakeVertex mkVertex (thePnt); TopoDS_Shape aShape = mkVertex.Shape(); - + // Taking into account LocalCS gp_Ax3 aWPlane = GetActiveLocalCS(); gp_Trsf aTrans; @@ -1714,14 +1714,14 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con aTrans.SetTransformation(aWPlane); BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); aShape = aTransformation.Shape(); - - gp_Pnt aTrsfPnt; + + gp_Pnt aTrsfPnt; GEOMBase::VertexToPoint( aShape, aTrsfPnt ); - + // NOTE autoapply disabled : doesn't seem useful anymore // autoApply = ( (getPnt2ConstructorId() == 1) && (!theImgFileName.isEmpty()) ); // If no additional argument needed after selection and there is a backgroundimage - // -> apply automatically - + // -> apply automatically + if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode x = aTrsfPnt.X() - myLastX1; y = aTrsfPnt.Y() - myLastY1; @@ -1734,12 +1734,12 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con case 1: Group2Spin->SpinBox_DX->setValue( x ); Group2Spin->SpinBox_DY->setValue( y ); - Group2Spin->buttonApply->setFocus(); // Previous setFocus (during preview) may have been inoperative if it was disabled + Group2Spin->buttonApply->setFocus(); // Previous setFocus (during preview) may have been inoperative if it was disabled break; case 0: Group3Spin->SpinBox_DX->setValue( x ); Group3Spin->SpinBox_DY->setValue( y ); - Group3Spin->buttonApply->setFocus(); + Group3Spin->buttonApply->setFocus(); break; case 2: if (modifiers == Qt::MetaModifier){ // Select center with Meta key @@ -1750,7 +1750,7 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con Group4Spin->SpinBox_DZ->setValue( x ); Group4Spin->SpinBox_DS->setValue( y ); } - Group4Spin->buttonApply->setFocus(); + Group4Spin->buttonApply->setFocus(); break; } if ( myConstructorId == 2 ) //RECTANGLE @@ -1830,7 +1830,7 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) vx = newValue; vxStr = newValueStr; vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text(); vz = Group3Spin->SpinBox_DZ->value(); - if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) { + if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) { if (mySketchType == PT_ABS_RADIUS){ dx = vx - myLastX1; dy = vy - myLastY1; @@ -1840,15 +1840,15 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) dy = vy; } minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation - if (aPrecision >= 0) // 'f' format in the QString + if (aPrecision >= 0) // 'f' format in the QString LastDecimal = aPrecision; else // 'g' format in the Qstring - LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); + LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place if ( Abs(vz) < minRad){ if (vz < 0.0) Group3Spin->SpinBox_DZ->setValue( - minRad ); - else + else Group3Spin->SpinBox_DZ->setValue( minRad ); } } @@ -1866,17 +1866,17 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) else{ dx = vx; dy = vy; - } + } minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation - if (aPrecision >= 0) // 'f' format in the QString + if (aPrecision >= 0) // 'f' format in the QString LastDecimal = aPrecision; - else // 'g' format in the QString - LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); + else // 'g' format in the QString + LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place if ( Abs(vz) < minRad){ if (vz < 0.0) Group3Spin->SpinBox_DZ->setValue( - minRad ); - else + else Group3Spin->SpinBox_DZ->setValue( minRad ); } } @@ -1994,7 +1994,7 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) } } else if ( myConstructorId == 1 ) { // ARC - if ( mySketchType == PT_ABS ) { + if ( mySketchType == PT_ABS ) { myX = vx; myY = vy; myXStr = vxStr; @@ -2006,7 +2006,7 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) myDXStr = vxStr; myDYStr = vyStr; } - if ( mySketchType == PT_ABS_RADIUS ) { + if ( mySketchType == PT_ABS_RADIUS ) { myX = vx; myY = vy; myRadius=vz; @@ -2026,7 +2026,7 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) myRadius = vx; myRadiusStr = vxStr; } - if ( mySketchType == PT_ABS_CENTER ) { + if ( mySketchType == PT_ABS_CENTER ) { myXc = vx; myYc = vy; myX = vz; @@ -2084,10 +2084,10 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) myY2 = GroupRect->SpinBox_DY2->value(); myY2Str = GroupRect->SpinBox_DY2->text(); } - - if (!autoApply) + + if (!autoApply) GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); - + double x, y, xc, yc; x = y = xc = yc = 0.0; if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER ) @@ -2123,7 +2123,7 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand char Format = 'f'; if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point - Format = 'g'; // g --> DigNum is the maximum number of significant digits + Format = 'g'; // g --> DigNum is the maximum number of significant digits if ( mySketchState == FIRST_POINT ) { if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { @@ -2218,19 +2218,19 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) } if ( mySketchType == PT_ABS_RADIUS || mySketchType == PT_SEL_RADIUS ) { myNewCommand = myNewCommand + "UU " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myRadius , Format, DigNum)+ " " + QString::number( myCheckFlag ); - theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr; + theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr; } if ( mySketchType == PT_REL_RADIUS) { myNewCommand = myNewCommand + "U " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myRadius, Format, DigNum )+ " " + QString::number( myCheckFlag ); - theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr; + theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr; } if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_SEL_CENTER ) { myNewCommand = myNewCommand + "EE " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myXc , Format, DigNum) + " " + QString::number( myYc , Format, DigNum)+ " " + QString::number( myCheckFlag ) + " " + QString::number( 0 ); - theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr; + theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr; } if ( mySketchType == PT_REL_CENTER) { myNewCommand = myNewCommand + "E " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myDXc, Format, DigNum )+ " " + QString::number( myDYc, Format, DigNum )+ " " + QString::number( myCheckFlag )+ " " + QString::number( 0 ); - theParameters = myDXStr + ":" + myDYStr + ":" + myDXcStr + ":" + myDYcStr ; + theParameters = myDXStr + ":" + myDYStr + ":" + myDXcStr + ":" + myDYcStr ; } if ( mySketchType == DIR_ANGLE_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); @@ -2258,7 +2258,7 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY2, Format, DigNum) + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum) + ":WW"; - + theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str; } return myNewCommand; @@ -2322,10 +2322,10 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand char Format = 'f'; if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point - Format = 'g'; // g --> DigNum is the maximum number of significant digits - + Format = 'g'; // g --> DigNum is the maximum number of significant digits + QString aParameters; - + if ( mySketchState == FIRST_POINT ) { myLastX2 = myX; myLastY2 = myY; @@ -2357,9 +2357,9 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) } else{ Group4Spin->label->hide(); - } + } } - else + else Group4Spin->label->hide(); if ( mySketchType == PT_SEL_CENTER ){ if (error > Precision::Confusion()){ @@ -2368,9 +2368,9 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) } else{ Group2Sel->label->hide(); - } + } } - else + else Group2Sel->label->hide(); if ( myShape2.IsNull() ) { @@ -2461,7 +2461,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); GEOM::GEOM_Object_var anObj = NULL; - + int index = ComboBox1->currentIndex(); if(index != -1 && !myWPlane->_is_nil()) // The combobox is not empty { @@ -2493,15 +2493,15 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, const double lineWidth, const int displayMode, const int color ) -{ - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0)); Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name(); - + // set width of displayed shape int lw = lineWidth; - if(lw == -1) { + if(lw == -1) { lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); } getDisplayer()->SetWidth( lw ); @@ -2523,19 +2523,19 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetColor( line_color ); else getDisplayer()->SetColor( Quantity_NOC_VIOLET ); - + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); aPrs = getDisplayer()->BuildPrs( aLastSegment ); - + if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); getDisplayer()->SetColor( line_color ); - + getDisplayer()->UnsetName(); // Enable activation of displayed objects @@ -2555,26 +2555,26 @@ void EntityGUI_SketcherDlg::displayPntPreview(const double x, // Get globalCS and working plane gp_Ax3 globalCS = WPlaneToLCS( myGlobalCS ); gp_Ax3 aWPlane = GetActiveLocalCS(); - + // Build point in localCS gp_Pnt aPnt = gp_Pnt(x,y,0.0); - + // Get transfomation from local to global CS gp_Trsf aTrans; aTrans.SetTransformation(aWPlane, globalCS); - + BRepBuilderAPI_MakeVertex mkVertex (aPnt); TopoDS_Shape aLocalVertex = mkVertex.Shape(); - + // Perform transformation BRepBuilderAPI_Transform aTransformation (aLocalVertex, aTrans, Standard_False); TopoDS_Shape aGlobalVertex = aTransformation.Shape(); - + // Build prs with vertex in globalCS SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aGlobalVertex ); if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - + } //================================================================ @@ -2624,14 +2624,14 @@ bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, // function : acceptMouseEvent() // purpose : //================================================================================= -bool EntityGUI_SketcherDlg::acceptMouseEvent() const +bool EntityGUI_SketcherDlg::acceptMouseEvent() const { - return ( (getPnt1ConstructorId() == 1 + return ( (getPnt1ConstructorId() == 1 || getPnt1ConstructorId() == 0 - || myConstructorId == 2) //accept mouse event only on absolute and relative selection mode + || myConstructorId == 2) //accept mouse event only on absolute and relative selection mode && !WPlaneLineEdit->isEnabled()); //or when the constructor is rectangle - //called by EntityGUI::OnMousePress() -} + //called by EntityGUI::OnMousePress() +} //================================================================================= // function : keyPressEvent() @@ -2663,16 +2663,16 @@ void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, // Obtain precision from preferences SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 ); - + spinBox->setPrecision( aPrecision ); spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting, // by default Qt rounds boundaries to 2 decimals at setRange spinBox->setRange( min, max ); spinBox->setSingleStep( step ); - + // Add a hint for the user saying how to tune precision QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() ); - spinBox->setProperty( "validity_tune_hint", + spinBox->setProperty( "validity_tune_hint", QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) ); } @@ -2705,24 +2705,24 @@ void EntityGUI_SketcherDlg::SetDoubleSpinBoxStep( double step ) void EntityGUI_SketcherDlg::AddLocalCS(GEOM::GEOM_Object_var aSelectedObject) { QString aName = GEOMBase::GetName( aSelectedObject ); - + int index = ComboBox1->findText(aName, Qt::MatchExactly); - + if (index==-1) // If the working plane hasn't been added yet - { + { myWPlaneList.push_back(aSelectedObject); myWPlane = aSelectedObject; addSubshapesToStudy(); myLCSList.push_back(WPlaneToLCS(aSelectedObject)); - ComboBox1->addItem(aName); + ComboBox1->addItem(aName); index = ComboBox1->count(); - ComboBox1->setCurrentIndex(index-1); + ComboBox1->setCurrentIndex(index-1); } else { ComboBox1->setCurrentIndex(index); } - ActivateLocalCS(); + ActivateLocalCS(); } //================================================================================= @@ -2761,14 +2761,14 @@ void EntityGUI_SketcherDlg::FindLocalCS() // browse through all GEOM data tree _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) ); - for ( it->InitEx( true ); it->More(); it->Next() ) + for ( it->InitEx( true ); it->More(); it->Next() ) { _PTR(SObject) child( it->Value() ); CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child ); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - if( CORBA::is_nil( geomObj ) ) + if( CORBA::is_nil( geomObj ) ) continue; - if (geomObj->GetType() == GEOM_MARKER) + if (geomObj->GetType() == GEOM_MARKER) { myWPlaneList.push_back(geomObj); myLCSList.push_back(WPlaneToLCS(geomObj)); @@ -2779,26 +2779,26 @@ void EntityGUI_SketcherDlg::FindLocalCS() //================================================================================= // function : WPlaneToLCS ( aWPlane ) -// purpose : +// purpose : //================================================================================= gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj ) { TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj); - + gp_Ax3 aLCS; if (CORBA::is_nil( geomObj ) || aShape.IsNull()) { MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()") } aLCS.Transform(aShape.Location().Transformation()); - if (aShape.ShapeType() == TopAbs_FACE) + if (aShape.ShapeType() == TopAbs_FACE) { GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = myGeometryGUI->GetGeomGen()->GetIMeasureOperations(); double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz; aMeasureOp->GetPosition( geomObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz); if ( aMeasureOp->IsDone() ) - { + { gp_Pnt aPnt ( Ox, Oy, Oz ); gp_Dir aDirN ( Zx, Zy, Zz ); gp_Dir aDirX ( Xx, Xy, Xz ); @@ -2814,8 +2814,8 @@ gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj ) // purpose : //================================================================================= int EntityGUI_SketcherDlg::getPnt1ConstructorId() const -{ - int buttonId = GroupPt->ButtonGroup->checkedId(); +{ + int buttonId = GroupPt->ButtonGroup->checkedId(); // MESSAGE("buttonId = "<ButtonGroup->checkedId(); +{ + int buttonId = GroupPt2->ButtonGroup->checkedId(); // MESSAGE("buttonId = "<currentIndex(); if (ind == -1) return myGeometryGUI->GetWorkingPlane(); - + gp_Ax3 aLCS = myLCSList.at(ind); myWPlane = myWPlaneList.at(ind); diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index d51e9f03c..f6d3fd386 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -47,14 +47,14 @@ //================================================================================= // class : GEOMBase_Skeleton() -// purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the +// purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // true to construct a modal dialog. //================================================================================= GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : QDialog( parent, fl ), + : QDialog( parent, fl ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( theGeometryGUI ), myRBGroup( 0 ) @@ -139,16 +139,16 @@ void GEOMBase_Skeleton::Init() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); bool aPrv = (resMgr == 0) ? false : resMgr->booleanValue( "Geometry", "geom_preview", false ); - + myMainFrame->CheckBoxPreview->setChecked( aPrv ); myMainFrame->GroupBoxPublish->hide(); } //================================================================================= // function : initSpinBox() -// purpose : +// purpose : //================================================================================= -void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, +void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, int min, int max, int step ) { spinBox->setRange( min, max ); @@ -157,25 +157,25 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, //================================================================================= // function : initSpinBox() -// purpose : +// purpose : //================================================================================= -void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, - double min, double max, +void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, + double min, double max, double step, const char* quantity ) { // Obtain precision from preferences SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 ); - + spinBox->setPrecision( aPrecision ); spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting, // by default Qt rounds boundaries to 2 decimals at setRange spinBox->setRange( min, max ); spinBox->setSingleStep( step ); - + // Add a hint for the user saying how to tune precision QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() ); - spinBox->setProperty( "validity_tune_hint", + spinBox->setProperty( "validity_tune_hint", QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) ); } @@ -355,7 +355,7 @@ void GEOMBase_Skeleton::ClickOnHelp() } else { context = myHelpContext; } - if ( app ) + if ( app ) app->onHelpContextModule( context , myHelpFileName ); else { QString platform; @@ -429,7 +429,7 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e ) //================================================================================= // function : showOnlyPreviewControl() // purpose : display only CheckBoxPreview check box, -// hide CheckBoxRestoreSS and CheckBoxAddPrefix +// hide CheckBoxRestoreSS and CheckBoxAddPrefix //================================================================================= void GEOMBase_Skeleton::showOnlyPreviewControl(){ mainFrame()->GroupBoxPublish->show(); diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index aeeb5f6db..f21d8fbae 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -395,7 +395,7 @@ bool GroupGUI_GroupDlg::ClickOnApply() setIsDisableBrowsing( true ); setIsDisplayResult( false ); } - + myIsAccept = onAccept(myMode == CreateGroup, true, isApplyAndClose()); if (!myIsAccept) return false; @@ -551,7 +551,7 @@ void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool i GEOM::ListOfLong_var aCurrList = aShapesOp->GetSameIDs( myMainObj, aSubObjects[i] ); if( aCurrList->length() > 1 ) { //rnv : To Fix the 21561: EDF 2184 GEOM: Group with second shape restriction. - // In case if GetSameIDs(...) method return more then one ID use + // In case if GetSameIDs(...) method return more then one ID use // GetSharedShapes(...) method to get sub-shapes of the second shape. GEOM::ListOfGO_var aSubObjects2 = aShapesOp->GetSharedShapes( myMainObj, aSubObjects[i], getShapeType() ); for( int j = 0; j < aSubObjects2->length(); j++ ) { @@ -774,7 +774,7 @@ void GroupGUI_GroupDlg::showOnlySelected() Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); if (view->isVisible(io)) myIsHiddenMain = true; - + //keep the selected entry and IO in the map for checking std::map aSelEntriesMap; SALOME_ListIteratorOfListIO aSelIt(aSelList); @@ -786,7 +786,7 @@ void GroupGUI_GroupDlg::showOnlySelected() SALOME_ListIO displayed; view->GetVisible(displayed); // Erase all, except the selected sub-shapes - std::map::iterator + std::map::iterator aSelDispIter = aSelEntriesMap.end(); SALOME_ListIteratorOfListIO aDispIt( displayed ); for ( ; aDispIt.More(); aDispIt.Next() ) { @@ -1163,7 +1163,7 @@ void GroupGUI_GroupDlg::updateState (bool isAdd) myRemBtn->setEnabled(hasSel); myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj)); mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj)); - + mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES); myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES); myFilterGrp->setEnabled(!CORBA::is_nil(myMainObj) && @@ -1177,7 +1177,7 @@ void GroupGUI_GroupDlg::updateState (bool isAdd) #ifndef DISABLE_PLOT2DVIEWER myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() && myIsShapeType && - ( getShapeType() == TopAbs_EDGE || + ( getShapeType() == TopAbs_EDGE || getShapeType() == TopAbs_FACE || getShapeType() == TopAbs_SOLID ) && hasCurrentEntities ); @@ -1421,7 +1421,7 @@ void GroupGUI_GroupDlg::ClickOnOkFilter() { if (CORBA::is_nil(myMainObj) || subSelectionWay() != ALL_SUBSHAPES || !myIsShapeType || getShapeType() == TopAbs_VERTEX) return; - + TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); TopTools_IndexedMapOfShape aSubShapesMap; TopExp::MapShapes(aMainShape, aSubShapesMap); diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index 34f34789c..2a4f6870d 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -90,7 +90,7 @@ MeasureGUI_CreateDimensionDlg::MeasureGUI_CreateDimensionDlg( const GEOM::GeomOb SLOT( OnStartSelection( const QList& ) ) ); connect( myDiameterArgs, SIGNAL( StartSelection( const QList& ) ), SLOT( OnStartSelection( const QList& ) ) ); - connect( myAngleArgs, SIGNAL( StartSelection( const QList& ) ), + connect( myAngleArgs, SIGNAL( StartSelection( const QList& ) ), SLOT( OnStartSelection( const QList& ) ) ); connect( myLengthArgs, SIGNAL( StopSelection() ), SLOT( OnStopSelection() ) ); @@ -107,7 +107,7 @@ MeasureGUI_CreateDimensionDlg::MeasureGUI_CreateDimensionDlg( const GEOM::GeomOb // construct main layout QVBoxLayout* aCustomWidLayout = new QVBoxLayout( centralWidget() ); - aCustomWidLayout->setMargin( 0 ); + aCustomWidLayout->setMargin( 0 ); aCustomWidLayout->setSpacing( 6 ); aCustomWidLayout->addWidget( aGroupArgs ); @@ -153,7 +153,7 @@ MeasureGUI_CreateDimensionDlg::~MeasureGUI_CreateDimensionDlg() //================================================================================= // function : ActiveArgs -// purpose : +// purpose : //================================================================================= MeasureGUI_CreateDimensionDlg::BaseSelectorPane* MeasureGUI_CreateDimensionDlg::ActiveArgs() { @@ -169,7 +169,7 @@ MeasureGUI_CreateDimensionDlg::BaseSelectorPane* MeasureGUI_CreateDimensionDlg:: //================================================================================= // function : GenerateName -// purpose : +// purpose : //================================================================================= QString MeasureGUI_CreateDimensionDlg::GenerateName( const QString& thePrefix ) { @@ -211,7 +211,7 @@ QString MeasureGUI_CreateDimensionDlg::GenerateName( const QString& thePrefix ) //================================================================================= // function : ConstructTypeChanged -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::ConstructTypeChanged( int theType ) { @@ -238,7 +238,7 @@ void MeasureGUI_CreateDimensionDlg::ConstructTypeChanged( int theType ) //================================================================================= // function : OnArgumentTabChanged -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::OnArgumentTabChanged() { @@ -306,9 +306,9 @@ void MeasureGUI_CreateDimensionDlg::SelectionIntoArgument() return; } - GEOM::GeomObjPtr aSelectedMain = - !aSelected->IsMainShape() - ? aSelected->GetMainShape() + GEOM::GeomObjPtr aSelectedMain = + !aSelected->IsMainShape() + ? aSelected->GetMainShape() : GEOM::GeomObjPtr(); if ( myParentObj != aSelected && myParentObj != aSelectedMain ) @@ -359,7 +359,7 @@ void MeasureGUI_CreateDimensionDlg::OnSelectionDone() //================================================================================= // function : ClickOnOk -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::ClickOnOk() { @@ -372,7 +372,7 @@ void MeasureGUI_CreateDimensionDlg::ClickOnOk() //================================================================================= // function : ClickOnApply -// purpose : +// purpose : //================================================================================= bool MeasureGUI_CreateDimensionDlg::ClickOnApply() { @@ -402,7 +402,7 @@ bool MeasureGUI_CreateDimensionDlg::ClickOnApply() //================================================================================= // function : StartLocalEditing -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::StartLocalEditing() { @@ -448,7 +448,7 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing() //================================================================================= // function : StopLocalEditing -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::StopLocalEditing() { @@ -475,7 +475,7 @@ void MeasureGUI_CreateDimensionDlg::StopLocalEditing() //================================================================================= // function : Init -// purpose : +// purpose : //================================================================================= void MeasureGUI_CreateDimensionDlg::Init() { @@ -492,7 +492,7 @@ void MeasureGUI_CreateDimensionDlg::Init() //================================================================================= // function : CreateDimensionPrs -// purpose : +// purpose : //================================================================================= Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension() { @@ -658,7 +658,7 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension() //================================================================================= // class : AddDimensionToOwner -// purpose : +// purpose : //================================================================================= bool MeasureGUI_CreateDimensionDlg::AddDimensionToOwner() { @@ -937,7 +937,7 @@ void MeasureGUI_CreateDimensionDlg::BaseSelectorPane::SelectionIntoArguments( co //================================================================================= // function : BaseSelectorPane::GetSelection -// purpose : +// purpose : //================================================================================= GEOM::GeomObjPtr MeasureGUI_CreateDimensionDlg::BaseSelectorPane::GetSelection( QLineEdit* theSelector ) const { -- 2.39.2